2024-07-08 00:44:20 +00:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
|
2024-07-29 10:06:23 +00:00
|
|
|
project(townengine LANGUAGES C)
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
# SDL dependencies
|
2024-09-16 06:07:01 +00:00
|
|
|
# for whatever reason Emscripten has SDL2 config, but not actual SDL2 port by default
|
|
|
|
if(NOT EMSCRIPTEN)
|
|
|
|
find_package(SDL2 REQUIRED GLOBAL)
|
|
|
|
endif()
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
# CMake actually has no default configuration and it's toolchain file dependent, set debug if not specified
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2024-07-08 16:13:53 +00:00
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
2024-08-27 10:05:10 +00:00
|
|
|
endif()
|
|
|
|
|
2024-09-27 14:49:56 +00:00
|
|
|
if(NOT TWN_SANITIZE AND CMAKE_BUILD_TYPE MATCHES Debug)
|
2024-09-26 18:44:31 +00:00
|
|
|
set(TWN_SANITIZE ON)
|
|
|
|
endif()
|
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2024-07-08 16:13:53 +00:00
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
set(TWN_TARGET townengine CACHE INTERNAL "")
|
|
|
|
set(TWN_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
|
2024-07-08 16:13:53 +00:00
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
# feature configuration, set them with -DFEATURE=ON/OFF in cli
|
2024-08-26 21:33:37 +00:00
|
|
|
option(TWN_FEATURE_DYNLIB_GAME "Enable dynamic library loading support" ON)
|
2024-10-13 16:04:23 +00:00
|
|
|
option(TWN_USE_AMALGAM "Enable use of twn_amalgam.c as a single compilation unit" ON)
|
2024-08-22 15:36:04 +00:00
|
|
|
|
2024-09-16 06:07:01 +00:00
|
|
|
# todo: figure out how to compile for dynamic linking instead
|
|
|
|
if(EMSCRIPTEN)
|
|
|
|
if(TWN_FEATURE_DYNLIB_GAME)
|
|
|
|
message(WARNING "TWN_FEATURE_DYNLIB_GAME is set, but not supported - it is turned off")
|
|
|
|
set(TWN_FEATURE_DYNLIB_GAME OFF CACHE INTERNAL "")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-09-24 17:29:40 +00:00
|
|
|
if(HAIKU)
|
|
|
|
if(TWN_SANITIZE)
|
|
|
|
message(WARNING "TWN_SANITIZE is set, but not supported - it is turned off")
|
|
|
|
set(TWN_SANITIZE OFF CACHE INTERNAL "")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-08-22 15:36:04 +00:00
|
|
|
# add -fPIC globally so that it's linked well
|
2024-08-26 21:33:37 +00:00
|
|
|
add_compile_options($<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:-fPIC>)
|
2024-08-21 13:55:34 +00:00
|
|
|
|
2024-10-13 16:17:26 +00:00
|
|
|
set(PHYSFS_BUILD_SHARED FALSE CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_DISABLE_INSTALL TRUE CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_TARGETNAME_UNINSTALL "physfs_uninstall" CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_GRP OFF CACHE BOOL "")
|
|
|
|
set(PHYSFS_ARCHIVE_WAD OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_HOG OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_MVL OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_QPAK OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_SLB OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_ISO9660 OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_VDF OFF CACHE INTERNAL "")
|
|
|
|
set(PHYSFS_ARCHIVE_7Z OFF CACHE INTERNAL "")
|
2024-09-25 16:51:39 +00:00
|
|
|
add_subdirectory(third-party/physfs ${CMAKE_CURRENT_BINARY_DIR}/third-party/physfs SYSTEM)
|
|
|
|
add_subdirectory(third-party/libxm ${CMAKE_CURRENT_BINARY_DIR}/third-party/libxm SYSTEM)
|
2024-07-08 00:44:20 +00:00
|
|
|
|
|
|
|
|
2024-09-16 06:07:01 +00:00
|
|
|
if(LINUX)
|
2024-09-23 09:50:44 +00:00
|
|
|
set(SYSTEM_SOURCE_FILES
|
|
|
|
src/system/linux/twn_elf.c
|
|
|
|
$<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:src/game_object/twn_linux_game_object.c>)
|
|
|
|
elseif(WIN32)
|
|
|
|
set(SYSTEM_SOURCE_FILES
|
|
|
|
$<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:src/game_object/twn_win32_game_object.c>)
|
2024-09-18 17:36:00 +00:00
|
|
|
else()
|
|
|
|
set(SYSTEM_SOURCE_FILES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EMSCRIPTEN)
|
|
|
|
set(TWN_RENDERING_API WEBGL1)
|
|
|
|
else()
|
|
|
|
set(TWN_RENDERING_API OPENGL_15)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(TWN_RENDERING_API MATCHES OPENGL_15)
|
|
|
|
set(SYSTEM_SOURCE_FILES ${SYSTEM_SOURCE_FILES}
|
2024-09-16 13:17:00 +00:00
|
|
|
src/rendering/twn_gl_any_rendering.c
|
|
|
|
src/rendering/twn_gl_15_rendering.c
|
|
|
|
src/rendering/twn_gl_15_gpu_texture.c)
|
2024-07-27 22:44:39 +00:00
|
|
|
endif()
|
|
|
|
|
2024-08-27 10:24:15 +00:00
|
|
|
set(TWN_THIRD_PARTY_SOURCE_FILES
|
2024-07-08 00:44:20 +00:00
|
|
|
third-party/physfs/extras/physfsrwops.c
|
2024-07-08 06:46:12 +00:00
|
|
|
third-party/stb/stb_vorbis.c
|
2024-10-01 00:13:58 +00:00
|
|
|
third-party/tomlc99/toml.c
|
2024-09-16 06:07:01 +00:00
|
|
|
$<$<NOT:$<BOOL:${EMSCRIPTEN}>>:third-party/glad/src/glad.c>)
|
2024-07-08 06:46:12 +00:00
|
|
|
|
2024-10-13 16:04:23 +00:00
|
|
|
set(TWN_NONOPT_SOURCE_FILES
|
|
|
|
src/twn_stb.c
|
2024-09-16 06:07:01 +00:00
|
|
|
src/twn_loop.c
|
|
|
|
src/twn_main.c
|
|
|
|
src/twn_context.c include/twn_context.h
|
|
|
|
src/twn_audio.c include/twn_audio.h
|
|
|
|
src/twn_util.c include/twn_util.h
|
|
|
|
src/twn_input.c include/twn_input.h
|
|
|
|
src/twn_camera.c include/twn_camera.h
|
2024-09-16 13:17:00 +00:00
|
|
|
src/twn_textures.c src/twn_textures_c.h
|
2024-10-06 21:26:48 +00:00
|
|
|
|
2024-10-07 14:53:09 +00:00
|
|
|
src/rendering/twn_draw.c src/rendering/twn_draw_c.h
|
2024-09-16 13:17:00 +00:00
|
|
|
src/rendering/twn_sprites.c
|
|
|
|
src/rendering/twn_text.c
|
|
|
|
src/rendering/twn_triangles.c
|
|
|
|
src/rendering/twn_circles.c
|
2024-09-26 18:02:56 +00:00
|
|
|
src/rendering/twn_skybox.c
|
2024-10-13 16:04:23 +00:00
|
|
|
src/rendering/twn_fog.c)
|
|
|
|
|
|
|
|
set(TWN_SOURCE_FILES
|
|
|
|
$<IF:$<BOOL:${TWN_USE_AMALGAM}>,src/twn_amalgam.c src/twn_stb.c,${TWN_NONOPT_SOURCE_FILES}>
|
2024-09-16 13:17:00 +00:00
|
|
|
|
2024-09-16 06:07:01 +00:00
|
|
|
# for dynamic load based solution main is compiled in a separate target
|
2024-09-23 09:50:44 +00:00
|
|
|
$<$<NOT:$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>>:src/twn_main.c
|
|
|
|
src/game_object/twn_static_game_object.c>
|
2024-07-29 19:53:26 +00:00
|
|
|
|
2024-08-21 13:55:34 +00:00
|
|
|
${SYSTEM_SOURCE_FILES})
|
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
list(TRANSFORM TWN_SOURCE_FILES PREPEND ${TWN_ROOT_DIR}/)
|
2024-10-13 16:04:23 +00:00
|
|
|
source_group(TREE ${TWN_ROOT_DIR} FILES ${TWN_NONOPT_SOURCE_FILES})
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:24:15 +00:00
|
|
|
add_library(twn_third_parties STATIC ${TWN_THIRD_PARTY_SOURCE_FILES})
|
|
|
|
|
2024-07-29 19:53:26 +00:00
|
|
|
# base engine code, reused for games and tools
|
2024-08-27 10:05:10 +00:00
|
|
|
if(TWN_FEATURE_DYNLIB_GAME)
|
2024-08-27 10:24:15 +00:00
|
|
|
add_library(${TWN_TARGET} SHARED ${TWN_SOURCE_FILES} ${twn_third_parties})
|
2024-08-27 10:05:10 +00:00
|
|
|
else()
|
2024-08-27 10:24:15 +00:00
|
|
|
add_library(${TWN_TARGET} STATIC ${TWN_SOURCE_FILES} ${twn_third_parties})
|
2024-08-27 10:05:10 +00:00
|
|
|
endif()
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
set_target_properties(${TWN_TARGET} PROPERTIES
|
2024-09-16 06:07:01 +00:00
|
|
|
C_STANDARD 11
|
|
|
|
C_STANDARD_REQUIRED ON
|
|
|
|
C_EXTENSIONS ON) # extensions are required by stb_ds.h
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
# precompile commonly used not-so-small headers
|
2024-08-26 21:33:37 +00:00
|
|
|
target_precompile_headers(${TWN_TARGET} PRIVATE
|
2024-09-16 06:07:01 +00:00
|
|
|
$<$<NOT:$<BOOL:${EMSCRIPTEN}>>:third-party/glad/include/glad/glad.h>
|
2024-10-13 15:17:32 +00:00
|
|
|
${SDL2_INCLUDE_DIR}/SDL.h
|
|
|
|
third-party/physfs/src/physfs.h)
|
2024-08-20 14:25:01 +00:00
|
|
|
|
2024-07-29 19:53:26 +00:00
|
|
|
|
2024-08-27 10:24:15 +00:00
|
|
|
function(give_options_without_warnings target)
|
2024-08-27 10:05:10 +00:00
|
|
|
set(BUILD_FLAGS
|
|
|
|
# these SHOULDN'T break anything...
|
|
|
|
-fno-math-errno
|
|
|
|
-ffp-contract=fast
|
|
|
|
-fno-signed-zeros
|
|
|
|
-fno-trapping-math
|
2024-09-16 06:07:01 +00:00
|
|
|
-freciprocal-math
|
|
|
|
$<$<BOOL:${EMSCRIPTEN}>:-sUSE_SDL=2>)
|
2024-08-27 10:05:10 +00:00
|
|
|
|
|
|
|
set(BUILD_FLAGS_RELEASE
|
|
|
|
-O3
|
2024-10-07 10:21:43 +00:00
|
|
|
-flto=auto
|
2024-08-27 10:05:10 +00:00
|
|
|
-mavx -mavx2
|
|
|
|
-Wl,--gc-sections
|
|
|
|
-fdata-sections
|
|
|
|
-ffunction-sections
|
|
|
|
-funroll-loops
|
2024-10-07 10:44:46 +00:00
|
|
|
-fomit-frame-pointer
|
|
|
|
-s)
|
2024-08-27 10:05:10 +00:00
|
|
|
|
|
|
|
set(BUILD_FLAGS_DEBUG
|
|
|
|
-O0
|
|
|
|
-g3
|
|
|
|
-gdwarf
|
|
|
|
-fno-omit-frame-pointer
|
2024-09-27 14:49:56 +00:00
|
|
|
$<$<BOOL:${TWN_SANITIZE}>:-fstack-protector-all -fsanitize=undefined -fsanitize=address>
|
2024-09-16 06:07:01 +00:00
|
|
|
$<$<BOOL:${EMSCRIPTEN}>:-gsource-map>)
|
2024-08-27 10:05:10 +00:00
|
|
|
|
2024-09-27 14:49:56 +00:00
|
|
|
target_compile_options(${target} PUBLIC
|
2024-08-27 10:05:10 +00:00
|
|
|
${BUILD_FLAGS}
|
|
|
|
$<$<CONFIG:Release>:${BUILD_FLAGS_RELEASE}>
|
2024-10-07 08:04:05 +00:00
|
|
|
$<$<CONFIG:Debug>:${BUILD_FLAGS_DEBUG}>
|
2024-10-07 10:22:25 +00:00
|
|
|
$<$<BOOL:${LINUX}>:-Wl,-rpath,$ORIGIN/>)
|
2024-08-27 10:05:10 +00:00
|
|
|
|
2024-09-27 14:49:56 +00:00
|
|
|
target_link_options(${target} PUBLIC
|
2024-08-27 10:05:10 +00:00
|
|
|
${BUILD_FLAGS}
|
2024-10-07 08:04:05 +00:00
|
|
|
# -Wl,--no-undefined # TODO: use later for implementing no-libc
|
2024-08-27 10:05:10 +00:00
|
|
|
$<$<CONFIG:Release>:${BUILD_FLAGS_RELEASE}>
|
2024-10-07 08:04:05 +00:00
|
|
|
$<$<CONFIG:Debug>:${BUILD_FLAGS_DEBUG}>
|
2024-10-07 10:44:46 +00:00
|
|
|
$<$<BOOL:${LINUX}>:-Wl,-rpath,$ORIGIN/>
|
|
|
|
-Bsymbolic-functions
|
|
|
|
-Wl,--hash-style=gnu)
|
2024-07-29 19:53:26 +00:00
|
|
|
|
2024-10-07 22:20:42 +00:00
|
|
|
target_compile_definitions(${target} PRIVATE
|
2024-08-26 21:33:37 +00:00
|
|
|
$<$<BOOL:${TWN_FEATURE_DYNLIB_GAME}>:TWN_FEATURE_DYNLIB_GAME>)
|
2024-07-29 19:53:26 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2024-08-27 10:24:15 +00:00
|
|
|
function(give_options target)
|
|
|
|
give_options_without_warnings(${target})
|
|
|
|
|
|
|
|
set(WARNING_FLAGS_CLANG
|
|
|
|
-Weverything
|
|
|
|
-Wno-padded
|
|
|
|
-Wno-declaration-after-statement
|
|
|
|
-Wno-unsafe-buffer-usage
|
|
|
|
-Wno-unused-command-line-argument)
|
|
|
|
|
|
|
|
set(WARNING_FLAGS
|
|
|
|
-Wall
|
|
|
|
-Wextra
|
|
|
|
-Wpedantic
|
|
|
|
-Wshadow
|
|
|
|
-Wdouble-promotion
|
|
|
|
-Wconversion -Wno-sign-conversion
|
|
|
|
-Werror=vla
|
2024-08-27 10:42:40 +00:00
|
|
|
-Wno-missing-field-initializers
|
2024-08-27 11:45:26 +00:00
|
|
|
-Wunused-result
|
2024-08-27 10:24:15 +00:00
|
|
|
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Gnu>:-Wcast-align=strict>)
|
|
|
|
|
|
|
|
target_compile_options(${target} PRIVATE
|
|
|
|
${WARNING_FLAGS}
|
|
|
|
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:${WARNING_FLAGS_CLANG}>)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2024-08-21 13:55:34 +00:00
|
|
|
function(include_deps target)
|
2024-07-29 19:53:26 +00:00
|
|
|
# header-only libraries should be marked as "system includes"
|
|
|
|
# to suppress compiler warnings in their code (it's not my problem after all)
|
2024-07-29 22:20:30 +00:00
|
|
|
set(THIRD_PARTY_INCLUDES
|
2024-07-29 19:53:26 +00:00
|
|
|
third-party/physfs/src
|
|
|
|
third-party/physfs/extras
|
|
|
|
third-party/libxm/include
|
|
|
|
third-party/stb
|
2024-09-16 06:07:01 +00:00
|
|
|
third-party/x-watcher
|
2024-10-01 00:13:58 +00:00
|
|
|
third-party/tomlc99
|
2024-09-16 06:07:01 +00:00
|
|
|
$<$<NOT:$<BOOL:${EMSCRIPTEN}>>:third-party/glad/include>)
|
2024-08-21 13:55:34 +00:00
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
list(TRANSFORM THIRD_PARTY_INCLUDES PREPEND ${TWN_ROOT_DIR}/)
|
2024-07-29 22:20:30 +00:00
|
|
|
target_include_directories(${target} SYSTEM PRIVATE ${THIRD_PARTY_INCLUDES})
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-07-29 20:40:15 +00:00
|
|
|
# allow access to headers from any point in source tree
|
2024-09-16 13:17:00 +00:00
|
|
|
target_include_directories(${target} PRIVATE ${TWN_ROOT_DIR} ${TWN_ROOT_DIR}/include)
|
2024-08-21 13:55:34 +00:00
|
|
|
endfunction()
|
|
|
|
|
2024-07-29 20:40:15 +00:00
|
|
|
|
2024-08-21 13:55:34 +00:00
|
|
|
function(link_deps target)
|
2024-07-29 19:53:26 +00:00
|
|
|
target_link_libraries(${target} PUBLIC
|
2024-09-16 06:07:01 +00:00
|
|
|
$<$<NOT:$<BOOL:${EMSCRIPTEN}>>:SDL2::SDL2>
|
2024-07-29 19:53:26 +00:00
|
|
|
physfs-static
|
2024-08-21 13:55:34 +00:00
|
|
|
xms)
|
2024-10-07 14:54:46 +00:00
|
|
|
target_include_directories(${target} PUBLIC ${SDL2_INCLUDE_DIRS})
|
2024-07-29 19:53:26 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2024-10-07 15:55:25 +00:00
|
|
|
function(use_townengine target sources output_directory)
|
2024-08-27 10:05:10 +00:00
|
|
|
if(TWN_FEATURE_DYNLIB_GAME)
|
2024-08-21 18:38:24 +00:00
|
|
|
# game shared library, for reloading
|
|
|
|
add_library(${target}_game SHARED ${sources})
|
|
|
|
give_options(${target}_game)
|
|
|
|
include_deps(${target}_game)
|
2024-09-16 06:07:01 +00:00
|
|
|
target_link_libraries(${target}_game PUBLIC $<$<NOT:$<BOOL:${EMSCRIPTEN}>>:SDL2::SDL2> ${TWN_TARGET})
|
2024-08-26 21:33:37 +00:00
|
|
|
set_target_properties(${target}_game PROPERTIES
|
|
|
|
OUTPUT_NAME game
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${output_directory}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
|
2024-08-21 18:38:24 +00:00
|
|
|
|
|
|
|
# launcher binary, loads game and engine shared library
|
2024-10-07 21:50:25 +00:00
|
|
|
add_executable(${target} ${TWN_ROOT_DIR}/src/twn_main.c)
|
2024-08-21 18:38:24 +00:00
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
# todo: copy instead?
|
2024-08-21 18:38:24 +00:00
|
|
|
# put libtownengine.so alongside the binary
|
2024-08-26 21:33:37 +00:00
|
|
|
set_target_properties(${TWN_TARGET} PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${output_directory})
|
2024-08-27 10:05:10 +00:00
|
|
|
else()
|
|
|
|
# build and link all statically
|
2024-10-07 21:50:25 +00:00
|
|
|
add_executable(${target} ${sources})
|
2024-08-27 10:05:10 +00:00
|
|
|
endif()
|
2024-08-20 14:50:50 +00:00
|
|
|
|
2024-10-07 21:50:25 +00:00
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${output_directory}
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
|
2024-09-16 06:07:01 +00:00
|
|
|
|
|
|
|
if(EMSCRIPTEN)
|
2024-10-07 21:50:25 +00:00
|
|
|
set_target_properties(${target} PROPERTIES SUFFIX .html)
|
2024-09-16 06:07:01 +00:00
|
|
|
endif()
|
|
|
|
|
2024-10-07 21:50:25 +00:00
|
|
|
target_compile_options(${target} PRIVATE
|
|
|
|
$<$<BOOL:${EMSCRIPTEN}>:--shell-file ${TWN_ROOT_DIR}/shell_minimal.html>)
|
2024-08-22 16:49:30 +00:00
|
|
|
|
2024-07-29 19:53:26 +00:00
|
|
|
# system libraries
|
|
|
|
find_library(MATH_LIBRARY m)
|
2024-08-21 13:55:34 +00:00
|
|
|
if (MATH_LIBRARY)
|
2024-10-07 21:50:25 +00:00
|
|
|
target_link_libraries(${target} PUBLIC ${MATH_LIBRARY})
|
2024-08-27 10:05:10 +00:00
|
|
|
endif()
|
2024-07-29 19:53:26 +00:00
|
|
|
|
2024-10-07 21:50:25 +00:00
|
|
|
give_options(${target})
|
|
|
|
include_deps(${target})
|
|
|
|
link_deps(${target})
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-10-07 21:50:25 +00:00
|
|
|
target_link_libraries(${target} PUBLIC ${TWN_TARGET})
|
2024-08-27 10:05:10 +00:00
|
|
|
if(WIN32)
|
|
|
|
# copy dlls for baby windows
|
2024-10-07 21:50:25 +00:00
|
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}>
|
|
|
|
$<TARGET_FILE_DIR:${target}>
|
2024-08-27 10:05:10 +00:00
|
|
|
COMMAND_EXPAND_LISTS)
|
|
|
|
endif()
|
2024-07-29 19:53:26 +00:00
|
|
|
endfunction()
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:24:15 +00:00
|
|
|
give_options_without_warnings(twn_third_parties)
|
|
|
|
include_deps(twn_third_parties)
|
|
|
|
link_deps(twn_third_parties)
|
|
|
|
|
2024-08-26 21:33:37 +00:00
|
|
|
give_options(${TWN_TARGET})
|
|
|
|
include_deps(${TWN_TARGET})
|
|
|
|
link_deps(${TWN_TARGET})
|
2024-10-13 16:03:29 +00:00
|
|
|
target_compile_options(${TWN_TARGET} PRIVATE -fvisibility=hidden)
|
2024-08-27 10:24:15 +00:00
|
|
|
target_link_libraries(${TWN_TARGET} PUBLIC twn_third_parties)
|
2024-09-16 13:17:00 +00:00
|
|
|
target_include_directories(${TWN_TARGET} PRIVATE ${TWN_ROOT_DIR}/src)
|
2024-07-08 00:44:20 +00:00
|
|
|
|
2024-08-27 10:05:10 +00:00
|
|
|
# move compie_commands.json into root directory so that it plays nicer with code editors without any configuration
|
|
|
|
add_custom_target(copy-compile-commands ALL
|
2024-09-16 06:07:01 +00:00
|
|
|
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/compile_commands.json
|
|
|
|
${TWN_ROOT_DIR})
|