Using more appropriate NS prefixes for our macro and cmake vars

This commit is contained in:
Yehonal
2016-08-11 20:10:08 +02:00
parent 4330b759b7
commit 991eed3b5a
21 changed files with 106 additions and 118 deletions

View File

@@ -34,6 +34,8 @@ include(CheckIncludeFiles)
# some utils for cmake
include(src/cmake/utils.cmake)
include(ScriptsMacro)
# set default buildoptions and print them
include(conf/config.cmake.dist)
@@ -42,7 +44,7 @@ if(EXISTS "conf/config.cmake")
include(conf/config.cmake)
endif()
RUN_HOOK("AFTER_LOAD_CONF")
CU_RUN_HOOK("AFTER_LOAD_CONF")
# build in Release-mode by default if not explicitly set
if( NOT CMAKE_BUILD_TYPE )
@@ -84,7 +86,7 @@ include(src/cmake/genrev.cmake)
include(src/cmake/showoptions.cmake)
# add modules and dependencies
AZTH_SUBDIRLIST(sub_DIRS "${CMAKE_SOURCE_DIR}/modules" FALSE FALSE)
CU_SUBDIRLIST(sub_DIRS "${CMAKE_SOURCE_DIR}/modules" FALSE FALSE)
FOREACH(subdir ${sub_DIRS})
STRING(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" subdir_rel ${subdir})
if(EXISTS "${subdir}/CMakeLists.txt")
@@ -93,9 +95,9 @@ FOREACH(subdir ${sub_DIRS})
endif()
ENDFOREACH()
RUN_HOOK("BEFORE_SRC_LOAD")
CU_RUN_HOOK("BEFORE_SRC_LOAD")
# add core sources
add_subdirectory(src)
RUN_HOOK("AFTER_SRC_LOAD")
CU_RUN_HOOK("AFTER_SRC_LOAD")

View File

@@ -1,7 +1,7 @@
AZTH_PATH_ROOT=$(readlink -f "$AZTH_PATH_BIN/../")
AC_PATH_ROOT=$(readlink -f "$AC_PATH_BIN/../")
AZTH_PATH_CONF="$AZTH_PATH_ROOT/conf"
AC_PATH_CONF="$AC_PATH_ROOT/conf"
AZTH_PATH_MODULES="$AZTH_PATH_ROOT/modules"
AC_PATH_MODULES="$AC_PATH_ROOT/modules"
AZTH_PATH_CUSTOM=$(readlink -f "$AZTH_PATH_ROOT/../azth_custom")
AC_PATH_CUSTOM=$(readlink -f "$AC_PATH_ROOT/../azth_custom")

View File

@@ -1,22 +1,22 @@
AZTH_PATH_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
AC_PATH_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
AZTH_PATH_SHARED="$AZTH_PATH_BIN/bash_shared"
AC_PATH_SHARED="$AC_PATH_BIN/bash_shared"
source "$AZTH_PATH_SHARED/defines.sh"
source "$AC_PATH_SHARED/defines.sh"
source "$AZTH_PATH_SHARED/functions.sh"
source "$AC_PATH_SHARED/functions.sh"
source "$AZTH_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables
source "$AC_PATH_CONF/config.sh.dist" # "hack" to avoid missing conf variables
if [ -f "$AZTH_PATH_CONF/config.sh" ]; then
source "$AZTH_PATH_CONF/config.sh" # should overwrite previous
if [ -f "$AC_PATH_CONF/config.sh" ]; then
source "$AC_PATH_CONF/config.sh" # should overwrite previous
fi
#
# Load modules
#
for entry in "$AZTH_PATH_MODULES/"*/include.sh
for entry in "$AC_PATH_MODULES/"*/include.sh
do
if [ -e $entry ]; then
source $entry

View File

@@ -26,7 +26,7 @@ function configure() {
#-DSCRIPTS_COMMANDS=$CSCRIPTS -DSCRIPTS_CUSTOM=$CSCRIPTS -DSCRIPTS_EASTERNKINGDOMS=$CSCRIPTS -DSCRIPTS_EVENTS=$CSCRIPTS -DSCRIPTS_KALIMDOR=$CSCRIPTS \
#-DSCRIPTS_NORTHREND=$CSCRIPTS -DSCRIPTS_OUTDOORPVP=$CSCRIPTS -DSCRIPTS_OUTLAND=$CSCRIPTS -DSCRIPTS_PET=$CSCRIPTS -DSCRIPTS_SPELLS=$CSCRIPTS -DSCRIPTS_WORLD=$CSCRIPTS \
#-DAZTH_WITH_UNIT_TEST=$CAZTH_UNIT_TEST -DAZTH_WITH_PLUGINS=$CAZTH_PLG \
#-DAC_WITH_UNIT_TEST=$CAC_UNIT_TEST -DAC_WITH_PLUGINS=$CAC_PLG \
cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH -DCONF_DIR=$CONFDIR -DSERVERS=$CSERVERS \
-DSCRIPTS=$CSCRIPTS \

View File

@@ -2,22 +2,22 @@ CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../../bash_shared/includes.sh"
AZTH_PATH_COMPILER="$AZTH_PATH_BIN/compiler"
AC_PATH_COMPILER="$AC_PATH_BIN/compiler"
if [ -f "$AZTH_PATH_COMPILER/config.sh" ]; then
source "$AZTH_PATH_COMPILER/config.sh" # should overwrite previous
if [ -f "$AC_PATH_COMPILER/config.sh" ]; then
source "$AC_PATH_COMPILER/config.sh" # should overwrite previous
fi
function azth_on_after_build() {
# move the run engine
cp -rvf "$AZTH_PATH_BIN/runners/"* "$INSTALL_PATH/bin/"
cp -rvf "$AC_PATH_BIN/runners/"* "$INSTALL_PATH/bin/"
}
registerHooks "ON_AFTER_BUILD" azth_on_after_build
source "$AZTH_PATH_COMPILER/includes/defines.sh"
source "$AC_PATH_COMPILER/includes/defines.sh"
source "$AZTH_PATH_COMPILER/includes/functions.sh"
source "$AC_PATH_COMPILER/includes/functions.sh"
mkdir -p $BUILDPATH
mkdir -p $BINPATH

View File

@@ -4,11 +4,11 @@
# absolute root path of your azerothshard repository
SRCPATH="$AZTH_PATH_ROOT"
SRCPATH="$AC_PATH_ROOT"
# absolute path where binary files must be stored
BINPATH="$AZTH_PATH_ROOT/build/"
BINPATH="$AC_PATH_ROOT/build/"
# absolute path where config. files must be stored
CONFDIR="$AZTH_PATH_ROOT/build/etc/"
CONFDIR="$AC_PATH_ROOT/build/etc/"
##############################################
#

View File

@@ -0,0 +1,21 @@
#
# AC_ADD_SCRIPT
#
MACRO(AC_ADD_SCRIPT path)
CU_ADD_GLOBAL("AC_SCRIPTS_SOURCES" "${path}")
ENDMACRO()
#
# AC_ADD_SCRIPT_LOADER
#
MACRO(AC_ADD_SCRIPT_LOADER script_dec include)
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_LIST" "Add${script_dec}Scripts()\;")
if (NOT ${include} STREQUAL "")
CU_GET_GLOBAL("AC_ADD_SCRIPTS_INCLUDE")
if (NOT ";${AC_ADD_SCRIPTS_INCLUDE};" MATCHES ";${include};")
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_INCLUDE" "${include}\;")
endif()
endif()
ENDMACRO()

View File

@@ -1,8 +1,8 @@
#
# AZTH_SUBDIRLIST
# CU_SUBDIRLIST
#
FUNCTION(AZTH_SUBDIRLIST result curdir recursive includeRoot)
FUNCTION(CU_SUBDIRLIST result curdir recursive includeRoot)
# glob recurse seem's doesn't work
FILE(GLOB children RELATIVE ${curdir} "${curdir}/[^\\.]*")
if (${includeRoot})
@@ -14,7 +14,7 @@ FUNCTION(AZTH_SUBDIRLIST result curdir recursive includeRoot)
FOREACH(child ${children})
IF(IS_DIRECTORY "${curdir}/${child}")
if (${recursive})
AZTH_SUBDIRLIST(sub_Dirs "${curdir}/${child}" TRUE FALSE)
CU_SUBDIRLIST(sub_Dirs "${curdir}/${child}" TRUE FALSE)
SET(dirlist "${curdir}/${child}" ${sub_Dirs} ${dirlist})
else()
SET(dirlist "${curdir}/${child}" ${dirlist})
@@ -22,123 +22,88 @@ FUNCTION(AZTH_SUBDIRLIST result curdir recursive includeRoot)
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist} PARENT_SCOPE)
ENDFUNCTION(AZTH_SUBDIRLIST result curdir recursive)
ENDFUNCTION(CU_SUBDIRLIST result curdir recursive)
#
# AZTH_SET_GLOBAL
# CU_SET_GLOBAL
#
MACRO(AZTH_SET_GLOBAL name val)
MACRO(CU_SET_GLOBAL name val)
set_property ( GLOBAL PROPERTY ${name} ${val})
# after set , create the variable for current scope
AZTH_GET_GLOBAL(${name})
CU_GET_GLOBAL(${name})
ENDMACRO()
MACRO(AZTH_ADD_GLOBAL name val)
AZTH_GET_GLOBAL(${name})
MACRO(CU_ADD_GLOBAL name val)
CU_GET_GLOBAL(${name})
set_property ( GLOBAL PROPERTY ${name}
${${name}}
${val}
)
# after set , create the variable for current scope
AZTH_GET_GLOBAL(${name})
CU_GET_GLOBAL(${name})
ENDMACRO()
#
# AZTH_GET_GLOBAL
# CU_GET_GLOBAL
#
MACRO(AZTH_GET_GLOBAL name)
MACRO(CU_GET_GLOBAL name)
get_property(${name} GLOBAL PROPERTY ${name})
ENDMACRO()
#
# AZTH_SET_CACHE
# CU_SET_CACHE
#
MACRO(AZTH_SET_CACHE name val)
set(${name} ${val} CACHE INTERNAL "AZTH Var")
MACRO(CU_SET_CACHE name val)
set(${name} ${val} CACHE INTERNAL "CU Var")
ENDMACRO()
#
# AZTH_SET_PATH
# CU_SET_PATH
#
MACRO(AZTH_SET_PATH name val)
AZTH_SET_CACHE(${name} ${val})
MACRO(CU_SET_PATH name val)
CU_SET_CACHE(${name} ${val})
AZTH_ADD_INC_PATH(${val})
CU_ADD_INC_PATH(${val})
ENDMACRO()
#
# AZTH_ADD_SCRIPT
# CU_ADD_INC_PATH
#
MACRO(AZTH_ADD_SCRIPT path)
AZTH_ADD_GLOBAL("AZTH_SCRIPTS_SOURCES" "${path}")
ENDMACRO()
#
# AZTH_ADD_SCRIPT_LOADER
#
MACRO(AZTH_ADD_SCRIPT_LOADER script_dec include)
AZTH_ADD_GLOBAL("AZTH_ADD_SCRIPTS_LIST" "Add${script_dec}Scripts()\;")
if (NOT ${include} STREQUAL "")
AZTH_GET_GLOBAL("AZTH_ADD_SCRIPTS_INCLUDE")
if (NOT ";${AZTH_ADD_SCRIPTS_INCLUDE};" MATCHES ";${include};")
AZTH_ADD_GLOBAL("AZTH_ADD_SCRIPTS_INCLUDE" "${include}\;")
endif()
endif()
ENDMACRO()
#
# AZTH_ADD_INC_PATH
#
MACRO(AZTH_ADD_INC_PATH val)
set(AZTH_INC_PATHS
${AZTH_INC_PATHS}
MACRO(CU_ADD_INC_PATH val)
set(CU_INC_PATHS
${CU_INC_PATHS}
${val}
)
#update cache
AZTH_SET_CACHE("AZTH_INC_PATHS" "${AZTH_INC_PATHS}")
CU_SET_CACHE("CU_INC_PATHS" "${CU_INC_PATHS}")
include_directories(${val})
ENDMACRO()
#
# AZTH_LOAD_INC_PATHS
# CU_LOAD_INC_PATHS
#
MACRO(AZTH_LOAD_INC_PATHS)
include_directories(${AZTH_INC_PATHS})
MACRO(CU_LOAD_INC_PATHS)
include_directories(${CU_INC_PATHS})
ENDMACRO()
#
# AZTH_SET_PARENT
# CU_SET_PARENT
#
MACRO(AZTH_SET_PARENT name val)
MACRO(CU_SET_PARENT name val)
set(${name} ${val} PARENT_SCOPE)
ENDMACRO()
#
# AZTH_ADD_CORE_TG
#
MACRO(AZTH_ADD_CORE_TG val)
AZTH_GET_GLOBAL("AZTH_CORE_TGS")
set(AZTH_CORE_TGS
${AZTH_CORE_TGS}
${val}
)
#update cache
AZTH_SET_GLOBAL("AZTH_CORE_TGS" "${AZTH_CORE_TGS}")
MACRO(CU_ADD_HOOK hook_name value)
CU_ADD_GLOBAL(${hook_name} "${value}")
ENDMACRO()
MACRO(ADD_HOOK hook_name value)
AZTH_ADD_GLOBAL(${hook_name} "${value}")
ENDMACRO()
MACRO(RUN_HOOK hook_name)
AZTH_GET_GLOBAL(${hook_name})
MACRO(CU_RUN_HOOK hook_name)
CU_GET_GLOBAL(${hook_name})
message("Running cmake hook: ${hook_name}")
if (${hook_name})
set(HOOK_ARRAY ${${hook_name}})

View File

@@ -109,4 +109,4 @@ if (USE_COREPCH)
add_cxx_pch(authserver ${authserver_PCH_HDR} ${authserver_PCH_SRC})
endif()
RUN_HOOK("AFTER_AUTHSERVER_CMAKE")
CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE")

View File

@@ -8,7 +8,7 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
RUN_HOOK(BEFORE_GAME_LIBRARY)
CU_RUN_HOOK(BEFORE_GAME_LIBRARY)
file(GLOB_RECURSE sources_Accounts Accounts/*.cpp Accounts/*.h)
file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
@@ -224,4 +224,4 @@ if (USE_COREPCH)
add_cxx_pch(game ${game_STAT_PCH_HDR} ${game_STAT_PCH_SRC})
endif ()
RUN_HOOK(AFTER_GAME_LIBRARY)
CU_RUN_HOOK(AFTER_GAME_LIBRARY)

View File

@@ -30,9 +30,9 @@ set(scripts_STAT_SRCS
../game/AI/ScriptedAI/ScriptedFollowerAI.cpp
)
AZTH_ADD_SCRIPT_LOADER("Spell" "ScriptLoader.h")
AZTH_ADD_SCRIPT_LOADER("SC_Smart" "ScriptLoader.h")
AZTH_ADD_SCRIPT_LOADER("Command" "ScriptLoader.h")
AC_ADD_SCRIPT_LOADER("Spell" "ScriptLoader.h")
AC_ADD_SCRIPT_LOADER("SC_Smart" "ScriptLoader.h")
AC_ADD_SCRIPT_LOADER("Command" "ScriptLoader.h")
if(SCRIPTS)
include(World/CMakeLists.txt)
@@ -46,19 +46,19 @@ if(SCRIPTS)
endif()
AZTH_GET_GLOBAL("AZTH_ADD_SCRIPTS_LIST")
AZTH_GET_GLOBAL("AZTH_ADD_SCRIPTS_INCLUDE")
AZTH_GET_GLOBAL("AZTH_SCRIPTS_SOURCES")
CU_GET_GLOBAL("AC_ADD_SCRIPTS_LIST")
CU_GET_GLOBAL("AC_ADD_SCRIPTS_INCLUDE")
CU_GET_GLOBAL("AC_SCRIPTS_SOURCES")
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
${AZTH_SCRIPTS_SOURCES}
${AC_SCRIPTS_SOURCES}
)
set("AZTH_SCRIPTS_INCLUDES" "")
set("AC_SCRIPTS_INCLUDES" "")
FOREACH (include ${AZTH_ADD_SCRIPTS_INCLUDE})
set("AZTH_SCRIPTS_INCLUDES" "#include \"${include}\"\n${AZTH_SCRIPTS_INCLUDES}")
FOREACH (include ${AC_ADD_SCRIPTS_INCLUDE})
set("AC_SCRIPTS_INCLUDES" "#include \"${include}\"\n${AC_SCRIPTS_INCLUDES}")
ENDFOREACH()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GenLoader.cpp.cmake ${BUILDDIR}/GenLoader.cpp)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -209,4 +209,4 @@ if( USE_COREPCH )
add_cxx_pch(worldserver ${worldserver_PCH_HDR} ${worldserver_PCH_SRC})
endif()
RUN_HOOK("AFTER_WORLDSERVER_CMAKE")
CU_RUN_HOOK("AFTER_WORLDSERVER_CMAKE")