-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
137 lines (119 loc) · 3.26 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
cmake_minimum_required(VERSION 3.10)
project(yapt)
set(CMAKE_CXX_STANDARD 17)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native")
# Add include directory
include_directories(include)
# Add source files
#file(GLOB SOURCES "src/*.cpp")
#file(GLOB HEADERS "include/*.h")
#external dependencies
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIRS})
# Add executable
add_executable(yapt ${SOURCES}
src/main.cpp
src/stb_image.cpp
include/Vec3.h
include/ray.h
include/hittable.h
include/sphere.h
src/Vec3.cpp
src/ray.cpp
include/hittable_list.h
src/hittable_list.cpp
include/yapt.h
include/constants.h
src/color.cpp
include/interval.h
src/interval.cpp
include/camera.h
src/camera.cpp
include/utils.h
include/material.h
src/material.cpp
include/aabb.h
include/bvh.h
include/texture.h
include/external/stb_image.h
include/rtw_stb_image.h
src/aabb.cpp
include/perlin.h
include/quad.h
include/constant_medium.h
include/onb.h
include/pdf.h
include/image_exporter.h
src/image_exporter.cpp
include/image_data.h
include/sampler.h
include/triangle.h
)
find_package(Threads REQUIRED)
target_link_libraries(yapt ${PNG_LIBRARIES} Threads::Threads)
add_custom_target(clean-all
COMMAND ${CMAKE_BUILD_TOOL} clean
COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles
COMMAND ${CMAKE_COMMAND} -E remove CMakeCache.txt
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# Tests configuration
# Add include directory for tests
include_directories(tests)
# Add test sources
file(GLOB TEST_SOURCES "tests/*.cpp")
# Add executable for tests
add_executable(tests ${TEST_SOURCES}
tests/vec3test.cpp
src/stb_image.cpp
include/color.h
include/hittable.h
include/sphere.h
include/ray.h
tests/raytest.cpp
tests/spheretest.cpp
src/Vec3.cpp
src/ray.cpp
include/hittable_list.h
src/hittable_list.cpp
tests/hittabletest.cpp
include/yapt.h
include/constants.h
src/color.cpp
include/interval.h
include/interval.h
src/interval.cpp
tests/intervaltest.cpp
include/camera.h
src/camera.cpp
include/utils.h
include/material.h
src/material.cpp
include/aabb.h
include/bvh.h
include/texture.h
include/external/stb_image.h
include/rtw_stb_image.h
src/aabb.cpp
include/perlin.h
include/quad.h
include/constant_medium.h
include/onb.h
include/pdf.h
include/image_exporter.h
src/image_exporter.cpp
include/image_data.h
include/sampler.h
include/triangle.h
tests/triangletest.cpp
)
# Link external libraries to tests executable if needed
target_link_libraries(tests ${PNG_LIBRARIES})
# Enable testing
enable_testing()
# Add tests to CTest
add_test(NAME doctest COMMAND tests)