feat(Core/Modules): add separated lib for modules (#9281)

This commit is contained in:
Kargatum
2021-12-02 20:28:58 +07:00
committed by GitHub
parent 8668a03e14
commit 51adbffae4
56 changed files with 1904 additions and 1014 deletions

View File

@@ -51,17 +51,17 @@ function(CopyModuleConfig configDir)
if(WIN32)
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
add_custom_command(TARGET worldserver
add_custom_command(TARGET modules
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
add_custom_command(TARGET worldserver
add_custom_command(TARGET modules
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
elseif(MINGW)
add_custom_command(TARGET worldserver
add_custom_command(TARGET modules
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
add_custom_command(TARGET worldserver
add_custom_command(TARGET modules
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
endif()
@@ -74,35 +74,3 @@ function(CopyModuleConfig configDir)
endif()
unset(postPath)
endfunction()
# Stores the absolut path of the given config module in the variable
function(GetPathToModuleConfig module variable)
set(${variable} "${CMAKE_SOURCE_DIR}/modules/${module}/conf" PARENT_SCOPE)
endfunction()
# Creates a list of all configs modules
# and stores it in the given variable.
function(CollectModulesConfig)
file(GLOB LOCALE_MODULE_LIST RELATIVE
${CMAKE_SOURCE_DIR}/modules
${CMAKE_SOURCE_DIR}/modules/*)
message(STATUS "* Modules config list:")
foreach(CONFIG_MODULE ${LOCALE_MODULE_LIST})
GetPathToModuleConfig(${CONFIG_MODULE} MODULE_CONFIG_PATH)
file(GLOB MODULE_CONFIG_LIST RELATIVE
${MODULE_CONFIG_PATH}
${MODULE_CONFIG_PATH}/*.conf.dist)
foreach(configFileName ${MODULE_CONFIG_LIST})
CopyModuleConfig("${MODULE_CONFIG_PATH}/${configFileName}")
set(CONFIG_LIST ${CONFIG_LIST}${configFileName},)
message(STATUS " |- ${configFileName}")
endforeach()
endforeach()
message("")
add_definitions(-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
endfunction()