|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
include(Definitions) |
|
|
|
|
|
|
|
include(functions/devilutionx_library) |
|
|
|
include(functions/genex) |
|
|
|
include(functions/genex) |
|
|
|
|
|
|
|
|
|
|
|
set(libdevilutionx_SRCS |
|
|
|
set(libdevilutionx_SRCS |
|
|
|
@ -183,61 +185,14 @@ if(VIRTUAL_GAMEPAD) |
|
|
|
controls/touch/renderers.cpp) |
|
|
|
controls/touch/renderers.cpp) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NINTENDO_SWITCH) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/switch/network.cpp |
|
|
|
|
|
|
|
platform/switch/keyboard.cpp |
|
|
|
|
|
|
|
platform/switch/docking.cpp |
|
|
|
|
|
|
|
platform/switch/asio/pause.c |
|
|
|
|
|
|
|
platform/switch/asio/net/if.c |
|
|
|
|
|
|
|
platform/switch/asio/sys/signal.c) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(PACKET_ENCRYPTION) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/switch/random.cpp) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(VITA) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/vita/network.cpp |
|
|
|
|
|
|
|
platform/vita/keyboard.cpp |
|
|
|
|
|
|
|
platform/vita/touch.cpp) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(PACKET_ENCRYPTION) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/vita/random.cpp) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NINTENDO_3DS) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/ctr/system.cpp |
|
|
|
|
|
|
|
platform/ctr/keyboard.cpp |
|
|
|
|
|
|
|
platform/ctr/display.cpp |
|
|
|
|
|
|
|
platform/ctr/messagebox.cpp |
|
|
|
|
|
|
|
platform/ctr/sockets.cpp |
|
|
|
|
|
|
|
platform/ctr/locale.cpp |
|
|
|
|
|
|
|
platform/ctr/asio/net/if.c |
|
|
|
|
|
|
|
platform/ctr/asio/sys/socket.c |
|
|
|
|
|
|
|
platform/ctr/asio/sys/uio.c) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(PACKET_ENCRYPTION) |
|
|
|
|
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
|
|
|
|
platform/ctr/random.cpp) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(DISCORD_INTEGRATION) |
|
|
|
if(DISCORD_INTEGRATION) |
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
list(APPEND libdevilutionx_SRCS |
|
|
|
discord/discord.cpp |
|
|
|
discord/discord.cpp |
|
|
|
) |
|
|
|
) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
add_library(libdevilutionx OBJECT ${libdevilutionx_SRCS}) |
|
|
|
add_devilutionx_library(libdevilutionx OBJECT ${libdevilutionx_SRCS}) |
|
|
|
target_include_directories(libdevilutionx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) |
|
|
|
target_include_directories(libdevilutionx PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) |
|
|
|
|
|
|
|
|
|
|
|
# Use file GENERATE instead of configure_file because configure_file |
|
|
|
# Use file GENERATE instead of configure_file because configure_file |
|
|
|
# does not support generator expressions. |
|
|
|
# does not support generator expressions. |
|
|
|
@ -266,14 +221,17 @@ if(GPERF) |
|
|
|
find_package(Gperftools REQUIRED) |
|
|
|
find_package(Gperftools REQUIRED) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC Threads::Threads) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC |
|
|
|
target_link_libraries(libdevilutionx PUBLIC |
|
|
|
|
|
|
|
Threads::Threads |
|
|
|
|
|
|
|
DevilutionX::SDL |
|
|
|
|
|
|
|
DevilutionX::SDL_image |
|
|
|
|
|
|
|
fmt::fmt |
|
|
|
PKWare |
|
|
|
PKWare |
|
|
|
libmpq |
|
|
|
libmpq |
|
|
|
libsmackerdec |
|
|
|
libsmackerdec |
|
|
|
simpleini |
|
|
|
simpleini |
|
|
|
hoehrmann_utf8) |
|
|
|
hoehrmann_utf8 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if(NOT NONET) |
|
|
|
if(NOT NONET) |
|
|
|
if(NOT DISABLE_TCP) |
|
|
|
if(NOT DISABLE_TCP) |
|
|
|
@ -284,40 +242,6 @@ if(NOT NONET) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC fmt::fmt) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
genex_for_option(DEBUG) |
|
|
|
|
|
|
|
target_compile_definitions(libdevilutionx PUBLIC "$<${DEBUG_GENEX}:_DEBUG>") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT NONET AND NOT DISABLE_TCP) |
|
|
|
|
|
|
|
target_compile_definitions(libdevilutionx PUBLIC ASIO_STANDALONE) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
genex_for_option(UBSAN) |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC $<${UBSAN_GENEX}:-fsanitize=undefined>) |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC $<${UBSAN_GENEX}:-fsanitize=undefined>) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(TSAN) |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC -fsanitize=thread) |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC -fsanitize=thread) |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
genex_for_option(ASAN) |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC "$<${ASAN_GENEX}:-fsanitize=address;-fsanitize-recover=address>") |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC "$<${ASAN_GENEX}:-fsanitize=address;-fsanitize-recover=address>") |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(USE_SDL1) |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC |
|
|
|
|
|
|
|
${SDL_LIBRARY} |
|
|
|
|
|
|
|
SDL_image) |
|
|
|
|
|
|
|
target_compile_definitions(libdevilutionx PUBLIC USE_SDL1) |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC |
|
|
|
|
|
|
|
${SDL2_MAIN} |
|
|
|
|
|
|
|
SDL2::SDL2 |
|
|
|
|
|
|
|
SDL2::SDL2_image) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT NOSOUND) |
|
|
|
if(NOT NOSOUND) |
|
|
|
target_link_libraries(libdevilutionx PUBLIC SDL_audiolib) |
|
|
|
target_link_libraries(libdevilutionx PUBLIC SDL_audiolib) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
@ -330,137 +254,8 @@ if(NOT NONET AND NOT DISABLE_ZERO_TIER) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC ${DEVILUTIONX_PLATFORM_LINK_LIBRARIES}) |
|
|
|
foreach(path ${DEVILUTIONX_PLATFORM_SUBDIRECTORIES}) |
|
|
|
target_compile_definitions(libdevilutionx PUBLIC ${DEVILUTIONX_PLATFORM_COMPILE_DEFINITIONS}) |
|
|
|
add_subdirectory(${path}) |
|
|
|
target_compile_options(libdevilutionx PUBLIC ${DEVILUTIONX_PLATFORM_COMPILE_OPTIONS}) |
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
if(GPERF) |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC ${GPERFTOOLS_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") |
|
|
|
|
|
|
|
genex_for_option(DEVILUTIONX_STATIC_CXX_STDLIB) |
|
|
|
|
|
|
|
target_link_libraries(libdevilutionx PUBLIC $<${DEVILUTIONX_STATIC_CXX_STDLIB_GENEX}:-static-libgcc;-static-libstdc++>) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") |
|
|
|
|
|
|
|
# Note: For Valgrind support. |
|
|
|
|
|
|
|
genex_for_option(DEBUG) |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC $<${DEBUG_GENEX}:-fno-omit-frame-pointer>) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Warnings for devilutionX |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC -Wall -Wextra -Wno-unused-parameter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# For ARM and other default unsigned char platforms |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC -fsigned-char) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT WIN32 AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD) |
|
|
|
|
|
|
|
# Enable POSIX extensions such as `readlink` and `ftruncate`. |
|
|
|
|
|
|
|
add_definitions(-D_POSIX_C_SOURCE=200809L) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(BUILD_TESTING) |
|
|
|
|
|
|
|
if(ENABLE_CODECOVERAGE) |
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") |
|
|
|
|
|
|
|
message(WARNING "Codecoverage not supported with MSVC") |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
target_compile_options(libdevilutionx PUBLIC --coverage) |
|
|
|
|
|
|
|
target_link_options(libdevilutionx PUBLIC --coverage) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_compile_definitions(libdevilutionx PRIVATE _DVL_EXPORTING) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Defines without value |
|
|
|
|
|
|
|
foreach( |
|
|
|
|
|
|
|
def_name |
|
|
|
|
|
|
|
NOSOUND |
|
|
|
|
|
|
|
NONET |
|
|
|
|
|
|
|
PREFILL_PLAYER_NAME |
|
|
|
|
|
|
|
DISABLE_TCP |
|
|
|
|
|
|
|
DISABLE_ZERO_TIER |
|
|
|
|
|
|
|
DISABLE_STREAMING_MUSIC |
|
|
|
|
|
|
|
DISABLE_STREAMING_SOUNDS |
|
|
|
|
|
|
|
BUILD_TESTING |
|
|
|
|
|
|
|
GPERF |
|
|
|
|
|
|
|
GPERF_HEAP_MAIN |
|
|
|
|
|
|
|
GPERF_HEAP_FIRST_GAME_ITERATION |
|
|
|
|
|
|
|
STREAM_ALL_AUDIO |
|
|
|
|
|
|
|
PACKET_ENCRYPTION |
|
|
|
|
|
|
|
VIRTUAL_GAMEPAD |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
if(${def_name}) |
|
|
|
|
|
|
|
list(APPEND def_list ${def_name}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endforeach(def_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Defines with value |
|
|
|
target_link_libraries(libdevilutionx PUBLIC ${DEVILUTIONX_PLATFORM_LINK_LIBRARIES}) |
|
|
|
foreach( |
|
|
|
|
|
|
|
def_name |
|
|
|
|
|
|
|
DEFAULT_WIDTH |
|
|
|
|
|
|
|
DEFAULT_HEIGHT |
|
|
|
|
|
|
|
DEFAULT_AUDIO_SAMPLE_RATE |
|
|
|
|
|
|
|
DEFAULT_AUDIO_CHANNELS |
|
|
|
|
|
|
|
DEFAULT_AUDIO_BUFFER_SIZE |
|
|
|
|
|
|
|
DEFAULT_AUDIO_RESAMPLING_QUALITY |
|
|
|
|
|
|
|
SDL1_VIDEO_MODE_BPP |
|
|
|
|
|
|
|
SDL1_VIDEO_MODE_FLAGS |
|
|
|
|
|
|
|
SDL1_VIDEO_MODE_SVID_FLAGS |
|
|
|
|
|
|
|
SDL1_FORCE_SVID_VIDEO_MODE |
|
|
|
|
|
|
|
SDL1_FORCE_DIRECT_RENDER |
|
|
|
|
|
|
|
HAS_KBCTRL |
|
|
|
|
|
|
|
KBCTRL_BUTTON_DPAD_LEFT |
|
|
|
|
|
|
|
KBCTRL_BUTTON_DPAD_RIGHT |
|
|
|
|
|
|
|
KBCTRL_BUTTON_DPAD_UP |
|
|
|
|
|
|
|
KBCTRL_BUTTON_DPAD_DOWN |
|
|
|
|
|
|
|
KBCTRL_BUTTON_B |
|
|
|
|
|
|
|
KBCTRL_BUTTON_A |
|
|
|
|
|
|
|
KBCTRL_BUTTON_Y |
|
|
|
|
|
|
|
KBCTRL_BUTTON_X |
|
|
|
|
|
|
|
KBCTRL_BUTTON_LEFTSTICK |
|
|
|
|
|
|
|
KBCTRL_BUTTON_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|
|
|
JOY_BUTTON_LEFTSHOULDER |
|
|
|
|
|
|
|
JOY_BUTTON_TRIGGERLEFT |
|
|
|
|
|
|
|
JOY_BUTTON_TRIGGERRIGHT |
|
|
|
|
|
|
|
JOY_BUTTON_START |
|
|
|
|
|
|
|
JOY_BUTTON_BACK |
|
|
|
|
|
|
|
REMAP_KEYBOARD_KEYS |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
if(DEFINED ${def_name}) |
|
|
|
|
|
|
|
list(APPEND def_list ${def_name}=${${def_name}}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endforeach(def_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_compile_definitions(libdevilutionx PUBLIC ${def_list}) |
|
|
|
|
|
|
|
|