mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-12-05 18:20:24 -08:00
refactor(Cmake): add support build selected applications and tools (#11836)
This commit is contained in:
parent
40a5eef152
commit
4fbec972a8
56 changed files with 1006 additions and 622 deletions
51
conf/dist/config.cmake
vendored
51
conf/dist/config.cmake
vendored
|
|
@ -11,15 +11,21 @@
|
|||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
option(SERVERS "Build worldserver and authserver" 1)
|
||||
|
||||
set(SCRIPTS_AVAILABLE_OPTIONS none static dynamic minimal-static minimal-dynamic)
|
||||
set(MODULES_AVAILABLE_OPTIONS none static dynamic)
|
||||
set(BUILD_APPS_AVAILABLE_OPTIONS none all auth-only world-only)
|
||||
# set(BUILD_TOOLS_AVAILABLE_OPTIONS none all db-only maps-only) # DB import PR
|
||||
set(BUILD_TOOLS_AVAILABLE_OPTIONS none all maps-only)
|
||||
|
||||
set(SCRIPTS "static" CACHE STRING "Build core with scripts")
|
||||
set(MODULES "static" CACHE STRING "Build core with modules")
|
||||
set(APPS_BUILD "all" CACHE STRING "Build list for applications")
|
||||
set(TOOLS_BUILD "none" CACHE STRING "Build list for tools")
|
||||
|
||||
set_property(CACHE SCRIPTS PROPERTY STRINGS ${SCRIPTS_AVAILABLE_OPTIONS})
|
||||
set_property(CACHE MODULES PROPERTY STRINGS ${MODULES_AVAILABLE_OPTIONS})
|
||||
set_property(CACHE APPS_BUILD PROPERTY STRINGS ${BUILD_APPS_AVAILABLE_OPTIONS})
|
||||
set_property(CACHE TOOLS_BUILD PROPERTY STRINGS ${BUILD_TOOLS_AVAILABLE_OPTIONS})
|
||||
|
||||
# Log a error when the value of the SCRIPTS variable isn't a valid option.
|
||||
if(SCRIPTS)
|
||||
|
|
@ -30,7 +36,7 @@ if(SCRIPTS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Log a error when the value of the SCRIPTS variable isn't a valid option.
|
||||
# Log a error when the value of the MODULES variable isn't a valid option.
|
||||
if(MODULES)
|
||||
list(FIND MODULES_AVAILABLE_OPTIONS "${MODULES}" MODULES_INDEX)
|
||||
if(${MODULES_INDEX} EQUAL -1)
|
||||
|
|
@ -39,6 +45,24 @@ if(MODULES)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Log a fatal error when the value of the APPS_BUILD variable isn't a valid option.
|
||||
if(APPS_BUILD)
|
||||
list(FIND BUILD_APPS_AVAILABLE_OPTIONS "${APPS_BUILD}" BUILD_APPS_INDEX)
|
||||
if(${BUILD_APPS_INDEX} EQUAL -1)
|
||||
message(FATAL_ERROR "The value (${APPS_BUILD}) of your APPS_BUILD variable is invalid! "
|
||||
"Allowed values are: ${BUILD_APPS_AVAILABLE_OPTIONS}. Set default")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Log a fatal error when the value of the TOOLS_BUILD variable isn't a valid option.
|
||||
if(TOOLS_BUILD)
|
||||
list(FIND BUILD_TOOLS_AVAILABLE_OPTIONS "${TOOLS_BUILD}" BUILD_TOOLS_INDEX)
|
||||
if(${BUILD_TOOLS_INDEX} EQUAL -1)
|
||||
message(FATAL_ERROR "The value (${TOOLS_BUILD}) of your TOOLS_BUILD variable is invalid! "
|
||||
"Allowed values are: ${BUILD_TOOLS_AVAILABLE_OPTIONS}. Set default")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build a list of all script modules when -DSCRIPT="custom" is selected
|
||||
GetScriptModuleList(SCRIPT_MODULE_LIST)
|
||||
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||
|
|
@ -47,7 +71,7 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||
set_property(CACHE ${SCRIPT_MODULE_VARIABLE} PROPERTY STRINGS default disabled static dynamic)
|
||||
endforeach()
|
||||
|
||||
# Build a list of all modules script when -DSCRIPT="custom" is selected
|
||||
# Build a list of all modules script when -DMODULE="custom" is selected
|
||||
GetModuleSourceList(SCRIPT_MODULE_LIST)
|
||||
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||
ModuleNameToVariable(${SCRIPT_MODULE} SCRIPT_MODULE_VARIABLE)
|
||||
|
|
@ -55,8 +79,23 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||
set_property(CACHE ${SCRIPT_MODULE_VARIABLE} PROPERTY STRINGS default disabled static dynamic)
|
||||
endforeach()
|
||||
|
||||
# Build a list of all applications when -DBUILD_APPS="custom" is selected
|
||||
GetApplicationsList(APPLICATIONS_BUILD_LIST)
|
||||
foreach(APPLICATION_BUILD_NAME ${APPLICATIONS_BUILD_LIST})
|
||||
ApplicationNameToVariable(${APPLICATION_BUILD_NAME} APPLICATION_BUILD_VARIABLE)
|
||||
set(${APPLICATION_BUILD_VARIABLE} "default" CACHE STRING "Enable build the ${APPLICATION_BUILD_NAME} application.")
|
||||
set_property(CACHE ${APPLICATION_BUILD_VARIABLE} PROPERTY STRINGS default enabled disabled)
|
||||
endforeach()
|
||||
|
||||
# Build a list of all applications when -DBUILD_TOOLS="custom" is selected
|
||||
GetToolsList(TOOLS_BUILD_LIST)
|
||||
foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST})
|
||||
ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE)
|
||||
set(${TOOL_BUILD_VARIABLE} "default" CACHE STRING "Enable build the ${TOOL_BUILD_NAME} tool.")
|
||||
set_property(CACHE ${TOOL_BUILD_VARIABLE} PROPERTY STRINGS default enabled disabled)
|
||||
endforeach()
|
||||
|
||||
option(BUILD_TESTING "Build unit tests" 0)
|
||||
option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 0)
|
||||
option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1)
|
||||
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
||||
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
||||
|
|
@ -69,6 +108,8 @@ option(WITH_STRICT_DATABASE_TYPE_CHECKS "Enable strict checking of database fiel
|
|||
option(WITHOUT_METRICS "Disable metrics reporting (i.e. InfluxDB and Grafana)" 0)
|
||||
option(WITH_DETAILED_METRICS "Enable detailed metrics reporting (i.e. time each session takes to update)" 0)
|
||||
|
||||
CheckApplicationsBuildList()
|
||||
CheckToolsBuildList()
|
||||
IsDynamicLinkingRequired(WITH_DYNAMIC_LINKING_FORCED)
|
||||
IsDynamicLinkingModulesRequired(WITH_DYNAMIC_LINKING_FORCED)
|
||||
|
||||
|
|
|
|||
35
conf/dist/config.sh
vendored
35
conf/dist/config.sh
vendored
|
|
@ -30,12 +30,12 @@ BINPATH="$AC_PATH_ROOT/env/dist"
|
|||
# DATAPATH_ZIP="$DATAPATH/data.zip"
|
||||
|
||||
# azerothcore's official remote source address to pull from
|
||||
# by default git will fetch form the azrothcore remote
|
||||
# by default git will fetch form the azrothcore remote
|
||||
# You can change it to "origin" if you want to fetch/pull from the set remote
|
||||
ORIGIN_REMOTE="https://github.com/azerothcore/azerothcore-wotlk.git"
|
||||
|
||||
# Branch configuration for the installer to pull from.
|
||||
# By default git will select the current working branch
|
||||
# Branch configuration for the installer to pull from.
|
||||
# By default git will select the current working branch
|
||||
# You can set it to "master" if you want the latest updates
|
||||
INSTALLER_PULL_FROM=
|
||||
|
||||
|
|
@ -44,8 +44,6 @@ INSTALLER_PULL_FROM=
|
|||
# COMPILER_CONFIGURATIONS
|
||||
#
|
||||
##############################################
|
||||
|
||||
|
||||
# Set preferred compilers.
|
||||
# To use gcc (not suggested) instead of clang change in:
|
||||
# CCOMPILERC="/usr/bin/gcc"
|
||||
|
|
@ -54,7 +52,6 @@ INSTALLER_PULL_FROM=
|
|||
CCOMPILERC="/usr/bin/clang"
|
||||
CCOMPILERCXX="/usr/bin/clang++"
|
||||
|
||||
|
||||
# how many thread must be used for compilation ( leave zero to use all available )
|
||||
MTHREADS=${MTHREADS:-0}
|
||||
# enable/disable warnings during compilation
|
||||
|
|
@ -69,23 +66,31 @@ CDEBUG=OFF
|
|||
# * RelWithDebInfo: optimized, *with* debug info, but no debug (output) code or asserts.
|
||||
# * MinSizeRel: same as Release but optimizing for size rather than speed.
|
||||
CTYPE=${CTYPE:-Release}
|
||||
|
||||
# compile scripts
|
||||
CSCRIPTS=${CSCRIPTS:-static}
|
||||
|
||||
# compile scripts
|
||||
CMODULES=${CMODULES:-none}
|
||||
|
||||
# compile unit tests
|
||||
CBUILD_TESTING=OFF
|
||||
# compile server
|
||||
CSERVERS=${CSERVERS:-ON}
|
||||
# compile tools
|
||||
CTOOLS=${CTOOLS:-OFF}
|
||||
|
||||
# use precompiled headers ( fatest compilation but not optimized if you change headers often )
|
||||
CSCRIPTPCH=${CSCRIPTPCH:-ON}
|
||||
CCOREPCH=${CCOREPCH:-ON}
|
||||
# compile with C++20
|
||||
CUSE_CPP_20=${CUSE_CPP_20:-OFF}
|
||||
|
||||
# Skip specific modules from compilation (cmake reconfigure needed)
|
||||
# use semicolon ; to separate modules
|
||||
CDISABLED_AC_MODULES=""
|
||||
# build apps list variable
|
||||
CAPPS_BUILD=${CAPPS_BUILD:-all}
|
||||
|
||||
# build tools list variable
|
||||
CTOOLS_BUILD=${CTOOLS_BUILD:-none}
|
||||
|
||||
# build apps list
|
||||
CBUILD_APPS_LIST=${CBUILD_APPS_LIST:-''}
|
||||
|
||||
# build tools list
|
||||
CBUILD_TOOLS_LIST=${CBUILD_TOOLS_LIST:-''}
|
||||
|
||||
# you can add your custom definitions here ( -D )
|
||||
# example: CCUSTOMOPTIONS=" -DWITH_PERFTOOLS=ON
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue