Fix cmake (#2554)
* Fix cmake Thanks to @secretdataz for help. (cherry-picked from refactor)
This commit is contained in:
parent
c76f3675a2
commit
611dee0753
1
3rdparty/CMakeLists.txt
vendored
1
3rdparty/CMakeLists.txt
vendored
@ -53,3 +53,4 @@ add_subdirectory( mt19937ar )
|
||||
add_subdirectory( mysql )
|
||||
add_subdirectory( pcre )
|
||||
add_subdirectory( zlib )
|
||||
add_subdirectory( yaml-cpp )
|
||||
|
54
3rdparty/cmake/GetGitVersion.cmake
vendored
Normal file
54
3rdparty/cmake/GetGitVersion.cmake
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# - Returns a version string from Git tags
|
||||
#
|
||||
# This function inspects the annotated git tags for the project and returns a string
|
||||
# into a CMake variable
|
||||
# higly adapted from https://raw.githubusercontent.com/google/benchmark/master/cmake/GetGitVersion.cmake
|
||||
# lighta
|
||||
#
|
||||
# get_git_version()
|
||||
#
|
||||
# - Example
|
||||
#
|
||||
# include(GetGitVersion)
|
||||
# get_git_version(GIT_VERSION)
|
||||
# return
|
||||
# - GIT_VERSION : remote tracking sha of master
|
||||
# - GIT_HEAD_VERSION : current sha of current branch
|
||||
#
|
||||
# Requires CMake 2.8.11+
|
||||
find_package(Git)
|
||||
|
||||
if(__get_git_version)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_version INCLUDED)
|
||||
|
||||
function(get_git_version)
|
||||
if(GIT_EXECUTABLE)
|
||||
#determine remote tracking master sha
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse origin/master
|
||||
RESULT_VARIABLE status
|
||||
OUTPUT_VARIABLE GIT_VERSION
|
||||
ERROR_QUIET)
|
||||
if(${status})
|
||||
set(GIT_VERSION "unknow")
|
||||
else()
|
||||
string(STRIP ${GIT_VERSION} GIT_VERSION)
|
||||
endif()
|
||||
|
||||
#determine current head sha
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
|
||||
RESULT_VARIABLE status
|
||||
OUTPUT_VARIABLE GIT_HEAD_VERSION
|
||||
ERROR_QUIET)
|
||||
if(${status})
|
||||
set(GIT_HEAD_VERSION "unknow")
|
||||
else()
|
||||
string(STRIP ${GIT_HEAD_VERSION} GIT_HEAD_VERSION)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
message("-- git Version: ${GIT_VERSION}, ${GIT_HEAD_VERSION}")
|
||||
set(GIT_VERSION ${GIT_VERSION} PARENT_SCOPE)
|
||||
set(GIT_HEAD_VERSION ${GIT_HEAD_VERSION} PARENT_SCOPE)
|
||||
endfunction()
|
44
3rdparty/cmake/GetSvnVersion.cmake
vendored
Normal file
44
3rdparty/cmake/GetSvnVersion.cmake
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
#
|
||||
# Find svnversion
|
||||
#
|
||||
function(get_svn_version)
|
||||
message( STATUS "Detecting svnversion" )
|
||||
find_program( SVNVERSION_EXECUTABLE svnversion )
|
||||
mark_as_advanced( SVNVERSION_EXECUTABLE )
|
||||
if( SVNVERSION_EXECUTABLE )
|
||||
message( STATUS "Found svnversion: ${SVNVERSION_EXECUTABLE}" )
|
||||
endif()
|
||||
message( STATUS "Detecting svnversion - done" )
|
||||
#
|
||||
# Find Subversion
|
||||
#
|
||||
message( STATUS "Detecting Subversion" )
|
||||
find_package( Subversion )
|
||||
message( STATUS "Detecting Subversion - done" )
|
||||
#
|
||||
# SVNVERSION
|
||||
#
|
||||
if( SVNVERSION_EXECUTABLE )
|
||||
message( STATUS "Getting svn version" )
|
||||
execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE SVNVERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
if( SVNVERSION MATCHES "^Unversioned" )
|
||||
set( SVNVERSION )
|
||||
endif()
|
||||
string( REGEX REPLACE "[^1234567890MSexported]" "_" SVNVERSION "${SVNVERSION}" )
|
||||
message( STATUS "Found SVNversion: ${SVNVERSION}" )
|
||||
message( STATUS "Getting svn version - done" )
|
||||
endif()
|
||||
if( Subversion_FOUND AND SVNVERSION )
|
||||
message( STATUS "Getting svn branch" )
|
||||
Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} rAthena )
|
||||
if( rAthena_WC_URL )
|
||||
string( REGEX MATCH "[^/]+$" BRANCH ${rAthena_WC_URL} )
|
||||
set( SVNVERSION "${BRANCH}-${SVNVERSION}" )
|
||||
message( STATUS "Found branch: ${BRANCH}" )
|
||||
endif()
|
||||
message( STATUS "Getting svn branch - done" )
|
||||
endif()
|
||||
set(SVNVERSION ${SVNVERSION} PARENT_SCOPE)
|
||||
endfunction()
|
83
3rdparty/yaml-cpp/CMakeLists.txt
vendored
Normal file
83
3rdparty/yaml-cpp/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
## start setting
|
||||
SET (this_target yaml-cpp)
|
||||
PROJECT(${this_target})
|
||||
|
||||
find_path( YAML_INCLUDE_DIRS "yaml-cpp/yaml.h"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
NO_DEFAULT_PATH )
|
||||
find_path( YAML_SOURCE_DIR "regex_yaml.cpp"
|
||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
NO_DEFAULT_PATH )
|
||||
mark_as_advanced( YAML_INCLUDE_DIRS )
|
||||
mark_as_advanced( YAML_SOURCE_DIR )
|
||||
|
||||
set( YAML_HEADERS
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/yaml.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/traits.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/stlemitter.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/parser.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/ostream_wrapper.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/null.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/noncopyable.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/mark.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/exceptions.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/eventhandler.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitterstyle.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emittermanip.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitter.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitterdef.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/emitfromevents.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/dll.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/binary.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/anchor.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/type.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/ptr.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/parse.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/node.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/iterator.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/impl.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/emit.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/node/convert.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/graphbuilder.h"
|
||||
"${YAML_INCLUDE_DIRS}/yaml-cpp/contrib/anchordict.h"
|
||||
CACHE INTERNAL "yaml headers" )
|
||||
set( YAML_SOURCES
|
||||
"${YAML_SOURCE_DIR}/binary.cpp"
|
||||
"${YAML_SOURCE_DIR}/convert.cpp"
|
||||
"${YAML_SOURCE_DIR}/directives.cpp"
|
||||
"${YAML_SOURCE_DIR}/emit.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitfromevents.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitter.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitterstate.cpp"
|
||||
"${YAML_SOURCE_DIR}/emitterutils.cpp"
|
||||
"${YAML_SOURCE_DIR}/exceptions.cpp"
|
||||
"${YAML_SOURCE_DIR}/exp.cpp"
|
||||
"${YAML_SOURCE_DIR}/memory.cpp"
|
||||
"${YAML_SOURCE_DIR}/nodebuilder.cpp"
|
||||
"${YAML_SOURCE_DIR}/node.cpp"
|
||||
"${YAML_SOURCE_DIR}/node_data.cpp"
|
||||
"${YAML_SOURCE_DIR}/nodeevents.cpp"
|
||||
"${YAML_SOURCE_DIR}/null.cpp"
|
||||
"${YAML_SOURCE_DIR}/ostream_wrapper.cpp"
|
||||
"${YAML_SOURCE_DIR}/parse.cpp"
|
||||
"${YAML_SOURCE_DIR}/parser.cpp"
|
||||
"${YAML_SOURCE_DIR}/regex_yaml.cpp"
|
||||
"${YAML_SOURCE_DIR}/scanner.cpp"
|
||||
"${YAML_SOURCE_DIR}/scanscalar.cpp"
|
||||
"${YAML_SOURCE_DIR}/scantag.cpp"
|
||||
"${YAML_SOURCE_DIR}/scantoken.cpp"
|
||||
"${YAML_SOURCE_DIR}/simplekey.cpp"
|
||||
"${YAML_SOURCE_DIR}/singledocparser.cpp"
|
||||
"${YAML_SOURCE_DIR}/stream.cpp"
|
||||
"${YAML_SOURCE_DIR}/tag.cpp"
|
||||
"${YAML_SOURCE_DIR}/contrib/graphbuilderadapter.cpp"
|
||||
"${YAML_SOURCE_DIR}/contrib/graphbuilder.cpp"
|
||||
CACHE INTERNAL "yaml sources" )
|
||||
set( YAML_DEFINITIONS
|
||||
"-std=c++11"
|
||||
CACHE INTERNAL "yaml definitions" )
|
||||
include_directories(${YAML_INCLUDE_DIRS} ${YAML_SOURCE_DIR})
|
||||
message(STATUS "YAML_INCLUDE_DIRS : ${YAML_INCLUDE_DIRS}, YAML_SOURCE_DIR=${YAML_SOURCE_DIR}")
|
||||
ADD_LIBRARY(${this_target} STATIC ${YAML_SOURCES} )
|
@ -28,20 +28,39 @@
|
||||
# changes to some CPack generators
|
||||
# CYGWIN no longer defines WIN32
|
||||
# CMP0017: Prefer files from the CMake module directory when including from there.
|
||||
# Update to 3.1 for CMAKE_CXX_STANDARD cross support definition
|
||||
set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
|
||||
cmake_minimum_required( VERSION 2.8.8 )
|
||||
project( rAthena C )
|
||||
cmake_minimum_required( VERSION 3.1 )
|
||||
project( rAthena )
|
||||
if( CYGWIN )
|
||||
unset( WIN32 )
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 11) # C++11...
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
||||
#set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
||||
|
||||
#actually this might be misleading for arm...
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
||||
set(architecture x86)
|
||||
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
set(architecture x64)
|
||||
else()
|
||||
message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" )
|
||||
endif()
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInstallStr})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
set(CMAKE_RELEASE_POSTFIX "r")
|
||||
#
|
||||
# Prevent building in the source directory by default
|
||||
#
|
||||
option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
|
||||
if( ALLOW_SAME_DIRECTORY )
|
||||
elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
|
||||
option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
|
||||
message( FATAL_ERROR
|
||||
"Do not use the source directory to build your files, instead delete CMakeCache.txt, create a separate folder and build there.\n"
|
||||
"Example: (build in subdir 'build' and install to source dir)\n"
|
||||
@ -105,47 +124,12 @@ if(GIT_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find svnversion
|
||||
#
|
||||
message( STATUS "Detecting svnversion" )
|
||||
find_program( SVNVERSION_EXECUTABLE svnversion )
|
||||
mark_as_advanced( SVNVERSION_EXECUTABLE )
|
||||
if( SVNVERSION_EXECUTABLE )
|
||||
message( STATUS "Found svnversion: ${SVNVERSION_EXECUTABLE}" )
|
||||
endif()
|
||||
message( STATUS "Detecting svnversion - done" )
|
||||
#
|
||||
# Find Subversion
|
||||
#
|
||||
message( STATUS "Detecting Subversion" )
|
||||
find_package( Subversion )
|
||||
message( STATUS "Detecting Subversion - done" )
|
||||
#
|
||||
# SVNVERSION
|
||||
#
|
||||
if( SVNVERSION_EXECUTABLE )
|
||||
message( STATUS "Getting svn version" )
|
||||
execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE SVNVERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
if( SVNVERSION MATCHES "^Unversioned" )
|
||||
set( SVNVERSION )
|
||||
endif()
|
||||
string( REGEX REPLACE "[^1234567890MSexported]" "_" SVNVERSION "${SVNVERSION}" )
|
||||
message( STATUS "Found SVNversion: ${SVNVERSION}" )
|
||||
message( STATUS "Getting svn version - done" )
|
||||
endif()
|
||||
if( Subversion_FOUND AND SVNVERSION )
|
||||
message( STATUS "Getting svn branch" )
|
||||
Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} rAthena )
|
||||
if( rAthena_WC_URL )
|
||||
string( REGEX MATCH "[^/]+$" BRANCH ${rAthena_WC_URL} )
|
||||
set( SVNVERSION "${BRANCH}-${SVNVERSION}" )
|
||||
message( STATUS "Found branch: ${BRANCH}" )
|
||||
endif()
|
||||
message( STATUS "Getting svn branch - done" )
|
||||
endif()
|
||||
include(GetGitVersion)
|
||||
get_git_version()
|
||||
|
||||
#include(GetSvnVersion)
|
||||
#get_svn_version(SVN_VERSION)
|
||||
#message( STATUS "SVN_VERSION: ${SVN_VERSION}" )
|
||||
|
||||
|
||||
#
|
||||
@ -198,12 +182,12 @@ endif()
|
||||
#
|
||||
if( NOT MSVC )
|
||||
message( STATUS "Detecting networking library (socket/nsl/ws2_32)" )
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
find_function_library( bind FUNCTION_BIND_LIBRARIES socket ws2_32 )
|
||||
if( FUNCTION_BIND_LIBRARIES )
|
||||
message( STATUS "Adding global library: ${FUNCTION_BIND_LIBRARIES}" )
|
||||
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_BIND_LIBRARIES} )
|
||||
endif()
|
||||
#set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
#find_function_library( bind FUNCTION_BIND_LIBRARIES socket ws2_32 )
|
||||
#if( FUNCTION_BIND_LIBRARIES )
|
||||
# message( STATUS "Adding global library: ${FUNCTION_BIND_LIBRARIES}" )
|
||||
# set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_BIND_LIBRARIES} )
|
||||
#endif()
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
find_function_library( gethostbyname FUNCTION_GETHOSTBYNAME_LIBRARIES nsl )
|
||||
if( FUNCTION_GETHOSTBYNAME_LIBRARIES )
|
||||
@ -590,11 +574,7 @@ add_subdirectory( src )
|
||||
#####################################################################
|
||||
# final checks and warnings
|
||||
#
|
||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
message( WARNING "64bit should work, but is not recommended." )
|
||||
elseif( NOT CMAKE_SIZEOF_VOID_P EQUAL 4 )
|
||||
message( FATAL_ERROR "unexpected architecture (CMAKE_SIZEOF_VOID_P is ${CMAKE_SIZEOF_VOID_P})" )
|
||||
endif()
|
||||
|
||||
list( LENGTH TARGET_LIST _LEN )
|
||||
if( _LEN EQUAL 0 )
|
||||
message( FATAL_ERROR "no targets available" )
|
||||
|
@ -15,6 +15,7 @@ set( CHAR_HEADERS
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_cnslif.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_logif.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_mapif.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_achievement.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_auction.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_clan.h"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_elemental.h"
|
||||
@ -29,11 +30,12 @@ set( CHAR_HEADERS
|
||||
"${SERVER_CHAR_SOURCE_DIR}/inter.h"
|
||||
)
|
||||
set( CHAR_SOURCES
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char.cpp"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_clif.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_cnslif.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_logif.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/char_mapif.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_achievement.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_auction.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_clan.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_elemental.c"
|
||||
@ -44,8 +46,8 @@ set( CHAR_SOURCES
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_party.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_pet.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_quest.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_storage.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/inter.c"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/int_storage.cpp"
|
||||
"${SERVER_CHAR_SOURCE_DIR}/inter.cpp"
|
||||
)
|
||||
set( DEPENDENCIES common )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
@ -55,10 +57,12 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${CHAR_HEADERS} ${CHA
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( char FILES ${CHAR_HEADERS} ${CHAR_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
add_executable( char-server ${SOURCE_FILES} )
|
||||
add_dependencies( char-server ${DEPENDENCIES} )
|
||||
target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
|
||||
if( INSTALL_COMPONENT_RUNTIME )
|
||||
cpack_add_component( Runtime_charserver DESCRIPTION "char-server" DISPLAY_NAME "char-server" GROUP Runtime )
|
||||
install( TARGETS char-server
|
||||
|
@ -1,9 +1,20 @@
|
||||
|
||||
#
|
||||
# Create svnversion.h
|
||||
# tbd, could be rename version.h
|
||||
#
|
||||
message( STATUS "Creating svnversion.h" )
|
||||
if( SVNVERSION )
|
||||
if(GIT_VERSION)
|
||||
# those 2 was done in parent to produce this
|
||||
#include(GetGitVersion)
|
||||
#get_git_version()
|
||||
string(SUBSTRING ${GIT_VERSION} 0 10 SHORT_GIT_VERSION)
|
||||
string(SUBSTRING ${GIT_HEAD_VERSION} 0 10 SHORT_GIT_HEAD_VERSION)
|
||||
string(CONCAT GIT_STR_VERSIONS ${SHORT_GIT_VERSION} "_" ${SHORT_GIT_HEAD_VERSION})
|
||||
#message( STATUS "git version=${GIT_STR_VERSIONS}" )
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
|
||||
"#ifndef SVNVERSION\n#define SVNVERSION ${GIT_STR_VERSIONS}\n#endif\n" )
|
||||
elseif( SVNVERSION )
|
||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
|
||||
"#ifndef SVNVERSION\n#define SVNVERSION ${SVNVERSION}\n#endif\n" )
|
||||
else()
|
||||
@ -25,6 +36,7 @@ message( STATUS "Creating svnversion.h - done" )
|
||||
#
|
||||
set( COMMON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
CACHE PATH "common source directory" )
|
||||
#message( STATUS "DEBUG COMMON_SOURCE_DIR=${COMMON_SOURCE_DIR}" )
|
||||
mark_as_advanced( COMMON_SOURCE_DIR )
|
||||
|
||||
set( COMMON_ALL_HEADERS
|
||||
@ -42,7 +54,7 @@ set( COMMON_MINI_HEADERS
|
||||
${LIBCONFIG_HEADERS} # needed by showmsg.h
|
||||
CACHE INTERNAL "" )
|
||||
set( COMMON_MINI_SOURCES
|
||||
"${COMMON_SOURCE_DIR}/core.c"
|
||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||
"${COMMON_SOURCE_DIR}/malloc.c"
|
||||
"${COMMON_SOURCE_DIR}/showmsg.c"
|
||||
"${COMMON_SOURCE_DIR}/strlib.c"
|
||||
@ -83,11 +95,12 @@ set( COMMON_BASE_HEADERS
|
||||
"${COMMON_SOURCE_DIR}/mempool.h"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.h"
|
||||
"${COMMON_SOURCE_DIR}/cli.h"
|
||||
"${COMMON_SOURCE_DIR}/yamlwrapper.h"
|
||||
${LIBCONFIG_HEADERS} # needed by conf.h/showmsg.h
|
||||
CACHE INTERNAL "common_base headers" )
|
||||
set( COMMON_BASE_SOURCES
|
||||
"${COMMON_SOURCE_DIR}/conf.c"
|
||||
"${COMMON_SOURCE_DIR}/core.c"
|
||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||
"${COMMON_SOURCE_DIR}/db.c"
|
||||
"${COMMON_SOURCE_DIR}/des.c"
|
||||
"${COMMON_SOURCE_DIR}/ers.c"
|
||||
@ -108,24 +121,28 @@ set( COMMON_BASE_SOURCES
|
||||
"${COMMON_SOURCE_DIR}/raconf.c"
|
||||
"${COMMON_SOURCE_DIR}/msg_conf.c"
|
||||
"${COMMON_SOURCE_DIR}/cli.c"
|
||||
"${COMMON_SOURCE_DIR}/yamlwrapper.cpp"
|
||||
${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c
|
||||
CACHE INTERNAL "common_base sources" )
|
||||
set( COMMON_BASE_INCLUDE_DIRS
|
||||
${LIBCONFIG_INCLUDE_DIRS}
|
||||
${YAML_INCLUDE_DIRS}
|
||||
CACHE INTERNAL "common_base include dirs" )
|
||||
set( COMMON_BASE_DEFINITIONS
|
||||
${LIBCONFIG_DEFINITIONS}
|
||||
CACHE INTERNAL "common_base definitions" )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS}} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||
source_group( mt19937ar FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} )
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||
|
||||
add_library( common_base ${SOURCE_FILES} )
|
||||
target_link_libraries( common_base ${LIBRARIES} )
|
||||
set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
set( HAVE_common_base ON CACHE INTERNAL "" )
|
||||
set( TARGET_LIST ${TARGET_LIST} common_base CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target common_base - done" )
|
||||
@ -147,17 +164,19 @@ set( COMMON_HEADERS
|
||||
set( COMMON_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sql.c"
|
||||
CACHE INTERNAL "common sources" )
|
||||
set( DEPENDENCIES common_base )
|
||||
set( DEPENDENCIES common_base yaml-cpp )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} )
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS}" )
|
||||
set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
|
||||
source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} )
|
||||
|
||||
add_library( common ${SOURCE_FILES} )
|
||||
add_dependencies( common ${DEPENDENCIES} )
|
||||
target_link_libraries( common ${LIBRARIES} ${DEPENDENCIES} )
|
||||
set_target_properties( common PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
include_directories( ${INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} )
|
||||
|
||||
set( HAVE_common ON CACHE INTERNAL "" )
|
||||
set( TARGET_LIST ${TARGET_LIST} common CACHE INTERNAL "" )
|
||||
message( STATUS "Creating target common - done" )
|
||||
|
@ -19,7 +19,7 @@ set( LOGIN_HEADERS
|
||||
set( LOGIN_SOURCES
|
||||
"${LOGIN_SOURCE_DIR}/account.c"
|
||||
"${LOGIN_SOURCE_DIR}/ipban.c"
|
||||
"${LOGIN_SOURCE_DIR}/login.c"
|
||||
"${LOGIN_SOURCE_DIR}/login.cpp"
|
||||
"${LOGIN_SOURCE_DIR}/loginclif.c"
|
||||
"${LOGIN_SOURCE_DIR}/loginchrif.c"
|
||||
"${LOGIN_SOURCE_DIR}/logincnslif.c"
|
||||
@ -33,6 +33,7 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${LOGIN_HEADERS} ${LO
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( login FILES ${LOGIN_HEADERS} ${LOGIN_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
add_executable( login-server ${SOURCE_FILES} )
|
||||
add_dependencies( login-server ${DEPENDENCIES} )
|
||||
target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
|
@ -10,6 +10,7 @@ set( MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
|
||||
if( BUILD_SERVERS )
|
||||
message( STATUS "Creating target map-server" )
|
||||
set( MAP_HEADERS
|
||||
"${MAP_SOURCE_DIR}/achievement.h"
|
||||
"${MAP_SOURCE_DIR}/atcommand.h"
|
||||
"${MAP_SOURCE_DIR}/battle.h"
|
||||
"${MAP_SOURCE_DIR}/battleground.h"
|
||||
@ -52,6 +53,7 @@ set( MAP_HEADERS
|
||||
"${MAP_SOURCE_DIR}/channel.h"
|
||||
)
|
||||
set( MAP_SOURCES
|
||||
"${MAP_SOURCE_DIR}/achievement.c"
|
||||
"${MAP_SOURCE_DIR}/atcommand.c"
|
||||
"${MAP_SOURCE_DIR}/battle.c"
|
||||
"${MAP_SOURCE_DIR}/battleground.c"
|
||||
@ -59,7 +61,7 @@ set( MAP_SOURCES
|
||||
"${MAP_SOURCE_DIR}/chat.c"
|
||||
"${MAP_SOURCE_DIR}/chrif.c"
|
||||
"${MAP_SOURCE_DIR}/clan.c"
|
||||
"${MAP_SOURCE_DIR}/clif.c"
|
||||
"${MAP_SOURCE_DIR}/clif.cpp"
|
||||
"${MAP_SOURCE_DIR}/date.c"
|
||||
"${MAP_SOURCE_DIR}/duel.c"
|
||||
"${MAP_SOURCE_DIR}/elemental.c"
|
||||
@ -70,10 +72,10 @@ set( MAP_SOURCES
|
||||
"${MAP_SOURCE_DIR}/itemdb.c"
|
||||
"${MAP_SOURCE_DIR}/log.c"
|
||||
"${MAP_SOURCE_DIR}/mail.c"
|
||||
"${MAP_SOURCE_DIR}/map.c"
|
||||
"${MAP_SOURCE_DIR}/map.cpp"
|
||||
"${MAP_SOURCE_DIR}/mapreg.c"
|
||||
"${MAP_SOURCE_DIR}/mercenary.c"
|
||||
"${MAP_SOURCE_DIR}/mob.c"
|
||||
"${MAP_SOURCE_DIR}/mob.cpp"
|
||||
"${MAP_SOURCE_DIR}/npc.c"
|
||||
"${MAP_SOURCE_DIR}/npc_chat.c"
|
||||
"${MAP_SOURCE_DIR}/party.c"
|
||||
@ -82,9 +84,9 @@ set( MAP_SOURCES
|
||||
"${MAP_SOURCE_DIR}/pc_groups.c"
|
||||
"${MAP_SOURCE_DIR}/pet.c"
|
||||
"${MAP_SOURCE_DIR}/quest.c"
|
||||
"${MAP_SOURCE_DIR}/script.c"
|
||||
"${MAP_SOURCE_DIR}/script.cpp"
|
||||
"${MAP_SOURCE_DIR}/searchstore.c"
|
||||
"${MAP_SOURCE_DIR}/skill.c"
|
||||
"${MAP_SOURCE_DIR}/skill.cpp"
|
||||
"${MAP_SOURCE_DIR}/status.c"
|
||||
"${MAP_SOURCE_DIR}/storage.c"
|
||||
"${MAP_SOURCE_DIR}/trade.c"
|
||||
@ -93,8 +95,8 @@ set( MAP_SOURCES
|
||||
"${MAP_SOURCE_DIR}/cashshop.c"
|
||||
"${MAP_SOURCE_DIR}/channel.c"
|
||||
)
|
||||
set( DEPENDENCIES common )
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} )
|
||||
set( DEPENDENCIES common yaml-cpp)
|
||||
set( LIBRARIES ${GLOBAL_LIBRARIES} yaml-cpp)
|
||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} )
|
||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||
if( WITH_PCRE )
|
||||
@ -109,6 +111,7 @@ set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} ${MAP_HEADERS} ${MAP_
|
||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_HEADERS} )
|
||||
source_group( map FILES ${MAP_HEADERS} ${MAP_SOURCES} )
|
||||
include_directories( ${INCLUDE_DIRS} )
|
||||
|
||||
add_executable( map-server ${SOURCE_FILES} )
|
||||
add_dependencies( map-server ${DEPENDENCIES} )
|
||||
target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} )
|
||||
|
Loading…
x
Reference in New Issue
Block a user