blob: ec11dab7524fc59318e6bcc14990746f5db87788 (
plain) (
blame)
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
|
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags ${cflags} -Wall -g3 -ffunction-sections -fdata-sections)
set(components
building
camera
container
font
game
gfx
gui
header
input
instance
keyboard
main
menu
mouse
net
packet
pad
peripheral
player
settings
sfx
system
terrain
transport
unit
util
)
set(interfaces
)
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
# Dependencies for main.c
target_link_libraries(${PROJECT_NAME} PRIVATE main)
foreach(c ${components})
add_subdirectory("${c}")
target_compile_options(${c} PUBLIC ${cflags})
if(${c} STREQUAL "net" AND NOT ESP32_BUILD)
# ESP32 builds pull non-portable header files (e.g.: xt_utils.h).
set_target_properties(${c} PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
target_compile_options(${c} PUBLIC -pedantic)
target_compile_features(${c} PUBLIC c_std_99)
endif()
endforeach()
foreach(i ${interfaces})
add_subdirectory("${i}")
target_compile_options(${i} INTERFACE ${cflags})
target_link_libraries(${PROJECT_NAME} PRIVATE ${c})
endforeach()
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--gc-sections)
|