[Core/Cmake] Scripts are now added dynamically

You can now add your scripts using cmake inside your module
instead patch core cpp files
This commit is contained in:
Yehonal
2016-08-07 12:21:52 +02:00
parent e72b8ac1cc
commit 1aef789c85
18 changed files with 101 additions and 96 deletions

View File

@@ -22,13 +22,19 @@ include(Commands/CMakeLists.txt)
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
ScriptLoader.cpp
ScriptLoader.h
${BUILDDIR}/GenLoader.cpp
../game/AI/ScriptedAI/ScriptedEscortAI.cpp
../game/AI/ScriptedAI/ScriptedCreature.cpp
../game/AI/ScriptedAI/ScriptedFollowerAI.cpp
)
AZTH_ADD_SCRIPTS("Spell" "ScriptLoader.h")
AZTH_ADD_SCRIPTS("SC_Smart" "ScriptLoader.h")
AZTH_ADD_SCRIPTS("Command" "ScriptLoader.h")
if(SCRIPTS)
include(Custom/CMakeLists.txt)
include(World/CMakeLists.txt)
include(OutdoorPvP/CMakeLists.txt)
include(EasternKingdoms/CMakeLists.txt)
@@ -39,6 +45,18 @@ if(SCRIPTS)
include(Pet/CMakeLists.txt)
endif()
AZTH_GET_GLOBAL("AZTH_ADD_SCRIPTS_LIST")
AZTH_GET_GLOBAL("AZTH_ADD_SCRIPTS_INCLUDE")
set("AZTH_SCRIPTS_INCLUDES" "")
FOREACH (include ${AZTH_ADD_SCRIPTS_INCLUDE})
set("AZTH_SCRIPTS_INCLUDES" "#include \"${include}\"\n${AZTH_SCRIPTS_INCLUDES}")
ENDFOREACH()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GenLoader.cpp.cmake ${BUILDDIR}/GenLoader.cpp)
message(STATUS "SCRIPT PREPARATION COMPLETE")
message("")
@@ -140,6 +158,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/game/ArenaSpectator
${CMAKE_SOURCE_DIR}/src/server/game/Misc
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}

View File

@@ -1,15 +0,0 @@
# Copyright (C)
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
)
message(" -> Prepared: Custom")

View File

@@ -164,4 +164,6 @@ set(scripts_STAT_SRCS
EasternKingdoms/TheStockade/instance_the_stockade.cpp
)
AZTH_ADD_SCRIPTS("EasternKingdoms" "ScriptLoader.h")
message(" -> Prepared: Eastern Kingdoms")

View File

@@ -9,4 +9,6 @@ set(scripts_STAT_SRCS
Events/midsummer.cpp
)
message(" -> Prepared: Events")
AZTH_ADD_SCRIPTS("Event" "ScriptLoader.h")
message(" -> Prepared: Events")

View File

@@ -0,0 +1,7 @@
// This file is autogenerated, please do not modify directly!
@AZTH_SCRIPTS_INCLUDES@
void AddScripts() {
@AZTH_ADD_SCRIPTS_LIST@
}

View File

@@ -105,4 +105,6 @@ set(scripts_STAT_SRCS
Kalimdor/DireMaul/dire_maul.h
)
AZTH_ADD_SCRIPTS("Kalimdor" "ScriptLoader.h")
message(" -> Prepared: Kalimdor")

View File

@@ -196,4 +196,6 @@ set(scripts_STAT_SRCS
Northrend/DraktharonKeep/boss_dred.cpp
)
AZTH_ADD_SCRIPTS("Northrend" "ScriptLoader.h")
message(" -> Prepared: Northrend")

View File

@@ -26,4 +26,6 @@ set(scripts_STAT_SRCS
OutdoorPvP/OutdoorPvPGH.h
)
AZTH_ADD_SCRIPTS("OutdoorPvP" "ScriptLoader.h")
message(" -> Prepared: Outdoor PVP Zones")

View File

@@ -109,4 +109,6 @@ set(scripts_STAT_SRCS
Outland/zone_zangarmarsh.cpp
)
AZTH_ADD_SCRIPTS("Outland" "ScriptLoader.h")
message(" -> Prepared: Outland")

View File

@@ -18,4 +18,6 @@ set(scripts_STAT_SRCS
Pet/pet_shaman.cpp
)
AZTH_ADD_SCRIPTS("Pet" "ScriptLoader.h")
message(" -> Prepared: Pet")

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SC_SCRIPTLOADER_H
#define SC_SCRIPTLOADER_H
void AddScripts();
void AddSpellScripts();
void AddCommandScripts();
void AddSC_SmartScripts();
void AddWorldScripts();
void AddEventScripts();
void AddEasternKingdomsScripts();
void AddKalimdorScripts();
void AddOutlandScripts();
void AddNorthrendScripts();
void AddPetScripts();
void AddOutdoorPvPScripts();
#endif

View File

@@ -23,4 +23,6 @@ set(scripts_STAT_SRCS
World/npcs_special.cpp
)
AZTH_ADD_SCRIPTS("World" "ScriptLoader.h")
message(" -> Prepared: World")