mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
feat(Core/Config): rework config and delete ACE inherited (#4608)
This commit is contained in:
@@ -8,6 +8,30 @@ target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations)
|
||||
# If the clang requirement is bumped to >= clang-8, you can remove this check, as well as
|
||||
# the associated ifdef block in src/common/Utilities/StringConvert.h
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <charconv>
|
||||
#include <cstdint>
|
||||
int main()
|
||||
{
|
||||
uint64_t n;
|
||||
char const c[] = \"0\";
|
||||
std::from_chars(c, c+1, n);
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
" CLANG_HAVE_PROPER_CHARCONV)
|
||||
|
||||
if (NOT CLANG_HAVE_PROPER_CHARCONV)
|
||||
message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled")
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-DACORE_NEED_CHARCONV_WORKAROUND)
|
||||
endif()
|
||||
|
||||
if(WITH_WARNINGS)
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
|
||||
90
src/cmake/macros/ConfigInstall.cmake
Normal file
90
src/cmake/macros/ConfigInstall.cmake
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
# Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
|
||||
#
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CopyDefaultConfig(worldserver)
|
||||
#
|
||||
|
||||
function(CopyDefaultConfig servertype)
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${servertype}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/configs")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${servertype}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${servertype}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
elseif(WIN32)
|
||||
install(FILES "${servertype}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CopyModuleConfig("warhead.conf.dist")
|
||||
#
|
||||
|
||||
function(CopyModuleConfig configDir)
|
||||
set(postPath "configs/modules")
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
add_custom_command(TARGET worldserver
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${configDir}" DESTINATION "${CONF_DIR}/modules")
|
||||
elseif(WIN32)
|
||||
install(FILES "${configDir}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${postPath}")
|
||||
endif()
|
||||
unset(postPath)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CollectModulesConfig()
|
||||
#
|
||||
|
||||
function(CollectModulesConfig)
|
||||
message(STATUS "* Modules config list:")
|
||||
|
||||
CU_GET_GLOBAL("MODULE_CONFIG_FILE_LIST")
|
||||
|
||||
foreach(configFile ${MODULE_CONFIG_FILE_LIST})
|
||||
CopyModuleConfig(${configFile})
|
||||
get_filename_component(file_name ${configFile} NAME)
|
||||
set(CONFIG_LIST ${CONFIG_LIST}${file_name},)
|
||||
message(STATUS " |- ${file_name}")
|
||||
endforeach()
|
||||
|
||||
message("")
|
||||
add_definitions(-DCONFIG_FILE_LIST=$<1:"${CONFIG_LIST}">)
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user