aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: 7a35715347290aaaf5fbe8a0c679fac768c05ed6 (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
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags -Wall -g3 -ffunction-sections -fdata-sections -pedantic -std=c99)

set(components
    building
    camera
    container
    font
    game
    gfx
    gui
    header
    input
    instance
    keyboard
    menu
    mouse
    net
    pad
    peripheral
    player
    resource
    sfx
    system
    terrain
    unit
    util
)

set(interfaces
    tech
)

target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
# Dependencies for main.c
target_link_libraries(${PROJECT_NAME} PRIVATE system menu)

foreach(c ${components})
    add_subdirectory("${c}")
    target_compile_options(${c} PUBLIC ${cflags})
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)