2023-04-14 23:38:34 +08:00
cmake_minimum_required ( VERSION 2.8.12...3.19.1 )
if ( CMAKE_VERSION VERSION_LESS 3.12 )
cmake_policy ( VERSION ${ CMAKE_VERSION } )
endif ( )
set ( CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE INTERNAL "Minimum macOS deployment version" )
if ( CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.13 )
message ( WARNING "Building for macOS < 10.13 is not supported" )
endif ( )
file ( STRINGS src/game/version.h VERSION_LINE
L I M I T _ C O U N T 1
R E G E X " ^ #define GAME_RELEASE_VERSION "
)
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 } )
elseif ( VERSION_LINE MATCHES "\" ( [0-9]+ ) \\.([0-9]+)\"")
set ( VERSION_MAJOR ${ CMAKE_MATCH_1 } )
set ( VERSION_MINOR ${ CMAKE_MATCH_2 } )
set ( VERSION_PATCH "0" )
else ( )
message ( FATAL_ERROR "Couldn't parse version from src/game/version.h" )
endif ( )
# Extra support for CMake pre-3.0
if ( NOT POLICY CMP0048 )
set ( PROJECT_VERSION_MAJOR ${ VERSION_MAJOR } )
set ( PROJECT_VERSION_MINOR ${ VERSION_MINOR } )
set ( PROJECT_VERSION_PATCH ${ VERSION_PATCH } )
if ( VERSION_PATCH STREQUAL "0" )
set ( PROJECT_VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } )
else ( )
set ( PROJECT_VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_PATCH } )
endif ( )
endif ( )
if ( VERSION_PATCH STREQUAL "0" )
project ( DDNet VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } )
else ( )
project ( DDNet VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_PATCH } )
endif ( )
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 } )
if ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set ( TARGET_BITS "32" )
else ( )
set ( TARGET_BITS "64" )
endif ( )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64" )
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 ( )
if ( CMAKE_SYSTEM_NAME STREQUAL "Windows" )
set ( TARGET_OS "windows" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( TARGET_OS "linux" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
set ( TARGET_OS "mac" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Haiku" )
set ( TARGET_OS "haiku" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Android" )
set ( TARGET_OS "android" )
endif ( )
include ( CheckCCompilerFlag )
include ( CheckCXXCompilerFlag )
if ( CMAKE_VERSION VERSION_GREATER_EQUAL 3.18 )
include ( CheckLinkerFlag )
endif ( )
include ( CheckSymbolExists )
if ( NOT ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" ) )
include ( CheckAtomic )
endif ( )
check_symbol_exists ( __i386 "" TARGET_ARCH_X86_i386 )
if ( TARGET_ARCH_X86_i386 )
set ( TARGET_ARCH x86 )
else ( )
set ( TARGET_ARCH )
endif ( )
set ( AUTO_DEPENDENCIES_DEFAULT OFF )
set ( AUTO_VULKAN_BACKEND ON )
if ( TARGET_OS STREQUAL "windows" )
set ( AUTO_DEPENDENCIES_DEFAULT ON )
if ( TARGET_CPU_ARCHITECTURE STREQUAL "x86" )
set ( AUTO_VULKAN_BACKEND OFF )
endif ( )
elseif ( TARGET_OS STREQUAL "mac" )
set ( AUTO_VULKAN_BACKEND OFF )
endif ( )
option ( WEBSOCKETS "Enable websockets support" OFF )
2023-04-15 19:13:34 +08:00
option ( MYSQL "Enable mysql support" ON )
2023-04-14 23:38:34 +08:00
option ( TEST_MYSQL "Test mysql support in unit tests (also sets -DMYSQL=ON)" OFF )
option ( AUTOUPDATE "Enable the autoupdater" OFF )
option ( INFORM_UPDATE "Inform about available updates" ON )
option ( VIDEORECORDER "Enable video recording support via FFmpeg" ON )
option ( UPNP "Enable UPnP support" OFF )
option ( ANTIBOT "Enable support for a dynamic anticheat library (not provided, see src/antibot for interface if you want to implement your own)" OFF )
option ( HEADLESS_CLIENT "Build the client without graphics" OFF )
option ( CLIENT "Compile client" OFF )
option ( SERVER "Compile server" ON )
option ( TOOLS "Compile tools" OFF )
option ( DOWNLOAD_GTEST "Download and compile GTest" ${ AUTO_DEPENDENCIES_DEFAULT } )
option ( STEAM "Build the Steam release version" OFF )
option ( DISCORD "Enable Discord rich presence support" OFF )
option ( DISCORD_DYNAMIC "Enable discovering Discord rich presence libraries at runtime (Linux only)" OFF )
option ( PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${ AUTO_DEPENDENCIES_DEFAULT } )
option ( DEV "Don't generate stuff necessary for packaging" OFF )
option ( VULKAN "Enable the vulkan backend" ${ AUTO_VULKAN_BACKEND } )
option ( EXCEPTION_HANDLING "Enable exception handling (only works with Windows as of now)" OFF )
option ( IPO "Enable interprocedural optimizations" OFF )
option ( FUSE_LD "Linker to use" OFF )
option ( SECURITY_COMPILER_FLAGS "Whether to set security-relevant compiler flags like -D_FORTIFY_SOURCE=2 and -fstack-protector-all" ON )
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
include ( ${ PROJECT_SOURCE_DIR } /cmake/toolchains/Emscripten.toolchain )
endif ( )
if ( TEST_MYSQL )
set ( MYSQL ON )
endif ( )
# Set version if not explicitly set
if ( NOT VERSION )
set ( VERSION ${ PROJECT_VERSION } )
endif ( )
set ( OpenGL_GL_PREFERENCE LEGACY )
# Set the default build type to Release
if ( NOT(CMAKE_BUILD_TYPE ) )
if ( NOT(DEV ) )
set ( CMAKE_BUILD_TYPE Release )
else ( )
set ( CMAKE_BUILD_TYPE Debug )
endif ( )
endif ( )
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 ( )
set ( DBG $< OR:$<CONFIG:Debug > , $< CONFIG:RelWithDebInfo > > )
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 ( )
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 ( )
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" )
########################################################################
# Compiler flags
########################################################################
function ( add_c_compiler_flag_if_supported VARIABLE FLAG )
if ( ARGC GREATER 2 )
set ( CHECKED_FLAG "${ARGV2}" )
else ( )
set ( CHECKED_FLAG "${FLAG}" )
endif ( )
string ( REGEX REPLACE "[^A-Za-z0-9]" "_" CONFIG_VARIABLE "FLAG_SUPPORTED${CHECKED_FLAG}" )
check_c_compiler_flag ( "${CHECKED_FLAG}" ${ CONFIG_VARIABLE } )
if ( ${ CONFIG_VARIABLE } )
if ( ${ VARIABLE } )
set ( "${VARIABLE}" "${${VARIABLE}};${FLAG}" PARENT_SCOPE )
else ( )
set ( "${VARIABLE}" "${FLAG}" PARENT_SCOPE )
endif ( )
endif ( )
endfunction ( )
function ( add_cxx_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_cxx_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_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 ( )
# 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" )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fdiagnostics-color=always )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fcolor-diagnostics )
endif ( )
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" )
else ( )
# 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 ( )
endif ( )
endif ( )
else ( )
add_linker_flag_if_supported ( OUR_FLAGS_LINK -fuse-ld=gold )
if ( FLAG_SUPPORTED_fuse_ld_gold )
message ( STATUS "Using gold linker" )
endif ( )
endif ( )
endif ( )
endif ( )
if ( CMAKE_VERSION VERSION_LESS 3.1 OR TARGET_OS STREQUAL "mac" )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -std=gnu++17 )
endif ( )
if ( NOT SECURITY_COMPILER_FLAGS STREQUAL OFF )
# Protect the stack pointer.
# -fstack-protector-all doesn't work on MinGW.
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fstack-protector-all )
endif ( )
# Disable exceptions as DDNet does not use them.
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fno-exceptions )
# Inaccurate floating point numbers cause problems on mingw-w64-gcc when
# compiling for x86, might cause problems elsewhere. So don't store floats
# in registers but keep them at higher accuracy.
if ( TARGET_ARCH STREQUAL "x86" )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -ffloat-store )
endif ( )
# Don't insert timestamps into PEs to keep the build reproducible.
if ( TARGET_OS STREQUAL "windows" )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_LINK -Wl,--no-insert-timestamp )
endif ( )
if ( TARGET_OS STREQUAL "mac" )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -stdlib=libc++ )
endif ( )
if ( EXCEPTION_HANDLING )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -DCONF_EXCEPTION_HANDLING )
# 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)
add_cxx_compiler_flag_if_supported ( OUR_FLAGS -fno-omit-frame-pointer )
endif ( )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wall )
if ( CMAKE_VERSION VERSION_GREATER 3.3 OR CMAKE_VERSION VERSION_EQUAL 3.3 )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN
$ < $ < C O M P I L E _ L A N G U A G E : C > : - W d e c l a r a t i o n - a f t e r - s t a t e m e n t >
- W d e c l a r a t i o n - a f t e r - s t a t e m e n t
)
endif ( )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wextra )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wno-psabi ) # parameter passing for argument of type ‘ __gnu_cxx::__normal_iterator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>*, std::vector<CCommandProcessorFragment_Vulkan::SMemoryBlock<1>, std::allocator<CCommandProcessorFragment_Vulkan::SMemoryBlock<1> > > >’ changed in GCC 7.1
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 )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wthread-safety-negative )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_OWN -Wsuggest-override )
add_linker_flag_if_supported ( OUR_FLAGS_LINK -Wno-alloc-size-larger-than ) # save.cpp with LTO
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wdouble-promotion) # Many occurrences
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wnull-dereference) # Many occurrences
# add_cxx_compiler_flag_if_supported(OUR_FLAGS_OWN -Wuseless-cast) # TODO: Enable for C++ code except gtest
endif ( )
if ( MSVC )
if ( EXCEPTION_HANDLING )
add_cxx_compiler_flag_if_supported ( OUR_FLAGS /DCONF_EXCEPTION_HANDLING )
endif ( )
endif ( )
if ( NOT MSVC AND NOT HAIKU AND NOT SECURITY_COMPILER_FLAGS STREQUAL OFF )
check_c_compiler_flag ( "-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE ) # Some distributions define _FORTIFY_SOURCE by themselves.
endif ( )
########################################################################
# COMMON FUNCTIONS
########################################################################
function ( set_glob VAR GLOBBING EXTS DIRECTORY ) # ...
set ( GLOBS )
foreach ( ext ${ EXTS } )
list ( APPEND GLOBS "${DIRECTORY}/*.${ext}" )
endforeach ( )
file ( ${ GLOBBING } GLOB_RESULT ${ GLOBS } )
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 ( )
if ( NOT LIST_BUT_NOT_GLOB AND NOT GLOB_BUT_NOT_LIST )
message ( AUTHOR_WARNING "${VAR} is not alphabetically sorted" )
endif ( )
endif ( )
endif ( )
set ( ${ VAR } ${ FILES } PARENT_SCOPE )
endfunction ( )
function ( set_src VAR GLOBBING DIRECTORY ) # ...
set_glob ( ${ VAR } ${ GLOBBING } "c;cpp;h" ${ DIRECTORY } ${ ARGN } )
set ( ${ VAR } ${ ${VAR } } PARENT_SCOPE )
set ( CHECKSUM_SRC ${ CHECKSUM_SRC } ${ ${VAR } } PARENT_SCOPE )
endfunction ( )
set ( CHECKSUM_SRC )
function ( set_own_rpath TARGET )
if ( NOT TARGET_OS STREQUAL "windows" AND NOT TARGET_OS STREQUAL "mac" )
if ( CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8 )
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 )
if ( ( CLIENT AND ( STEAM OR DISCORD_DYNAMIC ) ) OR ANTIBOT )
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 ( )
########################################################################
# INITIALIZE TARGET LISTS
########################################################################
set ( TARGETS_OWN )
set ( TARGETS_DEP )
set ( TARGETS_LINK ) # Targets with a linking stage.
########################################################################
# DEPENDENCIES
########################################################################
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" )
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( LIB_DIR "webasm/libwasm" )
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 ( )
function ( set_extra_dirs_lib VARIABLE NAME )
set ( "PATHS_${VARIABLE}_LIBDIR" PARENT_SCOPE )
set ( "HINTS_${VARIABLE}_LIBDIR" PARENT_SCOPE )
if ( PREFER_BUNDLED_LIBS )
set ( TYPE HINTS )
else ( )
set ( TYPE PATHS )
endif ( )
if ( TARGET_BITS AND TARGET_OS )
set ( DIR "ddnet-libs/${NAME}/${LIB_DIR}" )
set ( "${TYPE}_${VARIABLE}_LIBDIR" "${DIR}" PARENT_SCOPE )
set ( "EXTRA_${VARIABLE}_LIBDIR" "${DIR}" PARENT_SCOPE )
endif ( )
endfunction ( )
function ( set_extra_dirs_include VARIABLE NAME LIBRARY )
set ( "PATHS_${VARIABLE}_INCLUDEDIR" PARENT_SCOPE )
set ( "HINTS_${VARIABLE}_INCLUDEDIR" PARENT_SCOPE )
is_bundled ( IS_BUNDLED "${LIBRARY}" )
if ( IS_BUNDLED )
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 )
endif ( )
endfunction ( )
if ( CMAKE_CROSSCOMPILING )
if ( TARGET_OS STREQUAL "android" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
# 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 ( )
else ( )
set ( CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH )
endif ( )
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 )
endif ( )
else ( )
set ( "${VARIABLE}" OFF PARENT_SCOPE )
endif ( )
endfunction ( )
if ( NOT CMAKE_CROSSCOMPILING )
# Check for PkgConfig once so all the other `find_package` calls can do it
# quietly.
find_package ( PkgConfig )
endif ( )
if ( TARGET_OS STREQUAL "android" )
find_package ( Android )
endif ( )
find_package ( ZLIB )
find_package ( Crypto )
find_package ( Curl )
if ( CLIENT AND VIDEORECORDER )
find_package ( FFMPEG )
endif ( )
find_package ( Freetype )
if ( DOWNLOAD_GTEST )
find_package ( Git )
endif ( )
if ( NOT(TARGET_OS STREQUAL "android" ) )
find_package ( GLEW )
endif ( )
find_package ( GTest )
if ( UPNP )
find_package ( Miniupnpc )
endif ( )
if ( MYSQL )
find_package ( MySQL )
else ( )
set ( MYSQL_LIBRARIES )
endif ( )
find_package ( Ogg )
find_package ( Opus )
find_package ( Opusfile )
find_package ( PNG )
find_package ( PythonInterp 3 )
find_package ( Rust )
find_package ( SDL2 )
find_package ( SQLite3 )
if ( DISCORD )
find_package ( DiscordSdk )
endif ( )
if ( UNIX )
# Use -pthread instead of -lpthread to draw dependencies other than libpthread
set ( THREADS_PREFER_PTHREAD_FLAG TRUE )
endif ( )
find_package ( Threads )
find_package ( Wavpack )
if ( WEBSOCKETS )
find_package ( Websockets )
else ( )
set ( WEBSOCKETS_LIBRARIES )
set ( WEBSOCKETS_INCLUDE_DIRS )
endif ( )
if ( EXCEPTION_HANDLING )
find_package ( ExceptionHandling )
endif ( )
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
find_program ( CMAKE_OTOOL otool )
find_program ( DMGBUILD dmgbuild )
endif ( )
set ( VULKAN_SHADER_FILE_LIST "" CACHE STRING "Vulkan shader file list" )
set ( VULKAN_SHADER_FILE_SHA256 "" CACHE STRING "Vulkan shader file hash" )
if ( CLIENT AND VULKAN )
find_package ( Vulkan )
include ( cmake/BuildVulkanShaders.cmake )
else ( )
set ( VULKAN_LIBRARIES )
set ( VULKAN_INCLUDE_DIRS )
endif ( )
message ( STATUS "******** ${CMAKE_PROJECT_NAME} ********" )
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})" )
endif ( )
message ( STATUS ${ TARGET } )
message ( STATUS "Compiler: ${CMAKE_CXX_COMPILER}" )
message ( STATUS "Rust version: ${RUST_VERSION_STRING}" )
message ( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
message ( STATUS "Dependencies:" )
function ( show_dependency_status OUTPUT_NAME NAME )
if ( ${ NAME } _FOUND )
if ( ${ NAME } _BUNDLED )
message ( STATUS " * ${OUTPUT_NAME} not found (using bundled version)" )
else ( )
message ( STATUS " * ${OUTPUT_NAME} found" )
endif ( )
else ( )
message ( STATUS " * ${OUTPUT_NAME} not found" )
endif ( )
endfunction ( )
show_dependency_status ( "Curl" CURL )
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
show_dependency_status ( "Dmg tools" DMGTOOLS )
endif ( )
if ( CLIENT AND VIDEORECORDER )
show_dependency_status ( "FFmpeg" FFMPEG )
endif ( )
show_dependency_status ( "Freetype" FREETYPE )
if ( DOWNLOAD_GTEST )
show_dependency_status ( "Git" GIT )
endif ( )
show_dependency_status ( "Glew" GLEW )
show_dependency_status ( "GTest" GTEST )
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
show_dependency_status ( "Dmgbuild" DMGBUILD )
endif ( )
if ( UPNP )
show_dependency_status ( "Miniupnpc" MINIUPNPC )
endif ( )
if ( MYSQL )
show_dependency_status ( "MySQL" MYSQL )
endif ( )
show_dependency_status ( "Ogg" OGG )
show_dependency_status ( "OpenSSL Crypto" CRYPTO )
show_dependency_status ( "Opus" OPUS )
show_dependency_status ( "Opusfile" OPUSFILE )
show_dependency_status ( "PNG" PNG )
show_dependency_status ( "PythonInterp" PYTHONINTERP )
show_dependency_status ( "SDL2" SDL2 )
show_dependency_status ( "SQLite3" SQLite3 )
show_dependency_status ( "Wavpack" WAVPACK )
show_dependency_status ( "Zlib" ZLIB )
if ( DISCORD )
show_dependency_status ( "DiscordSdk" DiscordSdk )
endif ( )
if ( WEBSOCKETS )
show_dependency_status ( "Websockets" WEBSOCKETS )
endif ( )
if ( CLIENT AND VULKAN )
show_dependency_status ( "Vulkan" VULKAN )
endif ( )
if ( NOT(CURL_FOUND ) )
message ( SEND_ERROR "You must install Curl to compile ${CMAKE_PROJECT_NAME}" )
endif ( )
if ( NOT(PYTHONINTERP_FOUND ) )
message ( SEND_ERROR "You must install Python to compile ${CMAKE_PROJECT_NAME}" )
endif ( )
if ( NOT(RUST_FOUND ) )
message ( SEND_ERROR "You must install Rust and Cargo to compile ${CMAKE_PROJECT_NAME}" )
endif ( )
if ( NOT(SQLite3_FOUND ) )
message ( SEND_ERROR "You must install SQLite3 to compile ${CMAKE_PROJECT_NAME}" )
endif ( )
if ( MYSQL AND NOT(MYSQL_FOUND ) )
message ( SEND_ERROR "You must install MySQL to compile the ${CMAKE_PROJECT_NAME} server with MySQL support" )
endif ( )
if ( WEBSOCKETS AND NOT(WEBSOCKETS_FOUND ) )
message ( SEND_ERROR "You must install libwebsockets to compile the ${CMAKE_PROJECT_NAME} server with websocket support" )
endif ( )
if ( UPNP AND NOT(MINIUPNPC_FOUND ) )
message ( SEND_ERROR "You must install miniupnpc to compile the ${CMAKE_PROJECT_NAME} server with UPnP support" )
endif ( )
if ( DISCORD AND NOT(DISCORDSDK_FOUND ) )
message ( SEND_ERROR "You must install the Discord SDK to compile the ${CMAKE_PROJECT_NAME} client with Discord support" )
endif ( )
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 ( )
if ( CLIENT AND NOT(FREETYPE_FOUND ) )
message ( SEND_ERROR "You must install Freetype to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( CLIENT AND NOT(OGG_FOUND ) )
message ( SEND_ERROR "You must install Ogg to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( CLIENT AND NOT(OPUS_FOUND ) )
message ( SEND_ERROR "You must install Opus to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( CLIENT AND NOT(OPUSFILE_FOUND ) )
message ( SEND_ERROR "You must install Opusfile to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( CLIENT AND NOT(SDL2_FOUND ) )
message ( SEND_ERROR "You must install SDL2 to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( TARGET_OS STREQUAL "android" AND CLIENT AND NOT(CRYPTO_FOUND ) )
message ( SEND_ERROR "You must install OpenSSL to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( NOT(GTEST_FOUND ) )
if ( DOWNLOAD_GTEST )
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 ( )
else ( )
message ( STATUS "To run the tests, you have to install GTest" )
endif ( )
endif ( )
if ( CLIENT AND VULKAN AND NOT(VULKAN_FOUND ) )
message ( SEND_ERROR "You must install Vulkan libraries to compile the ${CMAKE_PROJECT_NAME} client" )
endif ( )
if ( TARGET_OS STREQUAL "windows" )
set ( PLATFORM_CLIENT )
set ( PLATFORM_CLIENT_LIBS opengl32 winmm )
set ( PLATFORM_LIBS )
list ( APPEND PLATFORM_LIBS shlwapi ) # PathIsRelativeW
list ( APPEND PLATFORM_LIBS version ws2_32 ) # Windows sockets
list ( APPEND PLATFORM_LIBS bcrypt userenv ) # for Rust (https://github.com/rust-lang/rust/issues/91974)
list ( APPEND PLATFORM_LIBS ole32 ) # CoInitialize(Ex)
list ( APPEND PLATFORM_LIBS shell32 )
elseif ( TARGET_OS STREQUAL "mac" )
find_library ( CARBON Carbon )
find_library ( COCOA Cocoa )
find_library ( OPENGL OpenGL )
find_library ( SECURITY Security )
set ( PLATFORM_CLIENT
s r c / m a c o s / c l i e n t . m m
s r c / m a c o s / n o t i f i c a t i o n s . m m
)
set ( PLATFORM_CLIENT_LIBS ${ COCOA } ${ OPENGL } )
set ( PLATFORM_LIBS ${ CARBON } ${ SECURITY } )
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 } )
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 )
else ( )
find_package ( Notify )
find_package ( OpenGL )
set ( PLATFORM_CLIENT_LIBS ${ OPENGL_gl_LIBRARY } ${ NOTIFY_LIBRARIES } )
set ( PLATFORM_CLIENT_INCLUDE_DIRS ${ OPENGL_INCLUDE_DIR } ${ NOTIFY_INCLUDE_DIRS } )
set ( PLATFORM_CLIENT )
if ( TARGET_OS STREQUAL "linux" )
set ( PLATFORM_LIBS )
list ( APPEND PLATFORM_LIBS rt ) # clock_gettime for glibc < 2.17
list ( APPEND PLATFORM_LIBS dl ) # for Rust
else ( )
set ( PLATFORM_LIBS )
endif ( )
endif ( )
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
set ( PLATFORM_CLIENT_LIBS GL )
set ( PLATFORM_CLIENT_INCLUDE_DIRS "" )
set ( CMAKE_EXECUTABLE_SUFFIX ".html" )
endif ( )
########################################################################
# DOWNLOAD GTEST
########################################################################
if ( NOT(GTEST_FOUND ) A N D D O W N L O A D _ G T E S T )
set ( DDNET_GTEST_VERSION 5c8ca58edfb304b2dd5e6061f83387470826dd87 ) # master as of 2021-04-07
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
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
)
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
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
)
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 (
$ { 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
E X C L U D E _ F R O M _ A L L
)
if ( MSVC )
foreach ( target gtest gmock )
set_property ( TARGET ${ target } PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded $< ${DBG}:Debug > )
# `/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 /w )
endforeach ( )
endif ( )
set ( GTEST_LIBRARIES gtest gmock )
set ( GTEST_INCLUDE_DIRS )
if ( CMAKE_VERSION VERSION_LESS 2.8.11 )
set ( GTEST_INCLUDE_DIRS "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include" )
endif ( )
endif ( )
endif ( )
endif ( )
########################################################################
# DEPENDENCY COMPILATION
########################################################################
set_src ( DEP_JSON_SRC GLOB src/engine/external/json-parser json.c json.h )
add_library ( json EXCLUDE_FROM_ALL OBJECT ${ DEP_JSON_SRC } )
set_src ( DEP_MD5_SRC GLOB src/engine/external/md5 md5.c md5.h )
add_library ( md5 EXCLUDE_FROM_ALL OBJECT ${ DEP_MD5_SRC } )
list ( APPEND TARGETS_DEP json md5 )
set ( DEP_JSON $< TARGET_OBJECTS:json > )
set ( DEP_MD5 )
if ( NOT CRYPTO_FOUND )
set ( DEP_MD5 $< TARGET_OBJECTS:md5 > )
endif ( )
########################################################################
# RUST
########################################################################
set_glob ( RUST_BASE GLOB_RECURSE "rs;toml" src/base
C a r g o . t o m l
c o l o r . r s
l i b . r s
r u s t . r s
)
set_glob ( RUST_ENGINE_INTERFACE GLOB "rs;toml" src/engine
C a r g o . t o m l
c o n s o l e . r s
l i b . r s
)
set_glob ( RUST_ENGINE_SHARED GLOB_RECURSE "rs;toml" src/engine/shared
C a r g o . t o m l
b u i l d . r s
c o n f i g . r s
l i b . r s
r u s t _ v e r s i o n . r s
)
set_src ( RUST_BRIDGE_SHARED GLOB_RECURSE src/rust-bridge
c p p / c o n s o l e . c p p
c p p / c o n s o l e . h
e n g i n e / s h a r e d / r u s t _ v e r s i o n . c p p
e n g i n e / s h a r e d / r u s t _ v e r s i o n . h
)
set_glob ( RUST_MASTERSRV GLOB "rs;toml" src/mastersrv/src
a d d r . r s
l o c a t i o n s . r s
m a i n . r s
)
add_library ( rust-bridge-shared EXCLUDE_FROM_ALL OBJECT ${ RUST_BRIDGE_SHARED } )
list ( APPEND TARGETS_OWN rust-bridge-shared )
set ( CARGO_BUILD_DIR "" )
set ( CARGO_BUILD ${ CMAKE_COMMAND } -E env CARGO_TARGET_DIR= ${ PROJECT_BINARY_DIR } DDNET_TEST_NO_LINK=1 ${ RUST_CARGO } build )
set ( CARGO_TEST ${ CMAKE_COMMAND } -E env CARGO_TARGET_DIR= ${ PROJECT_BINARY_DIR } ${ RUST_CARGO } test )
if ( MSVC )
list ( INSERT CARGO_BUILD 0 ${ CMAKE_COMMAND } -E env $< $<CONFIG:Debug > :CFLAGS=/MTd> $< $<CONFIG:Debug > :CXXFLAGS=/MTd> )
list ( INSERT CARGO_TEST 0 ${ CMAKE_COMMAND } -E env RUSTFLAGS=-Ctarget-feature=+crt-static )
endif ( )
if ( RUST_NIGHTLY )
list ( APPEND CARGO_BUILD -Z build-std=std,panic_abort )
endif ( )
if ( NOT CMAKE_OSX_ARCHITECTURES AND ( DEFINED CMAKE_RUST_COMPILER_TARGET OR RUST_NIGHTLY ) )
if ( DEFINED CMAKE_RUST_COMPILER_TARGET )
list ( APPEND CARGO_TEST --target ${ CMAKE_RUST_COMPILER_TARGET } )
set ( RUST_TARGET ${ CMAKE_RUST_COMPILER_TARGET } )
else ( )
set ( RUST_TARGET ${ RUST_TARGET_HOST } )
endif ( )
list ( APPEND CARGO_BUILD --target ${ RUST_TARGET } )
set ( CARGO_BUILD_DIR "${RUST_TARGET}/" )
endif ( )
set ( CARGO_BUILD_DIR_DEBUG "${CARGO_BUILD_DIR}debug" )
set ( CARGO_BUILD_DIR_RELEASE "${CARGO_BUILD_DIR}release" )
if ( GENERATOR_IS_MULTI_CONFIG )
if ( CMAKE_VERSION VERSION_LESS 3.20 )
message ( SEND_ERROR "Multi-config generators only supported from CMake 3.20 and up" )
else ( )
set ( CARGO_BUILD_DIR "${CARGO_BUILD_DIR}$<$<CONFIG:Debug>:debug>$<$<NOT:$<CONFIG:Debug>>:release>" )
endif ( )
else ( )
if ( CMAKE_BUILD_TYPE STREQUAL Debug )
set ( CARGO_BUILD_DIR "${CARGO_BUILD_DIR_DEBUG}" )
else ( )
set ( CARGO_BUILD_DIR "${CARGO_BUILD_DIR_RELEASE}" )
endif ( )
endif ( )
list ( APPEND CARGO_BUILD $< $<NOT:$<CONFIG:Debug > >:--release> )
if ( CMAKE_OSX_ARCHITECTURES )
set ( RUST_OSX_ARCHITECTURES )
foreach ( arch ${ CMAKE_OSX_ARCHITECTURES } )
if ( ${ arch } STREQUAL arm64 )
list ( APPEND RUST_OSX_ARCHITECTURES aarch64-apple-darwin )
elseif ( ${ arch } STREQUAL x86_64 )
list ( APPEND RUST_OSX_ARCHITECTURES x86_64-apple-darwin )
else ( )
message ( SEND_ERROR "CMAKE_OSX_ARCHITECTURES' architecture ${arch} unknown, can't build Rust code (known: arm64, x86_64)" )
endif ( )
endforeach ( )
endif ( )
set ( RUST_SRC
$ { R U S T _ B A S E }
$ { R U S T _ E N G I N E _ I N T E R F A C E }
$ { R U S T _ E N G I N E _ S H A R E D }
C a r g o . t o m l
C a r g o . l o c k
)
set ( RUST_TARGETS engine_shared )
if ( NOT CMAKE_OSX_ARCHITECTURES )
set ( RUST_OUTPUTS )
foreach ( rust_target ${ RUST_TARGETS } )
set ( LIBRARY_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}ddnet_${rust_target}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
add_library ( rust_ ${ rust_target } STATIC IMPORTED GLOBAL )
add_custom_target ( rust_ ${ rust_target } _target DEPENDS "${PROJECT_BINARY_DIR}/${CARGO_BUILD_DIR}/${LIBRARY_NAME}" )
add_dependencies ( rust_ ${ rust_target } rust_ ${ rust_target } _target )
set_target_properties ( rust_ ${ rust_target } PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R _ R E L E A S E } / $ { L I B R A R Y _ N A M E } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R _ D E B U G } / $ { L I B R A R Y _ N A M E } "
)
list ( APPEND RUST_OUTPUTS "${PROJECT_BINARY_DIR}/${CARGO_BUILD_DIR}/${LIBRARY_NAME}" )
endforeach ( )
add_custom_command (
O U T P U T $ { R U S T _ O U T P U T S }
C O M M A N D $ { C A R G O _ B U I L D }
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 }
U S E S _ T E R M I N A L
D E P E N D S $ { R U S T _ S R C }
)
else ( )
foreach ( rust_target ${ RUST_TARGETS } )
set ( LIBRARY_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}ddnet_${rust_target}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
add_library ( rust_ ${ rust_target } STATIC IMPORTED GLOBAL )
set_target_properties ( rust_ ${ rust_target } PROPERTIES
I M P O R T E D _ L O C A T I O N " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R _ R E L E A S E } / $ { L I B R A R Y _ N A M E } "
I M P O R T E D _ L O C A T I O N _ D E B U G " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R _ D E B U G } / $ { L I B R A R Y _ N A M E } "
)
add_custom_target ( rust_ ${ rust_target } _target DEPENDS "${PROJECT_BINARY_DIR}/${CARGO_BUILD_DIR}/${LIBRARY_NAME}" )
add_dependencies ( rust_ ${ rust_target } rust_ ${ rust_target } _target )
set ( ARCH_LIBRARIES )
foreach ( arch ${ RUST_OSX_ARCHITECTURES } )
list ( APPEND ARCH_LIBRARIES "${PROJECT_BINARY_DIR}/${arch}/${CARGO_BUILD_DIR}/${LIBRARY_NAME}" )
endforeach ( )
add_custom_command (
O U T P U T " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R } / $ { L I B R A R Y _ N A M E } "
C O M M A N D l i p o $ { A R C H _ L I B R A R I E S } - c r e a t e - o u t p u t " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { C A R G O _ B U I L D _ D I R } / $ { L I B R A R Y _ N A M E } "
D E P E N D S $ { A R C H _ L I B R A R I E S }
)
endforeach ( )
foreach ( arch ${ RUST_OSX_ARCHITECTURES } )
set ( RUST_OUTPUTS )
foreach ( rust_target ${ RUST_TARGETS } )
set ( LIBRARY_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}ddnet_${rust_target}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
list ( APPEND RUST_OUTPUTS "${PROJECT_BINARY_DIR}/${arch}/${CARGO_BUILD_DIR}/${LIBRARY_NAME}" )
endforeach ( )
add_custom_command (
O U T P U T $ { R U S T _ O U T P U T S }
C O M M A N D $ { C A R G O _ B U I L D } - - t a r g e t = $ { a r c 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 }
U S E S _ T E R M I N A L
D E P E N D S $ { R U S T _ S R C }
)
endforeach ( )
endif ( )
########################################################################
# DATA
########################################################################
set ( EXPECTED_DATA
a r r o w . p n g
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
a s s e t s / g a m e / g a m e _ 0 6 . p n g
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
a u t o e x e c _ s e r v e r . c f g
b l o b . p n g
c e n s o r l i s t . t x t
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
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
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
e x t r a s . p n g
f o n t s / D e j a V u S a n s . t t f
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
f o n t s / I c o n s . o t f
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
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
h u d . p n g
l a n g u a g e s / a r a b i c . t x t
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
l a n g u a g e s / e s p e r a n t o . t x t
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
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
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
m a p s / G o l d \ M i n e . m a p
m a p s / L e a r n T o P l a y . m a p
m a p s / S u n n y \ S i d e \ U p . m a p
m a p s / T s u n a m i . m a p
m a p s / T u t o r i a l . m a p
m a p s / c o v e r a g e . m a p
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
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
m a p s 7 / L e a r n T o P l a y . m a p
m a p s 7 / S u n n y \ S i d e \ U p . m a p
m a p s 7 / T s u n a m i . m a p
m a p s 7 / T u t o r i a l . m a p
m a p s 7 / r e a d m e . t x t
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
p a r t i c l e s . p n g
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
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
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
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
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
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
s k i n s / b o m b . p n g
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
s k i n s / l i c e n s e . t x t
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
s k i n s / x _ s p e c . p n g
s t r o n g _ w e a k . p n g
t h e m e s / a u t o . p n g
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
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
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
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
w o r d l i s t . t x t
)
set_glob ( DATA GLOB_RECURSE "cfg;frag;json;map;otf;png;rules;ttf;txt;vert;wv" data ${ EXPECTED_DATA } )
########################################################################
# COPY DATA AND SHARED LIBS
########################################################################
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 ( )
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
)
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 }
$ { P N G _ C O P Y _ F I L E S }
$ { S D L 2 _ C O P Y _ F I L E S }
$ { S Q L i t e 3 _ C O P Y _ F I L E S }
$ { F F M P E G _ C O P Y _ F I L E S }
$ { W E B S O C K E T S _ C O P Y _ F I L E S }
$ { D I S C O R D S D K _ C O P Y _ F I L E S }
$ { V U L K A N _ C O P Y _ F I L E S }
$ { 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 }
)
file ( COPY ${ COPY_FILES } DESTINATION . )
# Don't add integration test files to COPY_FILES since we don't want to add
# them in cpack.
file ( COPY ${ INTEGRATION_TEST_COPY_FILES } DESTINATION . )
set ( COPY_DIRS ${ SDL2_COPY_DIRS } )
file ( COPY ${ COPY_DIRS } DESTINATION . )
########################################################################
# CODE GENERATION
########################################################################
function ( generate_source output_file script_parameter )
add_custom_command ( OUTPUT ${ output_file }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } d a t a s r c / c o m p i l e . p y $ { s c r i p t _ p a r a m e t e r }
> " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { o u t p u t _ f i l e } "
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
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 ( )
function ( generate_source7 output_file script_parameter )
add_custom_command ( OUTPUT ${ output_file }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } - 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 }
> " $ { 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 ( )
function ( generate_maps output_file script_parameter )
add_custom_command ( OUTPUT ${ output_file }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } d a t a s r c / c 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 }
> " $ { 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 / c r o s s c o m p i l e . p y
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 ( )
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src/game/generated/" )
execute_process ( COMMAND git rev-parse --git-dir
E R R O R _ Q U I E T
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 } "
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 ( )
add_custom_command ( OUTPUT ${ PROJECT_BINARY_DIR } /src/game/generated/git_revision.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 / 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 }
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
)
generate_source ( "src/game/generated/client_data.cpp" "client_content_source" )
generate_source ( "src/game/generated/client_data.h" "client_content_header" )
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" )
generate_source7 ( "src/game/generated/protocol7.cpp" "network_source" )
generate_source7 ( "src/game/generated/protocol7.h" "network_header" )
generate_source7 ( "src/game/generated/client_data7.cpp" "client_content_source" )
generate_source7 ( "src/game/generated/client_data7.h" "client_content_header" )
generate_maps ( "src/game/generated/protocolglue.h" "map_header" )
generate_maps ( "src/game/generated/protocolglue.cpp" "map_source" )
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
)
########################################################################
# SHARED
########################################################################
# Sources
set_src ( BASE GLOB_RECURSE src/base
b e z i e r . c p p
b e z i e r . h
c o l o r . h
d e t e c t . h
d y n a m i c . h
h a s h . c p p
h a s h . h
h a s h _ b u n d l e d . c p p
h a s h _ c t x t . h
h a s h _ l i b t o m c r y p t . c p p
h a s h _ o p e n s s l . c p p
l o c k _ s c o p e . h
l o g . c p p
l o g . h
l o g g e r . h
m a t h . h
r u s t . h
s y s t e m . c p p
s y s t e m . h
t l / t h r e a d i n g . h
t y p e s . h
u n i c o d e / c o n f u s a b l e s . c p p
u n i c o d e / c o n f u s a b l e s . h
u n i c o d e / c o n f u s a b l e s _ d a t a . h
u n i c o d e / t o l o w e r . c p p
u n i c o d e / t o l o w e r . h
u n i c o d e / t o l o w e r _ d a t a . h
v m a t h . h
)
set_src ( ENGINE_INTERFACE GLOB src/engine
a n t i b o t . h
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
d i s c o r d . h
e d i t o r . h
e n g i n e . h
f a v o r i t e s . h
f r i e n d s . h
g h o s t . h
g r a p h i c s . h
i n p u t . h
k e r n e l . h
k e y s . h
m a p . h
m e s s a g e . h
r u s t . h
s e r v e r . h
s e r v e r b r o w s e r . h
s o u n d . h
s q l i t e . h
s t e a m . h
s t o r a g e . h
t e x t r e n d e r . h
u p d a t e r . h
u u i d . h
w a r n i n g . h
)
set_src ( ENGINE_SHARED GLOB_RECURSE src/engine/shared
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
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
c s v . c p p
c s v . h
d a t a f i l e . c p p
d a t a f i l e . h
d e m o . c p p
d e m o . h
e c o n . c p p
e c o n . h
e n g i n e . c p p
f i f o . c p p
f i f o . h
f i l e c o l l e c t i o n . c p p
f i l e c o l l e c t i o n . h
g l o b a l _ u u i d _ m a n a g e r . c p p
h t t p . c p p
h t t p . h
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
j s o n . c p p
j s o n . h
k e r n e l . c p p
l i n e r e a d e r . c p p
l i n e r e a d e r . h
l o c a l i z a t i o n . h
m a p . c p p
m a p . h
m a s t e r s e r v e r . c p p
m a s t e r s e r v e r . h
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
n e t w o r k _ s t u n . c p p
p a c k e r . c p p
p a c k e r . h
p r o t o c o l . h
p r o t o c o l 7 . h
p r o t o c o l _ e x . c p p
p r o t o c o l _ e x . h
p r o t o c o l _ e x _ m s g s . h
r i n g b u f f e r . c p p
r i n g b u f f e r . h
s e r v e r i n f o . c p p
s e r v e r i n f o . h
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
s t u n . c p p
s t u n . h
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
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
v i d e o . c p p
v i d e o . h
w e b s o c k e t s . c p p
w e b s o c k e t s . h
)
set_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
)
set_src ( GAME_SHARED GLOB src/game
c o l l i s i o n . c p p
c o l l i s i o n . h
d d r a c e c h a t . h
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
m a p b u g s . c p p
m a p b u g s . h
m a p b u g s _ l i s t . h
m a p i t e m s . c p p
m a p i t e m s . h
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
p r n g . c p p
p r n g . h
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
)
# A bit hacky, but these are needed to register all the UUIDs, even for stuff
# that doesn't link game.
set ( ENGINE_UUID_SHARED
s r c / g a m e / g e n e r a t e d / p r o t o c o l g l u e . 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 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
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 } )
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
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
)
set ( DEPS ${ DEP_JSON } ${ DEP_MD5 } ${ ZLIB_DEP } )
# Libraries
set ( LIBS
$ { C R Y P T O _ L I B R A R I E S }
$ { C U R L _ L I B R A R I E S }
$ { S Q L i t e 3 _ L I B R A R I E S }
$ { 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 }
)
# Targets
add_library ( engine-gfx EXCLUDE_FROM_ALL OBJECT ${ ENGINE_GFX } )
target_include_directories ( engine-gfx PRIVATE ${ PNG_INCLUDE_DIRS } )
add_library ( engine-shared EXCLUDE_FROM_ALL OBJECT ${ ENGINE_INTERFACE } ${ ENGINE_SHARED } ${ ENGINE_UUID_SHARED } ${ BASE } )
add_library ( game-shared EXCLUDE_FROM_ALL OBJECT ${ GAME_SHARED } ${ GAME_GENERATED_SHARED } )
list ( APPEND TARGETS_OWN engine-gfx engine-shared game-shared )
if ( DISCORD AND NOT DISCORD_DYNAMIC )
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 } "
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 } "
)
endif ( )
########################################################################
# CLIENT
########################################################################
if ( CLIENT )
# Sources
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
)
if ( STEAM OR TARGET_OS STREQUAL "windows" OR TARGET_OS STREQUAL "mac" )
set ( STEAMAPI_KIND SHARED )
else ( )
set ( STEAMAPI_KIND STATIC )
endif ( )
set ( TARGET_STEAMAPI steam_api )
add_library ( ${ TARGET_STEAMAPI } ${ STEAMAPI_KIND } ${ STEAMAPI_SRC } )
list ( APPEND TARGETS_OWN ${ TARGET_STEAMAPI } )
set_src ( ENGINE_CLIENT GLOB_RECURSE src/engine/client
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
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
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
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
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
b a c k e n d _ s d l . c p p
b a c k e n d _ s d l . h
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
c h e c k s u m . h
c l i e n t . c p p
c l i e n t . h
d e m o e d i t . c p p
d e m o e d i t . h
d i s c o r d . c p p
f a v o r i t e s . c p p
f r i e n d s . c p p
f r i e n d s . h
g h o s t . c p p
g h o s t . h
g r a p h i c s _ d e f i n e s . h
g r a p h i c s _ t h r e a d e d . c p p
g r a p h i c s _ t h r e a d e d . h
i n p u t . c p p
i n p u t . h
k e y n a m e s . h
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
s e r v e r b r o w s e r . c p p
s e r v e r b r o w s e r . h
s 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
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
s o u n d . c p p
s o u n d . h
s q l i t e . c p p
s t e a m . c p p
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
v i d e o . c p p
v i d e o . h
)
set_src ( GAME_CLIENT GLOB_RECURSE src/game/client
a n i m s t a t e . c p p
a n i m s t a t e . h
c o m p o n e n t . c p p
c o m p o n e n t . h
c o m p o n e n t s / b a c k g r o u n d . c p p
c o m p o n e n t s / b a c k g r o u n d . h
c o m p o n e n t s / b i n d s . c p p
c o m p o n e n t s / b i n d s . h
c o m p o n e n t s / b r o a d c a s t . c p p
c o m p o n e n t s / b r o a d c a s t . h
c o m p o n e n t s / c a m e r a . c p p
c o m p o n e n t s / c a m e r a . h
c o m p o n e n t s / c h a t . c p p
c o m p o n e n t s / c h a t . h
c o m p o n e n t s / c o n s o l e . c p p
c o m p o n e n t s / c o n s o l e . h
c o m p o n e n t s / c o n t r o l s . c p p
c o m p o n e n t s / c o n t r o l s . h
c o m p o n e n t s / c o u n t r y f l a g s . c p p
c o m p o n e n t s / c o u n t r y f l a g s . h
c o m p o n e n t s / d a m a g e i n d . c p p
c o m p o n e n t s / d a m a g e i n d . h
c o m p o n e n t s / d e b u g h u d . c p p
c o m p o n e n t s / d e b u g h u d . h
c o m p o n e n t s / e f f e c t s . c p p
c o m p o n e n t s / e f f e c t s . h
c o m p o n e n t s / e m o t i c o n . c p p
c o m p o n e n t s / e m o t i c o n . h
c o m p o n e n t s / f l o w . c p p
c o m p o n e n t s / f l o w . h
c o m p o n e n t s / 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
c o m p o n e n t s / g h o s t . c p p
c o m p o n e n t s / g h o s t . h
c o m p o n e n t s / h u d . c p p
c o m p o n e n t s / h u d . h
c o m p o n e n t s / i t e m s . c p p
c o m p o n e n t s / i t e m s . h
c o m p o n e n t s / k i l l m e s s a g e s . c p p
c o m p o n e n t s / k i l l m e s s a g e s . h
c o m p o n e n t s / m a p i m a g e s . c p p
c o m p o n e n t s / m a p i m a g e s . h
c o m p o n e n t s / m a p l a y e r s . c p p
c o m p o n e n t s / m a p l a y e r s . h
c o m p o n e n t s / m a p s o u n d s . c p p
c o m p o n e n t s / m a p s o u n d s . h
c o m p o n e n t s / m e n u _ 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
c o m p o n e n t s / m e n u s . c p p
c o m p o n e n t s / m e n u s . h
c o m p o n e n t s / m e n u s _ b r o w s e r . c p p
c o m p o n e n t s / m e n u s _ d e m o . c p p
c o m p o n e n t s / m e n u s _ i n g a m e . c p p
c o m p o n e n t s / m e n u s _ s e t t i n g s . c p p
c o m p o n e n t s / m e n u s _ s e t t i n g s _ a s s e t s . c p p
c o m p o n e n t s / m e n u s _ s t a r t . c p p
c o m p o n e n t s / m o t d . c p p
c o m p o n e n t s / m o t d . h
c o m p o n e n t s / n a m e p l a t e s . c p p
c o m p o n e n t s / n a m e p l a t e s . h
c o m p o n e n t s / p a r t i c l e s . c p p
c o m p o n e n t s / p a r t i c l e s . h
c o m p o n e n t s / p l a y e r s . c p p
c o m p o n e n t s / p l a y e r s . h
c o m p o n e n t s / r a c e _ d e m o . c p p
c o m p o n e n t s / r a c e _ d e m o . h
c o m p o n e n t s / s c o r e b o a r d . c p p
c o m p o n e n t s / s c o r e b o a r d . h
c o m p o n e n t s / s k i n s . c p p
c o m p o n e n t s / s k i n s . h
c o m p o n e n t s / s o u n d s . c p p
c o m p o n e n t s / s o u n d s . h
c o m p o n e n t s / s p e c t a t o r . c p p
c o m p o n e n t s / s p e c t a t o r . h
c o m p o n e n t s / s t a t b o a r d . c p p
c o m p o n e n t s / s t a t b o a r d . h
c o m p o n e n t s / 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
c o m p o n e n t s / v o t i n g . c p p
c o m p o n e n t s / v o t i n g . h
g a m e c l i e n t . c p p
g a m e c l i e n t . h
l a s e r _ d a t a . c p p
l a s e r _ d a t a . h
l i n e i n p u t . c p p
l i n e i n p u t . h
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
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
r a c e . c p p
r a c e . h
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
s k i n . h
u i . c p p
u i . h
u i _ l i s t b o x . c p p
u i _ l i s t b o x . h
u i _ r e c t . c p p
u i _ r e c t . h
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
)
set_src ( GAME_EDITOR GLOB src/game/editor
a u t o _ m a p . c p p
a u t o _ m a p . h
e d i t o r . c p p
e d i t o r . h
e x p l a n a t i o n s . c p p
i o . c p p
l a y e r _ g a m e . c p p
l a y e r _ q u a d s . c p p
l a y e r _ s o u n d s . c p p
l a y e r _ t i l e s . c p p
p o p u p s . c p p
)
set ( GAME_GENERATED_CLIENT
s r c / g a m e / g e n e r a t e d / c h e c k s u m . 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 . 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
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
)
set ( CLIENT_SRC ${ ENGINE_CLIENT } ${ PLATFORM_CLIENT } ${ GAME_CLIENT } ${ GAME_EDITOR } ${ GAME_GENERATED_CLIENT } )
set ( DEPS_CLIENT ${ DEPS } ${ GLEW_DEP } ${ WAVPACK_DEP } )
# Libraries
set ( LIBS_CLIENT
$ { F R E E T Y P E _ L I B R A R I E S }
$ { G L E W _ L I B R A R I E S }
$ { P N G _ L I B R A R I E S }
$ { S D L 2 _ L I B R A R I E S }
$ { W A V P A C K _ L I B R A R I E S }
$ { F F M P E G _ L I B R A R I E S }
# Order of these three is important.
$ { O P U S F I L E _ L I B R A R I E S }
$ { O P U S _ L I B R A R I E S }
$ { O G G _ L I B R A R I E S }
$ { V U L K A N _ L I B R A R I E S }
$ { T A R G E T _ S T E A M A P I }
r u s t _ e n g i n e _ s h a r e d
$ { P L A T F O R M _ C L I E N T _ L I B S }
$ { L I B S }
)
if ( DISCORD )
if ( NOT DISCORD_DYNAMIC )
list ( APPEND LIBS_CLIENT discord-shared )
else ( )
list ( APPEND LIBS_CLIENT ${ CMAKE_DL_LIBS } )
endif ( )
endif ( )
if ( TARGET_OS STREQUAL "windows" )
configure_file ( "other/manifest/client.manifest.in" "client.manifest" )
set ( CLIENT_ICON "other/icons/DDNet.rc" )
if ( NOT MINGW )
set ( CLIENT_MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/client.manifest" )
else ( )
set ( CLIENT_MANIFEST "other/manifest/client.rc" )
set_target_properties ( ${ TARGET_STEAMAPI } PROPERTIES PREFIX "" )
endif ( )
else ( )
set ( CLIENT_ICON )
set ( CLIENT_MANIFEST )
endif ( )
# Target
if ( TARGET_OS STREQUAL "android" )
add_library ( game-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 }
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
$ < 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 >
$ < T A R G E T _ O B J E C T S : r u s t - b r i d g e - s h a r e d >
)
else ( )
add_executable ( game-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 }
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
$ < 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 >
$ < T A R G E T _ O B J E C T S : r u s t - b r i d g e - s h a r e d >
)
endif ( )
set_property ( TARGET game-client
P R O P E R T Y O U T P U T _ N A M E $ { C L I E N T _ E X E C U T A B L E }
)
target_link_libraries ( game-client ${ LIBS_CLIENT } )
if ( MSVC )
target_link_options ( game-client PRIVATE /ENTRY:mainCRTStartup )
endif ( )
target_include_directories ( game-client SYSTEM PRIVATE
$ { F R E E T Y P E _ I N C L U D E _ D I R S }
$ { G L E W _ I N C L U D E _ D I R S }
$ { 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 }
$ { P N G _ I N C L U D E _ D I R S }
$ { S D L 2 _ I N C L U D E _ D I R S }
$ { W A V P A C K _ I N C L U D E _ D I R S }
$ { F F M P E G _ I N C L U D E _ D I R S }
$ { D I S C O R D S D K _ I N C L U D E _ D I R S }
$ { V U L K A N _ I N C L U D E _ D I R S }
$ { 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 }
)
if ( STEAMAPI_KIND STREQUAL SHARED OR DISCORD_DYNAMIC )
set_own_rpath ( game-client )
endif ( )
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 "" )
set ( CMAKE_REQUIRED_INCLUDES ${ ORIGINAL_CMAKE_REQUIRED_INCLUDES } ${ WAVPACK_INCLUDE_DIRS } )
set ( CMAKE_REQUIRED_LIBRARIES ${ ORIGINAL_CMAKE_REQUIRED_LIBRARIES } ${ WAVPACK_LIBRARIES } )
check_symbol_exists ( WavpackOpenFileInputEx wavpack.h WAVPACK_OPEN_FILE_INPUT_EX )
check_symbol_exists ( WavpackCloseFile wavpack.h WAVPACK_CLOSE_FILE )
set ( CMAKE_REQUIRED_INCLUDES ${ ORIGINAL_CMAKE_REQUIRED_INCLUDES } )
set ( CMAKE_REQUIRED_LIBRARIES ${ ORIGINAL_CMAKE_REQUIRED_LIBRARIES } )
if ( WAVPACK_OPEN_FILE_INPUT_EX )
target_compile_definitions ( game-client PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX )
endif ( )
if ( WAVPACK_CLOSE_FILE )
target_compile_definitions ( game-client PRIVATE CONF_WAVPACK_CLOSE_FILE )
endif ( )
if ( GLEW_BUNDLED )
target_compile_definitions ( game-client PRIVATE CONF_GLEW_HAS_CONTEXT_INIT )
endif ( )
if ( VULKAN )
target_compile_definitions ( game-client PRIVATE CONF_BACKEND_VULKAN )
endif ( )
list ( APPEND TARGETS_OWN game-client )
list ( APPEND TARGETS_LINK game-client )
endif ( )
########################################################################
# SERVER
########################################################################
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
)
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
m a i n . c p p
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
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
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
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
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
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
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 ( )
# Antibot
if ( ANTIBOT )
set ( TARGET_ANTIBOT antibot )
add_library ( ${ TARGET_ANTIBOT } SHARED ${ ANTIBOT_SRC } )
list ( APPEND TARGETS_OWN ${ TARGET_ANTIBOT } )
endif ( )
# Libraries
set ( LIBS_SERVER
$ { M I N I U P N P C _ L I B R A R I E 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 }
r u s t _ e n g i n e _ s h a r e d
$ { L I B S }
)
# Target
add_executable ( game-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 >
$ < T A R G E T _ O B J E C T S : r u s t - b r i d g e - s h a r e d >
)
set_property ( TARGET game-server
P R O P E R T Y O U T P U T _ N A M E $ { S E R V E R _ E X E C U T A B L E }
)
target_link_libraries ( game-server ${ LIBS_SERVER } )
target_include_directories ( game-server PRIVATE ${ PNG_INCLUDE_DIRS } )
list ( APPEND TARGETS_OWN game-server )
list ( APPEND TARGETS_LINK game-server )
if ( TARGET_OS AND TARGET_OS STREQUAL "mac" )
set ( SERVER_LAUNCHER_SRC src/macos/server.mm )
add_executable ( game-server-launcher ${ SERVER_LAUNCHER_SRC } )
set_property ( TARGET game-server-launcher
P R O P E R T Y O U T P U T _ N A M E $ { S E R V E R _ E X E C U T A B L E } - L a u n c h e r
)
target_link_libraries ( game-server-launcher ${ COCOA } )
list ( APPEND TARGETS_OWN game-server-launcher )
list ( APPEND TARGETS_LINK game-server-launcher )
endif ( )
endif ( )
# Targets for compatibility with build commands previously available with Makefiles
if ( CMAKE_GENERATOR MATCHES ".*Makefiles.*" )
if ( TARGET game-client )
add_custom_target ( ${ CLIENT_EXECUTABLE } )
add_dependencies ( ${ CLIENT_EXECUTABLE } game-client )
endif ( )
if ( TARGET game-server )
add_custom_target ( ${ SERVER_EXECUTABLE } )
add_dependencies ( ${ SERVER_EXECUTABLE } game-server )
endif ( )
endif ( )
########################################################################
# VARIOUS TARGETS
########################################################################
if ( TOOLS )
set ( TARGETS_TOOLS )
set_src ( TOOLS_SRC GLOB src/tools
c o n f i g _ c o m m o n . h
c o n f i g _ r e t r i e v e . c p p
c o n f i g _ s t o r e . c p p
c 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
m a p _ c r e a t e _ p i x e l a r t . c p p
m a p _ d i f f . c p p
m a p _ e x t r a c t . c p p
m a p _ f i n d _ e n v . c p p
m a p _ o p t i m i z e . c p p
m a p _ r e p l a c e _ a r e a . c p p
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
s t u n . c p p
t w p i n g . c p p
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
)
foreach ( ABS_T ${ TOOLS_SRC } )
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 } )
unset ( EXTRA_TOOL_SRC )
if ( TOOL MATCHES "^(dilate|map_convert_07|map_create_pixelart|map_optimize|map_extract|map_replace_image)$" )
list ( APPEND TOOL_INCLUDE_DIRS ${ PNG_INCLUDE_DIRS } )
list ( APPEND TOOL_DEPS $< TARGET_OBJECTS:engine-gfx > )
list ( APPEND TOOL_LIBS ${ PNG_LIBRARIES } )
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 >
)
target_include_directories ( ${ TOOL } SYSTEM PRIVATE ${ TOOL_INCLUDE_DIRS } )
target_link_libraries ( ${ TOOL } ${ TOOL_LIBS } )
list ( APPEND TARGETS_TOOLS ${ TOOL } )
endif ( )
endforeach ( )
list ( APPEND TARGETS_OWN ${ TARGETS_TOOLS } )
list ( APPEND TARGETS_LINK ${ TARGETS_TOOLS } )
add_custom_target ( tools DEPENDS ${ TARGETS_TOOLS } )
endif ( )
add_custom_target ( everything DEPENDS ${ TARGETS_OWN } )
########################################################################
# 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
)
########################################################################
# TESTS
########################################################################
if ( GTEST_FOUND OR DOWNLOAD_GTEST )
set_src ( TESTS GLOB src/test
a i o . c p p
b e z i e r . c p p
b l o c k l i s t _ d r i v e r . c p p
b y t e s _ b e . c p p
c o l o r . c p p
c o m p r e s s i o n . c p p
c s v . c p p
d a t a f i l e . c p p
f s . c p p
g i t _ r e v i s i o n . c p p
h a s h . c p p
h u f f m a n . c p p
i o . c p p
j o b s . c p p
j s o n . c p p
l i n e r e a d e r . c p p
m a p b u g s . c p p
n a m e _ b a n . c p p
n e t . c p p
n e t a d d r . c p p
o s . c p p
p a c k e r . c p p
p r n g . c p p
s c o r e . c p p
s e c u r e _ r a n d o m . c p p
s e r v e r b r o w s e r . c p p
s e r v e r i n f o . c p p
s t r . c p p
s t r i p _ p a t h _ a n d _ e x t e n s i o n . c p p
t e e h i s t o r i a n . c p p
t e s t . c p p
t e s t . h
t h r e a d . c p p
u n i x . c p p
u u i d . c p p
)
set ( TESTS_EXTRA
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
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
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
s r c / e n g i n e / c l i e n t / s q l i t e . 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 . 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
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
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
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
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
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
)
set ( TARGET_TESTRUNNER testrunner )
add_executable ( ${ TARGET_TESTRUNNER } EXCLUDE_FROM_ALL
$ { T E S T S }
$ { T E S T S _ E X T R A }
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
$ < 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 >
$ { D E P S }
)
target_link_libraries ( ${ TARGET_TESTRUNNER } ${ MYSQL_LIBRARIES } ${ PNG_LIBRARIES } ${ GTEST_LIBRARIES } ${ LIBS } )
target_include_directories ( ${ TARGET_TESTRUNNER } SYSTEM PRIVATE ${ GTEST_INCLUDE_DIRS } )
list ( APPEND TARGETS_OWN ${ TARGET_TESTRUNNER } )
list ( APPEND TARGETS_LINK ${ TARGET_TESTRUNNER } )
add_custom_target ( run_cxx_tests
C O M M A N D $ < T A R G E T _ F I L E : $ { T A R G E T _ T E S T R U N N E R } > $ { 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 u n i t t e s t s
D E P E N D S $ { T A R G E T _ T E S T R U N N E R }
U S E S _ T E R M I N A L
)
add_custom_target ( run_tests
D E P E N D S r u n _ c x x _ t e s t s
)
if ( NOT MSVC OR CMAKE_BUILD_TYPE STREQUAL Release )
# On MSVC, Rust tests only work in the release mode because we link our C++
# code with the debug C standard library (/MTd) but Rust only supports
# linking to the release C standard library (/MT).
#
# See also https://github.com/rust-lang/rust/issues/39016.
add_dependencies ( run_tests run_rust_tests )
endif ( )
endif ( )
add_library ( rust_test STATIC EXCLUDE_FROM_ALL
$ < T A R G E T _ O B J E C T S : e n g i n e - g f x >
$ < 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 >
$ < T A R G E T _ O B J E C T S : r u s t - b r i d g e - s h a r e d >
$ { D E P S }
)
list ( APPEND TARGETS_OWN rust_test )
list ( APPEND TARGETS_LINK rust_test )
set ( RUST_TEST_LIBS ${ LIBS } $< TARGET_FILE:rust_test > )
list ( REMOVE_ITEM RUST_TEST_LIBS "-pthread" )
add_custom_target ( run_rust_tests
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v " D D N E T _ T E S T _ L I B R A R I E S = $ { R U S T _ T E S T _ L I B S } " $ { C A R G O _ T E S T }
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 }
U S E S _ T E R M I N A L
D E P E N D S r u s t _ t e s t
V E R B A T I M
)
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 g a m e - c l i e n t g a m e - s e r v e r
U S E S _ T E R M I N A L
)
########################################################################
# INSTALLATION
########################################################################
function ( escape_regex VAR STRING )
string ( REGEX REPLACE "([][^$.+*?|()\\\\])" "\\\\\\1" ESCAPED "${STRING}" )
set ( ${ VAR } ${ ESCAPED } PARENT_SCOPE )
endfunction ( )
function ( escape_backslashes VAR STRING )
string ( REGEX REPLACE "\\\\" "\\\\\\\\" ESCAPED "${STRING}" )
set ( ${ VAR } ${ ESCAPED } PARENT_SCOPE )
endfunction ( )
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 )
if ( TARGET_OS STREQUAL "mac" )
set ( CPACK_STRIP_FILES FALSE )
else ( )
set ( CPACK_STRIP_FILES TRUE )
endif ( )
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 } )
set ( CPACK_PACKAGE_VERSION ${ VERSION } )
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" )
# 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 ( )
endif ( )
set ( CPACK_SYSTEM_NAME "linux_${ARCHITECTURE}" )
elseif ( TARGET_OS STREQUAL "mac" )
set ( CPACK_SYSTEM_NAME "macos" )
set ( CPACK_GENERATOR DMG )
endif ( )
endif ( )
set ( CPACK_PACKAGE_FILE_NAME ${ CPACK_PACKAGE_NAME } - ${ CPACK_PACKAGE_VERSION } - ${ CPACK_SYSTEM_NAME } )
set ( CPACK_ARCHIVE_PORTABLE_FILE_NAME ${ CPACK_PACKAGE_FILE_NAME } )
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
l s a n . s u p p
m e m c h e c k . s u p p
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
u b s a n . s u p p
v a l g r i n d . s u p p
)
set ( CPACK_SOURCE_IGNORE_FILES
" \ \ \ \ . p y c $ "
" / \ \ \ \ . g i t "
" / _ _ 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 } )
escape_backslashes ( STR_ESCAPED "${PROJECT_SOURCE_DIR_ESCAPED}/${str}" )
list ( APPEND CPACK_SOURCE_IGNORE_FILES "${STR_ESCAPED}" )
endforeach ( )
set ( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${ PROJECT_NAME } )
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 ( )
set ( CPACK_TARGETS )
if ( TARGET game-client )
list ( APPEND CPACK_TARGETS game-client )
endif ( )
if ( TARGET game-server )
list ( APPEND CPACK_TARGETS game-server )
endif ( )
list ( APPEND CPACK_TARGETS ${ TARGET_TOOLS } )
if ( STEAMAPI_KIND STREQUAL SHARED )
list ( APPEND CPACK_TARGETS ${ TARGET_STEAMAPI } )
endif ( )
set ( CPACK_DIRS
d a t a
$ { C O P Y _ D I R S }
)
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 }
)
set ( CPACK_GEN_FILES
$ { V U L K A N _ S H A D E R _ F I L E _ L I S T }
)
if ( TARGET_OS STREQUAL "windows" )
list ( APPEND CPACK_FILES other/config_directory.bat )
else ( )
list ( APPEND CPACK_FILES other/config_directory.sh )
endif ( )
if ( NOT DEV )
include ( GNUInstallDirs )
install ( DIRECTORY data DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /ddnet COMPONENT data )
if ( TARGET game-client )
install ( TARGETS game-client DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT client )
endif ( )
if ( STEAMAPI_KIND STREQUAL SHARED )
install ( TARGETS ${ TARGET_STEAMAPI } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT client )
endif ( )
if ( TARGET game-server )
install ( TARGETS game-server DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT server )
endif ( )
if ( ANTIBOT )
install ( TARGETS ${ TARGET_ANTIBOT } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT server )
endif ( )
install ( TARGETS ${ TARGETS_TOOLS } DESTINATION ${ CMAKE_INSTALL_LIBDIR } /ddnet COMPONENT tools )
install ( FILES other/ddnet.desktop DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /applications COMPONENT client )
install ( FILES other/ddnet.appdata.xml DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /metainfo COMPONENT client )
foreach ( SIZE 16 32 48 256 )
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 )
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 )
endforeach ( )
foreach ( file ${ VULKAN_SHADER_FILE_LIST } )
install ( FILES ${ PROJECT_BINARY_DIR } / ${ file } DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } /ddnet/data/shader/vulkan COMPONENT client )
endforeach ( )
endif ( )
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 ( )
set ( EXTRA_ARGS DESTINATION ${ CPACK_PACKAGE_FILE_NAME } COMPONENT portable EXCLUDE_FROM_ALL )
install ( TARGETS ${ CPACK_TARGETS } ${ EXTRA_ARGS } )
install ( DIRECTORY ${ CPACK_DIRS } ${ EXTRA_ARGS } )
set ( CPACK_FILES_TMP ${ CPACK_FILES } ${ CPACK_GEN_FILES } )
install ( FILES ${ CPACK_FILES_TMP } ${ EXTRA_ARGS } )
endif ( )
set ( PACKAGE_TARGETS )
if ( CLIENT AND DMGBUILD )
file ( MAKE_DIRECTORY bundle/client/ )
file ( MAKE_DIRECTORY bundle/server/ )
configure_file ( other/bundle/client/Info.plist.in bundle/client/Info.plist )
configure_file ( other/bundle/server/Info.plist.in bundle/server/Info.plist )
set ( DMG_TMPDIR pack_ ${ CPACK_PACKAGE_FILE_NAME } _dmg )
set ( DMG_MKDIRS
$ { C L I E N T _ E X E C U T A B L E } . a p p
$ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s
$ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / F r a m e w o r k s
$ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S
$ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / R e s o u r c e s
$ { S E R V E R _ E X E C U T A B L E } . a p p
$ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s
$ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S
$ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / R e s o u r c e s
$ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / R e s o u r c e s / d a t a
$ { S E R V E R _ E X E C U T A B L E } . 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
)
set ( DMG_MKDIR_COMMANDS )
foreach ( dir ${ DMG_MKDIRS } )
list ( APPEND DMG_MKDIR_COMMANDS COMMAND ${ CMAKE_COMMAND } -E make_directory ${ DMG_TMPDIR } / ${ dir } )
endforeach ( )
set ( TARGET_TOOLS_FILES )
foreach ( target ${ TARGET_TOOLS } )
list ( APPEND TARGET_TOOLS_FILES $< TARGET_FILE:${target} > )
endforeach ( )
add_custom_command ( OUTPUT ${ CPACK_PACKAGE_FILE_NAME } .dmg
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 }
$ { D M G _ M K D I R _ C O M M A N D S }
# CLIENT
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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 / $ { C L I E N T _ E X E C U T A B L E } . i c n s $ { D M G _ T M P D I R } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / R e s o u r c e 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 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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t 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 $ < T A R G E T _ F I L E : g a m e - 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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S /
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y $ { P R O J E C T _ S O U R C E _ D I R } / d d n e t - l i b s / s d l / $ { 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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / F r a m e w o r k s / S D L 2 . f r a m e w o r k
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { P R O J E C T _ S O U R C E _ D I R } / d d n e t - l i b s / 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 / 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 c o d e c . 5 9 . d y l i b $ { D M G _ T M P D I R } / $ { C L I E N T _ E X E C U T A B L E } . 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 _ 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 } / $ { C L I E N T _ E X E C U T A B L E } . 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 $ { 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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S / $ { C L I E N T _ E X E C U T A B L E }
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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S / $ { C L I E N T _ E X E C U T A B L E }
# SERVER
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 } / $ { S E R V E R _ E X E C U T A B L E } . 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 / $ { S E R V E R _ E X E C U T A B L E } . i c n s $ { D M G _ T M P D I R } / $ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / R e s o u r c e 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 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 } / $ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t 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 $ < T A R G E T _ F I L E : g a m e - s e r v e r > $ < T A R G E T _ F I L E : g a m e - s e r v e r - l a u n c h e r > $ { D M G _ T M P D I R } / $ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S /
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 } / $ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S / $ { S E R V E R _ E X E C U T A B L E }
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 } / $ { S E R V E R _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S / $ { S E R V E R _ E X E C U T A B L E } $ { D M G _ T M P D I R } / $ { C L I E N T _ E X E C U T A B L E } . a p p / C o n t e n t s / M a c O S / $ { S E R V E R _ E X E C U T A B L E }
# DMG
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 } / $ { C L I E N T _ E X E C U T A B L E } . a p p - D s e r v e r = $ { D M G _ T M P D I R } / $ { S E R V E R _ E X E C U T A B L E } . 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
D E P E N D S
g a m e - c l i e n t
$ { T A R G E T _ S T E A M A P I }
g a m e - s e r v e r - l a u n c h e r
g a m e - s e r v e r
$ { 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
d a t a
o t h e r / b u n d l e / c l i e n t / P k g I n f o
o t h e r / b u n d l e / s e r v e r / P k g I n f o
o t h e r / 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
o t h e r / i c o n s / $ { C L I E N T _ E X E C U T A B L E } . i c n s
o t h e r / i c o n s / $ { S E R V E R _ E X E C U T A B L E } . i c n s
)
add_custom_target ( package_dmg DEPENDS ${ CPACK_PACKAGE_FILE_NAME } .dmg )
list ( APPEND PACKAGE_TARGETS package_dmg )
endif ( )
foreach ( ext zip tar.gz tar.xz )
set ( TAR_MODE c )
set ( TAR_EXTRA_ARGS )
string ( REPLACE . _ EXT_SLUG ${ ext } )
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 )
set ( STRIP_TARGET_COMMANDS )
foreach ( file ${ CPACK_FILES } )
list ( APPEND COPY_FILE_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy ${ PROJECT_SOURCE_DIR } / ${ file } ${ TMPDIR } / )
endforeach ( )
foreach ( file ${ CPACK_GEN_FILES } )
list ( APPEND COPY_FILE_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy ${ PROJECT_BINARY_DIR } / ${ file } ${ TMPDIR } / ${ file } )
endforeach ( )
foreach ( dir ${ CPACK_DIRS } )
list ( APPEND COPY_DIR_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy_directory ${ PROJECT_SOURCE_DIR } / ${ dir } ${ TMPDIR } / ${ dir } )
endforeach ( )
foreach ( target ${ CPACK_TARGETS } )
list ( APPEND COPY_TARGET_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy $< TARGET_FILE:${target} > ${ TMPDIR } / )
if ( NOT TARGET_OS STREQUAL "mac" )
list ( APPEND STRIP_TARGET_COMMANDS COMMAND strip -s ${ TMPDIR } / $< TARGET_FILE_NAME:${target} > )
endif ( )
endforeach ( )
if ( ext STREQUAL zip )
set ( TAR_EXTRA_ARGS --format=zip )
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 }
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 }
$ { 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 }
$ { S T R I P _ T A R G E T _ C O M M A N D S }
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 } /
D E P E N D S $ { C P A C K _ T A R G E T S }
)
add_custom_target ( package_ ${ EXT_SLUG } DEPENDS ${ CPACK_PACKAGE_FILE_NAME } . ${ ext } )
list ( APPEND PACKAGE_TARGETS package_ ${ EXT_SLUG } )
endforeach ( )
set ( PACKAGE_DEFAULT tar_xz )
if ( TARGET_OS STREQUAL "windows" )
set ( PACKAGE_DEFAULT zip )
elseif ( TARGET_OS STREQUAL "mac" )
set ( PACKAGE_DEFAULT dmg )
endif ( )
add_custom_target ( package_default DEPENDS package_ ${ PACKAGE_DEFAULT } )
add_custom_target ( package_all DEPENDS ${ PACKAGE_TARGETS } )
# 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 )
unset ( CPACK_GEN_FILES )
include ( CPack )
########################################################################
# COMPILER-SPECIFICS
########################################################################
# 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 )
if ( ANTIBOT )
# Allow the antibot library to use functions from the server binary.
add_cxx_compiler_flag_if_supported ( OUR_FLAGS_LINK -rdynamic )
set_own_rpath ( game-server )
endif ( )
set ( TARGETS ${ TARGETS_OWN } ${ TARGETS_DEP } )
foreach ( target ${ TARGETS } )
if ( MSVC )
set_property ( TARGET ${ target } PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded $< ${DBG}:Debug > ) # Use static CRT
target_compile_options ( ${ target } PRIVATE /MP ) # Use multiple cores
target_compile_options ( ${ target } PRIVATE /EHsc ) # Only catch C++ exceptions with catch.
target_compile_options ( ${ target } PRIVATE /GS ) # Protect the stack pointer.
target_compile_options ( ${ target } PRIVATE /wd4996 ) # Use of non-_s functions.
target_compile_options ( ${ target } PRIVATE /utf-8 ) # Use UTF-8 for source files.
endif ( )
if ( OUR_FLAGS_LINK )
target_link_libraries ( ${ target } ${ OUR_FLAGS_LINK } )
endif ( )
if ( OUR_FLAGS )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS } )
endif ( )
if ( DEFINE_FORTIFY_SOURCE )
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 ( )
endif ( )
if ( ENABLE_IPO )
set_property ( TARGET ${ target } PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE )
endif ( )
endforeach ( )
foreach ( target ${ TARGETS_LINK } )
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 ( )
if ( TARGET_OS STREQUAL "mac" )
target_link_libraries ( ${ target } -stdlib=libc++ )
target_link_libraries ( ${ target } "-framework SystemConfiguration" ) # Required by curl 7.79.0
endif ( )
if ( ( MINGW OR TARGET_OS STREQUAL "linux" ) AND PREFER_BUNDLED_LIBS )
# Statically link the standard libraries with on MinGW/Linux so we don't
# have to ship them as DLLs.
target_link_libraries ( ${ target } -static-libgcc )
target_link_libraries ( ${ target } -static-libstdc++ )
endif ( )
endforeach ( )
foreach ( target ${ TARGETS_OWN } )
if ( ( CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1 ) )
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD 17 )
set_property ( TARGET ${ target } PROPERTY CXX_STANDARD_REQUIRED ON )
set_property ( TARGET ${ target } PROPERTY CXX_EXTENSIONS OFF )
endif ( )
if ( MSVC )
target_compile_options ( ${ target } PRIVATE /wd4244 ) # Possible loss of data (float -> int, int -> float, etc.).
target_compile_options ( ${ target } PRIVATE /wd4267 ) # Possible loss of data (size_t - int on win64).
target_compile_options ( ${ target } PRIVATE /wd4800 ) # Implicit conversion of int to bool.
endif ( )
if ( TARGET_OS STREQUAL "windows" )
target_compile_definitions ( ${ target } PRIVATE NOMINMAX ) # windows.h shouldn't define min/max macros
target_compile_definitions ( ${ target } PRIVATE UNICODE ) # Windows headers
target_compile_definitions ( ${ target } PRIVATE _UNICODE ) # C-runtime
endif ( )
if ( OUR_FLAGS_OWN )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS_OWN } )
endif ( )
target_include_directories ( ${ target } PRIVATE ${ PROJECT_BINARY_DIR } /src )
target_include_directories ( ${ target } PRIVATE src )
target_include_directories ( ${ target } PRIVATE src/rust-bridge )
target_compile_definitions ( ${ target } PRIVATE $< $<CONFIG:Debug > :CONF_DEBUG> )
target_include_directories ( ${ target } SYSTEM PRIVATE ${ CURL_INCLUDE_DIRS } ${ SQLite3_INCLUDE_DIRS } ${ ZLIB_INCLUDE_DIRS } )
target_compile_definitions ( ${ target } PRIVATE GLEW_STATIC )
if ( CRYPTO_FOUND )
target_compile_definitions ( ${ target } PRIVATE CONF_OPENSSL )
target_include_directories ( ${ target } SYSTEM PRIVATE ${ CRYPTO_INCLUDE_DIRS } )
endif ( )
if ( WEBSOCKETS )
target_compile_definitions ( ${ target } PRIVATE CONF_WEBSOCKETS )
target_include_directories ( ${ target } SYSTEM PRIVATE ${ WEBSOCKETS_INCLUDE_DIRS } )
endif ( )
if ( UPNP )
target_compile_definitions ( ${ target } PRIVATE CONF_UPNP )
target_include_directories ( ${ target } SYSTEM PRIVATE ${ MINIUPNPC_INCLUDE_DIRS } )
endif ( )
if ( VIDEORECORDER )
target_compile_definitions ( ${ target } PRIVATE CONF_VIDEORECORDER )
endif ( )
if ( ANTIBOT )
target_compile_definitions ( ${ target } PRIVATE CONF_ANTIBOT )
endif ( )
if ( HEADLESS_CLIENT )
target_compile_definitions ( ${ target } PRIVATE CONF_HEADLESS_CLIENT )
endif ( )
if ( MYSQL )
target_compile_definitions ( ${ target } PRIVATE CONF_MYSQL )
target_include_directories ( ${ target } SYSTEM PRIVATE ${ MYSQL_INCLUDE_DIRS } )
endif ( )
if ( TEST_MYSQL )
target_compile_definitions ( ${ target } PRIVATE CONF_TEST_MYSQL )
endif ( )
if ( AUTOUPDATE AND NOT STEAM )
target_compile_definitions ( ${ target } PRIVATE CONF_AUTOUPDATE )
endif ( )
if ( INFORM_UPDATE AND NOT STEAM )
target_compile_definitions ( ${ target } PRIVATE CONF_INFORM_UPDATE )
endif ( )
if ( STEAM )
target_compile_definitions ( ${ target } PRIVATE PLATFORM_SUFFIX= "-steam" )
endif ( )
if ( DISCORD )
target_compile_definitions ( ${ target } PRIVATE CONF_DISCORD )
if ( DISCORD_DYNAMIC )
target_compile_definitions ( ${ target } PRIVATE CONF_DISCORD_DYNAMIC )
endif ( )
endif ( )
if ( VERSION )
target_compile_definitions ( ${ target } PRIVATE GAME_RELEASE_VERSION= "${VERSION}" )
endif ( )
if ( CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
target_compile_definitions ( ${ target } PRIVATE CONF_WEBASM )
endif ( )
endforeach ( )
foreach ( target ${ TARGETS_DEP } )
if ( MSVC )
target_compile_options ( ${ target } PRIVATE /W0 )
endif ( )
if ( OUR_FLAGS_DEP )
target_compile_options ( ${ target } PRIVATE ${ OUR_FLAGS_DEP } )
endif ( )
endforeach ( )