-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (58 loc) · 1.75 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.16)
project(test-application)
set(CMAKE_CXX_STANDARD 14)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
message("Target System = ${CMAKE_SYSTEM_NAME}")
include(compiler-detects.cmake)
if (TARGET_IS_WINDOWS)
set(CMAKE_C_FLAGS "-static ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-static ${CMAKE_CXX_FLAGS}")
endif()
include(libraries.cmake)
set(SRC_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/src/sdlpp.h
${CMAKE_CURRENT_SOURCE_DIR}/src/sdlpp.cc
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.o
COMMAND ${CMAKE_OBJCOPY_EXECUTABLE}
--input-target binary
--output-target ${BUILD_OBJCOPY_TARGET_TYPE}
--binary-architecture ${BUILD_OBJCOPY_BINARY_ARCH}
font.ttf ${CMAKE_CURRENT_BINARY_DIR}/font.o
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res
)
if (TARGET_IS_WINDOWS)
list(APPEND SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/windows/app.rc)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/windows/app.rc PROPERTIES
OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/windows/app.manifest.xml")
endif()
set(APP_NAME test-app)
add_executable(${APP_NAME} ${SRC_FILES} ${CMAKE_CURRENT_BINARY_DIR}/font.o)
target_link_options(${APP_NAME}
PUBLIC
-static
)
if (TARGET_IS_WINDOWS)
target_link_libraries(${APP_NAME}
PUBLIC
mingw32
)
endif()
target_link_libraries(${APP_NAME}
PUBLIC
SDL2-static
SDL2_ttf
SDL2main
)
if (VIDEO_X11)
target_link_libraries(${APP_NAME}
PUBLIC
X11
Xext
xcb
Xau
Xdmcp
)
endif()