-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (62 loc) · 1.73 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
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.8)
project (trikonasana)
set(lib_type SHARED)
set(CMAKE_C_STANDARD 11)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (WIN32)
message("Configure for WIN32")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(lib_type STATIC)
set(warning_compiler_options /W3 /wd"4267" /wd"4305" /wd"4244" /wd"4996")
# /Od disables optimization to speed compilation.
add_compile_options(${warning_compiler_options} /MD /Od /JMC)
elseif(UNIX)
message("Configure for LINUX")
SET(CMAKE_C_FLAGS "-g -Wall -std=gnu11 -O0")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
endif()
# trini
add_library(trini ${lib_type}
Source/Trini/Array.c
Source/Trini/Vector.c
Source/Trini/Matrix.c
)
# trikonasana
add_library(engine ${lib_type}
Source/Trikonasana/AssetLoader.c
Source/Trikonasana/Color.c
Source/Trikonasana/Display.c
Source/Trikonasana/Draw.c
Source/Trikonasana/Light.c
Source/Trikonasana/Mesh.c
Source/Trikonasana/Render.c
)
target_include_directories(engine PUBLIC Source)
if (WIN32)
target_include_directories(engine PUBLIC lib/SDL2)
target_link_directories(engine PUBLIC lib/SDL2/lib/x64)
endif()
target_link_libraries(engine PUBLIC SDL2 SDL2_image trini)
# main
add_executable(main
Source/Application.c
Source/Main.c
)
target_include_directories(main PUBLIC Source)
if (UNIX)
target_link_libraries(main PRIVATE engine m)
elseif(WIN32)
target_link_libraries(main PRIVATE engine)
endif (UNIX)
# tests
add_executable(tests
Tests/Tests.c
)
target_include_directories(tests PUBLIC
Tests/
Source/
)
target_link_libraries(tests PUBLIC
trini
)