mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-28 08:27:22 +00:00
Fix indentation and divided the cmake into libraries and bins
- Each library and binary got their own CMakeLists.txt - Indentation was fixed everywhere - Weird if statement flows replaced
This commit is contained in:
parent
c25a8004be
commit
005a12424e
341
CMakeLists.txt
341
CMakeLists.txt
@ -38,68 +38,64 @@ endforeach()
|
|||||||
|
|
||||||
# On windows it's better to build this from source, as there's no way FindZLIB is gonna find it
|
# On windows it's better to build this from source, as there's no way FindZLIB is gonna find it
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Fetch External (Non-Submodule) Libraries
|
# Fetch External (Non-Submodule) Libraries
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
mysql
|
|
||||||
URL https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.0.27-winx64.zip
|
|
||||||
URL_HASH MD5=e3c53f6e4d0a72fde2713f7597bf9468
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
zlib
|
|
||||||
URL http://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip
|
|
||||||
URL_HASH MD5=9d6a627693163bbbf3f26403a3a0b0b1
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(zlib)
|
|
||||||
FetchContent_MakeAvailable(mysql)
|
|
||||||
|
|
||||||
set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
|
|
||||||
set_target_properties(zlib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") # Why?
|
|
||||||
add_library(ZLIB::ZLIB ALIAS zlib) # You're welcome
|
|
||||||
|
|
||||||
endif(WIN32)
|
|
||||||
if(UNIX)
|
|
||||||
if(APPLE)
|
|
||||||
else()
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
mysql
|
|
||||||
URL https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.0.27-linux-glibc2.12-x86-64bit.tar.gz
|
|
||||||
URL_HASH MD5=12f086b76c11022cc7139b41a36cdf9e
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(mysql)
|
|
||||||
|
|
||||||
if (__include_backtrace__ AND __compile_backtrace__)
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
backtrace
|
mysql
|
||||||
GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git
|
URL https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.0.27-winx64.zip
|
||||||
|
URL_HASH MD5=e3c53f6e4d0a72fde2713f7597bf9468
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(backtrace)
|
FetchContent_Declare(
|
||||||
|
zlib
|
||||||
if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs)
|
URL http://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip
|
||||||
set(backtrace_make_cmd "${backtrace_SOURCE_DIR}/configure --prefix=\"/usr\" --enable-shared --with-system-libunwind")
|
URL_HASH MD5=9d6a627693163bbbf3f26403a3a0b0b1
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND bash -c "cd ${backtrace_SOURCE_DIR} && ${backtrace_make_cmd} && make && cd ${CMAKE_SOURCE_DIR}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(zlib)
|
||||||
|
FetchContent_MakeAvailable(mysql)
|
||||||
|
|
||||||
|
set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
|
||||||
|
set_target_properties(zlib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") # Why?
|
||||||
|
add_library(ZLIB::ZLIB ALIAS zlib) # You're welcome
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
mysql
|
||||||
|
URL https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.0.27-linux-glibc2.12-x86-64bit.tar.gz
|
||||||
|
URL_HASH MD5=12f086b76c11022cc7139b41a36cdf9e
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(mysql)
|
||||||
|
|
||||||
|
if (__include_backtrace__ AND __compile_backtrace__)
|
||||||
|
FetchContent_Declare(
|
||||||
|
backtrace
|
||||||
|
GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(backtrace)
|
||||||
|
|
||||||
|
if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs)
|
||||||
|
set(backtrace_make_cmd "${backtrace_SOURCE_DIR}/configure --prefix=\"/usr\" --enable-shared --with-system-libunwind")
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND bash -c "cd ${backtrace_SOURCE_DIR} && ${backtrace_make_cmd} && make && cd ${CMAKE_SOURCE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
link_directories(${backtrace_SOURCE_DIR}/.libs/)
|
link_directories(${backtrace_SOURCE_DIR}/.libs/)
|
||||||
include_directories(${backtrace_SOURCE_DIR})
|
include_directories(${backtrace_SOURCE_DIR})
|
||||||
endif(__include_backtrace__ AND __compile_backtrace__)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif(UNIX)
|
|
||||||
|
|
||||||
# Set the version
|
# Set the version
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
@ -113,18 +109,14 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
endif(WIN32)
|
endif()
|
||||||
|
|
||||||
# Our output dir
|
# Our output dir
|
||||||
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
|
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
# Create a /res directory
|
# Create /res, /locale and /logs directories
|
||||||
make_directory(${CMAKE_BINARY_DIR}/res)
|
make_directory(${CMAKE_BINARY_DIR}/res)
|
||||||
|
|
||||||
# Create a /locale directory
|
|
||||||
make_directory(${CMAKE_BINARY_DIR}/locale)
|
make_directory(${CMAKE_BINARY_DIR}/locale)
|
||||||
|
|
||||||
# Create a /logs directory
|
|
||||||
make_directory(${CMAKE_BINARY_DIR}/logs)
|
make_directory(${CMAKE_BINARY_DIR}/logs)
|
||||||
|
|
||||||
# Copy ini files on first build
|
# Copy ini files on first build
|
||||||
@ -169,12 +161,13 @@ if(UNIX)
|
|||||||
else()
|
else()
|
||||||
include_directories(${mysql_SOURCE_DIR}/include/jdbc/)
|
include_directories(${mysql_SOURCE_DIR}/include/jdbc/)
|
||||||
include_directories(${mysql_SOURCE_DIR}/include/jdbc/cppconn/)
|
include_directories(${mysql_SOURCE_DIR}/include/jdbc/cppconn/)
|
||||||
endif(APPLE)
|
endif()
|
||||||
endif(UNIX)
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
include_directories(${mysql_SOURCE_DIR}/include/jdbc)
|
include_directories(${mysql_SOURCE_DIR}/include/jdbc)
|
||||||
include_directories(${mysql_SOURCE_DIR}/include/jdbc/cppconn)
|
include_directories(${mysql_SOURCE_DIR}/include/jdbc/cppconn)
|
||||||
endif(WIN32)
|
endif()
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Recast/Include)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Recast/Include)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Detour/Include)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Detour/Include)
|
||||||
@ -182,11 +175,11 @@ include_directories(${ZLIB_INCLUDE_DIRS})
|
|||||||
|
|
||||||
# Bcrypt
|
# Bcrypt
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt)
|
||||||
else ()
|
else()
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include)
|
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
# Our includes
|
# Our includes
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
include_directories(${PROJECT_BINARY_DIR})
|
||||||
@ -212,8 +205,8 @@ include_directories(${PROJECT_SOURCE_DIR}/dScripts/)
|
|||||||
# Default to linking to libmysql
|
# Default to linking to libmysql
|
||||||
set(MYSQL_LIB mysql)
|
set(MYSQL_LIB mysql)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(MYSQL_LIB mysqlcppconn)
|
set(MYSQL_LIB mysqlcppconn)
|
||||||
endif(WIN32)
|
endif()
|
||||||
|
|
||||||
# Lib folders:
|
# Lib folders:
|
||||||
link_directories(${PROJECT_BINARY_DIR})
|
link_directories(${PROJECT_BINARY_DIR})
|
||||||
@ -225,196 +218,46 @@ if(UNIX)
|
|||||||
|
|
||||||
# Link to libmysqlcppconn on Linux
|
# Link to libmysqlcppconn on Linux
|
||||||
set(MYSQL_LIB mysqlcppconn)
|
set(MYSQL_LIB mysqlcppconn)
|
||||||
endif(APPLE)
|
endif()
|
||||||
endif(UNIX)
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
link_directories(${mysql_SOURCE_DIR}/lib64/vs14)
|
link_directories(${mysql_SOURCE_DIR}/lib64/vs14)
|
||||||
endif(WIN32)
|
endif()
|
||||||
|
|
||||||
# Third-Party libraries
|
# Third-Party libraries
|
||||||
add_subdirectory(thirdparty)
|
add_subdirectory(thirdparty)
|
||||||
|
|
||||||
# Source Code
|
# add_subdirectory for libraries
|
||||||
file(
|
add_subdirectory(dCommon)
|
||||||
GLOB SOURCES
|
add_subdirectory(dChatFilter)
|
||||||
LIST_DIRECTORIES false
|
add_subdirectory(dDatabase)
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
add_subdirectory(dNet)
|
||||||
${PROJECT_SOURCE_DIR}/dWorldServer/*.cpp
|
add_subdirectory(dGame)
|
||||||
)
|
add_subdirectory(dZoneManager)
|
||||||
|
add_subdirectory(dPhysics)
|
||||||
|
|
||||||
# Source Code for AuthServer
|
# Setup shared libraries between binaries
|
||||||
file(
|
|
||||||
GLOB SOURCES_AUTH
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dAuthServer/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for MasterServer
|
set(SHARED_LIBS dCommon dNet dDatabase raknet ${MYSQL_LIB})
|
||||||
file(
|
|
||||||
GLOB SOURCES_MASTER
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dMasterServer/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for ChatServer
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_CHAT
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dChatServer/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dCommon
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DCOMMON
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dCommon/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dChatFilter
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DCHATFILTER
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dChatFilter/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dDatabase
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DDATABASE
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dDatabase/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dDatabase/Tables/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dNet
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DNET
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dNet/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dGame
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DGAME
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dBehaviors/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dComponents/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dGameMessages/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dInventory/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dMission/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dEntity/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dGame/dUtilities/*.cpp
|
|
||||||
${PROJECT_SOURCE_DIR}/dScripts/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dZoneManager
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DZM
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dZoneManager/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source Code for dPhysics
|
|
||||||
file(
|
|
||||||
GLOB SOURCES_DPHYSICS
|
|
||||||
LIST_DIRECTORIES false
|
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
${PROJECT_SOURCE_DIR}/dPhysics/*.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
|
|
||||||
add_compile_options("/wd4267")
|
|
||||||
endif(MSVC)
|
|
||||||
|
|
||||||
# Our static libraries:
|
|
||||||
add_library(dCommon ${SOURCES_DCOMMON})
|
|
||||||
add_library(dChatFilter ${SOURCES_DCHATFILTER})
|
|
||||||
add_library(dDatabase ${SOURCES_DDATABASE})
|
|
||||||
add_library(dNet ${SOURCES_DNET})
|
|
||||||
add_library(dGame ${SOURCES_DGAME})
|
|
||||||
add_library(dZoneManager ${SOURCES_DZM})
|
|
||||||
add_library(dPhysics ${SOURCES_DPHYSICS})
|
|
||||||
target_link_libraries(dDatabase sqlite3)
|
|
||||||
target_link_libraries(dNet dCommon) #Needed because otherwise linker errors occur.
|
|
||||||
target_link_libraries(dCommon ZLIB::ZLIB)
|
|
||||||
target_link_libraries(dCommon libbcrypt)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(raknet ws2_32)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
# Our executables:
|
|
||||||
add_executable(WorldServer ${SOURCES})
|
|
||||||
add_executable(AuthServer ${SOURCES_AUTH})
|
|
||||||
add_executable(MasterServer ${SOURCES_MASTER})
|
|
||||||
add_executable(ChatServer ${SOURCES_CHAT})
|
|
||||||
|
|
||||||
# Target libraries to link to:
|
|
||||||
target_link_libraries(WorldServer dCommon)
|
|
||||||
target_link_libraries(WorldServer dChatFilter)
|
|
||||||
target_link_libraries(WorldServer dDatabase)
|
|
||||||
target_link_libraries(WorldServer dNet)
|
|
||||||
target_link_libraries(WorldServer dGame)
|
|
||||||
target_link_libraries(WorldServer dZoneManager)
|
|
||||||
target_link_libraries(WorldServer dPhysics)
|
|
||||||
target_link_libraries(WorldServer detour)
|
|
||||||
target_link_libraries(WorldServer recast)
|
|
||||||
target_link_libraries(WorldServer raknet)
|
|
||||||
target_link_libraries(WorldServer ${MYSQL_LIB})
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(NOT APPLE AND __include_backtrace__)
|
set(SHARED_LIBS ${SHARED_LIBS} pthread dl)
|
||||||
target_link_libraries(WorldServer backtrace)
|
|
||||||
target_link_libraries(MasterServer backtrace)
|
if(NOT APPLE AND __include_backtrace__)
|
||||||
target_link_libraries(AuthServer backtrace)
|
set(SHARED_LIBS ${SHARED_LIBS} backtrace)
|
||||||
target_link_libraries(ChatServer backtrace)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif(UNIX)
|
# Our executables:
|
||||||
target_link_libraries(WorldServer tinyxml2)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
# Target libraries for Auth:
|
add_subdirectory(dAuthServer)
|
||||||
target_link_libraries(AuthServer dCommon)
|
add_subdirectory(dChatServer)
|
||||||
target_link_libraries(AuthServer dDatabase)
|
add_subdirectory(dWorldServer)
|
||||||
target_link_libraries(AuthServer dNet)
|
add_subdirectory(dMasterServer)
|
||||||
target_link_libraries(AuthServer raknet)
|
|
||||||
target_link_libraries(AuthServer ${MYSQL_LIB})
|
|
||||||
if(UNIX)
|
|
||||||
target_link_libraries(AuthServer pthread)
|
|
||||||
target_link_libraries(AuthServer dl)
|
|
||||||
endif(UNIX)
|
|
||||||
|
|
||||||
# Target libraries for Master:
|
|
||||||
target_link_libraries(MasterServer dCommon)
|
|
||||||
target_link_libraries(MasterServer dDatabase)
|
|
||||||
target_link_libraries(MasterServer dNet)
|
|
||||||
target_link_libraries(MasterServer raknet)
|
|
||||||
target_link_libraries(MasterServer ${MYSQL_LIB})
|
|
||||||
if(UNIX)
|
|
||||||
target_link_libraries(MasterServer pthread)
|
|
||||||
target_link_libraries(MasterServer dl)
|
|
||||||
endif(UNIX)
|
|
||||||
|
|
||||||
# Target libraries for Chat:
|
|
||||||
target_link_libraries(ChatServer dCommon)
|
|
||||||
target_link_libraries(ChatServer dChatFilter)
|
|
||||||
target_link_libraries(ChatServer dDatabase)
|
|
||||||
target_link_libraries(ChatServer dNet)
|
|
||||||
target_link_libraries(ChatServer raknet)
|
|
||||||
target_link_libraries(ChatServer ${MYSQL_LIB})
|
|
||||||
if(UNIX)
|
|
||||||
target_link_libraries(ChatServer pthread)
|
|
||||||
target_link_libraries(ChatServer dl)
|
|
||||||
endif(UNIX)
|
|
||||||
|
|
||||||
# Compiler flags:
|
# Compiler flags:
|
||||||
# Disabled deprecated warnings as the MySQL includes have deprecated code in them.
|
# Disabled deprecated warnings as the MySQL includes have deprecated code in them.
|
||||||
@ -433,13 +276,11 @@ if(UNIX)
|
|||||||
if (__ggdb)
|
if (__ggdb)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
|
|
||||||
endif(UNIX)
|
|
||||||
|
|
||||||
if(WIN32)
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
|
||||||
add_dependencies(MasterServer WorldServer)
|
elseif(WIN32)
|
||||||
add_dependencies(MasterServer AuthServer)
|
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
|
||||||
add_dependencies(MasterServer ChatServer)
|
add_compile_options("/wd4267")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Finally, add the tests
|
# Finally, add the tests
|
||||||
|
9
dAuthServer/CMakeLists.txt
Normal file
9
dAuthServer/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_AUTH
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(AuthServer ${SOURCES_AUTH})
|
||||||
|
target_link_libraries(AuthServer ${SHARED_LIBS})
|
8
dChatFilter/CMakeLists.txt
Normal file
8
dChatFilter/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DCHATFILTER
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dChatFilter ${SOURCES_DCHATFILTER})
|
10
dChatServer/CMakeLists.txt
Normal file
10
dChatServer/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_CHAT
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(ChatServer ${SOURCES_CHAT})
|
||||||
|
target_link_libraries(ChatServer dChatFilter)
|
||||||
|
target_link_libraries(ChatServer ${SHARED_LIBS})
|
10
dCommon/CMakeLists.txt
Normal file
10
dCommon/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DCOMMON
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dCommon ${SOURCES_DCOMMON})
|
||||||
|
target_link_libraries(dCommon ZLIB::ZLIB)
|
||||||
|
target_link_libraries(dCommon libbcrypt)
|
10
dDatabase/CMakeLists.txt
Normal file
10
dDatabase/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DDATABASE
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
Tables/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dDatabase ${SOURCES_DDATABASE})
|
||||||
|
target_link_libraries(dDatabase sqlite3)
|
16
dGame/CMakeLists.txt
Normal file
16
dGame/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DGAME
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
dBehaviors/*.cpp
|
||||||
|
dComponents/*.cpp
|
||||||
|
dGameMessages/*.cpp
|
||||||
|
dInventory/*.cpp
|
||||||
|
dMission/*.cpp
|
||||||
|
dEntity/*.cpp
|
||||||
|
dUtilities/*.cpp
|
||||||
|
../dScripts/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dGame ${SOURCES_DGAME})
|
15
dMasterServer/CMakeLists.txt
Normal file
15
dMasterServer/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_MASTER
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(MasterServer ${SOURCES_MASTER})
|
||||||
|
target_link_libraries(MasterServer ${SHARED_LIBS})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
add_dependencies(MasterServer WorldServer)
|
||||||
|
add_dependencies(MasterServer AuthServer)
|
||||||
|
add_dependencies(MasterServer ChatServer)
|
||||||
|
endif()
|
9
dNet/CMakeLists.txt
Normal file
9
dNet/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DNET
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dNet ${SOURCES_DNET})
|
||||||
|
target_link_libraries(dNet dCommon) # Needed because otherwise linker errors occur.
|
8
dPhysics/CMakeLists.txt
Normal file
8
dPhysics/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_DPHYSICS
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dPhysics ${SOURCES_DPHYSICS})
|
17
dWorldServer/CMakeLists.txt
Normal file
17
dWorldServer/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
file(
|
||||||
|
GLOB SOURCES_WORLD
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(WorldServer ${SOURCES_WORLD})
|
||||||
|
|
||||||
|
target_link_libraries(WorldServer dChatFilter)
|
||||||
|
target_link_libraries(WorldServer dGame)
|
||||||
|
target_link_libraries(WorldServer dZoneManager)
|
||||||
|
target_link_libraries(WorldServer dPhysics)
|
||||||
|
target_link_libraries(WorldServer detour)
|
||||||
|
target_link_libraries(WorldServer recast)
|
||||||
|
target_link_libraries(WorldServer tinyxml2)
|
||||||
|
target_link_libraries(WorldServer ${SHARED_LIBS})
|
9
dZoneManager/CMakeLists.txt
Normal file
9
dZoneManager/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Source Code for dZoneManager
|
||||||
|
file(
|
||||||
|
GLOB SOURCES_DZM
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(dZoneManager ${SOURCES_DZM})
|
69
thirdparty/CMakeLists.txt
vendored
69
thirdparty/CMakeLists.txt
vendored
@ -1,54 +1,53 @@
|
|||||||
# Source Code for raknet
|
# Source Code for raknet
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_RAKNET
|
GLOB SOURCES_RAKNET
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Source Code for recast
|
# Source Code for recast
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_RECAST
|
GLOB SOURCES_RECAST
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Source Code for detour
|
# Source Code for detour
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_DETOUR
|
GLOB SOURCES_DETOUR
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Source Code for tinyxml2
|
# Source Code for tinyxml2
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_TINYXML2
|
GLOB SOURCES_TINYXML2
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Source Code for libbcrypt
|
# Source Code for libbcrypt
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_LIBBCRYPT
|
GLOB SOURCES_LIBBCRYPT
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
|
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
|
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
|
||||||
)
|
)
|
||||||
|
|
||||||
file(
|
file(
|
||||||
GLOB SOURCES_SQLITE3
|
GLOB SOURCES_SQLITE3
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
|
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# 3rdparty static libraries:
|
# 3rdparty static libraries:
|
||||||
#add_library(zlib ${SOURCES_ZLIB})
|
|
||||||
add_library(raknet ${SOURCES_RAKNET})
|
add_library(raknet ${SOURCES_RAKNET})
|
||||||
add_library(tinyxml2 ${SOURCES_TINYXML2})
|
add_library(tinyxml2 ${SOURCES_TINYXML2})
|
||||||
add_library(detour ${SOURCES_DETOUR})
|
add_library(detour ${SOURCES_DETOUR})
|
||||||
@ -57,10 +56,14 @@ add_library(libbcrypt ${SOURCES_LIBBCRYPT})
|
|||||||
add_library(sqlite3 ${SOURCES_SQLITE3})
|
add_library(sqlite3 ${SOURCES_SQLITE3})
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(sqlite3 pthread dl m)
|
target_link_libraries(sqlite3 pthread dl m)
|
||||||
|
|
||||||
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
|
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
|
||||||
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
|
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
|
||||||
target_compile_options(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
|
target_compile_options(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
|
||||||
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
|
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
|
||||||
endif(UNIX)
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(raknet ws2_32)
|
||||||
|
endif()
|
Loading…
Reference in New Issue
Block a user