-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
104 lines (89 loc) · 3.62 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
cmake_minimum_required(VERSION 3.10)
project(cursedgl)
# C settings
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
SET(CMAKE_AR "gcc-ar")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH true)
list(APPEND CMAKE_C_FLAGS "-Wall \
-Wextra \
-Werror \
-Wpedantic \
-O1 \
-g \
-flto \
-Wfloat-equal \
-Wundef \
-Wshadow \
-Wpointer-arith \
-Wcast-align \
-Wswitch-enum \
-Wcast-qual \
-Wconversion \
-Wduplicated-cond \
-Wduplicated-branches \
-march=native \
-Winit-self \
-Wmissing-include-dirs")
# add source files
set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/framebuffer.c
${CMAKE_SOURCE_DIR}/src/rasterizer.c
${CMAKE_SOURCE_DIR}/src/transform.c
${CMAKE_SOURCE_DIR}/src/error.c)
# add header files
set(HEADER_FILES ${CMAKE_SOURCE_DIR}/include/common.h
${CMAKE_SOURCE_DIR}/include/framebuffer.h
${CMAKE_SOURCE_DIR}/include/init.h
${CMAKE_SOURCE_DIR}/include/mat2.h
${CMAKE_SOURCE_DIR}/include/mat3.h
${CMAKE_SOURCE_DIR}/include/mat4.h
${CMAKE_SOURCE_DIR}/include/pixel.h
${CMAKE_SOURCE_DIR}/include/quat.h
${CMAKE_SOURCE_DIR}/include/rasterizer.h
${CMAKE_SOURCE_DIR}/include/transform.h
${CMAKE_SOURCE_DIR}/include/cursedgl.h
${CMAKE_SOURCE_DIR}/include/vec.h
${CMAKE_SOURCE_DIR}/include/error.h
${CMAKE_SOURCE_DIR}/tp/stb_image.h)
# include directories
include_directories (
"${CMAKE_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/tp"
)
# build library
set(LIBS ${LIBS} notcurses-core m pthread)
add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})
# build examples
# colored_cube
# set(EXAMPLE colored_cube)
# add_executable(${EXAMPLE} examples/colored_cube.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# interpolation
# set(EXAMPLE interpolation)
# add_executable(${EXAMPLE} examples/interpolation.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# hello_triangle
# set(EXAMPLE hello_triangle)
# add_executable(${EXAMPLE} examples/hello_triangle.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# hello_textured_triangle
# set(EXAMPLE hello_textured_triangle)
# add_executable(${EXAMPLE} examples/hello_textured_triangle.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# montecarlo
# set(EXAMPLE montecarlo)
# add_executable(${EXAMPLE} examples/montecarlo.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# hello_cube
set(EXAMPLE hello_cube)
add_executable(${EXAMPLE} examples/hello_cube.c)
target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# hello_lines
# set(EXAMPLE hello_lines)
# add_executable(${EXAMPLE} examples/hello_lines.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})
# usage
# set(EXAMPLE usage)
# add_executable(${EXAMPLE} examples/usage.c)
# target_link_libraries(${EXAMPLE} PUBLIC ${LIBS} ${PROJECT_NAME})