Add building the servers with mysql support to cmake.
This commit is contained in:
parent
6f02d1bebb
commit
68f8055807
2 changed files with 26 additions and 3 deletions
|
@ -53,6 +53,7 @@ set(FIFO_DIR "/var/run/wesnothd" CACHE STRING "Directory for the wesnothd fifo s
|
|||
option(ENABLE_GAME "Enable compilation of the game" ON)
|
||||
option(ENABLE_CAMPAIGN_SERVER "Enable compilation of campaign(add-ons) server")
|
||||
option(ENABLE_SERVER "Enable compilation of MP server" ON)
|
||||
option(ENABLE_MYSQL "Enable building MP/add-ons servers with mysql support" OFF)
|
||||
option(ENABLE_TESTS "Build unit tests")
|
||||
option(ENABLE_NLS "Enable building of translations" ${ENABLE_GAME})
|
||||
option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF)
|
||||
|
|
|
@ -7,6 +7,13 @@ function(GetSources source_list store_in_var)
|
|||
set(${store_in_var} ${sources} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(ENABLE_MYSQL)
|
||||
execute_process(COMMAND mysql_config --cflags OUTPUT_VARIABLE MYSQL_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "-I" "" MYSQL_CFLAGS "${MYSQL_CFLAGS}")
|
||||
string(REGEX REPLACE "-DNDEBUG" "" MYSQL_CFLAGS "${MYSQL_CFLAGS}")
|
||||
execute_process(COMMAND mysql_config --libs OUTPUT_VARIABLE MYSQL_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif(ENABLE_MYSQL)
|
||||
|
||||
## some includes ##
|
||||
include_directories(SYSTEM ${FONTCONFIG_INCLUDE_DIRS} )
|
||||
include_directories(SYSTEM ${PANGOCAIRO_INCLUDE_DIRS} )
|
||||
|
@ -14,7 +21,6 @@ include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR} )
|
|||
include_directories(SYSTEM ${LIBDBUS_INCLUDE_DIRS} )
|
||||
include_directories(SYSTEM ${VORBISFILE_INCLUDE_DIR} )
|
||||
|
||||
|
||||
include_directories(SYSTEM ${SDL2_INCLUDE_DIR} )
|
||||
set(sdl-lib ${SDL2_LIBRARY})
|
||||
#optional dependencies
|
||||
|
@ -317,9 +323,19 @@ if(ENABLE_SERVER)
|
|||
GetSources("wesnothd" wesnothd_SRC)
|
||||
|
||||
add_executable(wesnothd WIN32 ${wesnothd_SRC})
|
||||
|
||||
target_link_libraries(wesnothd wesnoth-core ${server-external-libs} ${Boost_RANDOM_LIBRARY})
|
||||
|
||||
if(ENABLE_MYSQL)
|
||||
target_include_directories(wesnothd SYSTEM PRIVATE ${MYSQL_CFLAGS})
|
||||
target_compile_definitions(wesnothd PRIVATE HAVE_MYSQLPP)
|
||||
endif(ENABLE_MYSQL)
|
||||
|
||||
target_link_libraries(wesnothd
|
||||
wesnoth-core
|
||||
${server-external-libs}
|
||||
${Boost_RANDOM_LIBRARY}
|
||||
${CRYPTO_LIBRARY}
|
||||
${MYSQL_LIBS}
|
||||
)
|
||||
set_target_properties(wesnothd PROPERTIES OUTPUT_NAME ${BINARY_PREFIX}wesnothd${BINARY_SUFFIX})
|
||||
|
||||
install(TARGETS wesnothd DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
@ -334,11 +350,17 @@ if(ENABLE_CAMPAIGN_SERVER)
|
|||
|
||||
add_executable(campaignd ${campaignd_SRC})
|
||||
|
||||
if(ENABLE_MYSQL)
|
||||
target_include_directories(campaignd SYSTEM PRIVATE ${MYSQL_CFLAGS})
|
||||
target_compile_definitions(campaignd PRIVATE HAVE_MYSQLPP)
|
||||
endif(ENABLE_MYSQL)
|
||||
|
||||
target_link_libraries(campaignd
|
||||
wesnoth-core
|
||||
${server-external-libs}
|
||||
${CRYPTO_LIBRARY}
|
||||
${Boost_RANDOM_LIBRARY}
|
||||
${MYSQL_LIBS}
|
||||
)
|
||||
set_target_properties(campaignd PROPERTIES OUTPUT_NAME ${BINARY_PREFIX}campaignd${BINARY_SUFFIX})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue