mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 23:38:00 +00:00
refactor(Cmake): add support build selected applications and tools (#11836)
This commit is contained in:
@@ -14,12 +14,26 @@
|
||||
# This to stop a few silly crashes that could have been avoided IF people
|
||||
# weren't doing some -O3 psychooptimizations etc.
|
||||
|
||||
# Specified files for Windows
|
||||
if (WIN32)
|
||||
# Crash logs
|
||||
set(winDebugging
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h)
|
||||
|
||||
# Service
|
||||
set(winService
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
|
||||
add_definitions(-fno-delete-null-pointer-checks)
|
||||
endif()
|
||||
|
||||
add_subdirectory(genrev)
|
||||
add_subdirectory(server)
|
||||
|
||||
if( SERVERS )
|
||||
add_subdirectory(server)
|
||||
if (TOOLS_BUILD AND NOT TOOLS_BUILD STREQUAL "none")
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
|
||||
@@ -12,32 +12,62 @@
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CopyDefaultConfig(worldserver)
|
||||
# CopyApplicationConfig(${APP_PROJECT_NAME} ${APPLICATION_NAME})
|
||||
#
|
||||
|
||||
function(CopyDefaultConfig servertype)
|
||||
function(CopyApplicationConfig projectName appName)
|
||||
GetPathToApplication(${appName} SOURCE_APP_PATH)
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${servertype}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.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")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${servertype}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
elseif(WIN32)
|
||||
install(FILES "${servertype}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(CopyToolConfig projectName appName)
|
||||
GetPathToTool(${appName} SOURCE_APP_PATH)
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.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 "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
elseif(WIN32)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
108
src/cmake/macros/ConfigureApplications.cmake
Normal file
108
src/cmake/macros/ConfigureApplications.cmake
Normal file
@@ -0,0 +1,108 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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(BUILD_APPLICATION_AUTHSERVER 0)
|
||||
set(BUILD_APPLICATION_WORLDSERVER 0)
|
||||
|
||||
# Returns the base path to the apps directory in the source directory
|
||||
function(GetApplicationsBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/src/server/apps" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given app in the variable
|
||||
function(GetPathToApplication app variable)
|
||||
GetApplicationsBasePath(APPS_BASE_PATH)
|
||||
set(${variable} "${APPS_BASE_PATH}/${app}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given app in the variable
|
||||
function(GetProjectNameOfApplicationName app variable)
|
||||
string(TOLOWER "${app}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all applications and stores it in the given variable.
|
||||
function(GetApplicationsList variable)
|
||||
GetApplicationsBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_SOURCE_APP_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
|
||||
foreach(SOURCE_APP ${LOCALE_SOURCE_APP_LIST})
|
||||
GetPathToApplication(${SOURCE_APP} SOURCE_APP_PATH)
|
||||
if(IS_DIRECTORY ${SOURCE_APP_PATH})
|
||||
list(APPEND ${variable} ${SOURCE_APP})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given application name into it's
|
||||
# variable name which holds the build type.
|
||||
function(ApplicationNameToVariable application variable)
|
||||
string(TOUPPER ${application} ${variable})
|
||||
set(${variable} "APP_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CheckApplicationsBuildList)
|
||||
GetApplicationsList(APPLICATIONS_BUILD_LIST)
|
||||
|
||||
if (APPS_BUILD STREQUAL "none")
|
||||
set(APPS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(APPS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_APPS_USE_WHITELIST
|
||||
# Sets BUILD_APPS_WHITELIST
|
||||
if (APPS_BUILD MATCHES "-only")
|
||||
set(BUILD_APPS_USE_WHITELIST ON)
|
||||
|
||||
if (APPS_BUILD STREQUAL "servers-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST authserver worldserver)
|
||||
endif()
|
||||
|
||||
if (APPS_BUILD STREQUAL "dbimport-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST dbimport)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(APPLICATION_BUILD_NAME ${APPLICATIONS_BUILD_LIST})
|
||||
ApplicationNameToVariable(${APPLICATION_BUILD_NAME} APPLICATION_BUILD_VARIABLE)
|
||||
|
||||
if(${APPLICATION_BUILD_VARIABLE} STREQUAL "default")
|
||||
if(BUILD_APPS_USE_WHITELIST)
|
||||
list(FIND BUILD_APPS_WHITELIST "${APPLICATION_BUILD_NAME}" INDEX)
|
||||
if(${INDEX} GREATER -1)
|
||||
set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${APPLICATION_BUILD_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if(${APPLICATION_BUILD_VARIABLE} MATCHES "enabled")
|
||||
if (${APPLICATION_BUILD_NAME} MATCHES "authserver")
|
||||
set (BUILD_APPLICATION_AUTHSERVER 1 PARENT_SCOPE)
|
||||
elseif(${APPLICATION_BUILD_NAME} MATCHES "worldserver")
|
||||
set (BUILD_APPLICATION_WORLDSERVER 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
110
src/cmake/macros/ConfigureTools.cmake
Normal file
110
src/cmake/macros/ConfigureTools.cmake
Normal file
@@ -0,0 +1,110 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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(BUILD_TOOLS_MAPS 0)
|
||||
set(BUILD_TOOLS_DB_IMPORT 0)
|
||||
|
||||
# Returns the base path to the tools directory in the source directory
|
||||
function(GetToolsBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/src/tools" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given tool in the variable
|
||||
function(GetPathToTool tool variable)
|
||||
GetToolsBasePath(TOOLS_BASE_PATH)
|
||||
set(${variable} "${TOOLS_BASE_PATH}/${tool}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given tool in the variable
|
||||
function(GetProjectNameOfToolName tool variable)
|
||||
string(TOLOWER "${tool}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all applications and stores it in the given variable.
|
||||
function(GetToolsList variable)
|
||||
GetToolsBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_SOURCE_TOOL_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
|
||||
foreach(SOURCE_TOOL ${LOCALE_SOURCE_TOOL_LIST})
|
||||
GetPathToTool(${SOURCE_TOOL} SOURCE_TOOL_PATH)
|
||||
if(IS_DIRECTORY ${SOURCE_TOOL_PATH})
|
||||
list(APPEND ${variable} ${SOURCE_TOOL})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given application name into it's
|
||||
# variable name which holds the build type.
|
||||
function(ToolNameToVariable application variable)
|
||||
string(TOUPPER ${application} ${variable})
|
||||
set(${variable} "TOOL_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CheckToolsBuildList)
|
||||
GetToolsList(TOOLS_BUILD_LIST)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "none")
|
||||
set(TOOLS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(TOOLS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_TOOLS_USE_WHITELIST
|
||||
# Sets BUILD_TOOLS_WHITELIST
|
||||
if (TOOLS_BUILD MATCHES "-only")
|
||||
set(BUILD_TOOLS_USE_WHITELIST ON)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "maps-only")
|
||||
list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor)
|
||||
endif()
|
||||
|
||||
# if (TOOLS_BUILD STREQUAL "db-only")
|
||||
# list(APPEND BUILD_TOOLS_WHITELIST dbimport)
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
# Set the TOOL_${TOOL_BUILD_NAME} variables from the
|
||||
# variables set above
|
||||
foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST})
|
||||
ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE)
|
||||
|
||||
if (${TOOL_BUILD_VARIABLE} STREQUAL "default")
|
||||
if (BUILD_TOOLS_USE_WHITELIST)
|
||||
list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX)
|
||||
if (${INDEX} GREATER -1)
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if (${TOOL_BUILD_VARIABLE} MATCHES "enabled")
|
||||
if (${TOOL_BUILD_NAME} MATCHES "dbimport")
|
||||
set(BUILD_TOOLS_DB_IMPORT 1 PARENT_SCOPE)
|
||||
else()
|
||||
set(BUILD_TOOLS_MAPS 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -32,31 +32,32 @@ message("")
|
||||
|
||||
# Show infomation about the options selected during configuration
|
||||
|
||||
if( SERVERS )
|
||||
message("* Build world/auth : Yes (default)")
|
||||
if (APPS_BUILD AND (NOT APPS_BUILD STREQUAL "none"))
|
||||
message("* Build applications : Yes (${APPS_BUILD})")
|
||||
else()
|
||||
message("* Build world/authserver : No")
|
||||
message("* Build applications : No")
|
||||
endif()
|
||||
|
||||
if(SCRIPTS AND (NOT SCRIPTS STREQUAL "none"))
|
||||
if (TOOLS_BUILD AND (NOT TOOLS_BUILD STREQUAL "none"))
|
||||
message("* Build tools : Yes (${TOOLS_BUILD})")
|
||||
add_definitions(-DNO_CORE_FUNCS)
|
||||
else()
|
||||
message("* Build tools : No")
|
||||
endif()
|
||||
|
||||
if (SCRIPTS AND (NOT SCRIPTS STREQUAL "none"))
|
||||
message("* Build with scripts : Yes (${SCRIPTS})")
|
||||
|
||||
else()
|
||||
message("* Build with scripts : No")
|
||||
endif()
|
||||
|
||||
if(MODULES AND (NOT MODULES STREQUAL "none"))
|
||||
if (MODULES AND (NOT MODULES STREQUAL "none"))
|
||||
message("* Build with modules : Yes (${MODULES})")
|
||||
else()
|
||||
message("* Build with modules : No")
|
||||
endif()
|
||||
|
||||
if( TOOLS )
|
||||
message("* Build map/vmap tools : Yes")
|
||||
add_definitions(-DNO_CORE_FUNCS)
|
||||
else()
|
||||
message("* Build map/vmap tools : No (default)")
|
||||
endif()
|
||||
|
||||
if( BUILD_TESTING )
|
||||
message("* Build unit tests : Yes")
|
||||
else()
|
||||
|
||||
@@ -16,8 +16,21 @@ CollectSourceFiles(
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Platform
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Collision
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Navigation
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
if (BUILD_APPLICATION_WORLDSERVER OR BUILD_TOOLS_MAPS)
|
||||
unset(PRIVATE_SOURCES)
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Platform
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
endif()
|
||||
|
||||
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in common project
|
||||
# It needs to be included both in authserver and worldserver for the static global variable to be properly initialized
|
||||
# and to handle crash logs on windows
|
||||
@@ -55,8 +68,6 @@ target_link_libraries(common
|
||||
PUBLIC
|
||||
boost
|
||||
argon2
|
||||
g3dlib
|
||||
Detour
|
||||
sfmt
|
||||
utf8cpp
|
||||
openssl
|
||||
@@ -65,6 +76,13 @@ target_link_libraries(common
|
||||
stdfs
|
||||
fmt)
|
||||
|
||||
if (BUILD_APPLICATION_WORLDSERVER OR BUILD_TOOLS_MAPS)
|
||||
target_link_libraries(common
|
||||
PUBLIC
|
||||
g3dlib
|
||||
Detour)
|
||||
endif()
|
||||
|
||||
set_target_properties(common
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
public:
|
||||
static Log* instance();
|
||||
|
||||
void Initialize(Acore::Asio::IoContext* ioContext);
|
||||
void Initialize(Acore::Asio::IoContext* ioContext = nullptr);
|
||||
void SetSynchronous(); // Not threadsafe - should only be called from main() after all threads are joined
|
||||
void LoadFromConfig();
|
||||
void Close();
|
||||
|
||||
@@ -10,22 +10,19 @@
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Specified files for Windows
|
||||
if (WIN32)
|
||||
# Crash logs
|
||||
set(winDebugging
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h)
|
||||
add_subdirectory(apps)
|
||||
|
||||
# Service
|
||||
set(winService
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h)
|
||||
# if ((APPS_BUILD AND NOT APPS_BUILD STREQUAL "none") OR BUILD_TOOLS_DB_IMPORT) # DB import PR
|
||||
if ((APPS_BUILD AND NOT APPS_BUILD STREQUAL "none"))
|
||||
add_subdirectory(database)
|
||||
endif()
|
||||
|
||||
if (BUILD_APPLICATION_AUTHSERVER OR BUILD_APPLICATION_WORLDSERVER)
|
||||
add_subdirectory(shared)
|
||||
endif()
|
||||
|
||||
if (BUILD_APPLICATION_WORLDSERVER)
|
||||
add_subdirectory(game)
|
||||
add_subdirectory(scripts)
|
||||
endif()
|
||||
|
||||
add_subdirectory(authserver)
|
||||
add_subdirectory(database)
|
||||
add_subdirectory(game)
|
||||
add_subdirectory(shared)
|
||||
add_subdirectory(scripts)
|
||||
add_subdirectory(worldserver)
|
||||
|
||||
198
src/server/apps/CMakeLists.txt
Normal file
198
src/server/apps/CMakeLists.txt
Normal file
@@ -0,0 +1,198 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Make the script module list available in the current scope
|
||||
GetApplicationsList(APPLICATIONS_BUILD_LIST)
|
||||
|
||||
if (APPS_BUILD STREQUAL "none")
|
||||
set(APPS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(APPS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_APPS_USE_WHITELIST
|
||||
# Sets BUILD_APPS_WHITELIST
|
||||
if (APPS_BUILD MATCHES "-only")
|
||||
set(BUILD_APPS_USE_WHITELIST ON)
|
||||
|
||||
if (APPS_BUILD STREQUAL "auth-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST authserver)
|
||||
endif()
|
||||
|
||||
if (APPS_BUILD STREQUAL "world-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST worldserver)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the SCRIPTS_${BUILD_APP} variables from the
|
||||
# variables set above
|
||||
foreach(BUILD_APP ${APPLICATIONS_BUILD_LIST})
|
||||
ApplicationNameToVariable(${BUILD_APP} BUILD_APP_VARIABLE)
|
||||
|
||||
if(${BUILD_APP_VARIABLE} STREQUAL "default")
|
||||
if(BUILD_APPS_USE_WHITELIST)
|
||||
list(FIND BUILD_APPS_WHITELIST "${BUILD_APP}" INDEX)
|
||||
if(${INDEX} GREATER -1)
|
||||
set(${BUILD_APP_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${BUILD_APP_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${BUILD_APP_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if(${BUILD_APP_VARIABLE} MATCHES "enabled")
|
||||
list(APPEND BUILD_APP_GRAPH_KEYS apps)
|
||||
set(BUILD_APP_VALUE_DISPLAY_apps apps)
|
||||
list(APPEND BUILD_APP_VALUE_CONTAINS_apps ${BUILD_APP})
|
||||
|
||||
if (${BUILD_APP} MATCHES "authserver")
|
||||
set (BUILD_APPLICATION_AUTHSERVER 1)
|
||||
elseif(${BUILD_APP} MATCHES "worldserver")
|
||||
set (BUILD_APPLICATION_WORLDSERVER 1)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND BUILD_APP_GRAPH_KEYS disabled)
|
||||
set(BUILD_APP_VALUE_DISPLAY_disabled disabled)
|
||||
list(APPEND BUILD_APP_VALUE_CONTAINS_disabled ${BUILD_APP})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(SORT BUILD_APP_GRAPH_KEYS)
|
||||
list(REMOVE_DUPLICATES BUILD_APP_GRAPH_KEYS)
|
||||
|
||||
# Display the graphs
|
||||
message("")
|
||||
message("* Apps build list (${APPS_BUILD}):")
|
||||
message(" |")
|
||||
|
||||
foreach(BUILD_APP_GRAPH_KEY ${BUILD_APP_GRAPH_KEYS})
|
||||
if(NOT BUILD_APP_GRAPH_KEY STREQUAL "disabled")
|
||||
message(" +- ${BUILD_APP_VALUE_DISPLAY_${BUILD_APP_GRAPH_KEY}}")
|
||||
else()
|
||||
message(" | ${BUILD_APP_VALUE_DISPLAY_${BUILD_APP_GRAPH_KEY}}")
|
||||
endif()
|
||||
foreach(BUILD_APP_GRAPH_ENTRY ${BUILD_APP_VALUE_CONTAINS_${BUILD_APP_GRAPH_KEY}})
|
||||
message(" | +- ${BUILD_APP_GRAPH_ENTRY}")
|
||||
endforeach()
|
||||
message(" |")
|
||||
endforeach()
|
||||
|
||||
message("")
|
||||
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Generates the actual apps projects
|
||||
foreach(APPLICATION_NAME ${APPLICATIONS_BUILD_LIST})
|
||||
GetPathToApplication(${APPLICATION_NAME} SOURCE_APP_PATH)
|
||||
ApplicationNameToVariable(${APPLICATION_NAME} BUILD_APP_VARIABLE)
|
||||
|
||||
if (${BUILD_APP_VARIABLE} STREQUAL "disabled")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
unset(APP_PRIVATE_SOURCES)
|
||||
CollectSourceFiles(
|
||||
${SOURCE_APP_PATH}
|
||||
APP_PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${SOURCE_APP_PATH}/PrecompiledHeaders)
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND APP_PRIVATE_SOURCES ${winDebugging})
|
||||
|
||||
if (${APPLICATION_NAME} MATCHES "worldserver")
|
||||
list(APPEND APP_PRIVATE_SOURCES ${winService})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
list(APPEND APP_PRIVATE_SOURCES ${SOURCE_APP_PATH}/${APPLICATION_NAME}.rc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
GetProjectNameOfApplicationName(${APPLICATION_NAME} APP_PROJECT_NAME)
|
||||
|
||||
# Create the application project
|
||||
add_executable(${APP_PROJECT_NAME}
|
||||
${APP_PRIVATE_SOURCES})
|
||||
|
||||
add_dependencies(${APP_PROJECT_NAME} revision.h)
|
||||
|
||||
target_link_libraries(${APP_PROJECT_NAME}
|
||||
PRIVATE
|
||||
acore-core-interface)
|
||||
|
||||
if (${APP_PROJECT_NAME} MATCHES "authserver")
|
||||
target_link_libraries(${APP_PROJECT_NAME}
|
||||
PUBLIC
|
||||
shared)
|
||||
elseif(${APP_PROJECT_NAME} MATCHES "worldserver")
|
||||
target_link_libraries(${APP_PROJECT_NAME}
|
||||
PUBLIC
|
||||
modules
|
||||
scripts
|
||||
game
|
||||
gsoap
|
||||
readline
|
||||
gperftools)
|
||||
|
||||
if (UNIX AND NOT NOJEM)
|
||||
set(${APP_PROJECT_NAME}_LINK_FLAGS "-pthread -lncurses ${${APP_PROJECT_NAME}_LINK_FLAGS}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS "${${APP_PROJECT_NAME}_LINK_FLAGS}")
|
||||
|
||||
# Add all dynamic projects as dependency to the worldserver
|
||||
if (WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES)
|
||||
add_dependencies(${APP_PROJECT_NAME} ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(APP_PUBLIC_INCLUDES)
|
||||
CollectIncludeDirectories(
|
||||
${SOURCE_APP_PATH}
|
||||
APP_PUBLIC_INCLUDES
|
||||
# Exclude
|
||||
${SOURCE_APP_PATH}/PrecompiledHeaders)
|
||||
|
||||
target_include_directories(${APP_PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_include_directories(${APP_PROJECT_NAME}
|
||||
PUBLIC
|
||||
${APP_PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_NAME})
|
||||
|
||||
set_target_properties(${APP_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"server")
|
||||
|
||||
# Install config
|
||||
CopyApplicationConfig(${APP_PROJECT_NAME} ${APPLICATION_NAME})
|
||||
|
||||
if (UNIX)
|
||||
install(TARGETS ${APP_PROJECT_NAME} DESTINATION bin)
|
||||
elseif (WIN32)
|
||||
install(TARGETS ${APP_PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
set(PATH_TO_PCH ${SOURCE_APP_PATH}/PrecompiledHeaders/${APPLICATION_NAME}PCH.h)
|
||||
|
||||
# Generate precompiled header
|
||||
if (USE_COREPCH AND EXISTS ${PATH_TO_PCH})
|
||||
add_cxx_pch(${APP_PROJECT_NAME} ${PATH_TO_PCH})
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -41,8 +41,11 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Util.h"
|
||||
#include <boost/asio/signal_set.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include <csignal>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
@@ -51,19 +54,15 @@
|
||||
#endif
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
using namespace boost::program_options;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
bool StartDB();
|
||||
void StopDB();
|
||||
void SignalHandler(std::weak_ptr<Acore::Asio::IoContext> ioContextRef, boost::system::error_code const& error, int signalNumber);
|
||||
void KeepDatabaseAliveHandler(std::weak_ptr<Acore::Asio::DeadlineTimer> dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error);
|
||||
void BanExpiryHandler(std::weak_ptr<Acore::Asio::DeadlineTimer> banExpiryCheckTimerRef, int32 banExpiryCheckInterval, boost::system::error_code const& error);
|
||||
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char* prog)
|
||||
{
|
||||
LOG_INFO("server.authserver", "Usage: \n {} [<options>]\n"
|
||||
" -c config_file use config_file as configuration file\n\r", prog);
|
||||
}
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile);
|
||||
|
||||
/// Launch the auth server
|
||||
int main(int argc, char** argv)
|
||||
@@ -71,27 +70,16 @@ int main(int argc, char** argv)
|
||||
Acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_AUTHSERVER;
|
||||
signal(SIGABRT, &Acore::AbortHandler);
|
||||
|
||||
// Command line parsing to get the configuration file name
|
||||
std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG);
|
||||
int count = 1;
|
||||
while (count < argc)
|
||||
{
|
||||
if (strcmp(argv[count], "-c") == 0)
|
||||
{
|
||||
if (++count >= argc)
|
||||
{
|
||||
printf("Runtime-Error: -c option requires an input argument\n");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
configFile = argv[count];
|
||||
}
|
||||
++count;
|
||||
}
|
||||
// Command line parsing
|
||||
auto configFile = fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG));
|
||||
auto vm = GetConsoleArguments(argc, argv, configFile);
|
||||
|
||||
// exit if help or version is enabled
|
||||
if (vm.count("help"))
|
||||
return 0;
|
||||
|
||||
// Add file and args in config
|
||||
sConfigMgr->Configure(configFile, std::vector<std::string>(argv, argv + argc));
|
||||
sConfigMgr->Configure(configFile.generic_string(), std::vector<std::string>(argv, argv + argc));
|
||||
|
||||
if (!sConfigMgr->LoadAppConfigs())
|
||||
return 1;
|
||||
@@ -149,6 +137,13 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Stop auth server if dry run
|
||||
if (sConfigMgr->isDryRun())
|
||||
{
|
||||
LOG_INFO("server.authserver", "Dry run completed, terminating.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Start the listening port (acceptor) for auth connections
|
||||
int32 port = sConfigMgr->GetOption<int32>("RealmServerPort", 3724);
|
||||
if (port < 0 || port > 0xFFFF)
|
||||
@@ -268,3 +263,36 @@ void BanExpiryHandler(std::weak_ptr<Acore::Asio::DeadlineTimer> banExpiryCheckTi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile)
|
||||
{
|
||||
options_description all("Allowed options");
|
||||
all.add_options()
|
||||
("help,h", "print usage message")
|
||||
("version,v", "print version build info")
|
||||
("dry-run,d", "Dry run")
|
||||
("config,c", value<fs::path>(&configFile)->default_value(fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG))), "use <arg> as configuration file");
|
||||
|
||||
variables_map variablesMap;
|
||||
|
||||
try
|
||||
{
|
||||
store(command_line_parser(argc, argv).options(all).allow_unregistered().run(), variablesMap);
|
||||
notify(variablesMap);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
std::cerr << e.what() << "\n";
|
||||
}
|
||||
|
||||
if (variablesMap.count("help"))
|
||||
{
|
||||
std::cout << all << "\n";
|
||||
}
|
||||
else if (variablesMap.count("dry-run"))
|
||||
{
|
||||
sConfigMgr->setDryRun(true);
|
||||
}
|
||||
|
||||
return variablesMap;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
@@ -36,6 +36,7 @@
|
||||
#include "IoContext.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Metric.h"
|
||||
#include "ModuleMgr.h"
|
||||
#include "ModulesScriptLoader.h"
|
||||
#include "MySQLThreading.h"
|
||||
#include "OpenSSLCrypto.h"
|
||||
@@ -54,12 +55,12 @@
|
||||
#include <boost/asio/signal_set.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <csignal>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#include "ModuleMgr.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
||||
#include "ServiceWin32.h"
|
||||
char serviceName[] = "worldserver";
|
||||
char serviceLongName[] = "AzerothCore world service";
|
||||
@@ -78,6 +79,8 @@ int m_ServiceStatus = -1;
|
||||
#endif
|
||||
|
||||
#define WORLD_SLEEP_CONST 10
|
||||
using namespace boost::program_options;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class FreezeDetector
|
||||
{
|
||||
@@ -110,20 +113,7 @@ void ShutdownCLIThread(std::thread* cliThread);
|
||||
void AuctionListingRunnable();
|
||||
void ShutdownAuctionListingThread(std::thread* thread);
|
||||
void WorldUpdateLoop();
|
||||
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char* prog)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" %s [<options>]\n", prog);
|
||||
printf(" -c config_file use config_file as configuration file\n");
|
||||
#ifdef _WIN32
|
||||
printf(" Running as service functions:\n");
|
||||
printf(" --service run as service\n");
|
||||
printf(" -s install install service\n");
|
||||
printf(" -s uninstall uninstall service\n");
|
||||
#endif
|
||||
}
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& cfg_service);
|
||||
|
||||
/// Launch the Azeroth server
|
||||
int main(int argc, char** argv)
|
||||
@@ -131,66 +121,26 @@ int main(int argc, char** argv)
|
||||
Acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_WORLDSERVER;
|
||||
signal(SIGABRT, &Acore::AbortHandler);
|
||||
|
||||
///- Command line parsing to get the configuration file name
|
||||
std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG);
|
||||
int c = 1;
|
||||
while (c < argc)
|
||||
{
|
||||
if (strcmp(argv[c], "--dry-run") == 0)
|
||||
{
|
||||
sConfigMgr->setDryRun(true);
|
||||
}
|
||||
// Command line parsing
|
||||
auto configFile = fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG));
|
||||
std::string configService;
|
||||
auto vm = GetConsoleArguments(argc, argv, configFile, configService);
|
||||
|
||||
if (!strcmp(argv[c], "-c"))
|
||||
{
|
||||
if (++c >= argc)
|
||||
{
|
||||
printf("Runtime-Error: -c option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
configFile = argv[c];
|
||||
}
|
||||
// exit if help or version is enabled
|
||||
if (vm.count("help"))
|
||||
return 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (strcmp(argv[c], "-s") == 0) // Services
|
||||
{
|
||||
if (++c >= argc)
|
||||
{
|
||||
printf("Runtime-Error: -s option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[c], "install") == 0)
|
||||
{
|
||||
if (WinServiceInstall())
|
||||
printf("Installing service\n");
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(argv[c], "uninstall") == 0)
|
||||
{
|
||||
if (WinServiceUninstall())
|
||||
printf("Uninstalling service\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Runtime-Error: unsupported option %s", argv[c]);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(argv[c], "--service") == 0)
|
||||
WinServiceRun();
|
||||
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
||||
if (configService.compare("install") == 0)
|
||||
return WinServiceInstall() == true ? 0 : 1;
|
||||
else if (configService.compare("uninstall") == 0)
|
||||
return WinServiceUninstall() == true ? 0 : 1;
|
||||
else if (configService.compare("run") == 0)
|
||||
WinServiceRun();
|
||||
#endif
|
||||
++c;
|
||||
}
|
||||
|
||||
// Add file and args in config
|
||||
sConfigMgr->Configure(configFile, { argv, argv + argc }, CONFIG_FILE_LIST);
|
||||
sConfigMgr->Configure(configFile.generic_string(), {argv, argv + argc}, CONFIG_FILE_LIST);
|
||||
|
||||
if (!sConfigMgr->LoadAppConfigs())
|
||||
return 1;
|
||||
@@ -399,7 +349,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// Launch CliRunnable thread
|
||||
std::shared_ptr<std::thread> cliThread;
|
||||
#ifdef _WIN32
|
||||
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
|
||||
if (sConfigMgr->GetOption<bool>("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
#else
|
||||
if (sConfigMgr->GetOption<bool>("Console.Enable", true))
|
||||
@@ -768,3 +718,44 @@ void ShutdownAuctionListingThread(std::thread* thread)
|
||||
delete thread;
|
||||
}
|
||||
}
|
||||
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& configService)
|
||||
{
|
||||
options_description all("Allowed options");
|
||||
all.add_options()
|
||||
("help,h", "print usage message")
|
||||
("version,v", "print version build info")
|
||||
("dry-run,d", "Dry run")
|
||||
("config,c", value<fs::path>(&configFile)->default_value(fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG))), "use <arg> as configuration file");
|
||||
|
||||
#if AC_PLATFORM == WARHEAD_PLATFORM_WINDOWS
|
||||
options_description win("Windows platform specific options");
|
||||
win.add_options()
|
||||
("service,s", value<std::string>(&configService)->default_value(""), "Windows service options: [install | uninstall]");
|
||||
|
||||
all.add(win);
|
||||
#endif
|
||||
|
||||
variables_map vm;
|
||||
|
||||
try
|
||||
{
|
||||
store(command_line_parser(argc, argv).options(all).allow_unregistered().run(), vm);
|
||||
notify(vm);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
std::cerr << e.what() << "\n";
|
||||
}
|
||||
|
||||
if (vm.count("help"))
|
||||
{
|
||||
std::cout << all << "\n";
|
||||
}
|
||||
else if (vm.count("dry-run"))
|
||||
{
|
||||
sConfigMgr->setDryRun(true);
|
||||
}
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
@@ -1,77 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
########### authserver ###############
|
||||
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
if( WIN32 )
|
||||
list(APPEND PRIVATE_SOURCES ${winDebugging})
|
||||
if ( MSVC )
|
||||
list(APPEND PRIVATE_SOURCES authserver.rc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (USE_COREPCH)
|
||||
set(PRIVATE_PCH_HEADER PrecompiledHeaders/authPCH.h)
|
||||
endif()
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(authserver
|
||||
${PRIVATE_SOURCES})
|
||||
|
||||
add_dependencies(authserver revision.h)
|
||||
|
||||
target_link_libraries(authserver
|
||||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
shared)
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
target_include_directories(authserver
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set_target_properties(authserver
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"server")
|
||||
|
||||
# Install config
|
||||
CopyDefaultConfig(authserver)
|
||||
|
||||
if ( UNIX )
|
||||
install(TARGETS authserver DESTINATION bin)
|
||||
elseif ( WIN32 )
|
||||
install(TARGETS authserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
# Generate precompiled header
|
||||
if (USE_COREPCH)
|
||||
add_cxx_pch(authserver ${PRIVATE_PCH_HEADER})
|
||||
endif()
|
||||
|
||||
CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE")
|
||||
@@ -90,7 +90,7 @@ uint32 MySQLConnection::Open()
|
||||
MYSQL* mysqlInit = mysql_init(nullptr);
|
||||
if (!mysqlInit)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `{}`", m_connectionInfo.database);
|
||||
LOG_ERROR("sql.driver", "Could not initialize Mysql connection to database `{}`", m_connectionInfo.database);
|
||||
return CR_UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ uint32 MySQLConnection::Open()
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Could not connect to MySQL database at {}: {}", m_connectionInfo.host, mysql_error(mysqlInit));
|
||||
LOG_ERROR("sql.driver", "Could not connect to MySQL database at {}: {}", m_connectionInfo.host, mysql_error(mysqlInit));
|
||||
uint32 errorCode = mysql_errno(mysqlInit);
|
||||
mysql_close(mysqlInit);
|
||||
return errorCode;
|
||||
|
||||
@@ -12,11 +12,8 @@
|
||||
|
||||
CU_RUN_HOOK(BEFORE_SCRIPTS_LIBRARY)
|
||||
|
||||
message("")
|
||||
|
||||
# Make the script module list available in the current scope
|
||||
GetScriptModuleList(SCRIPT_MODULE_LIST)
|
||||
GetModuleSourceList(MODULES_MODULE_LIST)
|
||||
|
||||
# Make the native install offset available in this scope
|
||||
GetInstallOffset(INSTALL_OFFSET)
|
||||
@@ -33,18 +30,6 @@ else()
|
||||
set(SCRIPTS_DEFAULT_LINKAGE "disabled")
|
||||
endif()
|
||||
|
||||
# Sets the MODULES_${SOURCE_MODULE} variables
|
||||
# when using predefined templates for script building
|
||||
# like dynamic, static
|
||||
# Sets MODULES_DEFAULT_LINKAGE
|
||||
if(MODULES MATCHES "dynamic")
|
||||
set(MODULES_DEFAULT_LINKAGE "dynamic")
|
||||
elseif(MODULES MATCHES "static")
|
||||
set(MODULES_DEFAULT_LINKAGE "static")
|
||||
else()
|
||||
set(MODULES_DEFAULT_LINKAGE "disabled")
|
||||
endif()
|
||||
|
||||
# Sets SCRIPTS_USE_WHITELIST
|
||||
# Sets SCRIPTS_WHITELIST
|
||||
if(SCRIPTS MATCHES "minimal")
|
||||
@@ -93,8 +78,8 @@ list(SORT SCRIPT_GRAPH_KEYS)
|
||||
list(REMOVE_DUPLICATES SCRIPT_GRAPH_KEYS)
|
||||
|
||||
# Display the script graph
|
||||
message("* Script configuration (${SCRIPTS}):
|
||||
|")
|
||||
message("* Script configuration (${SCRIPTS}):")
|
||||
message(" |")
|
||||
|
||||
foreach(SCRIPT_GRAPH_KEY ${SCRIPT_GRAPH_KEYS})
|
||||
if(NOT SCRIPT_GRAPH_KEY STREQUAL "disabled")
|
||||
@@ -108,10 +93,8 @@ foreach(SCRIPT_GRAPH_KEY ${SCRIPT_GRAPH_KEYS})
|
||||
message(" |")
|
||||
endforeach()
|
||||
|
||||
message("")
|
||||
|
||||
# Base sources which are used by every script project
|
||||
if(USE_SCRIPTPCH)
|
||||
if (USE_SCRIPTPCH)
|
||||
set(PRIVATE_PCH_HEADER ScriptPCH.h)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define ACORE_SHAREDDEFINES_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "EnumFlag.h"
|
||||
#include <cassert>
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
if( WIN32 )
|
||||
list(APPEND PRIVATE_SOURCES ${winDebugging} ${winService})
|
||||
if ( MSVC )
|
||||
list(APPEND PRIVATE_SOURCES worldserver.rc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (USE_COREPCH)
|
||||
set(PRIVATE_PCH_HEADER PrecompiledHeaders/worldPCH.h)
|
||||
endif()
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(worldserver
|
||||
${PRIVATE_SOURCES})
|
||||
|
||||
add_dependencies(worldserver revision.h)
|
||||
|
||||
if(UNIX AND NOT NOJEM)
|
||||
set(worldserver_LINK_FLAGS "-pthread -lncurses ${worldserver_LINK_FLAGS}")
|
||||
endif()
|
||||
|
||||
set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}")
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
target_include_directories(worldserver
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
target_link_libraries(worldserver
|
||||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
modules
|
||||
scripts
|
||||
game
|
||||
gsoap
|
||||
readline
|
||||
gperftools)
|
||||
|
||||
set_target_properties(worldserver
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"server")
|
||||
|
||||
# Add all dynamic projects as dependency to the worldserver
|
||||
if(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES)
|
||||
add_dependencies(worldserver ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
# Install config
|
||||
CopyDefaultConfig(worldserver)
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS worldserver DESTINATION bin)
|
||||
elseif( WIN32 )
|
||||
install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
# Generate precompiled header
|
||||
if( USE_COREPCH )
|
||||
add_cxx_pch(worldserver ${PRIVATE_PCH_HEADER})
|
||||
endif()
|
||||
|
||||
CU_RUN_HOOK("AFTER_WORLDSERVER_CMAKE")
|
||||
@@ -8,9 +8,155 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
add_subdirectory(map_extractor)
|
||||
add_subdirectory(vmap4_assembler)
|
||||
add_subdirectory(vmap4_extractor)
|
||||
add_subdirectory(mmaps_generator)
|
||||
# Make the tools list available in the current scope
|
||||
GetToolsList(TOOLS_BUILD_LIST)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "none")
|
||||
set(TOOLS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(TOOLS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_TOOLS_USE_WHITELIST
|
||||
# Sets BUILD_TOOLS_WHITELIST
|
||||
if (TOOLS_BUILD MATCHES "-only")
|
||||
set(BUILD_TOOLS_USE_WHITELIST ON)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "maps-only")
|
||||
list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor)
|
||||
endif()
|
||||
|
||||
# if (TOOLS_BUILD STREQUAL "db-only")
|
||||
# list(APPEND BUILD_TOOLS_WHITELIST dbimport)
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
# Set the TOOL_${TOOL_BUILD_NAME} variables from the
|
||||
# variables set above
|
||||
foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST})
|
||||
ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE)
|
||||
|
||||
if(${TOOL_BUILD_VARIABLE} STREQUAL "default")
|
||||
if(BUILD_TOOLS_USE_WHITELIST)
|
||||
list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX)
|
||||
if(${INDEX} GREATER -1)
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if(${TOOL_BUILD_VARIABLE} MATCHES "enabled")
|
||||
list(APPEND TOOL_BUILD_GRAPH_KEYS tools)
|
||||
set(TOOL_BUILD_VALUE_DISPLAY_tools tools)
|
||||
list(APPEND TOOL_BUILD_VALUE_CONTAINS_tools ${TOOL_BUILD_NAME})
|
||||
else()
|
||||
list(APPEND TOOL_BUILD_GRAPH_KEYS disabled)
|
||||
set(TOOL_BUILD_VALUE_DISPLAY_disabled disabled)
|
||||
list(APPEND TOOL_BUILD_VALUE_CONTAINS_disabled ${TOOL_BUILD_NAME})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(SORT TOOL_BUILD_GRAPH_KEYS)
|
||||
list(REMOVE_DUPLICATES TOOL_BUILD_GRAPH_KEYS)
|
||||
|
||||
# Display the graphs
|
||||
# message("")
|
||||
message("* Tools build list (${TOOLS_BUILD}):")
|
||||
message(" |")
|
||||
|
||||
foreach(TOOL_BUILD_GRAPH_KEY ${TOOL_BUILD_GRAPH_KEYS})
|
||||
if(NOT TOOL_BUILD_GRAPH_KEY STREQUAL "disabled")
|
||||
message(" +- ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}")
|
||||
else()
|
||||
message(" | ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}")
|
||||
endif()
|
||||
foreach(TOOL_BUILD_GRAPH_ENTRY ${TOOL_BUILD_VALUE_CONTAINS_${TOOL_BUILD_GRAPH_KEY}})
|
||||
message(" | +- ${TOOL_BUILD_GRAPH_ENTRY}")
|
||||
endforeach()
|
||||
message(" |")
|
||||
endforeach()
|
||||
|
||||
message("")
|
||||
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Generates the actual tools projects
|
||||
foreach(TOOL_NAME ${TOOLS_BUILD_LIST})
|
||||
GetPathToTool(${TOOL_NAME} SOURCE_TOOL_PATH)
|
||||
ToolNameToVariable(${TOOL_NAME} TOOL_BUILD_VARIABLE)
|
||||
|
||||
if (${TOOL_BUILD_VARIABLE} STREQUAL "disabled")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
unset(TOOL_PRIVATE_SOURCES)
|
||||
CollectSourceFiles(
|
||||
${SOURCE_TOOL_PATH}
|
||||
TOOL_PRIVATE_SOURCES)
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND TOOL_PRIVATE_SOURCES ${winDebugging})
|
||||
endif()
|
||||
|
||||
GetProjectNameOfToolName(${TOOL_NAME} TOOL_PROJECT_NAME)
|
||||
|
||||
# Create the application project
|
||||
add_executable(${TOOL_PROJECT_NAME}
|
||||
${TOOL_PRIVATE_SOURCES})
|
||||
|
||||
add_dependencies(${TOOL_PROJECT_NAME} revision.h)
|
||||
|
||||
# Need fix errors
|
||||
# target_link_libraries(${TOOL_PROJECT_NAME}
|
||||
# PRIVATE
|
||||
# acore-core-interface)
|
||||
|
||||
# if (${TOOL_PROJECT_NAME} MATCHES "dbimport")
|
||||
# target_link_libraries(${TOOL_PROJECT_NAME}
|
||||
# PUBLIC
|
||||
# database)
|
||||
|
||||
# # Install config
|
||||
# CopyToolConfig(${TOOL_PROJECT_NAME} ${TOOL_NAME})
|
||||
# else()
|
||||
target_link_libraries(${TOOL_PROJECT_NAME}
|
||||
PUBLIC
|
||||
common
|
||||
mpq
|
||||
zlib
|
||||
Recast
|
||||
g3dlib)
|
||||
# endif()
|
||||
|
||||
unset(TOOL_PUBLIC_INCLUDES)
|
||||
CollectIncludeDirectories(
|
||||
${SOURCE_TOOL_PATH}
|
||||
TOOL_PUBLIC_INCLUDES)
|
||||
|
||||
target_include_directories(${TOOL_PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_include_directories(${TOOL_PROJECT_NAME}
|
||||
PUBLIC
|
||||
${TOOL_PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${TOOL_NAME})
|
||||
|
||||
set_target_properties(${TOOL_PROJECT_NAME}
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"tools")
|
||||
|
||||
if (UNIX)
|
||||
install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION bin)
|
||||
elseif (WIN32)
|
||||
install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES)
|
||||
|
||||
add_executable(mapextractor
|
||||
${PRIVATE_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(mapextractor
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/loadlib)
|
||||
|
||||
target_link_libraries(mapextractor
|
||||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
common
|
||||
mpq)
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES)
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_include_directories(mapextractor
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set_target_properties(mapextractor
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"tools")
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS mapextractor DESTINATION bin)
|
||||
elseif( WIN32 )
|
||||
install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES)
|
||||
|
||||
add_executable(mmaps_generator ${PRIVATE_SOURCES})
|
||||
|
||||
target_link_libraries(mmaps_generator
|
||||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
common
|
||||
Recast
|
||||
mpq)
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES)
|
||||
|
||||
target_include_directories(mmaps_generator
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Conditions)
|
||||
|
||||
set_target_properties(mmaps_generator
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"tools")
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS mmaps_generator DESTINATION bin)
|
||||
elseif( WIN32 )
|
||||
install(TARGETS mmaps_generator DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
add_executable(vmap4assembler VMapAssembler.cpp)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set_target_properties(vmap4assembler PROPERTIES LINK_FLAGS "-framework Carbon")
|
||||
endif()
|
||||
|
||||
target_link_libraries(vmap4assembler
|
||||
PRIVATE
|
||||
acore-core-interface
|
||||
PUBLIC
|
||||
common
|
||||
zlib)
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set_target_properties(vmap4assembler
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"tools")
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS vmap4assembler DESTINATION bin)
|
||||
elseif( WIN32 )
|
||||
install(TARGETS vmap4assembler DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES)
|
||||
|
||||
add_executable(vmap4extractor ${PRIVATE_SOURCES})
|
||||
|
||||
target_link_libraries(vmap4extractor
|
||||
PUBLIC
|
||||
g3dlib
|
||||
mpq)
|
||||
|
||||
# Group sources
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES)
|
||||
|
||||
target_include_directories(vmap4extractor
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set_target_properties(vmap4extractor
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"tools")
|
||||
|
||||
if( UNIX )
|
||||
install(TARGETS vmap4extractor DESTINATION bin)
|
||||
elseif( WIN32 )
|
||||
install(TARGETS vmap4extractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
Reference in New Issue
Block a user