feat(Cmake): Rewrite build and use inherited dependencies (#1652)

This commit is contained in:
Kargatum
2019-04-02 03:41:08 +07:00
committed by Francesco Borzì
parent 0f174eff01
commit eae9affec9
48 changed files with 6336 additions and 1178 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (C)
# Copyright (C)
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -10,63 +10,28 @@
########### authserver ###############
file(GLOB_RECURSE sources_authentication Authentication/*.cpp Authentication/*.h)
file(GLOB_RECURSE sources_realms Realms/*.cpp Realms/*.h)
file(GLOB_RECURSE sources_server Server/*.cpp Server/*.h)
file(GLOB sources_localdir *.cpp *.h)
if (USE_COREPCH)
set(authserver_PCH_HDR PrecompiledHeaders/authPCH.h)
set(authserver_PCH_SRC PrecompiledHeaders/authPCH.cpp)
endif()
set(authserver_SRCS
${authserver_SRCS}
${sources_authentication}
${sources_realms}
${sources_server}
${sources_localdir}
)
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if( WIN32 )
set(authserver_SRCS
${authserver_SRCS}
${sources_windows_Debugging}
)
list(APPEND PRIVATE_SOURCES ${sources_windows})
if ( MSVC )
set(authserver_SRCS
${authserver_SRCS}
authserver.rc
)
endif ()
list(APPEND PRIVATE_SOURCES authserver.rc)
endif()
endif()
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Authentication
${CMAKE_CURRENT_SOURCE_DIR}/Realms
${CMAKE_CURRENT_SOURCE_DIR}/Server
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
if (USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/authPCH.h)
endif()
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(authserver
${authserver_SRCS}
${authserver_PCH_SRC}
${PRIVATE_SOURCES}
)
add_dependencies(authserver revision.h)
@@ -78,13 +43,27 @@ if( NOT WIN32 )
endif()
target_link_libraries(authserver
shared
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${ACE_LIBRARY}
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")
if( WIN32 )
if ( MSVC )
add_custom_command(TARGET authserver
@@ -109,7 +88,7 @@ install(FILES authserver.conf.dist DESTINATION ${CONF_DIR})
# Generate precompiled header
if (USE_COREPCH)
add_cxx_pch(authserver ${authserver_PCH_HDR} ${authserver_PCH_SRC})
add_cxx_pch(authserver ${PRIVATE_PCH_HEADER})
endif()
CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE")

View File

@@ -1 +0,0 @@
#include "authPCH.h"