-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
115 lines (95 loc) · 3.28 KB
/
CMakeLists.txt
File metadata and controls
115 lines (95 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
cmake_minimum_required(VERSION 3.24)
project(Tails LANGUAGES CXX)
# Tails options
set(TAILS_BUILD_SHARED OFF CACHE BOOL "Whether to build shared/dynamically (default - OFF)")
set(TAILS_BUILD_EXAMPLES ON CACHE BOOL "Whether to build the examples or not (default - ON)")
set(TAILS_ENABLE_ASSERTS ON CACHE BOOL "Enable/disable asserts. Always off in release builds (default - ON)")
set(TAILS_ENABLE_PROFILING ON CACHE BOOL "Enable/disable profiling macros, independent of debug/release (default - ON)")
set(TAILS_ENABLE_LOGGING ON CACHE BOOL "Enable/disable logging macros, independent of debug/release (default - ON)")
# TODO - not sure on this!!
set(TAILS_TARGET_PLATFORM "Native" CACHE STRING "Choose a target platform to compile for. Supported: Native, PSP (default - Native)")
message("--")
message("-- Tails configuration:")
message("-- Shared: ${TAILS_BUILD_SHARED}")
message("-- (TAILS_BUILD_SHARED)")
message("-- Asserts: ${TAILS_ENABLE_ASSERTS}")
message("-- (TAILS_ENABLE_ASSERTS)")
message("-- Profiling: ${TAILS_ENABLE_PROFILING}")
message("-- (TAILS_ENABLE_PROFILING)")
message("-- Logging: ${TAILS_ENABLE_LOGGING}")
message("-- (TAILS_ENABLE_LOGGING)")
message("--")
if (TAILS_BUILD_SHARED)
add_library(Tails SHARED)
target_compile_definitions(Tails PUBLIC TAILS_BUILD_SHARED)
else ()
add_library(Tails STATIC)
endif ()
add_library(ostanton::Tails ALIAS Tails)
set_target_properties(
Tails
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/$<CONFIG>
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>
)
if (TAILS_ENABLE_ASSERTS)
target_compile_definitions(Tails PUBLIC TAILS_ENABLE_ASSERTS)
endif ()
if (TAILS_ENABLE_PROFILING)
target_compile_definitions(Tails PUBLIC TAILS_ENABLE_PROFILING)
endif ()
if (TAILS_ENABLE_LOGGING)
target_compile_definitions(Tails PUBLIC TAILS_ENABLE_LOGGING)
endif ()
add_subdirectory(include/Tails)
add_subdirectory(src)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
# external libraries
set(TAILS_LIBS)
# SDL3
message("--")
message("-- Tails: Fetching SDL3")
include(FetchContent)
FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-3.2.16
)
FetchContent_MakeAvailable(SDL3)
list(APPEND TAILS_LIBS SDL3::SDL3)
# SDL3_image
# TODO
#set(SDLIMAGE_AVIF OFF CACHE BOOL "" FORCE)
#set(SDL3_DIR "${SDL3_BINARY_DIR}")
#message("-- Tails: SDL3_BINARY_DIR = ${SDL3_BINARY_DIR}")
#FetchContent_Declare(
# SDL3_image
# GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
# GIT_TAG release-3.2.4
#)
#FetchContent_MakeAvailable(SDL3_image)
#list(APPEND TAILS_LIBS SDL3_image::SDL3_image)
target_include_directories(
Tails
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
if (TAILS_ENABLE_LOGGING)
# some logging lib? spdlog doesn't seem to work!
endif ()
if (PSP)
list(APPEND TAILS_LIBS pspdebug pspdisplay pspge)
endif ()
message("--")
message("-- Tails: Linking libraries '${TAILS_LIBS}'")
message("--")
target_link_libraries(Tails PUBLIC ${TAILS_LIBS})
target_compile_features(Tails PUBLIC cxx_std_20)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(Tails PRIVATE /W3 /WX)
endif ()
if (TAILS_BUILD_EXAMPLES)
# Examples
add_subdirectory(example)
endif ()