2020-12-08 09:02:54 +00:00
cmake_minimum_required ( VERSION 2.8.12...3.19.1 )
if ( CMAKE_VERSION VERSION_LESS 3.12 )
cmake_policy ( VERSION ${ CMAKE_VERSION } )
endif ( )
2017-08-01 19:55:49 +00:00
2022-05-25 15:01:21 +00:00
set ( CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE INTERNAL "" )
if ( CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.13 )
message ( WARNING "Building for macOS < 10.13 is not supported" )
2020-04-13 08:46:30 +00:00
endif ( )
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
2019-03-06 20:02:06 +00:00
R E G E X " ^ #define GAME_RELEASE_VERSION "
2017-08-01 19:55:49 +00:00
)
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 ( )
2020-12-08 09:02:54 +00:00
# Extra support for CMake pre-3.0
if ( NOT POLICY CMP0048 )
2017-08-01 19:55:49 +00:00
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 ( )
2020-12-08 09:02:54 +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-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
2019-12-30 09:55:45 +00:00
if ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
2017-07-31 16:30:24 +00:00
set ( TARGET_BITS "32" )
2019-12-30 09:55:45 +00:00
else ( )
set ( TARGET_BITS "64" )
2017-07-31 16:30:24 +00:00
endif ( )
2021-08-24 11:21:29 +00:00
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64" )
2021-08-24 10:18:20 +00:00
if ( TARGET_BITS STREQUAL "32" )
set ( TARGET_CPU_ARCHITECTURE "arm" )
else ( )
set ( TARGET_CPU_ARCHITECTURE "arm64" )
endif ( )
else ( )
if ( TARGET_BITS STREQUAL "32" )
set ( TARGET_CPU_ARCHITECTURE "x86" )
else ( )
set ( TARGET_CPU_ARCHITECTURE "x86_64" )
endif ( )
endif ( )
2017-07-31 16:30:24 +00:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Windows" )
set ( TARGET_OS "windows" )
2022-03-25 08:26:37 +00:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
2017-07-31 16:30:24 +00:00
set ( TARGET_OS "linux" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
set ( TARGET_OS "mac" )
2021-04-18 04:57:24 +00:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Haiku" )
set ( TARGET_OS "haiku" )
2021-08-24 10:18:20 +00:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Android" )
set ( TARGET_OS "android" )
2017-07-31 16:30:24 +00:00
endif ( )
2018-01-22 18:10:57 +00:00
include ( CheckCCompilerFlag )
2018-01-22 18:32:30 +00:00
include ( CheckCXXCompilerFlag )
2022-05-21 23:35:17 +00:00
if ( CMAKE_VERSION VERSION_GREATER_EQUAL 3.18 )
include ( CheckLinkerFlag )
endif ( )
2018-01-22 18:10:57 +00:00
include ( CheckSymbolExists )
2022-03-25 08:26:37 +00:00
if ( NOT ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" ) )
include ( CheckAtomic )
endif ( )
2018-01-22 18:10:57 +00:00
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 )
2022-05-15 11:22:30 +00:00
2022-03-20 17:04:00 +00:00
set ( AUTO_VULKAN_BACKEND ON )
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 )
2022-03-20 17:04:00 +00:00
if ( TARGET_CPU_ARCHITECTURE STREQUAL "x86" )
set ( AUTO_VULKAN_BACKEND OFF )
endif ( )
elseif ( TARGET_OS STREQUAL "mac" )
set ( AUTO_VULKAN_BACKEND OFF )
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 )
2021-11-28 00:49:08 +00:00
option ( TEST_MYSQL "Test mysql support in unit tests (also sets -DMYSQL=ON)" OFF )
2020-09-17 19:11:28 +00:00
option ( AUTOUPDATE "Enable the autoupdater" OFF )
2020-09-23 20:42:54 +00:00
option ( INFORM_UPDATE "Inform about available updates" ON )
2022-03-01 19:23:29 +00:00
option ( VIDEORECORDER "Enable video recording support via FFmpeg" ON )
2020-04-14 10:11:50 +00:00
option ( UPNP "Enable UPnP support" OFF )
2020-03-11 00:58:50 +00:00
option ( ANTIBOT "Enable support for a dynamic anticheat library" OFF )
2021-09-09 11:23:02 +00:00
option ( HEADLESS_CLIENT "Build the client without graphics" OFF )
2017-02-23 14:41:42 +00:00
option ( CLIENT "Compile client" ON )
2021-08-24 10:18:20 +00:00
option ( SERVER "Compile server" ON )
option ( TOOLS "Compile tools" ON )
2017-10-15 08:25:26 +00:00
option ( DOWNLOAD_GTEST "Download and compile GTest" ${ AUTO_DEPENDENCIES_DEFAULT } )
2020-08-31 10:25:53 +00:00
option ( STEAM "Build the Steam release version" OFF )
2021-01-17 23:52:58 +00:00
option ( DISCORD "Enable Discord rich presence support" OFF )
2021-02-01 11:20:11 +00:00
option ( DISCORD_DYNAMIC "Enable discovering Discord rich presence libraries at runtime (Linux only)" OFF )
2017-10-15 08:25:26 +00:00
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 )
2022-03-20 17:04:00 +00:00
option ( VULKAN "Enable the vulkan backend" ${ AUTO_VULKAN_BACKEND } )
2020-10-17 16:50:26 +00:00
2022-02-18 09:46:05 +00:00
option ( EXCEPTION_HANDLING "Enable exception handling (only works with Windows as of now)" OFF )
2022-05-21 23:34:34 +00:00
option ( IPO "Enable interprocedural optimizations" OFF )
2022-05-21 23:35:17 +00:00
option ( FUSE_LD "Linker to use" OFF )
2022-02-18 09:46:05 +00:00
2022-03-25 08:26:37 +00:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
include ( ${ PROJECT_SOURCE_DIR } /cmake/toolchains/Emscripten.toolchain )
endif ( )
2021-11-28 00:49:08 +00:00
if ( TEST_MYSQL )
set ( MYSQL ON )
endif ( )
2020-10-17 16:50:26 +00:00
# Set version if not explicitly set
if ( NOT VERSION )
set ( VERSION ${ PROJECT_VERSION } )
endif ( )
2017-02-23 14:41:42 +00:00
2019-05-11 10:00:21 +00:00
set ( OpenGL_GL_PREFERENCE LEGACY )
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 ( )
2019-03-19 09:46:28 +00:00
if ( NOT(CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$" ) )
message ( WARNING "Unknown CMAKE_BUILD_TYPE, should be one of Release, Debug, RelWithDebInfo or MinSizeRel" )
endif ( )
2017-11-23 02:10:25 +00:00
set ( DBG $< OR:$<CONFIG:Debug > , $< CONFIG:RelWithDebInfo > > )
2017-09-21 13:11:09 +00:00
2022-05-07 09:23:29 +00:00
if ( IPO )
if ( CMAKE_VERSION VERSION_GREATER 3.9 )
include ( CheckIPOSupported )
check_ipo_supported ( RESULT ipo_supported OUTPUT ipo_output )
if ( ipo_supported )
message ( STATUS "IPO is enabled" )
set ( ENABLE_IPO TRUE )
else ( )
message ( WARNING "IPO is not supported: ${ipo_output}" )
endif ( )
else ( )
message ( WARNING "IPO enablement requires CMake 3.9+" )
endif ( )
endif ( )
2020-10-17 16:50:26 +00:00
if ( CMAKE_VERSION VERSION_LESS 3.0 )
configure_file ( src/game/version.h vd.h )
else ( )
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
s r c / g a m e / v e r s i o n . h
)
endif ( )
2017-10-15 07:57:21 +00:00
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
########################################################################
2022-05-22 10:16:03 +00:00
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 ( )
function ( add_cxx_compiler_flag_if_supported VARIABLE FLAG )
2018-01-22 18:10:57 +00:00
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}" )
2022-05-19 09:01:54 +00:00
check_cxx_compiler_flag ( "${CHECKED_FLAG}" ${ CONFIG_VARIABLE } )
2018-01-22 18:10:57 +00:00
if ( ${ CONFIG_VARIABLE } )
if ( ${ VARIABLE } )
set ( "${VARIABLE}" "${${VARIABLE}};${FLAG}" PARENT_SCOPE )
else ( )
set ( "${VARIABLE}" "${FLAG}" PARENT_SCOPE )
endif ( )
endif ( )
endfunction ( )
2022-05-21 23:35:17 +00:00
function ( add_linker_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}" )
if ( CMAKE_VERSION VERSION_LESS 3.18 )
set ( ${ CONFIG_VARIABLE } OFF )
else ( )
check_linker_flag ( C "${CHECKED_FLAG}" ${ CONFIG_VARIABLE } )
endif ( )
if ( ${ CONFIG_VARIABLE } )
if ( ${ VARIABLE } )
set ( "${VARIABLE}" "${${VARIABLE}};${FLAG}" PARENT_SCOPE )
else ( )
set ( "${VARIABLE}" "${FLAG}" PARENT_SCOPE )
endif ( )
endif ( )
endfunction ( )
2019-04-10 20:37:58 +00:00
# Force compiler colors on when using ninja. Ninja filters the colors out when
# it's not printing to a terminal on its own.
if ( CMAKE_GENERATOR STREQUAL "Ninja" )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fdiagnostics-color=always )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fcolor-diagnostics )
2019-04-10 20:37:58 +00:00
endif ( )
2022-05-26 22:57:45 +00:00
if ( NOT MSVC AND NOT HAIKU )
IF ( NOT TARGET_OS STREQUAL "mac" )
if ( NOT FUSE_LD STREQUAL OFF )
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld= ${ FUSE_LD } )
if ( FLAG_SUPPORTED_fuse_ld_ ${ FUSE_LD } )
message ( STATUS "Using ${FUSE_LD} linker" )
endif ( )
else ( )
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT ENABLE_IPO )
# GCC+LTO: pthread_create has failed: Resource temporarily unavailable
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld=mold )
if ( FLAG_SUPPORTED_fuse_ld_mold )
message ( STATUS "Using mold linker" )
2022-05-21 23:35:17 +00:00
else ( )
2022-05-26 22:57:45 +00:00
# Does not support GCC+LTO
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld=lld )
if ( FLAG_SUPPORTED_fuse_ld_lld )
message ( STATUS "Using lld linker" )
else ( )
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld=gold )
if ( FLAG_SUPPORTED_fuse_ld_gold )
message ( STATUS "Using gold linker" )
endif ( )
2022-05-21 23:35:17 +00:00
endif ( )
endif ( )
2022-05-26 22:57:45 +00:00
else ( )
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld=gold )
if ( FLAG_SUPPORTED_fuse_ld_gold )
message ( STATUS "Using gold linker" )
endif ( )
2022-05-21 23:35:17 +00:00
endif ( )
endif ( )
endif ( )
2018-01-22 18:10:57 +00:00
if ( CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac" )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -std=gnu++17 )
2018-01-22 18:10:57 +00:00
endif ( )
# Protect the stack pointer.
# -fstack-protector-all doesn't work on MinGW.
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fstack-protector-all )
2018-01-22 18:10:57 +00:00
2021-01-31 16:58:30 +00:00
# Disable exceptions as DDNet does not use them.
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fno-exceptions )
2021-01-31 16:58:30 +00:00
2018-01-22 18:10:57 +00:00
# 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" )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -ffloat-store )
2018-01-22 18:10:57 +00:00
endif ( )
2020-09-08 12:13:24 +00:00
# Don't insert timestamps into PEs to keep the build reproducible.
if ( TARGET_OS STREQUAL "windows" )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_LINK -Wl,--no-insert-timestamp )
2020-09-08 12:13:24 +00:00
endif ( )
2018-01-22 18:10:57 +00:00
if ( TARGET_OS STREQUAL "mac" )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -stdlib=libc++ )
2018-01-22 18:10:57 +00:00
endif ( )
2022-02-18 09:46:05 +00:00
if ( EXCEPTION_HANDLING )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -DCONF_EXCEPTION_HANDLING )
2022-02-18 10:53:25 +00:00
# use the frame pointer (frame pointer usage is disabled by default in
# some architectures like x86_64 and for some optimization levels; and it
# may be impossible to walk the call stack without it)
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fno-omit-frame-pointer )
2022-02-18 09:46:05 +00:00
endif ( )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wall )
2018-01-22 18:10:57 +00:00
if ( CMAKE_VERSION VERSION_GREATER 3.3 OR CMAKE_VERSION VERSION_EQUAL 3.3 )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN
2018-01-22 18:10:57 +00:00
$ < $ < 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 ( )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wextra )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-unused-parameter )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-missing-field-initializers )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wformat=2 ) # Warn about format strings.
add_c_compiler_flag_if_supported ( OUR_FLAGS_DEP -Wno-implicit-function-declaration )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-nullability-completeness ) # Mac OS build on github
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wduplicated-cond )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wduplicated-branches )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wlogical-op )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wrestrict )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wshadow-all ) # clang
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wshadow=global ) # gcc
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wthread-safety )
2022-05-28 00:14:46 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wthread-safety-negative )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wsuggest-override )
2022-05-22 10:20:24 +00:00
add_linker_flag_if_supported ( OUR_FLAGS_LINK -Wno-alloc-size-larger-than ) # save.cpp with LTO
2022-05-22 10:16:03 +00:00
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wdouble-promotion) # Many occurences
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wnull-dereference) # Many occurences
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wuseless-cast) # TODO: Enable for C++ code except gtest
2018-01-22 18:10:57 +00:00
endif ( )
2022-02-18 09:46:05 +00:00
if ( MSVC )
if ( EXCEPTION_HANDLING )
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS /DCONF_EXCEPTION_HANDLING )
2022-02-18 09:46:05 +00:00
endif ( )
endif ( )
2021-04-17 15:49:41 +00:00
if ( NOT MSVC AND NOT HAIKU )
2018-02-12 22:14:14 +00:00
check_c_compiler_flag ( "-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE ) # Some distributions define _FORTIFY_SOURCE by themselves.
endif ( )
########################################################################
# COMMON FUNCTIONS
########################################################################
2020-01-19 19:32:54 +00:00
function ( set_glob VAR GLOBBING EXTS DIRECTORY ) # ...
set ( GLOBS )
foreach ( ext ${ EXTS } )
list ( APPEND GLOBS "${DIRECTORY}/*.${ext}" )
endforeach ( )
file ( ${ GLOBBING } GLOB_RESULT ${ GLOBS } )
2018-02-12 22:14:14 +00:00
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 ( )
2019-03-07 11:23:54 +00:00
if ( NOT LIST_BUT_NOT_GLOB AND NOT GLOB_BUT_NOT_LIST )
message ( AUTHOR_WARNING "${VAR} is not alphabetically sorted" )
endif ( )
2018-02-12 22:14:14 +00:00
endif ( )
endif ( )
set ( ${ VAR } ${ FILES } PARENT_SCOPE )
endfunction ( )
2020-01-19 19:32:54 +00:00
function ( set_src VAR GLOBBING DIRECTORY ) # ...
set_glob ( ${ VAR } ${ GLOBBING } "c;cpp;h" ${ DIRECTORY } ${ ARGN } )
set ( ${ VAR } ${ ${VAR } } PARENT_SCOPE )
2022-01-31 02:11:47 +00:00
set ( CHECKSUM_SRC ${ CHECKSUM_SRC } ${ ${VAR } } PARENT_SCOPE )
2020-01-19 19:32:54 +00:00
endfunction ( )
2022-01-31 02:11:47 +00:00
set ( CHECKSUM_SRC )
2020-01-19 19:32:54 +00:00
2020-08-20 10:17:44 +00:00
function ( set_own_rpath TARGET )
if ( NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac" )
2021-02-02 23:28:49 +00:00
if ( CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8 )
2020-08-20 10:17:44 +00:00
set_property ( TARGET ${ TARGET } PROPERTY BUILD_RPATH "$ORIGIN" )
endif ( )
set_property ( TARGET ${ TARGET } PROPERTY INSTALL_RPATH "$ORIGIN/../lib/ddnet" )
endif ( )
endfunction ( )
if ( NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac" AND CMAKE_VERSION VERSION_LESS 3.8 )
2021-02-01 11:20:11 +00:00
if ( ( CLIENT AND ( STEAM OR DISCORD_DYNAMIC ) ) OR ANTIBOT )
2020-08-20 10:17:44 +00:00
message ( STATUS "Can't set BUILD_RPATH in CMake before 3.8, pass -Wl,-rpath,'$ORIGIN' manually if you wish to emulate this. Or just install a newer version of CMake..." )
endif ( )
endif ( )
2018-02-12 22:14:14 +00:00
########################################################################
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
2021-12-14 14:12:48 +00:00
if ( ( CMAKE_OSX_ARCHITECTURES STREQUAL "arm64;x86_64" OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64;arm64" ) AND TARGET_OS STREQUAL "mac" )
set ( FAT ON )
else ( )
set ( FAT OFF )
endif ( )
if ( FAT )
set ( LIB_DIR "${TARGET_OS}/libfat" )
2022-03-25 08:26:37 +00:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( LIB_DIR "webasm/libwasm" )
2021-12-14 14:12:48 +00:00
elseif ( TARGET_CPU_ARCHITECTURE STREQUAL "arm" OR TARGET_CPU_ARCHITECTURE STREQUAL "arm64" )
set ( LIB_DIR "${TARGET_OS}/lib${TARGET_CPU_ARCHITECTURE}" )
else ( )
set ( LIB_DIR "${TARGET_OS}/lib${TARGET_BITS}" )
endif ( )
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 )
2021-12-14 14:12:48 +00:00
set ( DIR "ddnet-libs/${NAME}/${LIB_DIR}" )
2017-07-31 16:30:24 +00:00
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 )
2022-03-25 08:26:37 +00:00
set ( TMP_TARGET_OS ${ TARGET_OS } )
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( TMP_TARGET_OS webasm )
endif ( )
set ( "HINTS_${VARIABLE}_INCLUDEDIR" "ddnet-libs/${NAME}/include" "ddnet-libs/${NAME}/include/${TMP_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 )
2022-03-25 08:26:37 +00:00
if ( TARGET_OS STREQUAL "android" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
2021-08-24 10:18:20 +00:00
# be more aggressive with android toolchain
set ( CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
else ( )
set ( CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH NO_CMAKE_SYSTEM_PATH )
endif ( )
2017-10-25 14:57:25 +00:00
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 ( )
2021-08-24 10:18:20 +00:00
if ( TARGET_OS STREQUAL "android" )
find_package ( Android )
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 )
2022-03-21 22:08:55 +00:00
if ( CLIENT AND VIDEORECORDER )
2020-07-09 19:10:54 +00:00
find_package ( FFMPEG )
endif ( )
2020-04-06 10:23:22 +00:00
find_package ( Freetype )
2017-11-27 01:14:05 +00:00
if ( DOWNLOAD_GTEST )
find_package ( Git )
endif ( )
2021-08-24 10:18:20 +00:00
if ( NOT(TARGET_OS STREQUAL "android" ) )
find_package ( GLEW )
endif ( )
2017-08-30 19:57:55 +00:00
find_package ( GTest )
2020-07-09 19:10:54 +00:00
if ( UPNP )
find_package ( Miniupnpc )
endif ( )
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 )
2022-06-11 07:09:42 +00:00
find_package ( PNG )
2020-06-16 16:33:57 +00:00
find_package ( PythonInterp 3 )
2017-02-23 13:16:32 +00:00
find_package ( SDL2 )
2020-07-07 17:29:44 +00:00
find_package ( SQLite3 )
2021-01-02 16:10:31 +00:00
if ( DISCORD )
find_package ( DiscordSdk )
endif ( )
2020-12-30 13:50:36 +00:00
if ( UNIX )
# Use -pthread instead of -lpthread to draw dependencies other than libpthread
set ( THREADS_PREFER_PTHREAD_FLAG TRUE )
endif ( )
2017-02-23 13:16:32 +00:00
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 ( )
2022-02-18 09:46:05 +00:00
if ( EXCEPTION_HANDLING )
find_package ( ExceptionHandling )
endif ( )
2017-11-08 23:16:52 +00:00
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
2020-04-15 15:31:33 +00:00
find_program ( CMAKE_OTOOL otool )
2021-12-25 21:37:11 +00:00
find_program ( DMGBUILD dmgbuild )
2017-11-08 23:16:52 +00:00
endif ( )
2022-03-20 17:04:00 +00:00
set ( VULKAN_SHADER_FILE_LIST "" CACHE STRING "Vulkan shader file list" )
2022-03-21 22:08:55 +00:00
if ( CLIENT AND VULKAN )
2022-03-20 17:04:00 +00:00
find_package ( Vulkan )
include ( cmake/BuildVulkanShaders.cmake )
else ( )
set ( VULKAN_LIBRARIES )
set ( VULKAN_INCLUDE_DIRS )
endif ( )
2022-01-01 13:34:06 +00:00
message ( STATUS "******** ${CMAKE_PROJECT_NAME} ********" )
2021-12-20 15:06:55 +00:00
set ( TARGET "Target OS: ${TARGET_OS} ${CMAKE_SYSTEM_PROCESSOR}" )
if ( TARGET_OS STREQUAL "mac" )
set ( TARGET "${TARGET} (SDK: ${CMAKE_OSX_SYSROOT}, architectures: ${CMAKE_OSX_ARCHITECTURES})" )
2020-04-13 08:46:30 +00:00
endif ( )
2021-12-20 15:06:55 +00:00
message ( STATUS ${ TARGET } )
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 ( )
2022-03-21 22:08:55 +00:00
if ( CLIENT AND VIDEORECORDER )
2020-07-09 19:10:54 +00:00
show_dependency_status ( "FFmpeg" FFMPEG )
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" )
2021-12-25 21:37:11 +00:00
show_dependency_status ( "Dmgbuild" DMGBUILD )
2017-11-09 12:35:59 +00:00
endif ( )
2020-07-09 19:10:54 +00:00
if ( UPNP )
show_dependency_status ( "Miniupnpc" MINIUPNPC )
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 )
2022-06-11 07:09:42 +00:00
show_dependency_status ( "PNG" PNG )
2020-06-16 16:33:57 +00:00
show_dependency_status ( "PythonInterp" PYTHONINTERP )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "SDL2" SDL2 )
2020-07-07 17:29:44 +00:00
show_dependency_status ( "SQLite3" SQLite3 )
2018-02-12 22:14:14 +00:00
show_dependency_status ( "Wavpack" WAVPACK )
show_dependency_status ( "Zlib" ZLIB )
2021-01-02 16:10:31 +00:00
if ( DISCORD )
show_dependency_status ( "DiscordSdk" DiscordSdk )
endif ( )
2018-02-14 11:55:04 +00:00
if ( WEBSOCKETS )
show_dependency_status ( "Websockets" WEBSOCKETS )
endif ( )
2017-02-23 14:41:42 +00:00
2022-03-21 22:08:55 +00:00
if ( CLIENT AND VULKAN )
2022-03-20 17:04:00 +00:00
show_dependency_status ( "Vulkan" VULKAN )
endif ( )
2021-12-24 11:17:46 +00:00
if ( NOT(CURL_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Curl to compile ${CMAKE_PROJECT_NAME}" )
2018-06-19 12:45:53 +00:00
endif ( )
2020-06-16 16:33:57 +00:00
if ( NOT(PYTHONINTERP_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Python to compile ${CMAKE_PROJECT_NAME}" )
2017-08-03 16:44:36 +00:00
endif ( )
2020-07-07 17:29:44 +00:00
if ( NOT(SQLite3_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install SQLite3 to compile ${CMAKE_PROJECT_NAME}" )
2020-07-07 17:29:44 +00:00
endif ( )
2017-08-03 16:44:36 +00:00
2017-02-23 14:41:42 +00:00
if ( MYSQL AND NOT(MYSQL_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install MySQL to compile the ${CMAKE_PROJECT_NAME} 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 ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install libwebsockets to compile the ${CMAKE_PROJECT_NAME} server with websocket support" )
2018-02-14 11:55:04 +00:00
endif ( )
2020-04-14 10:11:50 +00:00
if ( UPNP AND NOT(MINIUPNPC_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install miniupnpc to compile the ${CMAKE_PROJECT_NAME} server with UPnP support" )
2020-04-14 10:11:50 +00:00
endif ( )
2021-01-02 16:10:31 +00:00
if ( DISCORD AND NOT(DISCORDSDK_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install the Discord SDK to compile the ${CMAKE_PROJECT_NAME} client with Discord support" )
2021-01-02 16:10:31 +00:00
endif ( )
2021-02-01 11:20:11 +00:00
if ( DISCORD_DYNAMIC )
if ( TARGET_OS STREQUAL "windows" OR TARGET_OS STREQUAL "mac" )
message ( SEND_ERROR "Dynamically loading the Discord SDK is only supported on Linux" )
endif ( )
if ( NOT DISCORD )
message ( SEND_ERROR "You must enable the DISCORD flag if you want to link the Discord SDK" )
endif ( )
endif ( )
2022-06-11 07:09:42 +00:00
if ( NOT(PNG_FOUND ) )
message ( SEND_ERROR "You must install libpng to compile DDNet" )
endif ( )
2017-02-23 14:41:42 +00:00
if ( CLIENT AND NOT(FREETYPE_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Freetype to compile the ${CMAKE_PROJECT_NAME} client" )
2017-02-28 23:51:22 +00:00
endif ( )
if ( CLIENT AND NOT(OGG_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Ogg to compile the ${CMAKE_PROJECT_NAME} client" )
2017-02-28 23:51:22 +00:00
endif ( )
if ( CLIENT AND NOT(OPUS_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Opus to compile the ${CMAKE_PROJECT_NAME} client" )
2017-02-23 14:41:42 +00:00
endif ( )
if ( CLIENT AND NOT(OPUSFILE_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Opusfile to compile the ${CMAKE_PROJECT_NAME} client" )
2017-02-23 14:41:42 +00:00
endif ( )
if ( CLIENT AND NOT(SDL2_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install SDL2 to compile the ${CMAKE_PROJECT_NAME} client" )
2017-02-23 14:41:42 +00:00
endif ( )
2021-08-24 10:18:20 +00:00
if ( TARGET_OS STREQUAL "android" AND CLIENT AND NOT(CRYPTO_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install OpenSSL to compile the ${CMAKE_PROJECT_NAME} client" )
2021-08-24 10:18:20 +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
2022-03-21 22:08:55 +00:00
if ( CLIENT AND VULKAN AND NOT(VULKAN_FOUND ) )
2022-05-25 07:44:11 +00:00
message ( SEND_ERROR "You must install Vulkan libraries to compile the ${CMAKE_PROJECT_NAME} client" )
2022-03-20 17:04:00 +00:00
endif ( )
2017-03-03 14:04:13 +00:00
if ( TARGET_OS STREQUAL "windows" )
2017-07-26 02:30:56 +00:00
set ( PLATFORM_CLIENT )
2020-04-08 13:55:10 +00:00
set ( PLATFORM_CLIENT_LIBS opengl32 winmm )
2022-08-20 18:54:25 +00:00
set ( PLATFORM_LIBS shlwapi version 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
2022-05-19 09:14:45 +00:00
s r c / m a c o s / c l i e n t . m m
2021-02-12 12:40:29 +00:00
s r c / m a c o s / n o t i f i c a t i o n s . m m
2017-07-26 02:30:56 +00:00
)
2018-06-27 10:35:01 +00:00
set ( PLATFORM_CLIENT_LIBS ${ COCOA } ${ OPENGL } )
set ( PLATFORM_LIBS ${ CARBON } ${ SECURITY } )
2021-04-18 04:57:24 +00:00
elseif ( TARGET_OS STREQUAL "haiku" )
set ( PLATFORM_CLIENT )
find_package ( OpenGL )
set ( PLATFORM_LIBS GL network )
set ( PLATFORM_CLIENT_LIBS ${ OPENGL_gl_LIBRARY } )
set ( PLATFORM_CLIENT_INCLUDE_DIRS ${ OPENGL_INCLUDE_DIR } )
2021-08-24 10:18:20 +00:00
elseif ( TARGET_OS STREQUAL "android" )
set ( PLATFORM_CLIENT
s r c / a n d r o i d / a n d r o i d _ m a i n . c p p
)
set ( PLATFORM_LIBS ${ TW_ANDROID_LIBS } )
set ( PLATFORM_CLIENT_LIBS ${ PLATFORM_LIBS } )
set ( PLATFORM_CLIENT_INCLUDE_DIRS )
2017-03-03 14:04:13 +00:00
else ( )
2020-04-14 15:53:53 +00:00
find_package ( Notify )
2019-04-22 16:33:52 +00:00
find_package ( OpenGL )
2021-06-04 23:34:26 +00:00
set ( PLATFORM_CLIENT_LIBS ${ OPENGL_gl_LIBRARY } ${ NOTIFY_LIBRARIES } )
set ( PLATFORM_CLIENT_INCLUDE_DIRS ${ OPENGL_INCLUDE_DIR } ${ NOTIFY_INCLUDE_DIRS } )
2020-04-14 15:53:53 +00:00
set ( PLATFORM_CLIENT )
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 ( )
2022-03-25 08:26:37 +00:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( PLATFORM_CLIENT_LIBS GL )
set ( PLATFORM_CLIENT_INCLUDE_DIRS "" )
set ( CMAKE_EXECUTABLE_SUFFIX ".html" )
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 )
2021-04-07 15:32:33 +00:00
set ( DDNET_GTEST_VERSION 5c8ca58edfb304b2dd5e6061f83387470826dd87 ) # master as of 2021-04-07
2017-10-15 07:57:21 +00:00
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 )
2021-12-25 01:21:14 +00:00
foreach ( target gtest gmock )
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 ( )
2021-12-25 01:21:14 +00:00
set ( GTEST_LIBRARIES gtest gmock )
2017-11-27 01:14:05 +00:00
set ( GTEST_INCLUDE_DIRS )
if ( CMAKE_VERSION VERSION_LESS 2.8.11 )
2021-12-25 01:21:14 +00:00
set ( GTEST_INCLUDE_DIRS "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include" )
2017-11-27 01:14:05 +00:00
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
2020-01-19 19:32:54 +00:00
set_src ( DEP_JSON_SRC GLOB src/engine/external/json-parser json.c json.h )
2018-07-11 18:17:21 +00:00
add_library ( json EXCLUDE_FROM_ALL OBJECT ${ DEP_JSON_SRC } )
2017-03-03 14:04:13 +00:00
2020-01-19 19:32:54 +00:00
set_src ( DEP_MD5_SRC GLOB src/engine/external/md5 md5.c md5.h )
2018-07-11 18:17:21 +00:00
add_library ( md5 EXCLUDE_FROM_ALL OBJECT ${ DEP_MD5_SRC } )
list ( APPEND TARGETS_DEP json md5 )
set ( DEP_JSON $< TARGET_OBJECTS:json > )
2019-04-06 00:46:56 +00:00
set ( DEP_MD5 )
if ( NOT CRYPTO_FOUND )
set ( DEP_MD5 $< TARGET_OBJECTS:md5 > )
endif ( )
2017-03-02 11:31:20 +00:00
2020-06-23 08:29:32 +00:00
########################################################################
# DATA
########################################################################
set ( EXPECTED_DATA
a r r o w . p n g
2020-10-07 03:11:38 +00:00
a s s e t s / e n t i t i e s / c o m f o r t / d d n e t . p n g
a s s e t s / e n t i t i e s / l i c e n s e . t x t
2020-09-25 07:58:16 +00:00
a s s e t s / g a m e / g a m e _ 0 6 . p n g
2020-06-23 08:29:32 +00:00
a u d i o / f o l e y _ b o d y _ i m p a c t - 0 1 . w v
a u d i o / f o l e y _ b o d y _ i m p a c t - 0 2 . w v
a u d i o / f o l e y _ b o d y _ i m p a c t - 0 3 . w v
a u d i o / f o l e y _ b o d y _ s p l a t - 0 1 . w v
a u d i o / f o l e y _ b o d y _ s p l a t - 0 2 . w v
a u d i o / f o l e y _ b o d y _ s p l a t - 0 3 . w v
a u d i o / f o l e y _ b o d y _ s p l a t - 0 4 . w v
a u d i o / f o l e y _ d b l j u m p - 0 1 . w v
a u d i o / f o l e y _ d b l j u m p - 0 2 . w v
a u d i o / f o l e y _ d b l j u m p - 0 3 . w v
a u d i o / f o l e y _ f o o t _ l e f t - 0 1 . w v
a u d i o / f o l e y _ f o o t _ l e f t - 0 2 . w v
a u d i o / f o l e y _ f o o t _ l e f t - 0 3 . w v
a u d i o / f o l e y _ f o o t _ l e f t - 0 4 . w v
a u d i o / f o l e y _ f o o t _ r i g h t - 0 1 . w v
a u d i o / f o l e y _ f o o t _ r i g h t - 0 2 . w v
a u d i o / f o l e y _ f o o t _ r i g h t - 0 3 . w v
a u d i o / f o l e y _ f o o t _ r i g h t - 0 4 . w v
a u d i o / f o l e y _ l a n d - 0 1 . w v
a u d i o / f o l e y _ l a n d - 0 2 . w v
a u d i o / f o l e y _ l a n d - 0 3 . w v
a u d i o / f o l e y _ l a n d - 0 4 . w v
a u d i o / h o o k _ a t t a c h - 0 1 . w v
a u d i o / h o o k _ a t t a c h - 0 2 . w v
a u d i o / h o o k _ a t t a c h - 0 3 . w v
a u d i o / h o o k _ l o o p - 0 1 . w v
a u d i o / h o o k _ l o o p - 0 2 . w v
a u d i o / h o o k _ n o a t t a c h - 0 1 . w v
a u d i o / h o o k _ n o a t t a c h - 0 2 . w v
a u d i o / h o o k _ n o a t t a c h - 0 3 . w v
a u d i o / m u s i c _ m e n u . w v
a u d i o / s f x _ c t f _ c a p _ p l . w v
a u d i o / s f x _ c t f _ d r o p . w v
a u d i o / s f x _ c t f _ g r a b _ e n . w v
a u d i o / s f x _ c t f _ g r a b _ p l . w v
a u d i o / s f x _ c t f _ r t n . w v
a u d i o / s f x _ h i t _ s t r o n g - 0 1 . w v
a u d i o / s f x _ h i t _ s t r o n g - 0 2 . w v
a u d i o / s f x _ h i t _ w e a k - 0 1 . w v
a u d i o / s f x _ h i t _ w e a k - 0 2 . w v
a u d i o / s f x _ h i t _ w e a k - 0 3 . w v
a u d i o / s f x _ m s g - c l i e n t . w v
a u d i o / s f x _ m s g - h i g h l i g h t . w v
a u d i o / s f x _ m s g - s e r v e r . w v
a u d i o / s f x _ p i c k u p _ a r m - 0 1 . w v
a u d i o / s f x _ p i c k u p _ a r m - 0 2 . w v
a u d i o / s f x _ p i c k u p _ a r m - 0 3 . w v
a u d i o / s f x _ p i c k u p _ a r m - 0 4 . w v
a u d i o / s f x _ p i c k u p _ g u n . w v
a u d i o / s f x _ p i c k u p _ h r t - 0 1 . w v
a u d i o / s f x _ p i c k u p _ h r t - 0 2 . w v
a u d i o / s f x _ p i c k u p _ l a u n c h e r . w v
a u d i o / s f x _ p i c k u p _ n i n j a . w v
a u d i o / s f x _ p i c k u p _ s g . w v
a u d i o / s f x _ s k i d - 0 1 . w v
a u d i o / s f x _ s k i d - 0 2 . w v
a u d i o / s f x _ s k i d - 0 3 . w v
a u d i o / s f x _ s k i d - 0 4 . w v
a u d i o / s f x _ s p a w n _ w p n - 0 1 . w v
a u d i o / s f x _ s p a w n _ w p n - 0 2 . w v
a u d i o / s f x _ s p a w n _ w p n - 0 3 . w v
a u d i o / v o _ t e e f a u l t _ c r y - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ c r y - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ n i n j a - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ n i n j a - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ n i n j a - 0 3 . w v
a u d i o / v o _ t e e f a u l t _ n i n j a - 0 4 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ l o n g - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ l o n g - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 3 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 4 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 5 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 6 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 7 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 8 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 0 9 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 1 0 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 1 1 . w v
a u d i o / v o _ t e e f a u l t _ p a i n _ s h o r t - 1 2 . w v
a u d i o / v o _ t e e f a u l t _ s l e d g e - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ s l e d g e - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ s l e d g e - 0 3 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 1 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 2 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 3 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 4 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 5 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 6 . w v
a u d i o / v o _ t e e f a u l t _ s p a w n - 0 7 . w v
a u d i o / w p _ f l u m p _ e x p l o - 0 1 . w v
a u d i o / w p _ f l u m p _ e x p l o - 0 2 . w v
a u d i o / w p _ f l u m p _ e x p l o - 0 3 . w v
a u d i o / w p _ f l u m p _ l a u n c h - 0 1 . w v
a u d i o / w p _ f l u m p _ l a u n c h - 0 2 . w v
a u d i o / w p _ f l u m p _ l a u n c h - 0 3 . w v
a u d i o / w p _ g u n _ f i r e - 0 1 . w v
a u d i o / w p _ g u n _ f i r e - 0 2 . w v
a u d i o / w p _ g u n _ f i r e - 0 3 . w v
a u d i o / w p _ h a m m e r _ h i t - 0 1 . w v
a u d i o / w p _ h a m m e r _ h i t - 0 2 . w v
a u d i o / w p _ h a m m e r _ h i t - 0 3 . w v
a u d i o / w p _ h a m m e r _ s w i n g - 0 1 . w v
a u d i o / w p _ h a m m e r _ s w i n g - 0 2 . w v
a u d i o / w p _ h a m m e r _ s w i n g - 0 3 . w v
a u d i o / w p _ l a s e r _ b n c e - 0 1 . w v
a u d i o / w p _ l a s e r _ b n c e - 0 2 . w v
a u d i o / w p _ l a s e r _ b n c e - 0 3 . w v
a u d i o / w p _ l a s e r _ f i r e - 0 1 . w v
a u d i o / w p _ l a s e r _ f i r e - 0 2 . w v
a u d i o / w p _ l a s e r _ f i r e - 0 3 . w v
a u d i o / w p _ n i n j a _ a t t a c k - 0 1 . w v
a u d i o / w p _ n i n j a _ a t t a c k - 0 2 . w v
a u d i o / w p _ n i n j a _ a t t a c k - 0 3 . w v
a u d i o / w p _ n i n j a _ a t t a c k - 0 4 . w v
a u d i o / w p _ n i n j a _ h i t - 0 1 . w v
a u d i o / w p _ n i n j a _ h i t - 0 2 . w v
a u d i o / w p _ n i n j a _ h i t - 0 3 . w v
a u d i o / w p _ n i n j a _ h i t - 0 4 . w v
a u d i o / w p _ n o a m m o - 0 1 . w v
a u d i o / w p _ n o a m m o - 0 2 . w v
a u d i o / w p _ n o a m m o - 0 3 . w v
a u d i o / w p _ n o a m m o - 0 4 . w v
a u d i o / w p _ n o a m m o - 0 5 . w v
a u d i o / w p _ s h o t t y _ f i r e - 0 1 . w v
a u d i o / w p _ s h o t t y _ f i r e - 0 2 . w v
a u d i o / w p _ s h o t t y _ f i r e - 0 3 . w v
a u d i o / w p _ s w i t c h - 0 1 . w v
a u d i o / w p _ s w i t c h - 0 2 . w v
a u d i o / w p _ s w i t c h - 0 3 . w v
2022-06-26 09:13:25 +00:00
a u t o e x e c _ s e r v e r . c f g
2020-06-23 08:29:32 +00:00
b l o b . p n g
2020-09-18 15:37:27 +00:00
c e n s o r l i s t . t x t
2020-06-23 08:29:32 +00:00
c o n s o l e . p n g
c o n s o l e _ b a r . p n g
c o u n t r y f l a g s / A D . p n g
c o u n t r y f l a g s / A E . p n g
c o u n t r y f l a g s / A F . p n g
c o u n t r y f l a g s / A G . p n g
c o u n t r y f l a g s / A I . p n g
c o u n t r y f l a g s / A L . p n g
c o u n t r y f l a g s / A M . p n g
c o u n t r y f l a g s / A O . p n g
c o u n t r y f l a g s / A R . p n g
c o u n t r y f l a g s / A S . p n g
c o u n t r y f l a g s / A T . p n g
c o u n t r y f l a g s / A U . p n g
c o u n t r y f l a g s / A W . p n g
c o u n t r y f l a g s / A X . p n g
c o u n t r y f l a g s / A Z . p n g
c o u n t r y f l a g s / B A . p n g
c o u n t r y f l a g s / B B . p n g
c o u n t r y f l a g s / B D . p n g
c o u n t r y f l a g s / B E . p n g
c o u n t r y f l a g s / B F . p n g
c o u n t r y f l a g s / B G . p n g
c o u n t r y f l a g s / B H . p n g
c o u n t r y f l a g s / B I . p n g
c o u n t r y f l a g s / B J . p n g
c o u n t r y f l a g s / B L . p n g
c o u n t r y f l a g s / B M . p n g
c o u n t r y f l a g s / B N . p n g
c o u n t r y f l a g s / B O . p n g
c o u n t r y f l a g s / B R . p n g
c o u n t r y f l a g s / B S . p n g
c o u n t r y f l a g s / B T . p n g
c o u n t r y f l a g s / B W . p n g
c o u n t r y f l a g s / B Y . p n g
c o u n t r y f l a g s / B Z . p n g
c o u n t r y f l a g s / C A . p n g
c o u n t r y f l a g s / C C . p n g
c o u n t r y f l a g s / C D . p n g
c o u n t r y f l a g s / C F . p n g
c o u n t r y f l a g s / C G . p n g
c o u n t r y f l a g s / C H . p n g
c o u n t r y f l a g s / C I . p n g
c o u n t r y f l a g s / C K . p n g
c o u n t r y f l a g s / C L . p n g
c o u n t r y f l a g s / C M . p n g
c o u n t r y f l a g s / C N . p n g
c o u n t r y f l a g s / C O . p n g
c o u n t r y f l a g s / C R . p n g
c o u n t r y f l a g s / C U . p n g
c o u n t r y f l a g s / C V . p n g
c o u n t r y f l a g s / C W . p n g
c o u n t r y f l a g s / C X . p n g
c o u n t r y f l a g s / C Y . p n g
c o u n t r y f l a g s / C Z . p n g
c o u n t r y f l a g s / D E . p n g
c o u n t r y f l a g s / D J . p n g
c o u n t r y f l a g s / D K . p n g
c o u n t r y f l a g s / D M . p n g
c o u n t r y f l a g s / D O . p n g
c o u n t r y f l a g s / D Z . p n g
c o u n t r y f l a g s / E C . p n g
c o u n t r y f l a g s / E E . p n g
c o u n t r y f l a g s / E G . p n g
c o u n t r y f l a g s / E H . p n g
c o u n t r y f l a g s / E R . p n g
c o u n t r y f l a g s / E S . p n g
c o u n t r y f l a g s / E T . p n g
c o u n t r y f l a g s / F I . p n g
c o u n t r y f l a g s / F J . p n g
c o u n t r y f l a g s / F K . p n g
c o u n t r y f l a g s / F M . p n g
c o u n t r y f l a g s / F O . p n g
c o u n t r y f l a g s / F R . p n g
c o u n t r y f l a g s / G A . p n g
c o u n t r y f l a g s / G B . p n g
c o u n t r y f l a g s / G D . p n g
c o u n t r y f l a g s / G E . p n g
c o u n t r y f l a g s / G F . p n g
c o u n t r y f l a g s / G G . p n g
c o u n t r y f l a g s / G H . p n g
c o u n t r y f l a g s / G I . p n g
c o u n t r y f l a g s / G L . p n g
c o u n t r y f l a g s / G M . p n g
c o u n t r y f l a g s / G N . p n g
c o u n t r y f l a g s / G P . p n g
c o u n t r y f l a g s / G Q . p n g
c o u n t r y f l a g s / G R . p n g
c o u n t r y f l a g s / G S . p n g
c o u n t r y f l a g s / G T . p n g
c o u n t r y f l a g s / G U . p n g
c o u n t r y f l a g s / G W . p n g
c o u n t r y f l a g s / G Y . p n g
c o u n t r y f l a g s / H K . p n g
c o u n t r y f l a g s / H N . p n g
c o u n t r y f l a g s / H R . p n g
c o u n t r y f l a g s / H T . p n g
c o u n t r y f l a g s / H U . p n g
c o u n t r y f l a g s / I D . p n g
c o u n t r y f l a g s / I E . p n g
c o u n t r y f l a g s / I L . p n g
c o u n t r y f l a g s / I M . p n g
c o u n t r y f l a g s / I N . p n g
c o u n t r y f l a g s / I O . p n g
c o u n t r y f l a g s / I Q . p n g
c o u n t r y f l a g s / I R . p n g
c o u n t r y f l a g s / I S . p n g
c o u n t r y f l a g s / I T . p n g
c o u n t r y f l a g s / J E . p n g
c o u n t r y f l a g s / J M . p n g
c o u n t r y f l a g s / J O . p n g
c o u n t r y f l a g s / J P . p n g
c o u n t r y f l a g s / K E . p n g
c o u n t r y f l a g s / K G . p n g
c o u n t r y f l a g s / K H . p n g
c o u n t r y f l a g s / K I . p n g
c o u n t r y f l a g s / K M . p n g
c o u n t r y f l a g s / K N . p n g
c o u n t r y f l a g s / K P . p n g
c o u n t r y f l a g s / K R . p n g
c o u n t r y f l a g s / K W . p n g
c o u n t r y f l a g s / K Y . p n g
c o u n t r y f l a g s / K Z . p n g
c o u n t r y f l a g s / L A . p n g
c o u n t r y f l a g s / L B . p n g
c o u n t r y f l a g s / L C . p n g
c o u n t r y f l a g s / L I . p n g
c o u n t r y f l a g s / L K . p n g
c o u n t r y f l a g s / L R . p n g
c o u n t r y f l a g s / L S . p n g
c o u n t r y f l a g s / L T . p n g
c o u n t r y f l a g s / L U . p n g
c o u n t r y f l a g s / L V . p n g
c o u n t r y f l a g s / L Y . p n g
c o u n t r y f l a g s / M A . p n g
c o u n t r y f l a g s / M C . p n g
c o u n t r y f l a g s / M D . p n g
c o u n t r y f l a g s / M E . p n g
c o u n t r y f l a g s / M F . p n g
c o u n t r y f l a g s / M G . p n g
c o u n t r y f l a g s / M H . p n g
c o u n t r y f l a g s / M K . p n g
c o u n t r y f l a g s / M L . p n g
c o u n t r y f l a g s / M M . p n g
c o u n t r y f l a g s / M N . p n g
c o u n t r y f l a g s / M O . p n g
c o u n t r y f l a g s / M P . p n g
c o u n t r y f l a g s / M Q . p n g
c o u n t r y f l a g s / M R . p n g
c o u n t r y f l a g s / M S . p n g
c o u n t r y f l a g s / M T . p n g
c o u n t r y f l a g s / M U . p n g
c o u n t r y f l a g s / M V . p n g
c o u n t r y f l a g s / M W . p n g
c o u n t r y f l a g s / M X . p n g
c o u n t r y f l a g s / M Y . p n g
c o u n t r y f l a g s / M Z . p n g
c o u n t r y f l a g s / N A . p n g
c o u n t r y f l a g s / N C . p n g
c o u n t r y f l a g s / N E . p n g
c o u n t r y f l a g s / N F . p n g
c o u n t r y f l a g s / N G . p n g
c o u n t r y f l a g s / N I . p n g
c o u n t r y f l a g s / N L . p n g
c o u n t r y f l a g s / N O . p n g
c o u n t r y f l a g s / N P . p n g
c o u n t r y f l a g s / N R . p n g
c o u n t r y f l a g s / N U . p n g
c o u n t r y f l a g s / N Z . p n g
c o u n t r y f l a g s / O M . p n g
c o u n t r y f l a g s / P A . p n g
c o u n t r y f l a g s / P E . p n g
c o u n t r y f l a g s / P F . p n g
c o u n t r y f l a g s / P G . p n g
c o u n t r y f l a g s / P H . p n g
c o u n t r y f l a g s / P K . p n g
c o u n t r y f l a g s / P L . p n g
c o u n t r y f l a g s / P M . p n g
c o u n t r y f l a g s / P N . p n g
c o u n t r y f l a g s / P R . p n g
c o u n t r y f l a g s / P S . p n g
c o u n t r y f l a g s / P T . p n g
c o u n t r y f l a g s / P W . p n g
c o u n t r y f l a g s / P Y . p n g
c o u n t r y f l a g s / Q A . p n g
c o u n t r y f l a g s / R E . p n g
c o u n t r y f l a g s / R O . p n g
c o u n t r y f l a g s / R S . p n g
c o u n t r y f l a g s / R U . p n g
c o u n t r y f l a g s / R W . p n g
c o u n t r y f l a g s / S A . p n g
c o u n t r y f l a g s / S B . p n g
c o u n t r y f l a g s / S C . p n g
c o u n t r y f l a g s / S D . p n g
c o u n t r y f l a g s / S E . p n g
c o u n t r y f l a g s / S G . p n g
c o u n t r y f l a g s / S H . p n g
c o u n t r y f l a g s / S I . p n g
c o u n t r y f l a g s / S K . p n g
c o u n t r y f l a g s / S L . p n g
c o u n t r y f l a g s / S M . p n g
c o u n t r y f l a g s / S N . p n g
c o u n t r y f l a g s / S O . p n g
c o u n t r y f l a g s / S R . p n g
c o u n t r y f l a g s / S S . p n g
c o u n t r y f l a g s / S T . p n g
c o u n t r y f l a g s / S V . p n g
c o u n t r y f l a g s / S X . p n g
c o u n t r y f l a g s / S Y . p n g
c o u n t r y f l a g s / S Z . p n g
c o u n t r y f l a g s / T C . p n g
c o u n t r y f l a g s / T D . p n g
c o u n t r y f l a g s / T F . p n g
c o u n t r y f l a g s / T G . p n g
c o u n t r y f l a g s / T H . p n g
c o u n t r y f l a g s / T J . p n g
c o u n t r y f l a g s / T K . p n g
c o u n t r y f l a g s / T L . p n g
c o u n t r y f l a g s / T M . p n g
c o u n t r y f l a g s / T N . p n g
c o u n t r y f l a g s / T O . p n g
c o u n t r y f l a g s / T R . p n g
c o u n t r y f l a g s / T T . p n g
c o u n t r y f l a g s / T V . p n g
c o u n t r y f l a g s / T W . p n g
c o u n t r y f l a g s / T Z . p n g
c o u n t r y f l a g s / U A . p n g
c o u n t r y f l a g s / U G . p n g
c o u n t r y f l a g s / U S . p n g
c o u n t r y f l a g s / U Y . p n g
c o u n t r y f l a g s / U Z . p n g
c o u n t r y f l a g s / V A . p n g
c o u n t r y f l a g s / V C . p n g
c o u n t r y f l a g s / V E . p n g
c o u n t r y f l a g s / V G . p n g
c o u n t r y f l a g s / V I . p n g
c o u n t r y f l a g s / V N . p n g
c o u n t r y f l a g s / V U . p n g
c o u n t r y f l a g s / W F . p n g
c o u n t r y f l a g s / W S . p n g
c o u n t r y f l a g s / X C A . p n g
c o u n t r y f l a g s / X E N . p n g
c o u n t r y f l a g s / X E U . p n g
c o u n t r y f l a g s / X N I . p n g
c o u n t r y f l a g s / X S C . p n g
c o u n t r y f l a g s / X W A . p n g
c o u n t r y f l a g s / Y E . p n g
c o u n t r y f l a g s / Z A . p n g
c o u n t r y f l a g s / Z M . p n g
c o u n t r y f l a g s / Z W . p n g
c o u n t r y f l a g s / d e f a u l t . p n g
c o u n t r y f l a g s / i n d e x . t x t
d e b u g _ f o n t . p n g
e d i t o r / a u d i o _ s o u r c e . p n g
e d i t o r / b a c k g r o u n d . p n g
e d i t o r / b a s i c _ f r e e z e . r u l e s
e d i t o r / c h e c k e r . p n g
e d i t o r / c u r s o r . p n g
e d i t o r / d d m a x _ f r e e z e . r u l e s
e d i t o r / d d n e t _ t i l e s . r u l e s
e d i t o r / d d n e t _ w a l l s . r u l e s
e d i t o r / d e s e r t _ m a i n . r u l e s
e d i t o r / e n t i t i e s / D D N e t . p n g
e d i t o r / e n t i t i e s / F N G . p n g
e d i t o r / e n t i t i e s / R a c e . p n g
e d i t o r / e n t i t i e s / V a n i l l a . p n g
e d i t o r / e n t i t i e s / b l o c k w o r l d s . p n g
e d i t o r / e n t i t i e s _ c l e a r / b l o c k w o r l d s . p n g
e d i t o r / e n t i t i e s _ c l e a r / d d n e t . p n g
e d i t o r / e n t i t i e s _ c l e a r / d d r a c e . p n g
2020-12-21 15:45:19 +00:00
e d i t o r / e n t i t i e s _ c l e a r / f - d d r a c e . p n g
2020-06-23 08:29:32 +00:00
e d i t o r / e n t i t i e s _ c l e a r / f n g . p n g
e d i t o r / e n t i t i e s _ c l e a r / r a c e . p n g
e d i t o r / e n t i t i e s _ c l e a r / v a n i l l a . p n g
e d i t o r / f a d e o u t . r u l e s
e d i t o r / f r o n t . p n g
e d i t o r / g e n e r i c _ c l e a r . r u l e s
e d i t o r / g e n e r i c _ u n h o o k a b l e . r u l e s
e d i t o r / g e n e r i c _ u n h o o k a b l e _ 0 . 7 . r u l e s
e d i t o r / g r a s s _ m a i n . r u l e s
e d i t o r / g r a s s _ m a i n _ 0 . 7 . r u l e s
e d i t o r / j u n g l e _ m a i n . r u l e s
e d i t o r / j u n g l e _ m i d g r o u n d . r u l e s
e d i t o r / r o u n d _ t i l e s . r u l e s
e d i t o r / s p e e d _ a r r o w . p n g
e d i t o r / s p e e d u p . p n g
e d i t o r / s w i t c h . p n g
e d i t o r / t e l e . p n g
e d i t o r / t u n e . p n g
e d i t o r / w a t e r . r u l e s
e d i t o r / w i n t e r _ m a i n . r u l e s
e m o t i c o n s . p n g
2022-06-14 17:28:51 +00:00
e x t r a s . p n g
2020-08-20 09:21:45 +00:00
f o n t s / D e j a V u S a n s . t t f
2021-06-04 13:15:29 +00:00
f o n t s / G l o w S a n s J C o m p r e s s e d - B o o k . o t f
2022-03-19 10:21:47 +00:00
f o n t s / I c o n s . o t f
2020-08-20 09:21:45 +00:00
f o n t s / S o u r c e H a n S a n s S C - R e g u l a r . o t f
2020-06-23 08:29:32 +00:00
g a m e . p n g
g u i _ b u t t o n s . p n g
g u i _ c u r s o r . p n g
g u i _ i c o n s . p n g
g u i _ l o g o . p n g
2022-03-15 15:52:41 +00:00
h u d . p n g
2021-01-31 08:33:01 +00:00
l a n g u a g e s / a r a b i c . t x t
2020-06-23 08:29:32 +00:00
l a n g u a g e s / b e l a r u s i a n . t x t
l a n g u a g e s / b o s n i a n . t x t
l a n g u a g e s / b r a z i l i a n _ p o r t u g u e s e . t x t
l a n g u a g e s / b u l g a r i a n . t x t
l a n g u a g e s / c a t a l a n . t x t
l a n g u a g e s / c h u v a s h . t x t
l a n g u a g e s / c z e c h . t x t
l a n g u a g e s / d a n i s h . t x t
l a n g u a g e s / d u t c h . t x t
2022-07-19 19:21:38 +00:00
l a n g u a g e s / e s p e r a n t o . t x t
2020-06-23 08:29:32 +00:00
l a n g u a g e s / f i n n i s h . t x t
l a n g u a g e s / f r e n c h . t x t
l a n g u a g e s / g e r m a n . t x t
l a n g u a g e s / g r e e k . t x t
l a n g u a g e s / h u n g a r i a n . t x t
l a n g u a g e s / i n d e x . t x t
l a n g u a g e s / i t a l i a n . t x t
l a n g u a g e s / j a p a n e s e . t x t
l a n g u a g e s / k o r e a n . t x t
l a n g u a g e s / k y r g y z . t x t
l a n g u a g e s / l i c e n s e . t x t
l a n g u a g e s / n o r w e g i a n . t x t
l a n g u a g e s / p e r s i a n . t x t
l a n g u a g e s / p o l i s h . t x t
l a n g u a g e s / p o r t u g u e s e . t x t
l a n g u a g e s / r o m a n i a n . t x t
l a n g u a g e s / r u s s i a n . t x t
l a n g u a g e s / s e r b i a n . t x t
2020-10-03 21:50:27 +00:00
l a n g u a g e s / s e r b i a n _ c y r i l l i c . t x t
2020-06-23 08:29:32 +00:00
l a n g u a g e s / s i m p l i f i e d _ c h i n e s e . t x t
l a n g u a g e s / s l o v a k . t x t
l a n g u a g e s / s p a n i s h . t x t
l a n g u a g e s / s w e d i s h . t x t
l a n g u a g e s / t r a d i t i o n a l _ c h i n e s e . t x t
l a n g u a g e s / t u r k i s h . t x t
l a n g u a g e s / u k r a i n i a n . t x t
m a p r e s / b a s i c _ f r e e z e . p n g
m a p r e s / b g _ c l o u d 1 . p n g
m a p r e s / b g _ c l o u d 2 . p n g
m a p r e s / b g _ c l o u d 3 . p n g
m a p r e s / d d m a x _ f r e e z e . p n g
m a p r e s / d d n e t _ s t a r t . p n g
m a p r e s / d d n e t _ t i l e s . p n g
m a p r e s / d d n e t _ w a l l s . p n g
m a p r e s / d e s e r t _ b a c k g r o u n d . p n g
m a p r e s / d e s e r t _ d o o d a d s . p n g
m a p r e s / d e s e r t _ m a i n . p n g
m a p r e s / d e s e r t _ m o u n t a i n s . p n g
m a p r e s / d e s e r t _ m o u n t a i n s 2 . p n g
m a p r e s / d e s e r t _ m o u n t a i n s _ n e w _ b a c k g r o u n d . p n g
m a p r e s / d e s e r t _ m o u n t a i n s _ n e w _ f o r e g r o u n d . p n g
m a p r e s / d e s e r t _ s u n . p n g
m a p r e s / e n t i t i e s . p n g
m a p r e s / f a d e o u t . p n g
m a p r e s / f o n t _ t e e w o r l d s . p n g
m a p r e s / f o n t _ t e e w o r l d s _ a l t . p n g
m a p r e s / g e n e r i c _ c l e a r . p n g
m a p r e s / g e n e r i c _ d e a t h t i l e s . p n g
m a p r e s / g e n e r i c _ l a m p s . p n g
m a p r e s / g e n e r i c _ u n h o o k a b l e . p n g
m a p r e s / g e n e r i c _ u n h o o k a b l e _ 0 . 7 . p n g
m a p r e s / g r a s s _ d o o d a d s . p n g
m a p r e s / g r a s s _ d o o d a d s _ 0 . 7 . p n g
m a p r e s / g r a s s _ m a i n . p n g
m a p r e s / g r a s s _ m a i n _ 0 . 7 . p n g
m a p r e s / j u n g l e _ b a c k g r o u n d . p n g
m a p r e s / j u n g l e _ d e a t h t i l e s . p n g
m a p r e s / j u n g l e _ d o o d a d s . p n g
m a p r e s / j u n g l e _ m a i n . p n g
m a p r e s / j u n g l e _ m i d g r o u n d . p n g
m a p r e s / j u n g l e _ u n h o o k a b l e s . p n g
m a p r e s / l i g h t . p n g
m a p r e s / m i x e d _ t i l e s . p n g
m a p r e s / m o o n . p n g
m a p r e s / m o u n t a i n s . p n g
m a p r e s / r o u n d _ t i l e s . p n g
m a p r e s / s n o w . p n g
m a p r e s / s n o w _ m o u n t a i n . p n g
m a p r e s / s t a r s . p n g
m a p r e s / s u n . p n g
m a p r e s / w a t e r . p n g
m a p r e s / w i n t e r _ d o o d a d s . p n g
m a p r e s / w i n t e r _ m a i n . p n g
m a p r e s / w i n t e r _ m o u n t a i n s . p n g
m a p r e s / w i n t e r _ m o u n t a i n s 2 . p n g
m a p r e s / w i n t e r _ m o u n t a i n s 3 . p n g
2020-08-16 21:21:59 +00:00
m a p s / G o l d \ M i n e . m a p
2020-09-22 12:07:33 +00:00
m a p s / L e a r n T o P l a y . m a p
2020-09-22 13:20:56 +00:00
m a p s / S u n n y \ S i d e \ U p . m a p
2020-09-22 13:18:21 +00:00
m a p s / T s u n a m i . m a p
2022-02-21 00:04:49 +00:00
m a p s / T u t o r i a l . m a p
2022-06-06 09:55:30 +00:00
m a p s / c o v e r a g e . m a p
2018-08-07 06:39:08 +00:00
m a p s / c t f 1 . m a p
m a p s / c t f 2 . m a p
m a p s / c t f 3 . m a p
m a p s / c t f 4 . m a p
m a p s / c t f 5 . m a p
m a p s / c t f 6 . m a p
m a p s / c t f 7 . m a p
m a p s / d m 1 . m a p
m a p s / d m 2 . m a p
m a p s / d m 6 . m a p
m a p s / d m 7 . m a p
m a p s / d m 8 . m a p
m a p s / d m 9 . m a p
2020-08-16 21:21:59 +00:00
m a p s / l i c e n s e . t x t
m a p s 7 / G o l d \ M i n e . m a p
2020-09-22 12:07:33 +00:00
m a p s 7 / L e a r n T o P l a y . m a p
2020-09-22 13:20:56 +00:00
m a p s 7 / S u n n y \ S i d e \ U p . m a p
2020-09-22 13:18:21 +00:00
m a p s 7 / T s u n a m i . m a p
2022-02-21 00:04:49 +00:00
m a p s 7 / T u t o r i a l . m a p
2020-08-16 21:21:59 +00:00
m a p s 7 / r e a d m e . t x t
2020-09-03 12:08:26 +00:00
m e n u i m a g e s / d e m o s . p n g
m e n u i m a g e s / e d i t o r . p n g
m e n u i m a g e s / l o c a l _ s e r v e r . p n g
m e n u i m a g e s / p l a y _ g a m e . p n g
m e n u i m a g e s / s e t t i n g s . p n g
2020-06-23 08:29:32 +00:00
p a r t i c l e s . p n g
2020-08-29 10:10:38 +00:00
s h a d e r / p i p e l i n e . f r a g
s h a d e r / p i p e l i n e . v e r t
2020-06-23 08:29:32 +00:00
s h a d e r / p r i m . f r a g
s h a d e r / p r i m . v e r t
2020-10-20 16:45:03 +00:00
s h a d e r / p r i m e x . f r a g
s h a d e r / p r i m e x . v e r t
2020-06-23 08:29:32 +00:00
s h a d e r / q u a d . f r a g
s h a d e r / q u a d . v e r t
s h a d e r / s p r i t e m u l t i . f r a g
s h a d e r / s p r i t e m u l t i . v e r t
s h a d e r / t e x t . f r a g
s h a d e r / t e x t . v e r t
s h a d e r / t i l e . f r a g
s h a d e r / t i l e . v e r t
2022-03-20 17:04:00 +00:00
s h a d e r / v u l k a n / p r i m . f r a g
s h a d e r / v u l k a n / p r i m . v e r t
s h a d e r / v u l k a n / p r i m 3 d . f r a g
s h a d e r / v u l k a n / p r i m 3 d . v e r t
s h a d e r / v u l k a n / p r i m e x . f r a g
s h a d e r / v u l k a n / p r i m e x . v e r t
s h a d e r / v u l k a n / q u a d . f r a g
s h a d e r / v u l k a n / q u a d . v e r t
s h a d e r / v u l k a n / s p r i t e m u l t i . f r a g
s h a d e r / v u l k a n / s p r i t e m u l t i . v e r t
s h a d e r / v u l k a n / t e x t . f r a g
s h a d e r / v u l k a n / t e x t . v e r t
s h a d e r / v u l k a n / t i l e . f r a g
s h a d e r / v u l k a n / t i l e . v e r t
2020-06-23 08:29:32 +00:00
s k i n s / P a l a d i N . p n g
s k i n s / a n t i a n t e y . p n g
s k i n s / b e a s t . p n g
s k i n s / b l a c k t e e . p n g
s k i n s / b l u e k i t t y . p n g
s k i n s / b l u e s t r i p e . p n g
2020-08-19 21:06:37 +00:00
s k i n s / b o m b . p n g
2020-06-23 08:29:32 +00:00
s k i n s / b r o w n b e a r . p n g
s k i n s / c a m m o . p n g
s k i n s / c a m m o s t r i p e s . p n g
s k i n s / c h i n e s e _ b y _ w h i s . p n g
s k i n s / c o a l a . p n g
s k i n s / c o a l a _ b l u e k i t t y . p n g
s k i n s / c o a l a _ b l u e s t r i p e . p n g
s k i n s / c o a l a _ c a m m o . p n g
s k i n s / c o a l a _ c a m m o s t r i p e s . p n g
s k i n s / c o a l a _ d e f a u l t . p n g
s k i n s / c o a l a _ l i m e k i t t y . p n g
s k i n s / c o a l a _ p i n k y . p n g
s k i n s / c o a l a _ r e d b o p p . p n g
s k i n s / c o a l a _ r e d s t r i p e . p n g
s k i n s / c o a l a _ s a d d o . p n g
s k i n s / c o a l a _ t o p t r i . p n g
s k i n s / c o a l a _ t w i n b o p . p n g
s k i n s / c o a l a _ t w i n t r i . p n g
s k i n s / c o a l a _ w a r p a i n t . p n g
s k i n s / c o a l a _ x _ n i n j a . p n g
s k i n s / d e f a u l t . p n g
s k i n s / d e m o n l i m e k i t t y . p n g
s k i n s / d i n o . p n g
s k i n s / d r a g o n . p n g
s k i n s / e v i l . p n g
s k i n s / e v i l w o l f e . p n g
s k i n s / g h o s t . p n g
s k i n s / g h o s t j t j . p n g
s k i n s / g i r a f f e . p n g
s k i n s / g r e e n s w a r d . p n g
s k i n s / g r e y f o x . p n g
s k i n s / g r e y f o x _ 2 . p n g
s k i n s / h a m m i e - c h e w . p n g
s k i n s / h a m m i e - w h i s . p n g
s k i n s / j e e t . p n g
s k i n s / k i n t a r o _ 2 . p n g
s k i n s / k i t t y _ b l u e s t r i p e . p n g
s k i n s / k i t t y _ b r o w n b e a r . p n g
s k i n s / k i t t y _ c a m m o . p n g
s k i n s / k i t t y _ c a m m o s t r i p e s . p n g
s k i n s / k i t t y _ c o a l a . p n g
s k i n s / k i t t y _ d e f a u l t . p n g
s k i n s / k i t t y _ p i n k y . p n g
s k i n s / k i t t y _ r e d b o p p . p n g
s k i n s / k i t t y _ r e d s t r i p e . p n g
s k i n s / k i t t y _ s a d d o . p n g
s k i n s / k i t t y _ t o p t r i . p n g
s k i n s / k i t t y _ t w i n b o p . p n g
s k i n s / k i t t y _ t w i n t r i . p n g
s k i n s / k i t t y _ w a r p a i n t . p n g
s k i n s / k i t t y _ x _ n i n j a . p n g
2020-08-10 15:57:02 +00:00
s k i n s / l i c e n s e . t x t
2020-06-23 08:29:32 +00:00
s k i n s / l i m e k i t t y . p n g
s k i n s / m e r m y d o n - c o a l a . p n g
s k i n s / m e r m y d o n . p n g
s k i n s / m o u s e . p n g
s k i n s / m u s m a n n . p n g
s k i n s / n a n a m i . p n g
s k i n s / n a n a s . p n g
s k i n s / n e r s i f . p n g
s k i n s / o l d m a n . p n g
s k i n s / o l d s c h o o l . p n g
s k i n s / p e n g u i n . p n g
s k i n s / p i n k y . p n g
s k i n s / r a n d o m . p n g
s k i n s / r e d b o p p . p n g
s k i n s / r e d s t r i p e . p n g
s k i n s / s a d d o . p n g
s k i n s / s a n t a _ b l u e k i t t y . p n g
s k i n s / s a n t a _ b l u e s t r i p e . p n g
s k i n s / s a n t a _ b r o w n b e a r . p n g
s k i n s / s a n t a _ c a m m o . p n g
s k i n s / s a n t a _ c a m m o s t r i p e s . p n g
s k i n s / s a n t a _ c o a l a . p n g
s k i n s / s a n t a _ d e f a u l t . p n g
s k i n s / s a n t a _ l i m e k i t t y . p n g
s k i n s / s a n t a _ p i n k y . p n g
s k i n s / s a n t a _ r e d b o p p . p n g
s k i n s / s a n t a _ r e d s t r i p e . p n g
s k i n s / s a n t a _ s a d d o . p n g
s k i n s / s a n t a _ t o p t r i . p n g
s k i n s / s a n t a _ t w i n b o p . p n g
s k i n s / s a n t a _ t w i n t r i . p n g
s k i n s / s a n t a _ w a r p a i n t . p n g
s k i n s / t e e r a s t a . p n g
s k i n s / t o p t r i . p n g
s k i n s / t w i n b o p . p n g
s k i n s / t w i n t r i . p n g
s k i n s / v e t e r a n . p n g
s k i n s / v o o d o o _ t e e . p n g
s k i n s / w a r p a i n t . p n g
s k i n s / w a r t e e . p n g
s k i n s / w h i s . p n g
s k i n s / x _ n i n j a . p n g
2020-06-24 07:55:17 +00:00
s k i n s / x _ s p e c . p n g
2021-08-14 13:40:58 +00:00
s t r o n g _ w e a k . p n g
2020-09-18 16:45:42 +00:00
t h e m e s / a u t o . p n g
2020-09-19 06:46:33 +00:00
t h e m e s / a u t u m n . p n g
t h e m e s / a u t u m n _ d a y . m a p
t h e m e s / a u t u m n _ n i g h t . m a p
2020-09-18 16:45:42 +00:00
t h e m e s / h e a v e n s . p n g
t h e m e s / h e a v e n s _ d a y . m a p
t h e m e s / h e a v e n s _ n i g h t . m a p
t h e m e s / j u n g l e . p n g
t h e m e s / j u n g l e _ d a y . m a p
t h e m e s / j u n g l e _ n i g h t . m a p
2020-12-28 16:20:29 +00:00
t h e m e s / n e w y e a r . m a p
t h e m e s / n e w y e a r . p n g
2020-09-18 16:45:42 +00:00
t h e m e s / n o n e . p n g
t h e m e s / r a n d . p n g
t h e m e s / w i n t e r . p n g
t h e m e s / w i n t e r _ d a y . m a p
t h e m e s / w i n t e r _ n i g h t . m a p
2020-06-23 08:29:32 +00:00
w o r d l i s t . t x t
)
2022-06-26 09:13:25 +00:00
set_glob ( DATA GLOB_RECURSE "cfg;frag;json;map;otf;png;rules;ttf;txt;vert;wv" data ${ EXPECTED_DATA } )
2020-06-23 08:29:32 +00:00
2017-03-07 14:24:08 +00:00
########################################################################
2021-12-14 23:58:35 +00:00
# COPY DATA AND SHARED LIBS
2017-03-07 14:24:08 +00:00
########################################################################
2020-06-23 08:29:32 +00:00
foreach ( datafile ${ DATA } )
file ( RELATIVE_PATH OUT ${ PROJECT_SOURCE_DIR } /data ${ datafile } )
get_filename_component ( DESTINATION data/ ${ OUT } PATH )
file ( MAKE_DIRECTORY ${ DESTINATION } )
file ( COPY ${ datafile } DESTINATION ${ DESTINATION } )
endforeach ( )
2022-06-06 09:55:30 +00:00
set ( INTEGRATION_TEST_COPY_FILES
l s a n . s u p p
m e m c h e c k . s u p p
u b s a n . s u p p
v a l g r i n d . s u p p
s c r i p t s / i n t e g r a t i o n _ t e s t . s h
)
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 }
2022-06-11 07:09:42 +00:00
$ { P N G _ C O P Y _ F I L E S }
2017-08-01 19:55:49 +00:00
$ { S D L 2 _ C O P Y _ F I L E S }
2020-08-10 21:43:10 +00:00
$ { S Q L i t e 3 _ C O P Y _ F I L E S }
2017-10-26 22:42:33 +00:00
$ { F F M P E G _ C O P Y _ F I L E S }
2020-09-16 15:16:13 +00:00
$ { W E B S O C K E T S _ C O P Y _ F I L E S }
2021-01-02 16:10:31 +00:00
$ { D I S C O R D S D K _ C O P Y _ F I L E S }
2022-03-20 17:04:00 +00:00
$ { V U L K A N _ C O P Y _ F I L E S }
2022-02-18 09:46:05 +00:00
$ { E X C E P T I O N _ H A N D L I N G _ C O P Y _ F I L E S }
2022-06-06 09:55:30 +00:00
$ { I N T E G R A T I O N _ T E S T _ C O P Y _ F I L E S }
2017-08-01 19:55:49 +00:00
)
file ( COPY ${ COPY_FILES } DESTINATION . )
2017-03-07 14:24:08 +00:00
2021-12-14 23:58:35 +00:00
set ( COPY_DIRS ${ SDL2_COPY_DIRS } )
file ( COPY ${ COPY_DIRS } DESTINATION . )
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 }
2020-06-16 16:33:57 +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 } 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 }
2018-02-05 19:22:54 +00:00
> " $ { 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
2020-04-16 08:46:43 +00:00
function ( generate_source7 output_file script_parameter )
add_custom_command ( OUTPUT ${ output_file }
2020-06-16 16:33:57 +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 } - m d a t a s r c . s e v e n . c o m p i l e $ { s c r i p t _ p a r a m e t e r }
2020-04-16 08:46:43 +00:00
> " $ { 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 } "
D E P E N D S
d a t a s r c / s e v e n / c o m p i l e . p y
d a t a s r c / s e v e n / c o n t e n t . p y
d a t a s r c / s e v e n / d a t a t y p e s . p y
d a t a s r c / s e v e n / n e t w o r k . p y
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 }
)
endfunction ( )
2022-04-03 00:20:53 +00:00
function ( generate_maps output_file script_parameter )
2020-04-16 08:46:43 +00:00
add_custom_command ( OUTPUT ${ output_file }
2022-04-03 00:20:53 +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 } d a t a s r c / c r o s s c o m p i l e . p y $ { s c r i p t _ p a r a m e t e r }
2020-04-16 08:46:43 +00:00
> " $ { 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 } "
D E P E N D S
2022-04-03 00:20:53 +00:00
d a t a s r c / c r o s s c o m p i l e . p y
2020-04-16 08:46:43 +00:00
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
d a t a s r c / s e v e n / c o m p i l e . p y
d a t a s r c / s e v e n / c o n t e n t . p y
d a t a s r c / s e v e n / d a t a t y p e s . p y
d a t a s r c / s e v e n / n e t w o r k . p y
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 }
)
endfunction ( )
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
2020-06-20 09:08:59 +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 } "
2018-03-01 15:50:29 +00:00
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
2020-06-16 16:33:57 +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" )
2020-04-16 08:46:43 +00:00
generate_source7 ( "src/game/generated/protocol7.cpp" "network_source" )
generate_source7 ( "src/game/generated/protocol7.h" "network_header" )
2020-10-09 07:07:05 +00:00
generate_source7 ( "src/game/generated/client_data7.cpp" "client_content_source" )
generate_source7 ( "src/game/generated/client_data7.h" "client_content_header" )
2020-04-16 08:46:43 +00:00
2022-04-03 00:20:53 +00:00
generate_maps ( "src/game/generated/protocolglue.h" "map_header" )
generate_maps ( "src/game/generated/protocolglue.cpp" "map_source" )
2017-02-23 14:41:42 +00:00
2020-11-03 13:48:24 +00:00
add_custom_command ( OUTPUT "src/game/generated/wordlist.h"
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } s c r i p t s / w o r d l i s t . 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 / w o r d l i s t . h
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 }
D E P E N D S
s c r i p t s / w o r d l i s t . p y
)
2017-02-23 14:41:42 +00:00
########################################################################
# SHARED
########################################################################
2017-03-01 12:40:11 +00:00
# Sources
2020-01-19 19:32:54 +00:00
set_src ( BASE GLOB_RECURSE src/base
2017-07-27 14:13:28 +00:00
c o l o r . h
d e t e c t . h
2020-08-20 10:17:44 +00:00
d y n a m i c . h
2021-06-15 01:24:23 +00:00
h a s h . c p p
2018-06-05 19:22:40 +00:00
h a s h . h
2021-06-15 01:24:23 +00:00
h a s h _ b u n d l e d . c p p
2018-06-05 19:22:40 +00:00
h a s h _ c t x t . h
2021-06-15 01:24:23 +00:00
h a s h _ l i b t o m c r y p t . c p p
h a s h _ o p e n s s l . c p p
2022-06-03 10:10:05 +00:00
l o c k _ s c o p e . h
2022-04-22 23:04:48 +00:00
l o g . c p p
l o g . h
l o g g e r . h
2017-07-27 14:13:28 +00:00
m a t h . h
2021-06-15 01:24:23 +00:00
s y s t e m . c p p
2017-07-27 14:13:28 +00:00
s y s t e m . h
t l / t h r e a d i n g . h
2022-05-23 18:16:18 +00:00
t y p e s . h
2021-06-15 01:24:23 +00:00
u n i c o d e / c o n f u s a b l e s . c p p
2022-05-06 22:54:29 +00:00
u n i c o d e / c o n f u s a b l e s . h
2019-01-07 22:49:20 +00:00
u n i c o d e / c o n f u s a b l e s _ d a t a . h
2021-06-15 01:24:23 +00:00
u n i c o d e / t o l o w e r . c p p
2022-05-06 22:54:29 +00:00
u n i c o d e / t o l o w e r . h
2019-01-07 22:49:20 +00:00
u n i c o d e / t o l o w e r _ d a t a . h
2017-07-27 14:13:28 +00:00
v m a t h . h
)
2020-01-19 19:32:54 +00:00
set_src ( ENGINE_INTERFACE GLOB src/engine
2020-05-13 20:27:49 +00:00
a n t i b o t . h
2017-11-27 00:16:11 +00:00
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
2021-01-17 23:52:58 +00:00
d i s c o r d . h
2017-11-27 00:16:11 +00:00
e d i t o r . h
e n g i n e . h
2022-05-23 18:16:18 +00:00
f a v o r i t e s . h
2017-11-27 00:16:11 +00:00
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 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
2021-04-21 11:21:25 +00:00
s q l i t e . h
2020-08-20 10:17:44 +00:00
s t e a m . h
2017-11-27 00:16:11 +00:00
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
2020-10-02 13:43:52 +00:00
w a r n i n g . h
2017-11-27 00:16:11 +00:00
)
2022-03-12 12:01:19 +00:00
set_src ( ENGINE_SHARED GLOB_RECURSE src/engine/shared
2022-03-02 13:28:37 +00:00
a s s e r t i o n _ l o g g e r . c p p
a s s e r t i o n _ l o g g e r . h
2017-07-27 14:13:28 +00:00
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
2020-06-22 20:16:58 +00:00
c s v . c p p
c s v . h
2017-07-27 14:13:28 +00:00
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
g l o b a l _ u u i d _ m a n a g e r . c p p
2021-12-24 11:17:46 +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
2018-12-12 08:59:42 +00:00
j s o n . c p p
j s o n . h
2017-07-27 14:13:28 +00:00
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
2020-09-18 16:45:42 +00:00
m a p . h
2017-07-27 14:13:28 +00:00
m a s t e r s e r v e r . c p p
Add HTTP masterserver registering and HTTP masterserver
Registering
-----------
The idea is that game servers push their server info to the
masterservers every 15 seconds or when the server info changes, but not
more than once per second.
The game servers do not support the old registering protocol anymore,
the backward compatibility is handled by the masterserver.
The register call is a HTTP POST to a URL like
`https://master1.ddnet.tw/ddnet/15/register` and looks like this:
```json
POST /ddnet/15/register HTTP/1.1
Address: tw-0.6+udp://connecting-address.invalid:8303
Secret: 81fa3955-6f83-4290-818d-31c0906b1118
Challenge-Secret: 81fa3955-6f83-4290-818d-31c0906b1118:tw0.6/ipv6
Info-Serial: 0
{
"max_clients": 64,
"max_players": 64,
"passworded": false,
"game_type": "TestDDraceNetwork",
"name": "My DDNet server",
"map": {
"name": "dm1",
"sha256": "0b0c481d77519c32fbe85624ef16ec0fa9991aec7367ad538bd280f28d8c26cf",
"size": 5805
},
"version": "0.6.4, 16.0.3",
"clients": []
}
```
The `Address` header declares that the server wants to register itself as
a `tw-0.6+udp` server, i.e. a server speaking a Teeworlds-0.6-compatible
protocol.
The free-form `Secret` header is used as a server identity, the server
list will be deduplicated via this secret.
The free-form `Challenge-Secret` is sent back via UDP for a port forward
check. This might have security implications as the masterserver can be
asked to send a UDP packet containing some user-controlled bytes. This
is somewhat mitigated by the fact that it can only go to an
attacker-controlled IP address.
The `Info-Serial` header is an integer field that should increase each
time the server info (in the body) changes. The masterserver uses that
field to ensure that it doesn't use old server infos.
The body is a free-form JSON object set by the game server. It should
contain certain keys in the correct form to be accepted by clients. The
body is optional if the masterserver already confirmed the reception of
the info with the given `Info-Serial`.
Not shown in this payload is the `Connless-Token` header that is used
for Teeworlds 0.7 style communication.
Also not shown is the `Challenge-Token` that should be included once the
server receives the challenge token via UDP.
The masterserver responds with a `200 OK` with a body like this:
```
{"status":"success"}
```
The `status` field can be `success` if the server was successfully
registered on the masterserver, `need_challenge` if the masterserver
wants the correct `Challenge-Token` header before the register process
is successful, `need_info` if the server sent an empty body but the
masterserver doesn't actually know the server info.
It can also be `error` if the request was malformed, only in this case
an HTTP status code except `200 OK` is sent.
Synchronization
---------------
The masterserver keeps state and outputs JSON files every second.
```json
{
"servers": [
{
"addresses": [
"tw-0.6+udp://127.0.0.1:8303",
"tw-0.6+udp://[::1]:8303"
],
"info_serial": 0,
"info": {
"max_clients": 64,
"max_players": 64,
"passworded": false,
"game_type": "TestDDraceNetwork",
"name": "My DDNet server",
"map": {
"name": "dm1",
"sha256": "0b0c481d77519c32fbe85624ef16ec0fa9991aec7367ad538bd280f28d8c26cf",
"size": 5805
},
"version": "0.6.4, 16.0.3",
"clients": []
}
}
]
}
```
`servers.json` (or configured by `--out`) is a server list that is
compatible with DDNet 15.5+ clients. It is a JSON object containing a
single key `servers` with a list of game servers. Each game server is
represented by a JSON object with an `addresses` key containing a list
of all known addresses of the server and an `info` key containing the
free-form server info sent by the game server. The free-form `info` JSON
object re-encoded by the master server and thus canonicalized and
stripped of any whitespace characters outside strings.
```json
{
"kind": "mastersrv",
"now": 1816002,
"secrets": {
"tw-0.6+udp://127.0.0.1:8303": {
"ping_time": 1811999,
"secret": "42d8f991-f2fa-46e5-a9ae-ebcc93846feb"
},
"tw-0.6+udp://[::1]:8303": {
"ping_time": 1811999,
"secret": "42d8f991-f2fa-46e5-a9ae-ebcc93846feb"
}
},
"servers": {
"42d8f991-f2fa-46e5-a9ae-ebcc93846feb": {
"info_serial": 0,
"info": {
"max_clients": 64,
"max_players": 64,
"passworded": false,
"game_type": "TestDDraceNetwork",
"name": "My DDNet server",
"map": {
"name": "dm1",
"sha256": "0b0c481d77519c32fbe85624ef16ec0fa9991aec7367ad538bd280f28d8c26cf",
"size": 5805
},
"version": "0.6.4, 16.0.3",
"clients": []
}
}
}
}
```
`--write-dump` outputs a JSON file compatible with `--read-dump-dir`,
this can be used to synchronize servers across different masterservers.
`--read-dump-dir` is also used to ingest servers from the backward
compatibility layer that pings each server for their server info using
the old protocol.
The `kind` field describe that this is `mastersrv` output and not from a
`backcompat`. This is used for prioritizing `mastersrv` information over
`backcompat` information.
The `now` field contains an integer describing the current time in
milliseconds relative an unspecified epoch that is fixed for each JSON
file. This is done instead of using the current time as the epoch for
better compression of non-changing data.
`secrets` is a map from each server address and to a JSON object
containing the last ping time (`ping_time`) in milliseconds relative to
the same epoch as before, and the server secret (`secret`) that is used
to unify server infos from different addresses of the same logical
server.
`servers` is a map from the aforementioned `secret`s to the
corresponding `info_serial` and `info`.
```json
[
"tw-0.6+udp://127.0.0.1:8303",
"tw-0.6+udp://[::1]:8303"
]
```
`--write-addresses` outputs a JSON file containing all addresses
corresponding to servers that are registered to HTTP masterservers. It
does not contain the servers that are obtained via backward
compatibility measures.
This file can be used by an old-style masterserver to also list
new-style servers without the game servers having to register there.
An implementation of this can be found at
https://github.com/heinrich5991/teeworlds/tree/mastersrv_6_backcompat
for Teeworlds 0.5/0.6 masterservers and at
https://github.com/heinrich5991/teeworlds/tree/mastersrv_7_backcompat
for Teeworlds 0.7 masterservers.
All these JSON files can be sent over the network in an efficient way
using https://github.com/heinrich5991/twmaster-collect. It establishes a
zstd-compressed TCP connection authenticated by a string token that is
sent in plain-text. It watches the specified file and transmits it every
time it changes. Due to the zstd-compression, the data sent over the
network is similar to the size of a diff.
Implementation
--------------
The masterserver implementation was done in Rust.
The current gameserver register implementation doesn't support more than
one masterserver for registering.
2022-05-19 20:03:17 +00:00
m a s t e r s e r v e r . h
2017-07-27 14:13:28 +00:00
m e m h e a p . c p p
m e m h e a p . 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
2022-05-15 19:59:17 +00:00
n e t w o r k _ s t u n . c p p
2017-07-27 14:13:28 +00:00
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
2018-07-11 20:46:04 +00:00
s e r v e r i n f o . c p p
s e r v e r i n f o . h
2017-07-27 14:13:28 +00:00
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
2022-05-14 00:03:42 +00:00
s t u n . c p p
s t u n . h
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
2017-10-26 22:42:33 +00:00
v i d e o . c p p
v i d e o . h
2017-07-27 14:13:28 +00:00
w e b s o c k e t s . c p p
w e b s o c k e t s . h
)
2022-06-21 13:26:23 +00:00
set_src ( ENGINE_GFX GLOB src/engine/gfx
i m a g e _ l o a d e r . c p p
i m a g e _ l o a d e r . h
i m a g e _ m a n i p u l a t i o n . c p p
i m a g e _ m a n i p u l a t i o n . h
)
2020-01-19 19:32:54 +00:00
set_src ( GAME_SHARED GLOB src/game
2020-06-30 22:19:17 +00:00
b e z i e r . c p p
b e z i e r . h
2017-07-27 14:13:28 +00:00
c o l l i s i o n . c p p
c o l l i s i o n . h
2021-01-11 21:54:08 +00:00
d d r a c e c h a t . h
2017-07-27 14:13:28 +00:00
d d r a c e c o m m a n d s . 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
2020-05-25 13:19:25 +00:00
p r n g . c p p
p r n g . 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
2022-04-03 00:20:53 +00:00
s r c / g a m e / g e n e r a t e d / p r o t o c o l g l u e . c p p
2020-04-16 08:46:43 +00:00
s r c / g a m e / g e n e r a t e d / p r o t o c o l g l u e . h
s r c / g a m e / g e n e r a t e d / p r o t o c o l 7 . 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 7 . h
2018-10-05 09:20:30 +00:00
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
2020-04-16 08:46:43 +00:00
s r c / g a m e / g e n e r a t e d / p r o t o c o l 7 . h
s r c / g a m e / g e n e r a t e d / p r o t o c o l g l u e . h
2018-03-02 02:42:35 +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-12-23 22:18:56 +00:00
set ( LIBS
$ { C R Y P T O _ L I B R A R I E S }
2021-12-24 11:17:46 +00:00
$ { C U R L _ L I B R A R I E S }
2021-04-21 11:21:25 +00:00
$ { S Q L i t e 3 _ L I B R A R I E S }
2018-12-23 22:18:56 +00:00
$ { W E B S O C K E T S _ L I B R A R I E S }
$ { Z L I B _ L I B R A R I E S }
$ { P L A T F O R M _ L I B S }
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
$ { C M A K E _ T H R E A D _ L I B S _ I N I T }
)
2017-02-23 13:16:32 +00:00
2017-02-23 14:41:42 +00:00
# Targets
2022-06-21 13:26:23 +00:00
add_library ( engine-gfx EXCLUDE_FROM_ALL OBJECT ${ ENGINE_GFX } )
target_include_directories ( engine-gfx PRIVATE ${ PNG_INCLUDE_DIRS } )
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 } )
2022-06-21 13:26:23 +00:00
list ( APPEND TARGETS_OWN engine-gfx engine-shared game-shared )
2017-02-23 13:16:32 +00:00
2021-02-01 11:20:11 +00:00
if ( DISCORD AND NOT DISCORD_DYNAMIC )
2021-01-02 16:10:31 +00:00
add_library ( discord-shared SHARED IMPORTED )
set_target_properties ( discord-shared PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { D I S C O R D S D K _ L I B R A R I E S } "
2021-01-31 09:09:25 +00:00
I M P O R T E D _ I M P L I B " $ { D I S C O R D S D K _ L I B R A R I E S } "
2021-01-02 16:10:31 +00:00
)
endif ( )
2017-02-23 13:16:32 +00:00
2017-02-23 14:41:42 +00:00
########################################################################
# CLIENT
########################################################################
if ( CLIENT )
# Sources
2020-08-20 10:17:44 +00:00
set_src ( STEAMAPI_SRC GLOB_RECURSE src/steam
s t e a m _ a p i _ f l a t . h
s t e a m _ a p i _ s t u b . c p p
)
2020-08-31 10:25:53 +00:00
if ( STEAM OR TARGET_OS STREQUAL "windows" OR TARGET_OS STREQUAL "mac" )
set ( STEAMAPI_KIND SHARED )
else ( )
set ( STEAMAPI_KIND STATIC )
endif ( )
2020-08-20 10:17:44 +00:00
set ( TARGET_STEAMAPI steam_api )
2020-08-31 10:25:53 +00:00
add_library ( ${ TARGET_STEAMAPI } ${ STEAMAPI_KIND } ${ STEAMAPI_SRC } )
2020-08-20 10:17:44 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_STEAMAPI } )
2021-04-30 22:42:37 +00:00
set_src ( ENGINE_CLIENT GLOB_RECURSE src/engine/client
2022-03-20 17:03:25 +00:00
b a c k e n d / b a c k e n d _ b a s e . c p p
b a c k e n d / b a c k e n d _ b a s e . h
2021-05-02 00:52:13 +00:00
b a c k e n d / g l s l _ s h a d e r _ c o m p i l e r . c p p
b a c k e n d / g l s l _ s h a d e r _ c o m p i l e r . h
2022-04-16 10:29:10 +00:00
b a c k e n d / n u l l / b a c k e n d _ n u l l . c p p
b a c k e n d / n u l l / b a c k e n d _ n u l l . h
2021-05-02 00:52:13 +00:00
b a c k e n d / o p e n g l / b a c k e n d _ o p e n g l . c p p
b a c k e n d / o p e n g l / b a c k e n d _ o p e n g l . h
b a c k e n d / o p e n g l / b a c k e n d _ o p e n g l 3 . c p p
b a c k e n d / o p e n g l / b a c k e n d _ o p e n g l 3 . h
b a c k e n d / o p e n g l / o p e n g l _ s l . c p p
b a c k e n d / o p e n g l / o p e n g l _ s l . h
b a c k e n d / o p e n g l / o p e n g l _ s l _ p r o g r a m . c p p
b a c k e n d / o p e n g l / o p e n g l _ s l _ p r o g r a m . h
b a c k e n d / o p e n g l e s / b a c k e n d _ o p e n g l e s . c p p
b a c k e n d / o p e n g l e s / b a c k e n d _ o p e n g l e s 3 . c p p
b a c k e n d / o p e n g l e s / b a c k e n d _ o p e n g l e s 3 . h
b a c k e n d / o p e n g l e s / g l e s _ c l a s s _ d e f i n e s . h
b a c k e n d / o p e n g l e s / o p e n g l e s _ s l . c p p
b a c k e n d / o p e n g l e s / o p e n g l e s _ s l _ p r o g r a m . c p p
2022-03-20 17:04:00 +00:00
b a c k e n d / v u l k a n / b a c k e n d _ v u l k a n . c p p
b a c k e n d / v u l k a n / b a c k e n d _ v u l k a n . h
2017-07-27 14:13:28 +00:00
b a c k e n d _ s d l . c p p
b a c k e n d _ s d l . h
2020-11-06 17:18:55 +00:00
b l o c k l i s t _ d r i v e r . c p p
b l o c k l i s t _ d r i v e r . h
2022-01-31 02:11:47 +00:00
c h e c k s u m . h
2017-07-27 14:13:28 +00:00
c l i e n t . c p p
c l i e n t . h
2019-06-02 13:34:01 +00:00
d e m o e d i t . c p p
d e m o e d i t . h
2021-01-17 23:52:58 +00:00
d i s c o r d . c p p
2022-05-23 18:16:18 +00:00
f a v o r i t e s . c p p
2017-07-27 14:13:28 +00:00
f r i e n d s . c p p
f r i e n d s . h
2020-10-10 21:01:57 +00:00
g h o s t . c p p
g h o s t . h
2021-05-01 21:33:42 +00:00
g r a p h i c s _ d e f i n e s . h
2017-07-27 14:13:28 +00:00
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
2020-04-14 15:53:53 +00:00
n o t i f i c a t i o n s . c p p
n o t i f i c a t i o n s . 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
2018-07-11 20:46:04 +00:00
s e r v e r b r o w s e r _ h t t p . c p p
s e r v e r b r o w s e r _ h t t p . h
2021-04-17 14:05:24 +00:00
s e r v e r b r o w s e r _ p i n g _ c a c h e . c p p
s e r v e r b r o w s e r _ p i n g _ c a c h e . h
2017-07-27 14:13:28 +00:00
s o u n d . c p p
s o u n d . h
2021-04-21 11:21:25 +00:00
s q l i t e . c p p
2020-08-20 10:17:44 +00:00
s t e a m . c p p
2017-07-27 14:13:28 +00:00
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
2017-10-26 22:42:33 +00:00
v i d e o . c p p
v i d e o . h
2017-07-27 14:13:28 +00:00
)
2020-01-19 19:32:54 +00:00
set_src ( GAME_CLIENT GLOB_RECURSE src/game/client
2017-07-27 14:13:28 +00:00
a n i m s t a t e . c p p
a n i m s t a t e . h
2021-07-12 09:29:59 +00:00
c o m p o n e n t . c p p
2017-07-27 14:13:28 +00:00
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
2022-03-25 11:54:11 +00:00
c o m p o n e n t s / f r e e z e b a r s . c p p
c o m p o n e n t s / f r e e z e b a r s . h
2017-07-27 14:13:28 +00:00
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
2020-09-18 16:45:42 +00:00
c o m p o n e n t s / m e n u _ b a c k g r o u n d . c p p
c o m p o n e n t s / m e n u _ b a c k g r o u n d . h
2017-07-27 14:13:28 +00:00
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
2020-09-26 07:37:35 +00:00
c o m p o n e n t s / m e n u s _ s e t t i n g s _ a s s e t s . c p p
2020-09-03 12:08:26 +00:00
c o m p o n e n t s / m e n u s _ s t a r t . c p p
2017-07-27 14:13:28 +00:00
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
2022-04-18 07:34:05 +00:00
c o m p o n e n t s / t o o l t i p s . c p p
c o m p o n e n t s / t o o l t i p s . h
2017-07-27 14:13:28 +00:00
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
2022-09-14 22:49:40 +00:00
l a s e r _ d a t a . c p p
l a s e r _ d a t a . h
2017-07-27 14:13:28 +00:00
l i n e i n p u t . c p p
l i n e i n p u t . h
2019-04-11 22:46:54 +00:00
p r e d i c t i o n / e n t i t i e s / c h a r a c t e r . c p p
p r e d i c t i o n / e n t i t i e s / c h a r a c t e r . h
p r e d i c t i o n / e n t i t i e s / l a s e r . c p p
p r e d i c t i o n / e n t i t i e s / l a s e r . h
p r e d i c t i o n / e n t i t i e s / p i c k u p . c p p
p r e d i c t i o n / e n t i t i e s / p i c k u p . h
p r e d i c t i o n / e n t i t i e s / p r o j e c t i l e . c p p
p r e d i c t i o n / e n t i t i e s / p r o j e c t i l e . h
p r e d i c t i o n / e n t i t y . c p p
p r e d i c t i o n / e n t i t y . h
p r e d i c t i o n / g a m e w o r l d . c p p
p r e d i c t i o n / g a m e w o r l d . h
2021-01-17 16:18:08 +00:00
p r o j e c t i l e _ d a t a . c p p
p r o j e c t i l e _ d a t a . 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
2020-10-09 07:07:05 +00:00
s k i n . h
2017-07-27 14:13:28 +00:00
u i . c p p
u i . h
2022-07-08 15:56:06 +00:00
u i _ r e c t . c p p
u i _ r e c t . h
2022-08-13 11:58:11 +00:00
u i _ s c r o l l r e g i o n . c p p
u i _ s c r o l l r e g i o n . h
2017-07-27 14:13:28 +00:00
)
2020-01-19 19:32:54 +00:00
set_src ( GAME_EDITOR GLOB src/game/editor
2017-07-27 14:13:28 +00:00
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
2019-04-08 17:39:55 +00:00
e x p l a n a t i o n s . c p p
2017-07-27 14:13:28 +00:00
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
2022-01-31 02:11:47 +00:00
s r c / g a m e / g e n e r a t e d / c h e c k s u m . c p p
2017-07-27 14:13:28 +00:00
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
2020-10-09 07:07:05 +00:00
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 7 . 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 7 . h
2017-07-27 14:13:28 +00:00
)
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
2022-06-11 07:09:42 +00:00
set ( DEPS_CLIENT ${ DEPS } ${ GLEW_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 }
2022-06-11 07:09:42 +00:00
$ { P N G _ 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-10-26 22:42:33 +00:00
$ { F F M P E G _ 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 }
2022-03-20 17:04:00 +00:00
$ { V U L K A N _ L I B R A R I E S }
2020-08-20 10:17:44 +00:00
$ { T A R G E T _ S T E A M A P I }
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 }
2018-12-23 22:13:41 +00:00
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
$ { C M A K E _ T H R E A D _ L I B S _ I N I T }
2017-02-23 14:41:42 +00:00
)
2017-02-23 13:16:32 +00:00
2021-01-02 16:10:31 +00:00
if ( DISCORD )
2021-02-01 11:20:11 +00:00
if ( NOT DISCORD_DYNAMIC )
list ( APPEND LIBS_CLIENT discord-shared )
else ( )
list ( APPEND LIBS_CLIENT ${ CMAKE_DL_LIBS } )
endif ( )
2021-01-02 16:10:31 +00:00
endif ( )
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" )
2020-08-29 12:51:14 +00:00
set_target_properties ( ${ TARGET_STEAMAPI } PROPERTIES PREFIX "" )
2018-05-09 20:06:52 +00:00
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 } )
2021-08-24 10:18:20 +00:00
if ( TARGET_OS STREQUAL "android" )
add_library ( ${ TARGET_CLIENT } SHARED
$ { C L I E N T _ S R C }
$ { C L I E N T _ I C O N }
$ { C L I E N T _ M A N I F E S T }
$ { D E P S _ C L I E N T }
2022-06-21 13:26:23 +00:00
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
2021-08-24 10:18:20 +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 >
)
else ( )
add_executable ( ${ TARGET_CLIENT } WIN32
$ { C L I E N T _ S R C }
$ { C L I E N T _ I C O N }
$ { C L I E N T _ M A N I F E S T }
$ { D E P S _ C L I E N T }
2022-06-21 13:26:23 +00:00
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
2021-08-24 10:18:20 +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 >
)
endif ( )
2017-03-01 12:40:11 +00:00
target_link_libraries ( ${ TARGET_CLIENT } ${ LIBS_CLIENT } )
2017-02-23 14:41:42 +00:00
2021-03-05 16:36:20 +00:00
if ( MSVC )
target_link_options ( ${ TARGET_CLIENT } PRIVATE /ENTRY:mainCRTStartup )
endif ( )
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ TARGET_CLIENT } SYSTEM PRIVATE
2017-02-28 23:51:22 +00:00
$ { 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 }
2022-06-11 07:09:42 +00:00
$ { P N G _ 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-10-26 22:42:33 +00:00
$ { F F M P E G _ I N C L U D E _ D I R S }
2021-01-02 16:10:31 +00:00
$ { D I S C O R D S D K _ I N C L U D E _ D I R S }
2020-04-14 15:53:53 +00:00
2022-03-20 17:04:00 +00:00
$ { V U L K A N _ I N C L U D E _ D I R S }
2020-04-14 15:53:53 +00:00
$ { P L A T F O R M _ C L I E N T _ 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
2021-02-01 11:20:11 +00:00
if ( STEAMAPI_KIND STREQUAL SHARED OR DISCORD_DYNAMIC )
2020-08-31 10:25:53 +00:00
set_own_rpath ( ${ TARGET_CLIENT } )
endif ( )
2020-06-23 13:25:53 +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 )
2020-04-11 11:17:14 +00:00
check_symbol_exists ( WavpackCloseFile wavpack.h WAVPACK_CLOSE_FILE )
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 ( )
2020-04-11 11:17:14 +00:00
if ( WAVPACK_CLOSE_FILE )
2022-06-21 10:17:15 +00:00
target_compile_definitions ( ${ TARGET_CLIENT } PRIVATE CONF_WAVPACK_CLOSE_FILE )
2020-04-11 11:17:14 +00:00
endif ( )
2021-08-23 10:31:41 +00:00
if ( GLEW_BUNDLED )
2022-06-21 10:17:15 +00:00
target_compile_definitions ( ${ TARGET_CLIENT } PRIVATE CONF_GLEW_HAS_CONTEXT_INIT )
2021-08-23 10:31:41 +00:00
endif ( )
2022-03-20 17:04:00 +00:00
if ( VULKAN )
2022-06-21 10:17:15 +00:00
target_compile_definitions ( ${ TARGET_CLIENT } PRIVATE CONF_BACKEND_VULKAN )
2022-03-20 17:04:00 +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
########################################################################
2021-08-24 10:18:20 +00:00
if ( SERVER )
# Sources
set_src ( ANTIBOT_SRC GLOB src/antibot
a n t i b o t _ d a t a . h
a n t i b o t _ i n t e r f a c e . h
a n t i b o t _ n u l l . c p p
)
2017-02-23 14:41:42 +00:00
2021-08-24 10:18:20 +00:00
set_src ( ENGINE_SERVER GLOB_RECURSE src/engine/server
a n t i b o t . c p p
a n t i b o t . h
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
d a t a b a s e s / c o n n e c t i o n . c p p
d a t a b a s e s / c o n n e c t i o n . h
d a t a b a s e s / c o n n e c t i o n _ p o o l . c p p
d a t a b a s e s / c o n n e c t i o n _ p o o l . h
d a t a b a s e s / m y s q l . c p p
d a t a b a s e s / s q l i t e . c p p
2022-05-26 23:17:01 +00:00
m a i n . c p p
2021-08-24 10:18:20 +00:00
n a m e _ b a n . c p p
n a m e _ b a n . h
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
2022-05-26 23:17:01 +00:00
s e r v e r _ l o g g e r . c p p
s e r v e r _ l o g g e r . h
2021-08-24 10:18:20 +00:00
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
u p n p . c p p
u p n p . h
)
set_src ( GAME_SERVER GLOB_RECURSE src/game/server
a l l o c . h
d d r a c e c h a t . c p p
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
2022-05-02 18:31:17 +00:00
e n t i t i e s / d r a g g e r _ b e a m . c p p
e n t i t i e s / d r a g g e r _ b e a m . h
2021-08-24 10:18:20 +00:00
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 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 . c p p
s c o r e . h
2021-11-24 12:09:07 +00:00
s c o r e w o r k e r . c p p
s c o r e w o r k e r . h
2021-08-24 10:18:20 +00:00
t e a m s . c p p
t e a m s . h
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
t e e i n f o . c p p
t e e i n f o . h
)
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 "
" s r c / g a m e / g e n e r a t e d / w o r d l i s t . h "
)
set ( SERVER_SRC ${ ENGINE_SERVER } ${ GAME_SERVER } ${ GAME_GENERATED_SERVER } )
if ( TARGET_OS STREQUAL "windows" )
set ( SERVER_ICON "other/icons/DDNet-Server.rc" )
else ( )
set ( SERVER_ICON )
endif ( )
2020-03-11 00:58:50 +00:00
2021-08-24 10:18:20 +00:00
# Antibot
if ( ANTIBOT )
set ( TARGET_ANTIBOT antibot )
add_library ( ${ TARGET_ANTIBOT } SHARED ${ ANTIBOT_SRC } )
list ( APPEND TARGETS_OWN ${ TARGET_ANTIBOT } )
endif ( )
2017-03-01 12:40:11 +00:00
2021-08-24 10:18:20 +00:00
# Libraries
set ( LIBS_SERVER
$ { L I B S }
$ { M Y S Q L _ L I B R A R I E S }
$ { T A R G E T _ A N T I B O T }
$ { M I N I U P N P C _ L I B R A R I E S }
# Add pthreads (on non-Windows) at the end, so that other libraries can depend
# on it.
$ { C M A K E _ T H R E A D _ L I B S _ I N I T }
)
2017-02-23 14:41:42 +00:00
2021-08-24 10:18:20 +00:00
# Target
set ( TARGET_SERVER ${ SERVER_EXECUTABLE } )
add_executable ( ${ TARGET_SERVER }
$ { D E P S }
$ { S E R V E R _ S R C }
$ { S E R V E R _ I C O N }
$ < 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 } )
2022-06-11 07:09:42 +00:00
target_include_directories ( ${ TARGET_SERVER } PRIVATE ${ PNG_INCLUDE_DIRS } )
2021-08-24 10:18:20 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_SERVER } )
list ( APPEND TARGETS_LINK ${ TARGET_SERVER } )
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
2022-05-19 09:14:45 +00:00
set ( SERVER_LAUNCHER_SRC src/macos/server.mm )
2021-08-24 10:18:20 +00:00
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-11-17 13:37:29 +00:00
endif ( )
2017-03-01 12:40:11 +00:00
########################################################################
# VARIOUS TARGETS
########################################################################
2021-08-24 10:18:20 +00:00
if ( TOOLS )
set ( TARGETS_TOOLS )
2022-01-26 22:17:56 +00:00
set_src ( TOOLS_SRC GLOB src/tools
2021-08-24 10:18:20 +00:00
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 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
m a p _ c o n v e r t _ 0 7 . c p p
2022-08-23 16:12:15 +00:00
m a p _ c r e a t e _ p i x e l a r t . c p p
2021-08-24 10:18:20 +00:00
m a p _ d i f f . c p p
m a p _ e x t r a c t . c p p
2022-08-13 16:55:33 +00:00
m a p _ f i n d _ e n v . c p p
2021-08-24 10:18:20 +00:00
m a p _ o p t i m i z e . c p p
2022-03-16 18:03:28 +00:00
m a p _ r e p l a c e _ a r e a . c p p
2021-08-24 10:18:20 +00:00
m a p _ r e p l a c e _ i m a g e . c p p
m a p _ r e s a v e . c p p
p a c k e t g e n . c p p
2022-05-14 00:03:42 +00:00
s t u n . c p p
2022-06-24 23:28:05 +00:00
t w p i n g . c p p
2021-08-24 10:18:20 +00:00
u n i c o d e _ c o n f u s a b l e s . c p p
u u i d . c p p
)
2022-01-26 22:17:56 +00:00
foreach ( ABS_T ${ TOOLS_SRC } )
2021-08-24 10:18:20 +00:00
file ( RELATIVE_PATH T "${PROJECT_SOURCE_DIR}/src/tools/" ${ ABS_T } )
if ( T MATCHES "\\.cpp$" )
string ( REGEX REPLACE "\\.cpp$" "" TOOL "${T}" )
set ( TOOL_DEPS ${ DEPS } )
set ( TOOL_LIBS ${ LIBS } )
2022-08-23 16:12:15 +00:00
if ( TOOL MATCHES "^(dilate|map_convert_07|map_create_pixelart|map_optimize|map_extract|map_replace_image)$" )
2022-06-11 07:09:42 +00:00
list ( APPEND TOOL_INCLUDE_DIRS ${ PNG_INCLUDE_DIRS } )
2022-06-21 13:26:23 +00:00
list ( APPEND TOOL_DEPS $< TARGET_OBJECTS:engine-gfx > )
list ( APPEND TOOL_LIBS ${ PNG_LIBRARIES } )
2021-08-24 10:18:20 +00:00
endif ( )
if ( TOOL MATCHES "^config_" )
list ( APPEND EXTRA_TOOL_SRC "src/tools/config_common.h" )
endif ( )
set ( EXCLUDE_FROM_ALL )
if ( DEV )
set ( EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL )
endif ( )
add_executable ( ${ TOOL } ${ EXCLUDE_FROM_ALL }
$ { T O O L _ D E P S }
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 >
)
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ TOOL } SYSTEM PRIVATE ${ TOOL_INCLUDE_DIRS } )
2021-08-24 10:18:20 +00:00
target_link_libraries ( ${ TOOL } ${ TOOL_LIBS } )
list ( APPEND TARGETS_TOOLS ${ TOOL } )
2017-08-01 19:55:49 +00:00
endif ( )
2021-08-24 10:18:20 +00:00
endforeach ( )
2017-03-01 14:49:22 +00:00
2021-08-24 10:18:20 +00:00
list ( APPEND TARGETS_OWN ${ TARGETS_TOOLS } )
list ( APPEND TARGETS_LINK ${ TARGETS_TOOLS } )
2017-03-03 14:23:18 +00:00
2021-08-24 10:18:20 +00:00
add_custom_target ( tools DEPENDS ${ TARGETS_TOOLS } )
endif ( )
2017-03-03 14:04:13 +00:00
add_custom_target ( everything DEPENDS ${ TARGETS_OWN } )
2017-03-03 12:29:35 +00:00
2022-01-31 02:11:47 +00:00
########################################################################
# CHECKSUM
########################################################################
if ( DEV )
# Only do minimal checksumming in a DEV build.
set ( CHECKSUM_SRC )
endif ( )
list ( APPEND CHECKSUM_SRC
$ { P R O J E C T _ S O U R C E _ D I R } / C M a k e L i s t s . t x t
$ { P R O J E C T _ S O U R C E _ D I R } / s c r i p t s / c h e c k s u m . p y
)
configure_file ( cmake/checksummed_extra.txt checksummed_extra.txt )
string ( REPLACE ";" "\n" CHECKSUM_SRC_FILE "${CHECKSUM_SRC}" )
file ( WRITE ${ PROJECT_BINARY_DIR } /checksummed_files.txt ${ CHECKSUM_SRC_FILE } )
add_custom_command ( OUTPUT ${ PROJECT_BINARY_DIR } /src/game/generated/checksum.cpp
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
s c r i p t s / c h e c k s u m . p y
$ { P R O J E C T _ B I N A R Y _ D I R } / c h e c k s u m m e d _ f i l e s . t x t
$ { P R O J E C T _ B I N A R Y _ D I R } / c h e c k s u m m e d _ e x t r a . t x t
> $ { 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 / c h e c k s u m . 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 }
D E P E N D S
$ { C H E C K S U M _ S R C }
$ { P R O J E C T _ B I N A R Y _ D I R } / c h e c k s u m m e d _ f i l e s . t x t
$ { P R O J E C T _ B I N A R Y _ D I R } / c h e c k s u m m e d _ e x t r a . t x t
s c r i p t s / c h e c k s u m . p y
)
2017-08-30 19:57:55 +00:00
########################################################################
# TESTS
########################################################################
2017-10-15 07:57:21 +00:00
if ( GTEST_FOUND OR DOWNLOAD_GTEST )
2020-01-19 19:32:54 +00:00
set_src ( TESTS GLOB src/test
2017-10-13 00:48:42 +00:00
a i o . c p p
2020-07-02 09:07:30 +00:00
b e z i e r . c p p
2020-11-06 17:18:55 +00:00
b l o c k l i s t _ d r i v e r . c p p
2021-12-31 12:18:41 +00:00
b y t e s _ b e . c p p
2019-04-24 20:47:03 +00:00
c o l o r . c p p
2021-12-27 13:08:29 +00:00
c o m p r e s s i o n . c p p
2020-06-22 20:16:58 +00:00
c s v . 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
2021-12-17 20:56:31 +00:00
i o . 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
2021-04-17 14:03:12 +00:00
n e t a d d r . c p p
2022-01-27 01:35:08 +00:00
o s . c p p
2020-09-03 16:50:23 +00:00
p a c k e r . c p p
2020-05-25 13:19:25 +00:00
p r n g . c p p
2021-11-24 12:09:07 +00:00
s c o r e . c p p
2021-03-13 15:52:35 +00:00
s e c u r e _ r a n d o m . c p p
2021-04-17 14:05:24 +00:00
s e r v e r b r o w s e r . c p p
2018-07-11 20:46:04 +00:00
s e r v e r i n f o . 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
2021-01-22 20:04:18 +00:00
u u i d . c p p
2017-09-28 00:03:30 +00:00
)
set ( TESTS_EXTRA
2020-11-06 17:18:55 +00:00
s r c / e n g i n e / c l i e n t / b l o c k l i s t _ d r i v e r . c p p
s r c / e n g i n e / c l i e n t / b l o c k l i s t _ d r i v e r . h
2018-07-11 20:46:04 +00:00
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r . c p p
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r . h
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r _ h t t p . c p p
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r _ h t t p . h
2021-04-17 14:05:24 +00:00
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r _ p i n g _ c a c h e . c p p
s r c / e n g i n e / c l i e n t / s e r v e r b r o w s e r _ p i n g _ c a c h e . h
2021-04-21 11:21:25 +00:00
s r c / e n g i n e / c l i e n t / s q l i t e . c p p
2021-11-24 12:09:07 +00:00
s r c / e n g i n e / s e r v e r / d a t a b a s e s / c o n n e c t i o n . c p p
s r c / e n g i n e / s e r v e r / d a t a b a s e s / c o n n e c t i o n . h
s r c / e n g i n e / s e r v e r / d a t a b a s e s / s q l i t e . c p p
2021-11-28 00:29:38 +00:00
s r c / e n g i n e / s e r v e r / d a t a b a s e s / m y s q l . c p p
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
2021-11-24 12:09:07 +00:00
s r c / e n g i n e / s e r v e r / s q l _ s t r i n g _ h e l p e r s . c p p
s r c / e n g i n e / s e r v e r / s q l _ s t r i n g _ h e l p e r s . 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
2021-11-24 12:09:07 +00:00
s r c / g a m e / s e r v e r / s c o r e w o r k e r . c p p
s r c / g a m e / s e r v e r / s c o r e w o r k e r . 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 }
2022-06-21 13:26:23 +00:00
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
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
)
2022-06-21 13:26:23 +00:00
target_link_libraries ( ${ TARGET_TESTRUNNER } ${ LIBS } ${ MYSQL_LIBRARIES } ${ PNG_LIBRARIES } ${ GTEST_LIBRARIES } )
2021-12-24 11:17:46 +00:00
target_include_directories ( ${ TARGET_TESTRUNNER } SYSTEM PRIVATE ${ GTEST_INCLUDE_DIRS } )
2017-08-30 19:57:55 +00:00
list ( APPEND TARGETS_OWN ${ TARGET_TESTRUNNER } )
list ( APPEND TARGETS_LINK ${ TARGET_TESTRUNNER } )
add_custom_target ( run_tests
2019-01-06 06:16:53 +00:00
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 } > $ { T E S T R U N N E R _ A R G S }
2022-06-06 09:55:30 +00:00
C O M M E N T R u n n i n g u n i t t e s t s
2017-08-30 19:57:55 +00:00
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 ( )
2022-06-06 09:55:30 +00:00
add_custom_target ( run_integration_tests
C O M M A N D $ { P R O J E C T _ B I N A R Y _ D I R } / i n t e g r a t i o n _ t e s t . s h $ { I N T E G R A T I O N T E S T R U N N E R _ A R G S }
C O M M E N T R u n n i n g i n t e g r a t i o n t e s t s
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 }
U S E S _ T E R M I N A L
)
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 )
2021-12-17 15:05:00 +00:00
if ( TARGET_OS STREQUAL "mac" )
set ( CPACK_STRIP_FILES FALSE )
else ( )
set ( CPACK_STRIP_FILES TRUE )
endif ( )
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 } )
2020-09-24 15:06:03 +00:00
set ( CPACK_PACKAGE_VERSION ${ VERSION } )
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" )
2018-12-23 03:43:12 +00:00
# Let compiler tell its arch
# Both gcc and clang support -dumpmachine
execute_process (
C O M M A N D $ { C M A K E _ C _ C O M P I L E R } - d u m p m a c h i n e
O U T P U T _ V A R I A B L E A R C H I T E C T U R E _ T U P L E
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
)
if ( NOT ARCHITECTURE_TUPLE )
# If you're really using a weird compiler, then assume Intel here.
message ( WARNING "Your compiler doesn't support -dumpmachine, this is weird" )
if ( TARGET_BITS EQUAL 32 )
set ( ARCHITECTURE "x86" )
elseif ( TARGET_BITS EQUAL 64 )
set ( ARCHITECTURE "x86_64" )
endif ( )
else ( )
string ( REGEX MATCH "^[^-]*" ARCHITECTURE "${ARCHITECTURE_TUPLE}" )
if ( ARCHITECTURE MATCHES "i.86" )
set ( ARCHITECTURE "x86" )
endif ( )
2017-08-01 19:55:49 +00:00
endif ( )
2018-12-23 03:43:12 +00:00
set ( CPACK_SYSTEM_NAME "linux_${ARCHITECTURE}" )
2017-08-01 19:55:49 +00:00
elseif ( TARGET_OS STREQUAL "mac" )
2021-12-04 12:26:12 +00:00
set ( CPACK_SYSTEM_NAME "macos" )
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
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
2022-06-06 09:55:30 +00:00
l s a n . s u p p
m e m c h e c k . s u p p
2017-08-01 19:55:49 +00:00
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
2022-06-06 09:55:30 +00:00
u b s a n . s u p p
v a l g r i n d . s u p p
2017-08-01 19:55:49 +00:00
)
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 } )
2021-08-24 10:18:20 +00:00
if ( TOOLS )
set ( TARGET_TOOLS
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 _ c o n v e r t _ 0 7
m a p _ d i f f
m a p _ e x t r a c t
)
else ( )
set ( TARGET_TOOLS )
endif ( )
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 }
2021-08-24 10:18:20 +00:00
$ { T A R G E T _ T O O L S }
2017-09-05 14:00:50 +00:00
)
2020-09-01 13:23:56 +00:00
if ( STEAMAPI_KIND STREQUAL SHARED )
2020-08-31 10:25:53 +00:00
list ( APPEND CPACK_TARGETS ${ TARGET_STEAMAPI } )
endif ( )
2021-12-14 23:58:35 +00:00
set ( CPACK_DIRS
d a t a
$ { C O P Y _ D I R S }
)
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
$ { C O P Y _ F I L E S }
)
2022-03-20 17:04:00 +00:00
set ( CPACK_GEN_FILES
$ { V U L K A N _ S H A D E R _ F I L E _ L I S T }
)
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 )
2021-12-21 16:19:42 +00:00
else ( )
list ( APPEND CPACK_FILES other/config_directory.sh )
2017-09-05 14:00:50 +00:00
endif ( )
2018-08-26 19:44:31 +00:00
if ( NOT DEV )
2019-12-06 10:13:18 +00:00
include ( GNUInstallDirs )
install ( DIRECTORY data DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /ddnet COMPONENT data )
install ( TARGETS ${ TARGET_CLIENT } DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT client )
2020-09-01 13:23:56 +00:00
if ( STEAMAPI_KIND STREQUAL SHARED )
2020-08-31 10:25:53 +00:00
install ( TARGETS ${ TARGET_STEAMAPI } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT client )
endif ( )
2019-12-06 10:13:18 +00:00
install ( TARGETS ${ TARGET_SERVER } DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT server )
2020-04-12 15:03:49 +00:00
if ( ANTIBOT )
2020-08-20 10:17:44 +00:00
install ( TARGETS ${ TARGET_ANTIBOT } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT server )
2020-04-12 15:03:49 +00:00
endif ( )
2019-12-06 10:13:18 +00:00
install ( TARGETS ${ TARGETS_TOOLS } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT tools )
install ( FILES other/ddnet.desktop DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /applications COMPONENT client )
2019-12-31 07:00:41 +00:00
install ( FILES other/ddnet.appdata.xml DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /metainfo COMPONENT client )
2022-01-25 14:24:57 +00:00
foreach ( SIZE 16 32 48 256 )
2019-12-06 10:13:18 +00:00
install ( FILES other/icons/DDNet_ ${ SIZE } x ${ SIZE } x32.png DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /icons/hicolor/ ${ SIZE } x ${ SIZE } /apps RENAME ddnet.png COMPONENT client )
2021-12-27 22:23:38 +00:00
install ( FILES other/icons/DDNet-Server_ ${ SIZE } x ${ SIZE } x32.png DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /icons/hicolor/ ${ SIZE } x ${ SIZE } /apps RENAME ddnet-server.png COMPONENT server )
2019-05-23 14:28:25 +00:00
endforeach ( )
2022-03-20 17:04:00 +00:00
foreach ( file ${ VULKAN_SHADER_FILE_LIST } )
install ( FILES ${ PROJECT_BINARY_DIR } / ${ file } DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /ddnet/data/shader/vulkan COMPONENT client )
endforeach ( )
2018-08-26 19:44:31 +00:00
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 } )
2022-03-20 17:04:00 +00:00
set ( CPACK_FILES_TMP ${ CPACK_FILES } ${ CPACK_GEN_FILES } )
install ( FILES ${ CPACK_FILES_TMP } ${ EXTRA_ARGS } )
2017-08-01 19:55:49 +00:00
endif ( )
2017-11-17 21:32:56 +00:00
set ( PACKAGE_TARGETS )
2021-12-25 21:37:11 +00:00
if ( CLIENT AND DMGBUILD )
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
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 ( )
2021-12-14 14:12:48 +00:00
2021-12-27 11:05:38 +00:00
set ( TARGET_TOOLS_FILES )
foreach ( target ${ TARGET_TOOLS } )
list ( APPEND TARGET_TOOLS_FILES $< TARGET_FILE:${target} > )
endforeach ( )
2017-11-08 23:16:52 +00:00
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 /
2021-12-27 11:05:38 +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 } > $ { T A R G E T _ T O O L S _ F I L E 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 / M a c O S /
2021-12-19 11:48:01 +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 d n e t - l i b s / s d l / $ { L I B _ D I R } / 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
2022-06-22 16:43: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 $ { 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 / d i s c o r d / $ { L I B _ D I R } / d i s c o r d _ g a m e _ s d k . 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 /
2021-12-14 14:12:48 +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 $ { 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 / $ { L I B _ D I R } / 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 /
2022-08-22 08:35:31 +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 $ { 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 / p n g / $ { L I B _ D I R } / l i b p n g 1 6 . 1 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 /
2022-02-07 00:06:19 +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 $ { 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 f m p e g / $ { L I B _ D I R } / l i b a v c o d e c . 5 9 . 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 /
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 f m p e g / $ { L I B _ D I R } / l i b a v f o r m a t . 5 9 . 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 /
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 f m p e g / $ { L I B _ D I R } / l i b a v u t i l . 5 7 . 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 /
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 f m p e g / $ { L I B _ D I R } / l i b s w r e s a m p l e . 4 . 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 /
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 f m p e g / $ { L I B _ D I R } / l i b s w s c a l 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 /
2020-08-25 20:41:13 +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 $ { P R O J E C T _ B I N A R Y _ D I R } / l i b s t e a m _ a p i . 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 /
2020-04-15 15:31:33 +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 a r w i n _ s t r i p _ r p a t h . p y $ { C M A K E _ O T O O L } $ { C M A K E _ I N S T A L L _ N A M E _ T O O L } $ { 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 }
2020-04-13 08:46:30 +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 } - a d d _ r p a t h @ l o a d e r _ p a t h / . . / F r a m e w o r k 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 / 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 /
2020-08-25 20:41:13 +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 a r w i n _ s t r i p _ r p a t h . p y $ { C M A K E _ O T O O L } $ { C M A K E _ I N S T A L L _ N A M E _ T O O L } $ { 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 / $ { T A R G E T _ S E R V E R }
2021-12-25 18:05:15 +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 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 / $ { T A R G E T _ S E R V E R } $ { 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 _ S E R V E R }
2017-11-16 09:28:55 +00:00
# DMG
2021-12-26 23:34:37 +00:00
C O M M A N D d m g b u i l d - s $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / d m g s e t t i n g s . p y - D 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 - D s e r v 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 - D b a c k g r o u n d = $ { P R O J E C T _ S O U R C E _ D I R } / o t h e r / d m g b a c k g r o u n d . p n g " $ { C P A C K _ P A C K A G E _ N A M E } $ { C P A C K _ P A C K A G E _ V E R S I O N } " $ { C P A C K _ P A C K A G E _ F I L E _ N A M E } . d m g
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 }
2020-08-25 20:41:13 +00:00
$ { T A R G E T _ S T E A M A P I }
2017-11-17 21:32:44 +00:00
$ { 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
2021-12-26 23:34:37 +00:00
o t h e r / d m g b a c k g r o u n d . p n g
o t h e r / d m g s e t t i n g s . p y
2017-11-17 21:32:44 +00:00
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
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 ( )
2022-03-20 17:04:00 +00:00
foreach ( file ${ CPACK_GEN_FILES } )
list ( APPEND COPY_FILE_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy ${ PROJECT_BINARY_DIR } / ${ file } ${ TMPDIR } / ${ file } )
endforeach ( )
2017-11-09 12:35:59 +00:00
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 } / )
2021-12-17 15:05:00 +00:00
if ( NOT TARGET_OS STREQUAL "mac" )
list ( APPEND STRIP_TARGET_COMMANDS COMMAND strip -s ${ TMPDIR } / $< TARGET_FILE_NAME:${target} > )
endif ( )
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 )
2022-03-20 17:04:00 +00:00
unset ( CPACK_GEN_FILES )
2017-09-05 14:00:50 +00:00
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
2020-08-20 10:17:44 +00:00
if ( ANTIBOT )
2020-12-09 09:17:11 +00:00
# Allow the antibot library to use functions from the server binary.
2022-05-22 10:16:03 +00:00
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_LINK -rdynamic )
2020-08-20 10:17:44 +00:00
set_own_rpath ( ${ TARGET_SERVER } )
endif ( )
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.
2022-02-15 14:01:02 +00:00
target_compile_options ( ${ target } PRIVATE /utf-8 ) # Use UTF-8 for source files.
2017-03-03 14:04:13 +00:00
endif ( )
2020-09-08 12:13:24 +00:00
if ( OUR_FLAGS_LINK )
target_link_libraries ( ${ target } ${ OUR_FLAGS_LINK } )
endif ( )
2018-01-22 18:10:57 +00:00
if ( OUR_FLAGS )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS } )
endif ( )
if ( DEFINE_FORTIFY_SOURCE )
2019-12-17 21:04:21 +00:00
if ( MINGW )
target_compile_definitions ( ${ target } PRIVATE $< $<NOT:$<CONFIG:Debug > >:_FORTIFY_SOURCE=0> ) # Currently broken in MinGW, see https://sourceforge.net/p/mingw-w64/discussion/723798/thread/b9d24f041f/
else ( )
target_compile_definitions ( ${ target } PRIVATE $< $<NOT:$<CONFIG:Debug > >:_FORTIFY_SOURCE=2> ) # Detect some buffer overflows.
endif ( )
2017-07-26 02:30:56 +00:00
endif ( )
2022-05-07 09:23:29 +00:00
if ( ENABLE_IPO )
set_property ( TARGET ${ target } PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE )
endif ( )
2017-07-26 02:30:56 +00:00
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++ )
2021-10-03 08:42:02 +00:00
target_link_libraries ( ${ target } "-framework SystemConfiguration" ) # Required by curl 7.79.0
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 } )
2022-03-30 13:16:19 +00:00
if ( ( CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1 ) )
2022-02-14 16:31:50 +00:00
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD 17 )
2018-01-14 13:36:25 +00:00
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD_REQUIRED ON )
2022-05-28 12:46:53 +00:00
set_property ( TARGET ${ target } PROPERTY CXX_EXTENSIONS OFF )
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 ( )
2021-11-20 11:39:52 +00:00
if ( TARGET_OS STREQUAL "windows" )
2022-05-31 15:26:35 +00:00
target_compile_definitions ( ${ target } PRIVATE NOMINMAX ) # windows.h shouldn't define min/max macros
2021-11-20 11:39:52 +00:00
target_compile_definitions ( ${ target } PRIVATE UNICODE ) # Windows headers
target_compile_definitions ( ${ target } PRIVATE _UNICODE ) # C-runtime
endif ( )
2018-01-22 18:10:57 +00:00
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> )
2021-12-24 11:17:46 +00:00
target_include_directories ( ${ target } SYSTEM PRIVATE ${ CURL_INCLUDE_DIRS } ${ SQLite3_INCLUDE_DIRS } ${ 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 )
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ target } SYSTEM PRIVATE ${ CRYPTO_INCLUDE_DIRS } )
2018-06-05 19:22:40 +00:00
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 )
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ target } SYSTEM PRIVATE ${ WEBSOCKETS_INCLUDE_DIRS } )
2017-03-03 14:04:13 +00:00
endif ( )
2020-04-14 10:11:50 +00:00
if ( UPNP )
target_compile_definitions ( ${ target } PRIVATE CONF_UPNP )
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ target } SYSTEM PRIVATE ${ MINIUPNPC_INCLUDE_DIRS } )
2020-04-14 10:11:50 +00:00
endif ( )
2020-01-01 15:56:48 +00:00
if ( VIDEORECORDER )
2017-10-26 22:42:33 +00:00
target_compile_definitions ( ${ target } PRIVATE CONF_VIDEORECORDER )
endif ( )
2020-03-11 00:58:50 +00:00
if ( ANTIBOT )
target_compile_definitions ( ${ target } PRIVATE CONF_ANTIBOT )
endif ( )
2021-09-09 11:23:02 +00:00
if ( HEADLESS_CLIENT )
target_compile_definitions ( ${ target } PRIVATE CONF_HEADLESS_CLIENT )
endif ( )
2017-07-22 23:36:36 +00:00
if ( MYSQL )
2021-11-28 00:31:22 +00:00
target_compile_definitions ( ${ target } PRIVATE CONF_MYSQL )
2022-01-22 16:22:08 +00:00
target_include_directories ( ${ target } SYSTEM PRIVATE ${ MYSQL_INCLUDE_DIRS } )
2017-07-22 23:36:36 +00:00
endif ( )
2021-11-28 00:49:08 +00:00
if ( TEST_MYSQL )
target_compile_definitions ( ${ target } PRIVATE CONF_TEST_MYSQL )
endif ( )
2020-09-24 15:11:02 +00:00
if ( AUTOUPDATE AND NOT STEAM )
2018-09-20 01:01:31 +00:00
target_compile_definitions ( ${ target } PRIVATE CONF_AUTOUPDATE )
endif ( )
2020-09-24 15:11:02 +00:00
if ( INFORM_UPDATE AND NOT STEAM )
2020-09-23 20:42:54 +00:00
target_compile_definitions ( ${ target } PRIVATE CONF_INFORM_UPDATE )
endif ( )
2020-09-24 15:11:02 +00:00
if ( STEAM )
target_compile_definitions ( ${ target } PRIVATE PLATFORM_SUFFIX= "-steam" )
endif ( )
2021-01-02 16:10:31 +00:00
if ( DISCORD )
target_compile_definitions ( ${ target } PRIVATE CONF_DISCORD )
2021-02-01 11:20:11 +00:00
if ( DISCORD_DYNAMIC )
target_compile_definitions ( ${ target } PRIVATE CONF_DISCORD_DYNAMIC )
endif ( )
2021-01-02 16:10:31 +00:00
endif ( )
2020-09-24 15:06:03 +00:00
if ( VERSION )
target_compile_definitions ( ${ target } PRIVATE GAME_RELEASE_VERSION= "${VERSION}" )
endif ( )
2022-03-25 08:26:37 +00:00
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
target_compile_definitions ( ${ target } PRIVATE CONF_WEBASM )
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 ( )