aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-09-16 20:29:47 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-09-16 20:29:47 +0200
commit95ae0911ff152d0429dcc2359047428810502526 (patch)
tree35f44a831cb0dea836bb9dfb1c47d7da13fc8a21 /src
parent1ad52adf0dd889fb9e12cc0e8ee0e9366a4ade74 (diff)
downloadjancity-95ae0911ff152d0429dcc2359047428810502526.tar.gz
Split CMakeLists.txt for src
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..ba57b6f
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,47 @@
+# 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
+ instance
+ keyboard
+ menu
+ mouse
+ 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)