2017-02-23 13:41:53 +00:00
cmake_minimum_required ( VERSION 2.8 )
2017-08-01 19:55:49 +00:00
file ( STRINGS src/game/version.h VERSION_LINE
L I M I T _ C O U N T 1
R E G E X G A M E _ R E L E A S E _ V E R S I O N
)
if ( VERSION_LINE MATCHES "\" ( [0-9]+ ) \\.([0-9]+)\\.([0-9]+)\"")
set ( VERSION_MAJOR ${ CMAKE_MATCH_1 } )
set ( VERSION_MINOR ${ CMAKE_MATCH_2 } )
set ( VERSION_PATCH ${ CMAKE_MATCH_3 } )
2018-01-14 14:04:18 +00:00
elseif ( VERSION_LINE MATCHES "\" ( [0-9]+ ) \\.([0-9]+)\"")
set ( VERSION_MAJOR ${ CMAKE_MATCH_1 } )
set ( VERSION_MINOR ${ CMAKE_MATCH_2 } )
set ( VERSION_PATCH "0" )
2017-08-01 19:55:49 +00:00
else ( )
message ( FATAL_ERROR "Couldn't parse version from src/game/version.h" )
endif ( )
if ( POLICY CMP0048 )
cmake_policy ( SET CMP0048 NEW )
2018-01-14 14:31:31 +00:00
if ( VERSION_PATCH STREQUAL "0" )
project ( DDNet VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } )
else ( )
project ( DDNet VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_PATCH } )
endif ( )
2017-08-01 19:55:49 +00:00
else ( )
project ( DDNet )
set ( PROJECT_VERSION_MAJOR ${ VERSION_MAJOR } )
set ( PROJECT_VERSION_MINOR ${ VERSION_MINOR } )
set ( PROJECT_VERSION_PATCH ${ VERSION_PATCH } )
2018-01-14 14:31:31 +00:00
if ( VERSION_PATCH STREQUAL "0" )
set ( PROJECT_VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } )
else ( )
set ( PROJECT_VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_PATCH } )
endif ( )
2017-08-01 19:55:49 +00:00
endif ( )
2017-02-23 13:16:32 +00:00
2018-02-12 22:14:14 +00:00
set ( ORIGINAL_CMAKE_MODULE_PATH ${ CMAKE_MODULE_PATH } )
set ( ORIGINAL_CMAKE_REQUIRED_INCLUDES ${ CMAKE_REQUIRED_INCLUDES } )
set ( ORIGINAL_CMAKE_REQUIRED_LIBRARIES ${ CMAKE_REQUIRED_LIBRARIES } )
set ( OWN_CMAKE_MODULE_PATH ${ CMAKE_MODULE_PATH } ${ PROJECT_SOURCE_DIR } /cmake )
set ( CMAKE_MODULE_PATH ${ OWN_CMAKE_MODULE_PATH } )
2017-02-23 13:16:32 +00:00
2017-07-31 16:30:24 +00:00
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( TARGET_BITS "64" )
elseif ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set ( TARGET_BITS "32" )
endif ( )
if ( CMAKE_SYSTEM_NAME STREQUAL "Windows" )
set ( TARGET_OS "windows" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
set ( TARGET_OS "linux" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
set ( TARGET_OS "mac" )
endif ( )
2018-01-22 18:10:57 +00:00
include ( CheckCCompilerFlag )
2018-01-22 18:32:30 +00:00
include ( CheckCXXCompilerFlag )
2018-01-22 18:10:57 +00:00
include ( CheckSymbolExists )
check_symbol_exists ( __i386 "" TARGET_ARCH_X86_i386 )
if ( TARGET_ARCH_X86_i386 )
set ( TARGET_ARCH x86 )
else ( )
set ( TARGET_ARCH )
endif ( )
2017-10-15 08:25:26 +00:00
set ( AUTO_DEPENDENCIES_DEFAULT OFF )
2018-09-20 12:06:18 +00:00
set ( AUTOUPDATE_DEFAULT OFF )
2017-07-31 16:30:24 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-10-15 08:25:26 +00:00
set ( AUTO_DEPENDENCIES_DEFAULT ON )
2018-09-20 12:06:18 +00:00
set ( AUTOUPDATE_DEFAULT ON )
elseif ( TARGET_OS STREQUAL "linux" )
set ( AUTOUPDATE_DEFAULT ON )
2017-07-31 16:30:24 +00:00
endif ( )
2017-02-23 15:29:13 +00:00
option ( WEBSOCKETS "Enable websockets support" OFF )
2017-03-01 12:40:11 +00:00
option ( MYSQL "Enable mysql support" OFF )
2018-09-20 12:06:18 +00:00
option ( AUTOUPDATE "Enable the autoupdater" ${ AUTOUPDATE_DEFAULT } )
2017-02-23 14:41:42 +00:00
option ( CLIENT "Compile client" ON )
2017-10-15 08:25:26 +00:00
option ( DOWNLOAD_GTEST "Download and compile GTest" ${ AUTO_DEPENDENCIES_DEFAULT } )
option ( PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${ AUTO_DEPENDENCIES_DEFAULT } )
2018-08-26 19:44:31 +00:00
option ( DEV "Don't generate stuff necessary for packaging" OFF )
2017-02-23 14:41:42 +00:00
# Set the default build type to Release
if ( NOT(CMAKE_BUILD_TYPE ) )
2018-09-30 17:01:43 +00:00
if ( NOT(DEV ) )
2018-08-26 19:44:31 +00:00
set ( CMAKE_BUILD_TYPE Release )
else ( )
set ( CMAKE_BUILD_TYPE Debug )
endif ( )
2017-02-23 14:41:42 +00:00
endif ( )
2017-11-23 02:10:25 +00:00
set ( DBG $< OR:$<CONFIG:Debug > , $< CONFIG:RelWithDebInfo > > )
2017-09-21 13:11:09 +00:00
2017-10-15 07:57:21 +00:00
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
s r c / g a m e / v e r s i o n . h
)
2017-03-01 12:40:11 +00:00
set ( SERVER_EXECUTABLE DDNet-Server CACHE STRING "Name of the built server executable" )
set ( CLIENT_EXECUTABLE DDNet CACHE STRING "Name of the build client executable" )
2018-01-22 18:10:57 +00:00
########################################################################
# Compiler flags
########################################################################
function ( add_c_compiler_flag_if_supported VARIABLE FLAG )
if ( ARGC GREATER 2 )
set ( CHECKED_FLAG "${ARGV2}" )
else ( )
set ( CHECKED_FLAG "${FLAG}" )
endif ( )
string ( REGEX REPLACE "[^A-Za-z0-9]" "_" CONFIG_VARIABLE "FLAG_SUPPORTED${CHECKED_FLAG}" )
check_c_compiler_flag ( "${CHECKED_FLAG}" ${ CONFIG_VARIABLE } )
if ( ${ CONFIG_VARIABLE } )
if ( ${ VARIABLE } )
set ( "${VARIABLE}" "${${VARIABLE}};${FLAG}" PARENT_SCOPE )
else ( )
set ( "${VARIABLE}" "${FLAG}" PARENT_SCOPE )
endif ( )
endif ( )
endfunction ( )
if ( NOT MSVC )
if ( CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac" )
2018-01-22 18:48:17 +00:00
check_cxx_compiler_flag ( -std=gnu++11 FLAG_SUPPORTED_std_gnu__11 )
if ( FLAG_SUPPORTED_std_gnu__11 )
if ( CMAKE_CXX_FLAGS )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11" )
else ( )
set ( CMAKE_CXX_FLAGS -std=gnu++11 )
endif ( )
endif ( )
2018-01-22 18:10:57 +00:00
endif ( )
# Protect the stack pointer.
# -fstack-protector-all doesn't work on MinGW.
add_c_compiler_flag_if_supported ( OUR_FLAGS -fstack-protector-all )
# Inaccurate floating point numbers cause problems on mingw-w64-gcc when
# compiling for x86, might cause problems elsewhere. So don't store floats
# in registers but keep them at higher accuracy.
if ( TARGET_ARCH STREQUAL "x86" )
add_c_compiler_flag_if_supported ( OUR_FLAGS -ffloat-store )
endif ( )
if ( TARGET_OS STREQUAL "mac" )
add_c_compiler_flag_if_supported ( OUR_FLAGS -stdlib=libc++ )
add_c_compiler_flag_if_supported ( OUR_FLAGS -mmacosx-version-min=10.7 )
endif ( )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wall )
if ( CMAKE_VERSION VERSION_GREATER 3.3 OR CMAKE_VERSION VERSION_EQUAL 3.3 )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN
$ < $ < C O M P I L E _ L A N G U A G E : C > : - W d e c l a r a t i o n - a f t e r - s t a t e m e n t >
- W d e c l a r a t i o n - a f t e r - s t a t e m e n t
)
endif ( )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wextra )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-unused-parameter )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-missing-field-initializers )
add_c_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wformat=2 ) # Warn about format strings.
2018-02-12 20:29:43 +00:00
add_c_compiler_flag_if_supported ( OUR_FLAGS_DEP -Wno-implicit-function-declaration )
2018-01-22 18:10:57 +00:00
endif ( )
2018-02-12 22:14:14 +00:00
if ( NOT MSVC )
check_c_compiler_flag ( "-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE ) # Some distributions define _FORTIFY_SOURCE by themselves.
endif ( )
########################################################################
# COMMON FUNCTIONS
########################################################################
function ( set_glob VAR GLOBBING DIRECTORY ) # ...
file ( ${ GLOBBING } GLOB_RESULT "${DIRECTORY}/*.c" "${DIRECTORY}/*.cpp" "${DIRECTORY}/*.h" )
list ( SORT GLOB_RESULT )
set ( FILES )
foreach ( file ${ ARGN } )
list ( APPEND FILES "${PROJECT_SOURCE_DIR}/${DIRECTORY}/${file}" )
endforeach ( )
if ( NOT FILES STREQUAL GLOB_RESULT )
message ( AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}" )
set ( LIST_BUT_NOT_GLOB )
if ( POLICY CMP0057 )
cmake_policy ( SET CMP0057 NEW )
foreach ( file ${ FILES } )
if ( NOT file IN_LIST GLOB_RESULT )
list ( APPEND LIST_BUT_NOT_GLOB ${ file } )
endif ( )
endforeach ( )
if ( LIST_BUT_NOT_GLOB )
message ( AUTHOR_WARNING "Entries only present in ${VAR}: ${LIST_BUT_NOT_GLOB}" )
endif ( )
set ( GLOB_BUT_NOT_LIST )
foreach ( file ${ GLOB_RESULT } )
if ( NOT file IN_LIST FILES )
list ( APPEND GLOB_BUT_NOT_LIST ${ file } )
endif ( )
endforeach ( )
if ( GLOB_BUT_NOT_LIST )
message ( AUTHOR_WARNING "Entries only present in ${DIRECTORY}: ${GLOB_BUT_NOT_LIST}" )
endif ( )
endif ( )
endif ( )
set ( ${ VAR } ${ FILES } PARENT_SCOPE )
endfunction ( )
########################################################################
2018-07-10 09:29:02 +00:00
# INITIALIZE TARGET LISTS
2018-02-12 22:14:14 +00:00
########################################################################
set ( TARGETS_OWN )
set ( TARGETS_DEP )
set ( TARGETS_LINK ) # Targets with a linking stage.
2017-02-23 14:41:42 +00:00
########################################################################
# DEPENDENCIES
########################################################################
2017-02-23 13:16:32 +00:00
2017-10-24 10:10:46 +00:00
function ( set_extra_dirs_lib VARIABLE NAME )
2017-07-31 16:30:24 +00:00
set ( "PATHS_${VARIABLE}_LIBDIR" PARENT_SCOPE )
set ( "HINTS_${VARIABLE}_LIBDIR" PARENT_SCOPE )
if ( PREFER_BUNDLED_LIBS )
set ( TYPE HINTS )
else ( )
set ( TYPE PATHS )
endif ( )
2017-02-28 23:51:22 +00:00
if ( TARGET_BITS AND TARGET_OS )
2017-07-31 16:30:24 +00:00
set ( DIR "ddnet-libs/${NAME}/${TARGET_OS}/lib${TARGET_BITS}" )
set ( "${TYPE}_${VARIABLE}_LIBDIR" "${DIR}" PARENT_SCOPE )
set ( "EXTRA_${VARIABLE}_LIBDIR" "${DIR}" PARENT_SCOPE )
2017-02-28 23:51:22 +00:00
endif ( )
endfunction ( )
2017-10-24 10:10:46 +00:00
function ( set_extra_dirs_include VARIABLE NAME LIBRARY )
set ( "PATHS_${VARIABLE}_INCLUDEDIR" PARENT_SCOPE )
set ( "HINTS_${VARIABLE}_INCLUDEDIR" PARENT_SCOPE )
2017-10-24 13:29:53 +00:00
is_bundled ( IS_BUNDLED "${LIBRARY}" )
if ( IS_BUNDLED )
2017-10-25 14:57:25 +00:00
set ( "HINTS_${VARIABLE}_INCLUDEDIR" "ddnet-libs/${NAME}/include" "ddnet-libs/${NAME}/include/${TARGET_OS}" PARENT_SCOPE )
2017-10-24 13:29:53 +00:00
endif ( )
endfunction ( )
2017-10-25 14:57:25 +00:00
if ( CMAKE_CROSSCOMPILING )
set ( CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH NO_CMAKE_SYSTEM_PATH )
else ( )
set ( CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH )
endif ( )
2017-10-24 13:29:53 +00:00
function ( is_bundled VARIABLE PATH )
if ( PATH )
string ( FIND "${PATH}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS )
if ( LOCAL_PATH_POS EQUAL 0 AND TARGET_BITS AND TARGET_OS )
set ( "${VARIABLE}" ON PARENT_SCOPE )
else ( )
set ( "${VARIABLE}" OFF PARENT_SCOPE )
2017-10-24 10:10:46 +00:00
endif ( )
2017-10-24 13:29:53 +00:00
else ( )
set ( "${VARIABLE}" OFF PARENT_SCOPE )
2017-10-24 10:10:46 +00:00
endif ( )
endfunction ( )
2017-10-25 14:57:25 +00:00
if ( NOT CMAKE_CROSSCOMPILING )
# Check for PkgConfig once so all the other `find_package` calls can do it
# quietly.
find_package ( PkgConfig )
endif ( )
2018-02-12 22:14:14 +00:00
find_package ( ZLIB )
2018-06-27 08:02:29 +00:00
find_package ( Crypto )
2017-02-23 13:16:32 +00:00
find_package ( Curl )
find_package ( Freetype )
2017-11-27 01:14:05 +00:00
if ( DOWNLOAD_GTEST )
find_package ( Git )
endif ( )
2018-02-12 22:14:14 +00:00
find_package ( GLEW )
2017-08-30 19:57:55 +00:00
find_package ( GTest )
2017-02-23 14:41:42 +00:00
if ( MYSQL )
find_package ( MySQL )
2017-03-02 10:46:00 +00:00
else ( )
set ( MYSQL_LIBRARIES )
2017-02-23 14:41:42 +00:00
endif ( )
2017-02-28 23:51:22 +00:00
find_package ( Ogg )
find_package ( Opus )
2017-02-23 13:16:32 +00:00
find_package ( Opusfile )
2018-02-12 22:14:14 +00:00
find_package ( Pnglite )
2017-02-23 13:16:32 +00:00
find_package ( PythonInterp )
find_package ( SDL2 )
find_package ( Threads )
2018-02-12 22:14:14 +00:00
find_package ( Wavpack )
2018-02-14 11:55:04 +00:00
if ( WEBSOCKETS )
find_package ( Websockets )
else ( )
set ( WEBSOCKETS_LIBRARIES )
set ( WEBSOCKETS_INCLUDE_DIRS )
endif ( )
2017-02-23 13:16:32 +00:00
2017-11-08 23:16:52 +00:00
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
find_program ( DMG dmg )
find_program ( HFSPLUS hfsplus )
find_program ( NEWFS_HFS newfs_hfs )
if ( DMG AND HFSPLUS AND NEWFS_HFS )
set ( DMGTOOLS_FOUND ON )
else ( )
set ( DMGTOOLS_FOUND OFF )
endif ( )
2017-11-09 12:35:59 +00:00
find_program ( HDIUTIL hdiutil )
2017-11-08 23:16:52 +00:00
endif ( )
2017-02-23 14:41:42 +00:00
message ( STATUS "******** DDNet ********" )
2017-07-26 02:30:56 +00:00
message ( STATUS "Target OS: ${TARGET_OS} ${TARGET_BITS}bit" )
2017-02-23 14:41:42 +00:00
message ( STATUS "Compiler: ${CMAKE_CXX_COMPILER}" )
2017-07-26 02:30:56 +00:00
message ( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
2017-02-23 14:41:42 +00:00
2017-02-28 23:51:22 +00:00
message ( STATUS "Dependencies:" )
2018-02-12 22:14:14 +00:00
function ( show_dependency_status OUTPUT_NAME NAME )
if ( ${ NAME } _FOUND )
if ( ${ NAME } _BUNDLED )
message ( STATUS " * ${OUTPUT_NAME} not found (using bundled version)" )
2017-02-28 23:51:22 +00:00
else ( )
2018-02-12 22:14:14 +00:00
message ( STATUS " * ${OUTPUT_NAME} found" )
2017-02-28 23:51:22 +00:00
endif ( )
2017-02-23 14:41:42 +00:00
else ( )
2018-02-12 22:14:14 +00:00
message ( STATUS " * ${OUTPUT_NAME} not found" )
2017-02-23 14:41:42 +00:00
endif ( )
endfunction ( )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Curl" CURL )
2017-11-08 23:16:52 +00:00
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Dmg tools" DMGTOOLS )
2017-11-08 23:16:52 +00:00
endif ( )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Freetype" FREETYPE )
2017-11-27 01:14:05 +00:00
if ( DOWNLOAD_GTEST )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Git" GIT )
2017-11-27 01:14:05 +00:00
endif ( )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Glew" GLEW )
show_dependency_status ( "GTest" GTEST )
2017-11-09 12:35:59 +00:00
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Hdiutil" HDIUTIL )
2017-11-09 12:35:59 +00:00
endif ( )
2017-02-23 14:41:42 +00:00
if ( MYSQL )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "MySQL" MYSQL )
2017-03-01 12:40:11 +00:00
endif ( )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Ogg" OGG )
2018-06-05 19:22:40 +00:00
show_dependency_status ( "OpenSSL Crypto" CRYPTO )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Opus" OPUS )
show_dependency_status ( "Opusfile" OPUSFILE )
show_dependency_status ( "Pnglite" PNGLITE )
show_dependency_status ( "PythonInterp" PYTHONINTERP )
show_dependency_status ( "SDL2" SDL2 )
show_dependency_status ( "Wavpack" WAVPACK )
show_dependency_status ( "Zlib" ZLIB )
2018-02-14 11:55:04 +00:00
if ( WEBSOCKETS )
show_dependency_status ( "Websockets" WEBSOCKETS )
endif ( )
2017-02-23 14:41:42 +00:00
2018-06-19 12:45:53 +00:00
if ( NOT(CURL_FOUND ) )
message ( SEND_ERROR "You must install Curl to compile the DDNet" )
endif ( )
2017-08-03 16:44:36 +00:00
if ( NOT(PYTHONINTERP_FOUND ) )
message ( SEND_ERROR "You must install Python to compile DDNet" )
endif ( )
2017-02-23 14:41:42 +00:00
if ( MYSQL AND NOT(MYSQL_FOUND ) )
2017-03-01 12:40:11 +00:00
message ( SEND_ERROR "You must install MySQL to compile the DDNet server with MySQL support" )
2017-02-23 14:02:23 +00:00
endif ( )
2018-02-14 11:55:04 +00:00
if ( WEBSOCKETS AND NOT(WEBSOCKETS_FOUND ) )
message ( SEND_ERROR "You must install libwebsockets to compile the DDNet server with websocket support" )
endif ( )
2017-02-23 14:41:42 +00:00
if ( CLIENT AND NOT(FREETYPE_FOUND ) )
2017-02-28 23:51:22 +00:00
message ( SEND_ERROR "You must install Freetype to compile the DDNet client" )
endif ( )
if ( CLIENT AND NOT(OGG_FOUND ) )
message ( SEND_ERROR "You must install Ogg to compile the DDNet client" )
endif ( )
if ( CLIENT AND NOT(OPUS_FOUND ) )
message ( SEND_ERROR "You must install Opus to compile the DDNet client" )
2017-02-23 14:41:42 +00:00
endif ( )
if ( CLIENT AND NOT(OPUSFILE_FOUND ) )
2017-02-28 23:51:22 +00:00
message ( SEND_ERROR "You must install Opusfile to compile the DDNet client" )
2017-02-23 14:41:42 +00:00
endif ( )
if ( CLIENT AND NOT(SDL2_FOUND ) )
2017-02-28 23:51:22 +00:00
message ( SEND_ERROR "You must install SDL2 to compile the DDNet client" )
2017-02-23 14:41:42 +00:00
endif ( )
2017-08-30 19:57:55 +00:00
if ( NOT(GTEST_FOUND ) )
2017-10-15 07:57:21 +00:00
if ( DOWNLOAD_GTEST )
2017-11-27 01:14:05 +00:00
if ( GIT_FOUND )
message ( STATUS "Automatically downloading GTest to be able to run tests" )
else ( )
set ( DOWNLOAD_GTEST OFF )
message ( WARNING "To automatically download GTest, you have to install Git" )
endif ( )
2017-10-15 07:57:21 +00:00
else ( )
message ( STATUS "To run the tests, you have to install GTest" )
endif ( )
2017-08-30 19:57:55 +00:00
endif ( )
2017-02-23 14:41:42 +00:00
2017-03-03 14:04:13 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-07-26 02:30:56 +00:00
set ( PLATFORM_CLIENT )
2017-03-03 14:04:13 +00:00
set ( PLATFORM_CLIENT_LIBS opengl32 glu32 winmm )
set ( PLATFORM_LIBS ws2_32 ) # Windows sockets
2017-07-26 02:30:56 +00:00
elseif ( TARGET_OS STREQUAL "mac" )
find_library ( CARBON Carbon )
find_library ( COCOA Cocoa )
find_library ( OPENGL OpenGL )
2017-09-16 09:39:09 +00:00
find_library ( SECURITY Security )
2017-07-26 02:30:56 +00:00
set ( PLATFORM_CLIENT
s r c / o s x / n o t i f i c a t i o n . h
s r c / o s x / n o t i f i c a t i o n . m m
s r c / o s x l a u n c h / c l i e n t . h
s r c / o s x l a u n c h / c l i e n t . m
)
2018-06-27 10:35:01 +00:00
set ( PLATFORM_CLIENT_LIBS ${ COCOA } ${ OPENGL } )
set ( PLATFORM_LIBS ${ CARBON } ${ SECURITY } )
2017-03-03 14:04:13 +00:00
else ( )
2017-07-26 02:30:56 +00:00
set ( PLATFORM_CLIENT )
2017-03-03 14:04:13 +00:00
set ( PLATFORM_CLIENT_LIBS GL GLU X11 )
2017-03-18 00:20:55 +00:00
if ( TARGET_OS STREQUAL "linux" )
set ( PLATFORM_LIBS rt ) # clock_gettime for glibc < 2.17
else ( )
set ( PLATFORM_LIBS )
endif ( )
2017-03-03 14:04:13 +00:00
endif ( )
2017-10-15 07:57:21 +00:00
########################################################################
# DOWNLOAD GTEST
########################################################################
if ( NOT(GTEST_FOUND ) A N D D O W N L O A D _ G T E S T )
# Change to the 1.9.0 release tag once that works.
set ( DDNET_GTEST_VERSION 7b6561c56e353100aca8458d7bc49c4e0119bae8 )
configure_file ( cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt )
execute_process ( COMMAND ${ CMAKE_COMMAND } -G "${CMAKE_GENERATOR}" .
R E S U L T _ V A R I A B L E r e s u l t
2018-02-12 22:14:14 +00:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R } / g o o g l e t e s t - d o w n l o a d
2017-10-15 07:57:21 +00:00
)
2017-11-27 01:14:05 +00:00
if ( result )
message ( WARNING "CMake step for googletest failed: ${result}" )
set ( DOWNLOAD_GTEST OFF )
else ( )
execute_process ( COMMAND ${ CMAKE_COMMAND } --build .
R E S U L T _ V A R I A B L E r e s u l t
2018-02-12 22:14:14 +00:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R } / g o o g l e t e s t - d o w n l o a d
2017-11-27 01:14:05 +00:00
)
if ( result )
message ( WARNING "Build step for googletest failed: ${result}" )
set ( DOWNLOAD_GTEST OFF )
else ( )
# Prevent overriding the parent project's compiler/linker settings on Windows
set ( gtest_force_shared_crt ON CACHE BOOL "" FORCE )
# Add googletest directly to our build. This defines the gtest target.
add_subdirectory (
2018-02-12 22:14:14 +00:00
$ { P R O J E C T _ B I N A R Y _ D I R } / g o o g l e t e s t - s r c
$ { P R O J E C T _ B I N A R Y _ D I R } / g o o g l e t e s t - b u i l d
2017-11-27 01:14:05 +00:00
E X C L U D E _ F R O M _ A L L
)
if ( MSVC )
foreach ( target gtest )
2018-01-05 14:59:06 +00:00
# `/w` disables all warnings. This is needed because `gtest` enables
# `/WX` (equivalent of `-Werror`) for some reason, breaking builds
# when MSVS adds new warnings.
target_compile_options ( ${ target } PRIVATE $< $<NOT:${DBG} > :/MT> $< ${DBG}:/MTd > /w )
2017-11-27 01:14:05 +00:00
endforeach ( )
endif ( )
set ( GTEST_LIBRARIES gtest )
set ( GTEST_INCLUDE_DIRS )
if ( CMAKE_VERSION VERSION_LESS 2.8.11 )
set ( GTEST_INCLUDE_DIRS "${gtest_SOURCE_DIR}/include" )
endif ( )
endif ( )
2017-10-15 07:57:21 +00:00
endif ( )
endif ( )
2017-03-07 15:47:27 +00:00
2017-03-03 14:04:13 +00:00
########################################################################
# DEPENDENCY COMPILATION
########################################################################
2017-02-23 14:41:42 +00:00
2018-07-11 18:17:21 +00:00
# Static dependencies
set_glob ( DEP_JSON_SRC GLOB src/engine/external/json-parser json.c json.h )
add_library ( json EXCLUDE_FROM_ALL OBJECT ${ DEP_JSON_SRC } )
2017-03-03 14:04:13 +00:00
2018-07-11 18:17:21 +00:00
set_glob ( DEP_MD5_SRC GLOB src/engine/external/md5 md5.c md5.h )
add_library ( md5 EXCLUDE_FROM_ALL OBJECT ${ DEP_MD5_SRC } )
list ( APPEND TARGETS_DEP json md5 )
set ( DEP_JSON $< TARGET_OBJECTS:json > )
set ( DEP_MD5 $< TARGET_OBJECTS:md5 > )
2017-03-02 11:31:20 +00:00
2017-03-07 14:24:08 +00:00
########################################################################
# COPY DATA AND DLLS
########################################################################
file ( COPY data DESTINATION . )
2017-08-01 19:55:49 +00:00
set ( COPY_FILES
$ { C U R L _ C O P Y _ F I L E S }
$ { F R E E T Y P E _ C O P Y _ F I L E S }
$ { O P U S F I L E _ C O P Y _ F I L E S }
$ { S D L 2 _ C O P Y _ F I L E S }
)
file ( COPY ${ COPY_FILES } DESTINATION . )
2017-03-07 14:24:08 +00:00
2017-02-23 14:41:42 +00:00
########################################################################
# CODE GENERATION
########################################################################
2017-02-23 13:16:32 +00:00
function ( generate_source output_file script_parameter )
2018-02-05 19:22:54 +00:00
add_custom_command ( OUTPUT ${ output_file }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } d a t a s r c / c o m p i l e . p y $ { s c r i p t _ p a r a m e t e r }
> " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { o u t p u t _ f i l e } "
2017-02-23 13:16:32 +00:00
D E P E N D S
d a t a s r c / c o m p i l e . p y
d a t a s r c / c o n t e n t . p y
d a t a s r c / d a t a t y p e s . p y
d a t a s r c / n e t w o r k . p y
2017-03-03 12:29:35 +00:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ S O U R C E _ D I R }
2017-02-23 13:16:32 +00:00
)
2017-10-25 14:57:25 +00:00
endfunction ( )
2017-02-23 13:16:32 +00:00
2018-02-12 22:14:14 +00:00
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src/game/generated/" )
2018-03-01 15:50:29 +00:00
execute_process ( COMMAND git rev-parse --git-dir
E R R O R _ Q U I E T
O U T P U T _ V A R I A B L E P R O J E C T _ G I T _ D I R
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
R E S U L T _ V A R I A B L E P R O J E C T _ G I T _ D I R _ E R R O R
)
if ( NOT PROJECT_GIT_DIR_ERROR )
set ( GIT_REVISION_EXTRA_DEPS
$ { P R O J E C T _ G I T _ D I R } / i n d e x
$ { P R O J E C T _ G I T _ D I R } / l o g s / H E A D
)
endif ( )
2018-03-09 23:58:10 +00:00
add_custom_command ( OUTPUT ${ PROJECT_BINARY_DIR } /src/game/generated/git_revision.cpp
2018-03-01 15:50:29 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
2018-03-09 23:58:10 +00:00
s c r i p t s / g i t _ r e v i s i o n . p y
> $ { P R O J E C T _ B I N A R Y _ D I R } / s r c / g a m e / g e n e r a t e d / g i t _ r e v i s i o n . c p p
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ S O U R C E _ D I R }
2018-03-01 15:50:29 +00:00
D E P E N D S
$ { G I T _ R E V I S I O N _ E X T R A _ D E P S }
s c r i p t s / g i t _ r e v i s i o n . p y
2017-02-23 13:16:32 +00:00
)
2017-02-23 15:29:13 +00:00
generate_source ( "src/game/generated/client_data.cpp" "client_content_source" )
generate_source ( "src/game/generated/client_data.h" "client_content_header" )
2017-02-23 13:16:32 +00:00
generate_source ( "src/game/generated/protocol.cpp" "network_source" )
generate_source ( "src/game/generated/protocol.h" "network_header" )
generate_source ( "src/game/generated/server_data.cpp" "server_content_source" )
generate_source ( "src/game/generated/server_data.h" "server_content_header" )
2017-02-23 14:41:42 +00:00
########################################################################
# SHARED
########################################################################
2017-03-01 12:40:11 +00:00
# Sources
2017-07-27 14:13:28 +00:00
set_glob ( BASE GLOB_RECURSE src/base
c o l o r . h
c o n f u s a b l e s . c
c o n f u s a b l e s _ d a t a . h
d e t e c t . h
2018-06-05 19:22:40 +00:00
h a s h . c
h a s h . h
h a s h _ c t x t . h
h a s h _ l i b t o m c r y p t . c
h a s h _ o p e n s s l . c
2017-07-27 14:13:28 +00:00
m a t h . h
s y s t e m . c
s y s t e m . h
t l / a l g o r i t h m . h
t l / a l l o c a t o r . h
t l / a r r a y . h
t l / b a s e . h
t l / r a n g e . h
t l / s o r t e d _ a r r a y . h
t l / s t r i n g . h
t l / t h r e a d i n g . h
v m a t h . h
)
2017-11-27 00:16:11 +00:00
set_glob ( ENGINE_INTERFACE GLOB src/engine
c l i e n t . h
c o n f i g . h
c o n s o l e . h
d e m o . h
e d i t o r . h
e n g i n e . h
f r i e n d s . h
g h o s t . h
g r a p h i c s . h
i n p u t . h
k e r n e l . h
k e y s . h
m a p . h
m a s t e r s e r v e r . h
m e s s a g e . h
s e r v e r . h
s e r v e r b r o w s e r . h
s o u n d . h
s t o r a g e . h
t e x t r e n d e r . h
u p d a t e r . h
u u i d . h
)
2017-07-27 14:13:28 +00:00
set_glob ( ENGINE_SHARED GLOB src/engine/shared
c o m p r e s s i o n . c p p
c o m p r e s s i o n . h
c o n f i g . c p p
c o n f i g . h
c o n f i g _ v a r i a b l e s . h
c o n s o l e . c p p
c o n s o l e . h
d a t a f i l e . c p p
d a t a f i l e . h
d e m o . c p p
d e m o . h
e c o n . c p p
e c o n . h
e n g i n e . c p p
f i f o . c p p
f i f o . h
f i l e c o l l e c t i o n . c p p
f i l e c o l l e c t i o n . h
2017-09-09 00:41:11 +00:00
g h o s t . c p p
g h o s t . h
2017-07-27 14:13:28 +00:00
g l o b a l _ u u i d _ m a n a g e r . c p p
2018-07-11 18:17:21 +00:00
h t t p . c p p
h t t p . h
2017-07-27 14:13:28 +00:00
h u f f m a n . c p p
h u f f m a n . h
j o b s . c p p
j o b s . h
k e r n e l . c p p
l i n e r e a d e r . c p p
l i n e r e a d e r . h
m a p . c p p
m a s t e r s e r v e r . c p p
m e m h e a p . c p p
m e m h e a p . h
m e s s a g e . h
n e t b a n . c p p
n e t b a n . h
n e t w o r k . c p p
n e t w o r k . h
n e t w o r k _ c l i e n t . c p p
n e t w o r k _ c o n n . c p p
n e t w o r k _ c o n s o l e . c p p
n e t w o r k _ c o n s o l e _ c o n n . c p p
n e t w o r k _ s e r v e r . c p p
p a c k e r . c p p
p a c k e r . h
p r o t o c o l . h
p r o t o c o l _ e x . c p p
p r o t o c o l _ e x . h
p r o t o c o l _ e x _ m s g s . h
r i n g b u f f e r . c p p
r i n g b u f f e r . h
s e r v e r b r o w s e r . c p p
s n a p s h o t . c p p
s n a p s h o t . h
s t o r a g e . c p p
2018-01-11 15:01:13 +00:00
t e e h i s t o r i a n _ e x . c p p
t e e h i s t o r i a n _ e x . h
t e e h i s t o r i a n _ e x _ c h u n k s . h
2017-07-27 14:13:28 +00:00
u u i d _ m a n a g e r . c p p
u u i d _ m a n a g e r . h
w e b s o c k e t s . c p p
w e b s o c k e t s . h
)
set_glob ( GAME_SHARED GLOB src/game
c o l l i s i o n . c p p
c o l l i s i o n . h
d d r a c e c o m m a n d s . h
e x t r a i n f o . c p p
e x t r a i n f o . h
g a m e c o r e . c p p
g a m e c o r e . h
l a y e r s . c p p
l a y e r s . h
l o c a l i z a t i o n . c p p
l o c a l i z a t i o n . h
2018-03-24 13:00:41 +00:00
m a p b u g s . c p p
m a p b u g s . h
2018-05-01 10:38:33 +00:00
m a p b u g s _ l i s t . h
2017-07-27 14:13:28 +00:00
m a p i t e m s . c p p
m a p i t e m s . h
2018-10-05 09:20:30 +00:00
m a p i t e m s _ e x . c p p
m a p i t e m s _ e x . h
m a p i t e m s _ e x _ t y p e s . h
2017-07-27 14:13:28 +00:00
t e a m s c o r e . c p p
t e a m s c o r e . h
t u n i n g . h
v a r i a b l e s . h
v e r s i o n . h
v o t i n g . h
)
2018-10-05 09:20:30 +00:00
# A bit hacky, but these are needed to register all the UUIDs, even for stuff
# that doesn't link game.
set ( ENGINE_UUID_SHARED
s r c / g a m e / g e n e r a t e d / p r o t o c o l . c p p
s r c / g a m e / g e n e r a t e d / p r o t o c o l . h
s r c / g a m e / m a p i t e m s _ e x . c p p
s r c / g a m e / m a p i t e m s _ e x . h
s r c / g a m e / m a p i t e m s _ e x _ t y p e s . h
)
foreach ( s ${ GAME_SHARED } )
if ( s MATCHES "mapitems_(ex.cpp|ex.h|ex_types.h)$" )
list ( REMOVE_ITEM GAME_SHARED ${ s } )
endif ( )
endforeach ( )
list ( REMOVE_ITEM GAME_SHARED ${ ENGINE_UUID_SHARED } )
2018-03-02 02:42:35 +00:00
set ( GAME_GENERATED_SHARED
s r c / g a m e / g e n e r a t e d / g i t _ r e v i s i o n . c p p
s r c / g a m e / g e n e r a t e d / p r o t o c o l . h
)
2017-02-23 13:16:32 +00:00
2018-07-11 18:17:21 +00:00
set ( DEPS ${ DEP_JSON } ${ DEP_MD5 } ${ ZLIB_DEP } )
2017-02-23 14:41:42 +00:00
# Libraries
2018-10-04 06:39:43 +00:00
set ( LIBS ${ CURL_LIBRARIES } ${ CRYPTO_LIBRARIES } ${ WEBSOCKETS_LIBRARIES } ${ ZLIB_LIBRARIES } ${ PLATFORM_LIBS } )
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
list ( APPEND LIBS ${ CMAKE_THREAD_LIBS_INIT } )
2017-02-23 13:16:32 +00:00
2017-02-23 14:41:42 +00:00
# Targets
2018-10-05 09:20:30 +00:00
add_library ( engine-shared EXCLUDE_FROM_ALL OBJECT ${ ENGINE_INTERFACE } ${ ENGINE_SHARED } ${ ENGINE_UUID_SHARED } ${ BASE } )
2017-03-03 14:17:12 +00:00
add_library ( game-shared EXCLUDE_FROM_ALL OBJECT ${ GAME_SHARED } ${ GAME_GENERATED_SHARED } )
2017-03-03 14:04:13 +00:00
list ( APPEND TARGETS_OWN engine-shared game-shared )
2017-02-23 13:16:32 +00:00
2017-02-23 14:41:42 +00:00
########################################################################
# CLIENT
########################################################################
if ( CLIENT )
# Sources
2017-07-27 14:13:28 +00:00
set_glob ( ENGINE_CLIENT GLOB src/engine/client
b a c k e n d _ s d l . c p p
b a c k e n d _ s d l . h
c l i e n t . c p p
c l i e n t . h
f r i e n d s . c p p
f r i e n d s . h
g r a p h i c s _ t h r e a d e d . c p p
g r a p h i c s _ t h r e a d e d . h
i n p u t . c p p
i n p u t . h
k e y n a m e s . h
2017-09-16 16:58:24 +00:00
o p e n g l _ s l . c p p
o p e n g l _ s l . h
o p e n g l _ s l _ p r o g r a m . c p p
o p e n g l _ s l _ p r o g r a m . h
2017-07-27 14:13:28 +00:00
s e r v e r b r o w s e r . c p p
s e r v e r b r o w s e r . h
s o u n d . c p p
s o u n d . h
t e x t . c p p
u p d a t e r . c p p
u p d a t e r . h
)
set_glob ( GAME_CLIENT GLOB_RECURSE src/game/client
a n i m s t a t e . c p p
a n i m s t a t e . h
c o m p o n e n t . h
c o m p o n e n t s / b a c k g r o u n d . c p p
c o m p o n e n t s / b a c k g r o u n d . h
c o m p o n e n t s / b i n d s . c p p
c o m p o n e n t s / b i n d s . h
c o m p o n e n t s / b r o a d c a s t . c p p
c o m p o n e n t s / b r o a d c a s t . h
c o m p o n e n t s / c a m e r a . c p p
c o m p o n e n t s / c a m e r a . h
c o m p o n e n t s / c h a t . c p p
c o m p o n e n t s / c h a t . h
c o m p o n e n t s / c o n s o l e . c p p
c o m p o n e n t s / c o n s o l e . h
c o m p o n e n t s / c o n t r o l s . c p p
c o m p o n e n t s / c o n t r o l s . h
c o m p o n e n t s / c o u n t r y f l a g s . c p p
c o m p o n e n t s / c o u n t r y f l a g s . h
c o m p o n e n t s / d a m a g e i n d . c p p
c o m p o n e n t s / d a m a g e i n d . h
c o m p o n e n t s / d e b u g h u d . c p p
c o m p o n e n t s / d e b u g h u d . h
c o m p o n e n t s / e f f e c t s . c p p
c o m p o n e n t s / e f f e c t s . h
c o m p o n e n t s / e m o t i c o n . c p p
c o m p o n e n t s / e m o t i c o n . h
c o m p o n e n t s / f l o w . c p p
c o m p o n e n t s / f l o w . h
c o m p o n e n t s / g h o s t . c p p
c o m p o n e n t s / g h o s t . h
c o m p o n e n t s / h u d . c p p
c o m p o n e n t s / h u d . h
c o m p o n e n t s / i t e m s . c p p
c o m p o n e n t s / i t e m s . h
c o m p o n e n t s / k i l l m e s s a g e s . c p p
c o m p o n e n t s / k i l l m e s s a g e s . h
c o m p o n e n t s / m a p i m a g e s . c p p
c o m p o n e n t s / m a p i m a g e s . h
c o m p o n e n t s / m a p l a y e r s . c p p
c o m p o n e n t s / m a p l a y e r s . h
c o m p o n e n t s / m a p s o u n d s . c p p
c o m p o n e n t s / m a p s o u n d s . h
c o m p o n e n t s / m e n u s . c p p
c o m p o n e n t s / m e n u s . h
c o m p o n e n t s / m e n u s _ b r o w s e r . c p p
c o m p o n e n t s / m e n u s _ d e m o . c p p
c o m p o n e n t s / m e n u s _ i n g a m e . c p p
c o m p o n e n t s / m e n u s _ s e t t i n g s . c p p
c o m p o n e n t s / m o t d . c p p
c o m p o n e n t s / m o t d . h
c o m p o n e n t s / n a m e p l a t e s . c p p
c o m p o n e n t s / n a m e p l a t e s . h
c o m p o n e n t s / p a r t i c l e s . c p p
c o m p o n e n t s / p a r t i c l e s . h
c o m p o n e n t s / p l a y e r s . c p p
c o m p o n e n t s / p l a y e r s . h
c o m p o n e n t s / r a c e _ d e m o . c p p
c o m p o n e n t s / r a c e _ d e m o . h
c o m p o n e n t s / s c o r e b o a r d . c p p
c o m p o n e n t s / s c o r e b o a r d . h
c o m p o n e n t s / s k i n s . c p p
c o m p o n e n t s / s k i n s . h
c o m p o n e n t s / s o u n d s . c p p
c o m p o n e n t s / s o u n d s . h
c o m p o n e n t s / s p e c t a t o r . c p p
c o m p o n e n t s / s p e c t a t o r . h
c o m p o n e n t s / s t a t b o a r d . c p p
c o m p o n e n t s / s t a t b o a r d . h
c o m p o n e n t s / v o t i n g . c p p
c o m p o n e n t s / v o t i n g . h
g a m e c l i e n t . c p p
g a m e c l i e n t . h
l i n e i n p u t . c p p
l i n e i n p u t . h
2017-10-06 20:10:29 +00:00
r a c e . c p p
r a c e . h
2017-07-27 14:13:28 +00:00
r e n d e r . c p p
r e n d e r . h
r e n d e r _ m a p . c p p
u i . c p p
u i . h
)
set_glob ( GAME_EDITOR GLOB src/game/editor
a u t o _ m a p . c p p
a u t o _ m a p . h
e d i t o r . c p p
e d i t o r . h
i o . c p p
l a y e r _ g a m e . c p p
l a y e r _ q u a d s . c p p
l a y e r _ s o u n d s . c p p
l a y e r _ t i l e s . c p p
p o p u p s . c p p
)
set ( GAME_GENERATED_CLIENT
s r c / g a m e / g e n e r a t e d / c l i e n t _ d a t a . c p p
s r c / g a m e / g e n e r a t e d / c l i e n t _ d a t a . h
)
2017-07-26 02:30:56 +00:00
set ( CLIENT_SRC ${ ENGINE_CLIENT } ${ PLATFORM_CLIENT } ${ GAME_CLIENT } ${ GAME_EDITOR } ${ GAME_GENERATED_CLIENT } )
2017-02-23 14:41:42 +00:00
2018-07-11 18:17:21 +00:00
set ( DEPS_CLIENT ${ DEPS } ${ GLEW_DEP } ${ PNGLITE_DEP } ${ WAVPACK_DEP } )
2017-02-23 14:41:42 +00:00
# Libraries
set ( LIBS_CLIENT
2017-03-01 12:40:11 +00:00
$ { L I B S }
2017-02-23 14:41:42 +00:00
$ { F R E E T Y P E _ L I B R A R I E S }
2018-02-12 22:14:14 +00:00
$ { G L E W _ L I B R A R I E S }
$ { P N G L I T E _ L I B R A R I E S }
2017-03-18 00:20:55 +00:00
$ { S D L 2 _ L I B R A R I E S }
2018-02-12 22:14:14 +00:00
$ { W A V P A C K _ L I B R A R I E S }
2017-03-18 00:20:55 +00:00
# Order of these three is important.
2017-02-23 14:41:42 +00:00
$ { O P U S F I L E _ L I B R A R I E S }
2017-03-07 12:39:23 +00:00
$ { O P U S _ L I B R A R I E S }
2017-03-18 00:20:55 +00:00
$ { O G G _ L I B R A R I E S }
2017-03-02 11:31:20 +00:00
$ { P L A T F O R M _ C L I E N T _ L I B S }
2017-02-23 14:41:42 +00:00
)
2017-02-23 13:16:32 +00:00
2017-03-18 00:45:50 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-08-01 19:43:56 +00:00
set ( CLIENT_ICON "other/icons/DDNet.rc" )
2018-05-09 20:06:52 +00:00
if ( NOT MINGW )
set ( CLIENT_MANIFEST "other/manifest/DDNet.manifest" )
else ( )
set ( CLIENT_MANIFEST "other/manifest/DDNet.rc" )
endif ( )
2017-03-18 00:45:50 +00:00
else ( )
set ( CLIENT_ICON )
2018-05-09 20:06:52 +00:00
set ( CLIENT_MANIFEST )
2017-03-18 00:45:50 +00:00
endif ( )
2017-02-23 14:41:42 +00:00
# Target
2017-03-01 12:40:11 +00:00
set ( TARGET_CLIENT ${ CLIENT_EXECUTABLE } )
add_executable ( ${ TARGET_CLIENT }
$ { C L I E N T _ S R C }
2017-03-18 00:45:50 +00:00
$ { C L I E N T _ I C O N }
2018-05-09 20:06:52 +00:00
$ { C L I E N T _ M A N I F E S T }
2017-03-01 12:40:11 +00:00
$ { D E P S _ C L I E N T }
$ < T A R G E T _ O B J E C T S : e n g i n e - s h a r e d >
$ < T A R G E T _ O B J E C T S : g a m e - s h a r e d >
)
target_link_libraries ( ${ TARGET_CLIENT } ${ LIBS_CLIENT } )
2017-02-23 14:41:42 +00:00
2017-02-28 23:51:22 +00:00
target_include_directories ( ${ TARGET_CLIENT } PRIVATE
$ { F R E E T Y P E _ I N C L U D E _ D I R S }
2018-02-12 22:14:14 +00:00
$ { G L E W _ I N C L U D E _ D I R S }
2017-02-28 23:51:22 +00:00
$ { O G G _ I N C L U D E _ D I R S }
$ { O P U S F I L E _ I N C L U D E _ D I R S }
$ { O P U S _ I N C L U D E _ D I R S }
2018-02-12 22:14:14 +00:00
$ { P N G L I T E _ I N C L U D E _ D I R S }
2017-02-28 23:51:22 +00:00
$ { S D L 2 _ I N C L U D E _ D I R S }
2018-02-12 22:14:14 +00:00
$ { W A V P A C K _ I N C L U D E _ D I R S }
2017-02-28 23:51:22 +00:00
)
2018-02-12 22:14:14 +00:00
2018-02-20 16:10:52 +00:00
set ( PARAMS "${WAVPACK_INCLUDE_DIRS};${WAVPACK_INCLUDE_DIRS}" )
if ( NOT(WAVPACK_OPEN_FILE_INPUT_EX_PARAMS STREQUAL PARAMS ) )
unset ( WAVPACK_OPEN_FILE_INPUT_EX CACHE )
endif ( )
set ( WAVPACK_OPEN_FILE_INPUT_EX_PARAMS "${PARAMS}" CACHE INTERNAL "" )
2018-02-17 00:31:40 +00:00
set ( CMAKE_REQUIRED_INCLUDES ${ ORIGINAL_CMAKE_REQUIRED_INCLUDES } ${ WAVPACK_INCLUDE_DIRS } )
set ( CMAKE_REQUIRED_LIBRARIES ${ ORIGINAL_CMAKE_REQUIRED_LIBRARIES } ${ WAVPACK_LIBRARIES } )
2018-02-18 14:35:20 +00:00
check_symbol_exists ( WavpackOpenFileInputEx wavpack.h WAVPACK_OPEN_FILE_INPUT_EX )
2018-02-17 00:31:40 +00:00
set ( CMAKE_REQUIRED_INCLUDES ${ ORIGINAL_CMAKE_REQUIRED_INCLUDES } )
set ( CMAKE_REQUIRED_LIBRARIES ${ ORIGINAL_CMAKE_REQUIRED_LIBRARIES } )
2018-02-18 14:35:20 +00:00
if ( WAVPACK_OPEN_FILE_INPUT_EX )
target_compile_definitions ( ${ TARGET_CLIENT } PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX )
2018-02-12 22:14:14 +00:00
endif ( )
2017-03-03 14:04:13 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_CLIENT } )
2017-07-26 02:30:56 +00:00
list ( APPEND TARGETS_LINK ${ TARGET_CLIENT } )
2017-02-23 13:16:32 +00:00
endif ( )
2017-03-07 14:32:11 +00:00
2017-02-23 14:41:42 +00:00
########################################################################
# SERVER
########################################################################
2017-03-01 12:40:11 +00:00
# Sources
2017-07-27 14:13:28 +00:00
set_glob ( ENGINE_SERVER GLOB src/engine/server
a u t h m a n a g e r . c p p
a u t h m a n a g e r . h
2018-03-14 01:35:31 +00:00
n a m e _ b a n . c p p
n a m e _ b a n . h
2017-07-27 14:13:28 +00:00
r e g i s t e r . c p p
r e g i s t e r . h
s e r v e r . c p p
s e r v e r . h
s q l _ c o n n e c t o r . c p p
s q l _ c o n n e c t o r . h
s q l _ s e r v e r . c p p
s q l _ s e r v e r . h
s q l _ s t r i n g _ h e l p e r s . c p p
s q l _ s t r i n g _ h e l p e r s . h
)
set_glob ( GAME_SERVER GLOB_RECURSE src/game/server
d d r a c e c h a t . c p p
d d r a c e c h a t . h
d d r a c e c o m m a n d s . c p p
e n t i t i e s / c h a r a c t e r . c p p
e n t i t i e s / c h a r a c t e r . h
e n t i t i e s / d o o r . c p p
e n t i t i e s / d o o r . h
e n t i t i e s / d r a g g e r . c p p
e n t i t i e s / d r a g g e r . h
e n t i t i e s / f l a g . c p p
e n t i t i e s / f l a g . h
e n t i t i e s / g u n . c p p
e n t i t i e s / g u n . h
e n t i t i e s / l a s e r . c p p
e n t i t i e s / l a s e r . h
e n t i t i e s / l i g h t . c p p
e n t i t i e s / l i g h t . h
e n t i t i e s / p i c k u p . c p p
e n t i t i e s / p i c k u p . h
e n t i t i e s / p l a s m a . c p p
e n t i t i e s / p l a s m a . h
e n t i t i e s / p r o j e c t i l e . c p p
e n t i t i e s / p r o j e c t i l e . h
e n t i t y . c p p
e n t i t y . h
e v e n t h a n d l e r . c p p
e v e n t h a n d l e r . h
g a m e c o n t e x t . c p p
g a m e c o n t e x t . h
g a m e c o n t r o l l e r . c p p
g a m e c o n t r o l l e r . h
g a m e m o d e s / D D R a c e . c p p
g a m e m o d e s / D D R a c e . h
g a m e m o d e s / g a m e m o d e . h
g a m e w o r l d . c p p
g a m e w o r l d . h
p l a y e r . c p p
p l a y e r . h
s a v e . c p p
s a v e . h
s c o r e . h
s c o r e / f i l e _ s c o r e . c p p
s c o r e / f i l e _ s c o r e . h
s c o r e / s q l _ s c o r e . c p p
s c o r e / s q l _ s c o r e . h
t e a m s . c p p
t e a m s . h
2017-09-12 12:58:44 +00:00
t e e h i s t o r i a n . c p p
t e e h i s t o r i a n . h
2017-07-27 14:13:28 +00:00
)
set ( GAME_GENERATED_SERVER
" s r c / g a m e / g e n e r a t e d / s e r v e r _ d a t a . c p p "
" s r c / g a m e / g e n e r a t e d / s e r v e r _ d a t a . h "
)
2017-03-01 12:40:11 +00:00
set ( SERVER_SRC ${ ENGINE_SERVER } ${ GAME_SERVER } ${ GAME_GENERATED_SERVER } )
2017-03-18 00:45:50 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-08-01 19:43:56 +00:00
set ( SERVER_ICON "other/icons/DDNet-Server.rc" )
2017-03-18 00:45:50 +00:00
else ( )
set ( SERVER_ICON )
endif ( )
2017-02-23 14:41:42 +00:00
2017-03-01 12:40:11 +00:00
# Libraries
2017-06-09 17:34:01 +00:00
set ( LIBS_SERVER ${ LIBS } ${ MYSQL_LIBRARIES } )
2017-03-01 12:40:11 +00:00
# Target
set ( TARGET_SERVER ${ SERVER_EXECUTABLE } )
add_executable ( ${ TARGET_SERVER }
2017-03-03 14:04:13 +00:00
$ { D E P S }
2017-03-01 12:40:11 +00:00
$ { S E R V E R _ S R C }
2017-03-18 00:45:50 +00:00
$ { S E R V E R _ I C O N }
2017-03-01 12:40:11 +00:00
$ < T A R G E T _ O B J E C T S : e n g i n e - s h a r e d >
$ < T A R G E T _ O B J E C T S : g a m e - s h a r e d >
)
target_link_libraries ( ${ TARGET_SERVER } ${ LIBS_SERVER } )
2017-03-03 14:04:13 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_SERVER } )
2017-07-26 02:30:56 +00:00
list ( APPEND TARGETS_LINK ${ TARGET_SERVER } )
2017-02-23 14:41:42 +00:00
2017-11-17 13:37:29 +00:00
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
set ( SERVER_LAUNCHER_SRC src/osxlaunch/server.mm )
set ( TARGET_SERVER_LAUNCHER ${ TARGET_SERVER } -Launcher )
add_executable ( ${ TARGET_SERVER_LAUNCHER } ${ SERVER_LAUNCHER_SRC } )
target_link_libraries ( ${ TARGET_SERVER_LAUNCHER } ${ COCOA } )
list ( APPEND TARGETS_OWN ${ TARGET_SERVER_LAUNCHER } )
list ( APPEND TARGETS_LINK ${ TARGET_SERVER_LAUNCHER } )
endif ( )
2017-03-01 12:40:11 +00:00
########################################################################
# VARIOUS TARGETS
########################################################################
2017-07-27 14:13:28 +00:00
set_glob ( MASTERSRV_SRC GLOB src/mastersrv mastersrv.cpp mastersrv.h )
set_glob ( TWPING_SRC GLOB src/twping twping.cpp )
2017-03-01 12:40:11 +00:00
set ( TARGET_MASTERSRV mastersrv )
set ( TARGET_TWPING twping )
2017-03-03 14:04:13 +00:00
add_executable ( ${ TARGET_MASTERSRV } EXCLUDE_FROM_ALL ${ MASTERSRV_SRC } $< TARGET_OBJECTS:engine-shared > ${ DEPS } )
add_executable ( ${ TARGET_TWPING } EXCLUDE_FROM_ALL ${ TWPING_SRC } $< TARGET_OBJECTS:engine-shared > ${ DEPS } )
2017-03-01 12:40:11 +00:00
target_link_libraries ( ${ TARGET_MASTERSRV } ${ LIBS } )
target_link_libraries ( ${ TARGET_TWPING } ${ LIBS } )
2017-09-03 15:36:51 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_MASTERSRV } ${ TARGET_TWPING } )
list ( APPEND TARGETS_LINK ${ TARGET_MASTERSRV } ${ TARGET_TWPING } )
2017-03-01 14:49:22 +00:00
2017-03-03 14:23:18 +00:00
set ( TARGETS_TOOLS )
2017-07-27 14:13:28 +00:00
set_glob ( TOOLS GLOB src/tools
c o n f i g _ c o m m o n . h
c o n f i g _ r e t r i e v e . c p p
c o n f i g _ s t o r e . c p p
c o n f u s a b l e s . c p p
c r a p n e t . c p p
d i l a t e . c p p
d u m m y _ m a p . c p p
f a k e _ s e r v e r . c p p
m a p _ d i f f . c p p
m a p _ e x t r a c t . c p p
2017-08-28 16:06:19 +00:00
m a p _ r e p l a c e _ i m a g e . c p p
2017-07-27 14:13:28 +00:00
m a p _ r e s a v e . c p p
p a c k e t g e n . c p p
t i l e s e t _ b o r d e r a d d . c p p
t i l e s e t _ b o r d e r f i x . c p p
t i l e s e t _ b o r d e r r e m . c p p
t i l e s e t _ b o r d e r s e t . c p p
u u i d . c p p
)
foreach ( ABS_T ${ TOOLS } )
file ( RELATIVE_PATH T "${PROJECT_SOURCE_DIR}/src/tools/" ${ ABS_T } )
if ( T MATCHES "\\.cpp$" )
string ( REGEX REPLACE "\\.cpp$" "" TOOL "${T}" )
2018-02-12 22:14:14 +00:00
set ( TOOL_DEPS ${ DEPS } )
set ( TOOL_LIBS ${ LIBS } )
2017-09-05 14:00:50 +00:00
if ( TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$" )
2018-02-12 22:14:14 +00:00
list ( APPEND TOOL_DEPS ${ PNGLITE_DEP } )
list ( APPEND TOOL_LIBS ${ PNGLITE_LIBRARIES } )
list ( APPEND TOOL_INCLUDE_DIRS ${ PNGLITE_INCLUDE_DIRS } )
2017-07-27 14:13:28 +00:00
endif ( )
if ( TOOL MATCHES "^config_" )
list ( APPEND EXTRA_TOOL_SRC "src/tools/config_common.h" )
endif ( )
2018-08-26 19:44:31 +00:00
set ( EXCLUDE_FROM_ALL )
if ( DEV )
set ( EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL )
2017-08-01 19:55:49 +00:00
endif ( )
add_executable ( ${ TOOL } ${ EXCLUDE_FROM_ALL }
2018-02-12 22:14:14 +00:00
$ { T O O L _ D E P S }
2017-07-27 14:13:28 +00:00
s r c / t o o l s / $ { T O O L } . c p p
$ { E X T R A _ T O O L _ S R C }
$ < T A R G E T _ O B J E C T S : e n g i n e - s h a r e d >
)
2018-02-12 22:14:14 +00:00
target_include_directories ( ${ TOOL } PRIVATE ${ TOOL_INCLUDE_DIRS } )
target_link_libraries ( ${ TOOL } ${ TOOL_LIBS } )
2017-07-27 14:13:28 +00:00
list ( APPEND TARGETS_TOOLS ${ TOOL } )
2017-03-18 00:45:50 +00:00
endif ( )
2017-03-01 14:49:22 +00:00
endforeach ( )
2017-03-03 14:23:18 +00:00
list ( APPEND TARGETS_OWN ${ TARGETS_TOOLS } )
2017-07-26 02:30:56 +00:00
list ( APPEND TARGETS_LINK ${ TARGETS_TOOLS } )
2017-03-03 14:23:18 +00:00
add_custom_target ( tools DEPENDS ${ TARGETS_TOOLS } )
2017-03-03 14:04:13 +00:00
add_custom_target ( everything DEPENDS ${ TARGETS_OWN } )
2017-03-03 12:29:35 +00:00
2017-08-30 19:57:55 +00:00
########################################################################
# TESTS
########################################################################
2017-10-15 07:57:21 +00:00
if ( GTEST_FOUND OR DOWNLOAD_GTEST )
2017-08-30 19:57:55 +00:00
set_glob ( TESTS GLOB src/test
2017-10-13 00:48:42 +00:00
a i o . c p p
2018-10-05 09:20:30 +00:00
d a t a f i l e . c p p
2017-10-22 22:13:53 +00:00
f s . c p p
2018-03-01 15:50:29 +00:00
g i t _ r e v i s i o n . c p p
2018-06-05 19:22:40 +00:00
h a s h . c p p
2017-11-24 09:33:42 +00:00
j o b s . c p p
2018-06-19 12:45:53 +00:00
j s o n . c p p
2018-03-24 13:00:41 +00:00
m a p b u g s . c p p
2018-03-14 01:35:31 +00:00
n a m e _ b a n . c p p
2018-03-06 17:41:18 +00:00
s t r . c p p
2017-08-30 19:57:55 +00:00
s t r i p _ p a t h _ a n d _ e x t e n s i o n . c p p
2017-09-28 00:03:30 +00:00
t e e h i s t o r i a n . c p p
2017-10-22 22:13:53 +00:00
t e s t . c p p
t e s t . h
2017-10-09 22:08:24 +00:00
t h r e a d . c p p
2017-12-20 15:56:44 +00:00
u n i x . c p p
2017-09-28 00:03:30 +00:00
)
set ( TESTS_EXTRA
2018-03-14 01:35:31 +00:00
s r c / e n g i n e / s e r v e r / n a m e _ b a n . c p p
s r c / e n g i n e / s e r v e r / n a m e _ b a n . h
2017-09-28 00:03:30 +00:00
s r c / g a m e / s e r v e r / t e e h i s t o r i a n . c p p
s r c / g a m e / s e r v e r / t e e h i s t o r i a n . h
2017-08-30 19:57:55 +00:00
)
set ( TARGET_TESTRUNNER testrunner )
add_executable ( ${ TARGET_TESTRUNNER } EXCLUDE_FROM_ALL
$ { T E S T S }
2017-09-28 00:03:30 +00:00
$ { T E S T S _ E X T R A }
2017-08-30 19:57:55 +00:00
$ < T A R G E T _ O B J E C T S : e n g i n e - s h a r e d >
$ < T A R G E T _ O B J E C T S : g a m e - s h a r e d >
2017-10-15 07:57:21 +00:00
$ { D E P S }
2017-08-30 19:57:55 +00:00
)
2017-11-24 09:51:46 +00:00
target_link_libraries ( ${ TARGET_TESTRUNNER } ${ LIBS } ${ GTEST_LIBRARIES } )
2017-08-30 19:57:55 +00:00
target_include_directories ( ${ TARGET_TESTRUNNER } PRIVATE ${ GTEST_INCLUDE_DIRS } )
list ( APPEND TARGETS_OWN ${ TARGET_TESTRUNNER } )
list ( APPEND TARGETS_LINK ${ TARGET_TESTRUNNER } )
add_custom_target ( run_tests
C O M M A N D $ < T A R G E T _ F I L E : $ { T A R G E T _ T E S T R U N N E R } >
C O M M E N T R u n n i n g t e s t s
D E P E N D S $ { T A R G E T _ T E S T R U N N E R }
U S E S _ T E R M I N A L
)
endif ( )
2017-08-01 19:55:49 +00:00
########################################################################
# INSTALLATION
########################################################################
function ( escape_regex VAR STRING )
string ( REGEX REPLACE "([][^$.+*?|()\\\\])" "\\\\\\1" ESCAPED "${STRING}" )
set ( ${ VAR } ${ ESCAPED } PARENT_SCOPE )
endfunction ( )
2017-09-13 20:38:25 +00:00
function ( escape_backslashes VAR STRING )
string ( REGEX REPLACE "\\\\" "\\\\\\\\" ESCAPED "${STRING}" )
set ( ${ VAR } ${ ESCAPED } PARENT_SCOPE )
endfunction ( )
2017-08-01 19:55:49 +00:00
function ( max_length VAR )
set ( MAX_LENGTH 0 )
foreach ( str ${ ARGN } )
string ( LENGTH ${ str } LENGTH )
if ( LENGTH GREATER MAX_LENGTH )
set ( MAX_LENGTH ${ LENGTH } )
endif ( )
endforeach ( )
set ( ${ VAR } ${ MAX_LENGTH } PARENT_SCOPE )
endfunction ( )
# Tries to generate a list of regex that matches everything except the given
# parameters.
function ( regex_inverted VAR )
max_length ( MAX_LENGTH ${ ARGN } )
math ( EXPR UPPER_BOUND "${MAX_LENGTH}-1" )
set ( REMAINING ${ ARGN } )
set ( RESULT )
foreach ( i RANGE ${ UPPER_BOUND } )
set ( TEMP ${ REMAINING } )
set ( REMAINING )
foreach ( str ${ TEMP } )
string ( LENGTH ${ str } LENGTH )
if ( i LESS LENGTH )
list ( APPEND REMAINING ${ str } )
endif ( )
endforeach ( )
set ( ADDITIONAL )
foreach ( outer ${ REMAINING } )
string ( SUBSTRING ${ outer } 0 ${ i } OUTER_PREFIX )
set ( CHARS "" )
foreach ( inner ${ REMAINING } )
string ( SUBSTRING ${ inner } 0 ${ i } INNER_PREFIX )
if ( OUTER_PREFIX STREQUAL INNER_PREFIX )
string ( SUBSTRING ${ inner } ${ i } 1 INNER_NEXT )
set ( CHARS "${CHARS}${INNER_NEXT}" )
endif ( )
endforeach ( )
escape_regex ( OUTER_PREFIX_ESCAPED "${OUTER_PREFIX}" )
list ( APPEND ADDITIONAL "${OUTER_PREFIX_ESCAPED}([^${CHARS}]|$)" )
endforeach ( )
list ( REMOVE_DUPLICATES ADDITIONAL )
list ( APPEND RESULT ${ ADDITIONAL } )
endforeach ( )
set ( ${ VAR } ${ RESULT } PARENT_SCOPE )
endfunction ( )
set ( CPACK_PACKAGE_NAME ${ PROJECT_NAME } )
set ( CPACK_GENERATOR TGZ TXZ )
set ( CPACK_ARCHIVE_COMPONENT_INSTALL ON )
2018-01-14 07:42:15 +00:00
set ( CPACK_STRIP_FILES TRUE )
2017-08-01 19:55:49 +00:00
set ( CPACK_COMPONENTS_ALL portable )
set ( CPACK_SOURCE_GENERATOR ZIP TGZ TBZ2 TXZ )
set ( CPACK_PACKAGE_VERSION_MAJOR ${ PROJECT_VERSION_MAJOR } )
set ( CPACK_PACKAGE_VERSION_MINOR ${ PROJECT_VERSION_MINOR } )
set ( CPACK_PACKAGE_VERSION_PATCH ${ PROJECT_VERSION_PATCH } )
2018-01-14 14:31:31 +00:00
if ( VERSION_PATCH STREQUAL "0" )
set ( CPACK_PACKAGE_VERSION ${ CPACK_PACKAGE_VERSION_MAJOR } . ${ CPACK_PACKAGE_VERSION_MINOR } )
else ( )
set ( CPACK_PACKAGE_VERSION ${ CPACK_PACKAGE_VERSION_MAJOR } . ${ CPACK_PACKAGE_VERSION_MINOR } . ${ CPACK_PACKAGE_VERSION_PATCH } )
endif ( )
2017-08-01 19:55:49 +00:00
set ( CPACK_SYSTEM_NAME ${ CMAKE_SYSTEM_NAME } )
if ( TARGET_OS AND TARGET_BITS )
if ( TARGET_OS STREQUAL "windows" )
set ( CPACK_SYSTEM_NAME "win${TARGET_BITS}" )
set ( CPACK_GENERATOR ZIP )
elseif ( TARGET_OS STREQUAL "linux" )
# Assuming Intel here.
if ( TARGET_BITS EQUAL 32 )
set ( CPACK_SYSTEM_NAME "linux_x86" )
elseif ( TARGET_BITS EQUAL 64 )
set ( CPACK_SYSTEM_NAME "linux_x86_64" )
endif ( )
elseif ( TARGET_OS STREQUAL "mac" )
set ( CPACK_SYSTEM_NAME "osx" )
2017-10-25 14:57:25 +00:00
set ( CPACK_GENERATOR DMG )
2017-08-01 19:55:49 +00:00
endif ( )
endif ( )
set ( CPACK_PACKAGE_FILE_NAME ${ CPACK_PACKAGE_NAME } - ${ CPACK_PACKAGE_VERSION } - ${ CPACK_SYSTEM_NAME } )
2017-11-08 23:16:52 +00:00
set ( CPACK_ARCHIVE_PORTABLE_FILE_NAME ${ CPACK_PACKAGE_FILE_NAME } )
2017-08-01 19:55:49 +00:00
set ( CPACK_SOURCE_PACKAGE_FILE_NAME ${ CPACK_PACKAGE_NAME } - ${ CPACK_PACKAGE_VERSION } -src )
set ( CPACK_SOURCE_FILES
C M a k e L i s t s . t x t
R E A D M E . m d
a u t o e x e c _ s e r v e r . c f g
c m a k e /
d a t a /
d a t a s r c /
d d n e t - l i b s /
l i c e n s e . t x t
o t h e r /
s c r i p t s /
s r c /
s t o r a g e . c f g
)
set ( CPACK_SOURCE_IGNORE_FILES
2017-09-13 20:38:25 +00:00
" \ \ \ \ . p y c $ "
" / \ \ \ \ . g i t "
2017-08-01 19:55:49 +00:00
" / _ _ p y c a c h e _ _ / "
)
regex_inverted ( CPACK_SOURCE_FILES_INVERTED ${ CPACK_SOURCE_FILES } )
escape_regex ( PROJECT_SOURCE_DIR_ESCAPED ${ PROJECT_SOURCE_DIR } )
foreach ( str ${ CPACK_SOURCE_FILES_INVERTED } )
2017-09-13 20:38:25 +00:00
escape_backslashes ( STR_ESCAPED "${PROJECT_SOURCE_DIR_ESCAPED}/${str}" )
list ( APPEND CPACK_SOURCE_IGNORE_FILES "${STR_ESCAPED}" )
2017-08-01 19:55:49 +00:00
endforeach ( )
set ( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${ PROJECT_NAME } )
2017-09-05 14:00:50 +00:00
set ( CPACK_TARGETS
$ { T A R G E T _ C L I E N T }
$ { T A R G E T _ S E R V E R }
c o n f i g _ r e t r i e v e
c o n f i g _ s t o r e
d i l a t e
m a p _ d i f f
m a p _ e x t r a c t
)
2017-11-08 21:19:47 +00:00
set ( CPACK_DIRS data )
2017-09-05 14:00:50 +00:00
set ( CPACK_FILES
l i c e n s e . t x t
s t o r a g e . c f g
a u t o e x e c _ s e r v e r . c f g
$ { C O P Y _ F I L E S }
)
2017-08-01 19:55:49 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-09-05 14:00:50 +00:00
list ( APPEND CPACK_FILES other/config_directory.bat )
endif ( )
2018-08-26 19:44:31 +00:00
if ( NOT DEV )
install ( DIRECTORY data DESTINATION share/ddnet COMPONENT data )
install ( TARGETS ${ TARGET_CLIENT } DESTINATION bin COMPONENT client )
install ( TARGETS ${ TARGET_SERVER } DESTINATION bin COMPONENT server )
install ( TARGETS ${ TARGETS_TOOLS } DESTINATION lib/ddnet COMPONENT tools )
endif ( )
2018-08-21 19:53:08 +00:00
2018-08-26 19:44:31 +00:00
if ( DEV )
# Don't generate CPack targets.
elseif ( CMAKE_VERSION VERSION_LESS 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6 )
message ( WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer." )
else ( )
2017-11-17 16:43:52 +00:00
set ( EXTRA_ARGS DESTINATION ${ CPACK_PACKAGE_FILE_NAME } COMPONENT portable EXCLUDE_FROM_ALL )
2017-09-05 14:00:50 +00:00
install ( TARGETS ${ CPACK_TARGETS } ${ EXTRA_ARGS } )
install ( DIRECTORY ${ CPACK_DIRS } ${ EXTRA_ARGS } )
install ( FILES ${ CPACK_FILES } ${ EXTRA_ARGS } )
2017-08-01 19:55:49 +00:00
endif ( )
2017-11-17 21:32:56 +00:00
set ( PACKAGE_TARGETS )
2018-03-06 18:25:07 +00:00
if ( CLIENT AND ( DMGTOOLS_FOUND OR HDIUTIL ) )
2018-02-05 19:22:54 +00:00
file ( MAKE_DIRECTORY bundle/client/ )
file ( MAKE_DIRECTORY bundle/server/ )
2017-11-17 21:32:44 +00:00
configure_file ( other/bundle/client/Info.plist.in bundle/client/Info.plist )
configure_file ( other/bundle/server/Info.plist.in bundle/server/Info.plist )
2017-11-09 12:35:59 +00:00
if ( HDIUTIL )
set ( DMG_PARAMS --hdiutil ${ HDIUTIL } )
elseif ( DMGTOOLS_FOUND )
set ( DMG_PARAMS --dmgtools ${ DMG } ${ HFSPLUS } ${ NEWFS_HFS } )
endif ( )
set ( DMG_TMPDIR pack_ ${ CPACK_PACKAGE_FILE_NAME } _dmg )
2017-11-08 23:16:52 +00:00
set ( DMG_MKDIRS
$ { T A R G E T _ C L I E N T } . a p p
$ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s
$ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / F r a m e w o r k s
$ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / M a c O S
$ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / R e s o u r c e s
2017-11-16 09:28:55 +00:00
$ { T A R G E T _ S E R V E R } . a p p
$ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s
$ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / M a c O S
$ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / R e s o u r c e s
$ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / R e s o u r c e s / d a t a
$ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / R e s o u r c e s / d a t a / m a p r e s
2017-11-08 23:16:52 +00:00
)
set ( DMG_MKDIR_COMMANDS )
foreach ( dir ${ DMG_MKDIRS } )
2017-11-17 14:55:22 +00:00
list ( APPEND DMG_MKDIR_COMMANDS COMMAND ${ CMAKE_COMMAND } -E make_directory ${ DMG_TMPDIR } / ${ dir } )
2017-11-08 23:16:52 +00:00
endforeach ( )
add_custom_command ( OUTPUT ${ CPACK_PACKAGE_FILE_NAME } .dmg
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E r e m o v e _ d i r e c t o r y $ { D M G _ T M P D I R }
2017-11-08 23:16:52 +00:00
$ { D M G _ M K D I R _ C O M M A N D S }
2017-11-16 09:28:55 +00:00
# CLIENT
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { P R O J E C T _ S O U R C E _ D I R } / d a t a $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / R e s o u r c e s / d a t a
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / i c o n s / $ { T A R G E T _ C L I E N T } . i c n s $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / R e s o u r c e s /
2017-11-17 21:32:44 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y b u n d l e / c l i e n t / I n f o . p l i s t $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / b u n d l e / c l i e n t / P k g I n f o $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s /
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ < T A R G E T _ F I L E : $ { T A R G E T _ C L I E N T } > $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / M a c O S /
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { P R O J E C T _ S O U R C E _ D I R } / d d n e t - l i b s / s d l / m a c / l i b 6 4 / S D L 2 . f r a m e w o r k $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / F r a m e w o r k s / S D L 2 . f r a m e w o r k
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { P R O J E C T _ S O U R C E _ D I R } / d d n e t - l i b s / f r e e t y p e / m a c / l i b 6 4 / l i b f r e e t y p e . 6 . d y l i b $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / F r a m e w o r k s /
2017-11-08 23:16:52 +00:00
C O M M A N D $ { C M A K E _ I N S T A L L _ N A M E _ T O O L } - c h a n g e @ r p a t h / S D L 2 . f r a m e w o r k / V e r s i o n s / A / S D L 2 @ e x e c u t a b l e _ p a t h / . . / F r a m e w o r k s / S D L 2 . f r a m e w o r k / S D L 2 $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / M a c O S / $ { T A R G E T _ C L I E N T }
C O M M A N D $ { C M A K E _ I N S T A L L _ N A M E _ T O O L } - c h a n g e / u s r / l o c a l / l i b / l i b f r e e t y p e . 6 . d y l i b @ e x e c u t a b l e _ p a t h / . . / F r a m e w o r k s / l i b f r e e t y p e . 6 . d y l i b $ { D M G _ T M P D I R } / $ { T A R G E T _ C L I E N T } . a p p / C o n t e n t s / M a c O S / $ { T A R G E T _ C L I E N T }
2017-11-16 09:28:55 +00:00
# SERVER
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { P R O J E C T _ S O U R C E _ D I R } / d a t a / m a p s $ { D M G _ T M P D I R } / $ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / R e s o u r c e s / d a t a / m a p s
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / i c o n s / $ { T A R G E T _ S E R V E R } . i c n s $ { D M G _ T M P D I R } / $ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / R e s o u r c e s /
2017-11-17 21:32:44 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y b u n d l e / s e r v e r / I n f o . p l i s t $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / b u n d l e / s e r v e r / P k g I n f o $ { D M G _ T M P D I R } / $ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s /
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ < T A R G E T _ F I L E : $ { T A R G E T _ S E R V E R } > $ < T A R G E T _ F I L E : $ { T A R G E T _ S E R V E R _ L A U N C H E R } > $ { D M G _ T M P D I R } / $ { T A R G E T _ S E R V E R } . a p p / C o n t e n t s / M a c O S /
2017-11-16 09:28:55 +00:00
# DMG
2017-11-09 12:35:59 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { P R O J E C T _ S O U R C E _ D I R } / s c r i p t s / d m g . p y c r e a t e $ { D M G _ P A R A M S } $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . d m g $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } $ { D M G _ T M P D I R }
2017-11-17 13:37:29 +00:00
2017-11-17 21:32:44 +00:00
D E P E N D S
$ { T A R G E T _ C L I E N T }
$ { T A R G E T _ S E R V E R _ L A U N C H E R }
$ { T A R G E T _ S E R V E R }
2018-02-12 22:14:14 +00:00
$ { P R O J E C T _ B I N A R Y _ D I R } / b u n d l e / c l i e n t / I n f o . p l i s t
$ { P R O J E C T _ B I N A R Y _ D I R } / b u n d l e / s e r v e r / I n f o . p l i s t
2017-11-17 21:32:44 +00:00
d a t a
o t h e r / b u n d l e / c l i e n t / P k g I n f o
o t h e r / b u n d l e / s e r v e r / P k g I n f o
o t h e r / i c o n s / $ { T A R G E T _ C L I E N T } . i c n s
o t h e r / i c o n s / $ { T A R G E T _ S E R V E R } . i c n s
s c r i p t s / d m g . p y
2017-11-08 23:16:52 +00:00
)
add_custom_target ( package_dmg DEPENDS ${ CPACK_PACKAGE_FILE_NAME } .dmg )
2017-11-17 21:32:56 +00:00
list ( APPEND PACKAGE_TARGETS package_dmg )
2017-11-08 23:16:52 +00:00
endif ( )
2017-09-05 14:00:50 +00:00
foreach ( ext zip tar.gz tar.xz )
set ( TAR_MODE c )
2017-09-05 19:42:09 +00:00
set ( TAR_EXTRA_ARGS )
2017-09-05 14:00:50 +00:00
string ( REPLACE . _ EXT_SLUG ${ ext } )
2017-11-09 12:35:59 +00:00
set ( TMPDIR pack_ ${ CPACK_PACKAGE_FILE_NAME } _ ${ EXT_SLUG } / ${ CPACK_PACKAGE_FILE_NAME } )
set ( COPY_FILE_COMMANDS )
set ( COPY_DIR_COMMANDS )
set ( COPY_TARGET_COMMANDS )
2018-01-14 14:57:02 +00:00
set ( STRIP_TARGET_COMMANDS )
2017-11-09 12:35:59 +00:00
foreach ( file ${ CPACK_FILES } )
2017-11-17 14:55:22 +00:00
list ( APPEND COPY_FILE_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy ${ PROJECT_SOURCE_DIR } / ${ file } ${ TMPDIR } / )
2017-11-09 12:35:59 +00:00
endforeach ( )
foreach ( dir ${ CPACK_DIRS } )
2017-11-17 14:55:22 +00:00
list ( APPEND COPY_DIR_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy_directory ${ PROJECT_SOURCE_DIR } / ${ dir } ${ TMPDIR } / ${ dir } )
2017-11-09 12:35:59 +00:00
endforeach ( )
foreach ( target ${ CPACK_TARGETS } )
2017-11-17 14:55:22 +00:00
list ( APPEND COPY_TARGET_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy $< TARGET_FILE:${target} > ${ TMPDIR } / )
2018-01-14 15:11:09 +00:00
list ( APPEND STRIP_TARGET_COMMANDS COMMAND strip -s ${ TMPDIR } / $< TARGET_FILE_NAME:${target} > )
2017-11-09 12:35:59 +00:00
endforeach ( )
2017-09-05 14:00:50 +00:00
if ( ext STREQUAL zip )
2017-09-05 19:42:09 +00:00
set ( TAR_EXTRA_ARGS --format=zip )
2017-09-05 14:00:50 +00:00
elseif ( ext STREQUAL tar.gz )
set ( TAR_MODE cz )
elseif ( ext STREQUAL tar.xz )
set ( TAR_MODE cJ )
endif ( )
add_custom_command ( OUTPUT ${ CPACK_PACKAGE_FILE_NAME } . ${ ext }
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E r e m o v e _ d i r e c t o r y $ { T M P D I R }
C O M M A N D $ { C M A K E _ C O M M A N D } - E m a k e _ d i r e c t o r y $ { T M P D I R }
2017-09-05 19:42:09 +00:00
$ { C O P Y _ F I L E _ C O M M A N D S }
$ { C O P Y _ D I R _ C O M M A N D S }
$ { C O P Y _ T A R G E T _ C O M M A N D S }
2018-01-14 14:57:02 +00:00
$ { S T R I P _ T A R G E T _ C O M M A N D S }
2017-11-17 14:55:22 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c h d i r p a c k _ $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } _ $ { E X T _ S L U G } $ { C M A K E _ C O M M A N D } - E t a r $ { T A R _ M O D E } . . / $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . $ { e x t } $ { T A R _ E X T R A _ A R G S } - - $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } /
2017-11-17 13:37:29 +00:00
D E P E N D S $ { C P A C K _ T A R G E T S }
2017-09-05 14:00:50 +00:00
)
add_custom_target ( package_ ${ EXT_SLUG } DEPENDS ${ CPACK_PACKAGE_FILE_NAME } . ${ ext } )
2017-11-17 21:32:56 +00:00
list ( APPEND PACKAGE_TARGETS package_ ${ EXT_SLUG } )
2017-09-05 14:00:50 +00:00
endforeach ( )
set ( PACKAGE_DEFAULT tar_xz )
if ( TARGET_OS STREQUAL "windows" )
set ( PACKAGE_DEFAULT zip )
2017-11-08 23:16:52 +00:00
elseif ( TARGET_OS STREQUAL "mac" )
set ( PACKAGE_DEFAULT dmg )
2017-09-05 14:00:50 +00:00
endif ( )
add_custom_target ( package_default DEPENDS package_ ${ PACKAGE_DEFAULT } )
2017-11-17 21:32:56 +00:00
add_custom_target ( package_all DEPENDS ${ PACKAGE_TARGETS } )
2017-09-05 14:00:50 +00:00
# Unset these variables, they might do something in the future of CPack.
unset ( CPACK_SOURCE_FILES )
unset ( CPACK_SOURCE_FILES_INVERTED )
unset ( CPACK_TARGETS )
unset ( CPACK_DIRS )
unset ( CPACK_FILES )
2017-08-01 19:55:49 +00:00
include ( CPack )
2017-03-03 12:39:06 +00:00
########################################################################
2017-03-03 14:23:18 +00:00
# COMPILER-SPECIFICS
2017-03-03 12:39:06 +00:00
########################################################################
2017-03-03 12:29:35 +00:00
# In the future (CMake 3.8.0+), use source_group(TREE ...)
macro ( source_group_tree dir )
file ( GLOB ents RELATIVE ${ PROJECT_SOURCE_DIR } / ${ dir } ${ PROJECT_SOURCE_DIR } / ${ dir } /* )
foreach ( ent ${ ents } )
if ( IS_DIRECTORY ${ PROJECT_SOURCE_DIR } / ${ dir } / ${ ent } )
source_group_tree ( ${ dir } / ${ ent } )
else ( )
string ( REPLACE "/" "\\" group ${ dir } )
source_group ( ${ group } FILES ${ PROJECT_SOURCE_DIR } / ${ dir } / ${ ent } )
endif ( )
endforeach ( )
endmacro ( )
source_group_tree ( src )
2017-03-03 12:39:06 +00:00
2017-03-03 14:04:13 +00:00
set ( TARGETS ${ TARGETS_OWN } ${ TARGETS_DEP } )
foreach ( target ${ TARGETS } )
if ( MSVC )
2017-03-12 15:28:04 +00:00
target_compile_options ( ${ target } PRIVATE $< $<NOT:${DBG} > :/MT> $< ${DBG}:/MTd > ) # Use static CRT
2017-03-12 15:27:34 +00:00
target_compile_options ( ${ target } PRIVATE /MP ) # Use multiple cores
2017-03-07 14:24:08 +00:00
target_compile_options ( ${ target } PRIVATE /EHsc ) # Only catch C++ exceptions with catch.
2017-03-03 14:04:13 +00:00
target_compile_options ( ${ target } PRIVATE /GS ) # Protect the stack pointer.
2017-03-03 14:10:21 +00:00
target_compile_options ( ${ target } PRIVATE /wd4996 ) # Use of non-_s functions.
2017-03-03 14:04:13 +00:00
endif ( )
2018-01-22 18:10:57 +00:00
if ( OUR_FLAGS )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS } )
endif ( )
if ( DEFINE_FORTIFY_SOURCE )
target_compile_definitions ( ${ target } PRIVATE $< $<NOT:$<CONFIG:Debug > >:_FORTIFY_SOURCE=2> ) # Detect some buffer overflows.
2017-07-26 02:30:56 +00:00
endif ( )
endforeach ( )
foreach ( target ${ TARGETS_LINK } )
2018-06-19 12:45:53 +00:00
if ( MSVC )
set_property ( TARGET ${ target } APPEND PROPERTY LINK_FLAGS /SAFESEH:NO ) # Disable SafeSEH because the shipped libraries don't support it (would cause error LNK2026 otherwise).
endif ( )
2017-07-26 02:30:56 +00:00
if ( TARGET_OS STREQUAL "mac" )
target_link_libraries ( ${ target } -stdlib=libc++ )
target_link_libraries ( ${ target } -mmacosx-version-min=10.7 )
2018-10-04 07:25:41 +00:00
# Fixes: Undefined symbols for architecture x86_64:
# "___isOSVersionAtLeast", referenced from:
# _singleipconnect in libcurl.a(libcurl_la-connect.o)
target_link_libraries ( ${ target } -Wl,-undefined -Wl,dynamic_lookup )
2017-07-26 02:30:56 +00:00
endif ( )
2018-09-19 05:58:17 +00:00
if ( ( MINGW OR TARGET_OS STREQUAL "linux" ) AND PREFER_BUNDLED_LIBS )
2018-05-22 17:42:48 +00:00
# Statically link the standard libraries with on MinGW/Linux so we don't
# have to ship them as DLLs.
2017-07-31 23:21:34 +00:00
target_link_libraries ( ${ target } -static-libgcc )
target_link_libraries ( ${ target } -static-libstdc++ )
endif ( )
2017-03-03 14:04:13 +00:00
endforeach ( )
foreach ( target ${ TARGETS_OWN } )
2018-01-14 13:36:25 +00:00
if ( ( CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1 ) AND NOT TARGET_OS STREQUAL "mac" )
2017-11-23 02:10:25 +00:00
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD 11 )
2018-01-14 13:36:25 +00:00
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD_REQUIRED ON )
2017-11-23 02:10:25 +00:00
endif ( )
2017-03-03 14:04:13 +00:00
if ( MSVC )
target_compile_options ( ${ target } PRIVATE /wd4244 ) # Possible loss of data (float -> int, int -> float, etc.).
2017-03-12 15:23:17 +00:00
target_compile_options ( ${ target } PRIVATE /wd4267 ) # Possible loss of data (size_t - int on win64).
2017-03-03 14:04:13 +00:00
target_compile_options ( ${ target } PRIVATE /wd4800 ) # Implicit conversion of int to bool.
2018-01-22 18:10:57 +00:00
endif ( )
if ( OUR_FLAGS_OWN )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS_OWN } )
2017-03-03 14:04:13 +00:00
endif ( )
2018-02-12 22:14:14 +00:00
target_include_directories ( ${ target } PRIVATE ${ PROJECT_BINARY_DIR } /src )
2018-02-20 16:11:18 +00:00
target_include_directories ( ${ target } PRIVATE src )
2017-03-03 14:04:13 +00:00
target_compile_definitions ( ${ target } PRIVATE $< $<CONFIG:Debug > :CONF_DEBUG> )
2018-06-19 12:45:53 +00:00
target_include_directories ( ${ target } PRIVATE ${ CURL_INCLUDE_DIRS } )
2018-02-12 22:14:14 +00:00
target_include_directories ( ${ target } PRIVATE ${ ZLIB_INCLUDE_DIRS } )
2017-10-20 09:52:18 +00:00
target_compile_definitions ( ${ target } PRIVATE GLEW_STATIC )
2018-06-05 19:22:40 +00:00
if ( CRYPTO_FOUND )
target_compile_definitions ( ${ target } PRIVATE CONF_OPENSSL )
endif ( )
2017-03-03 14:04:13 +00:00
if ( WEBSOCKETS )
2017-03-07 12:03:37 +00:00
target_compile_definitions ( ${ target } PRIVATE CONF_WEBSOCKETS )
2018-02-14 11:55:04 +00:00
target_include_directories ( ${ target } PRIVATE ${ WEBSOCKETS_INCLUDE_DIRS } )
2017-03-03 14:04:13 +00:00
endif ( )
2017-07-22 23:36:36 +00:00
if ( MYSQL )
target_compile_definitions ( ${ target } PRIVATE CONF_SQL )
target_include_directories ( ${ target } PRIVATE ${ MYSQL_INCLUDE_DIRS } )
endif ( )
2018-09-20 01:01:31 +00:00
if ( AUTOUPDATE )
target_compile_definitions ( ${ target } PRIVATE CONF_AUTOUPDATE )
endif ( )
2017-03-03 14:04:13 +00:00
endforeach ( )
2017-03-12 14:56:44 +00:00
foreach ( target ${ TARGETS_DEP } )
2017-03-03 14:04:13 +00:00
if ( MSVC )
target_compile_options ( ${ target } PRIVATE /W0 )
endif ( )
2018-02-12 20:29:43 +00:00
if ( OUR_FLAGS_DEP )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS_DEP } )
endif ( )
2017-03-03 14:04:13 +00:00
endforeach ( )