forked from agerasev/hypertrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (107 loc) · 2.99 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
cmake_minimum_required(VERSION 3.0)
project(hypertrace)
set(COMMON_FLAGS "\
-g \
-Wall \
-Wextra \
-Wno-unused-parameter \
")
set(CMAKE_C_FLAGS "\
${CMAKE_C_FLAGS} \
${COMMON_FLAGS} \
")
set(CMAKE_CXX_FLAGS "\
${CMAKE_CXX_FLAGS} \
${COMMON_FLAGS} \
-std=c++14 \
")
set(COMMON_SRC
"src/host/vec.hpp"
"src/host/vec.cpp"
"src/host/mat.hpp"
"src/host/mat.cpp"
"src/common/types.hh"
"src/common/types.cc"
"src/common/algebra/real.hh"
"src/common/algebra/complex.hh"
"src/common/algebra/complex.cc"
"src/common/algebra/quaternion.hh"
"src/common/algebra/quaternion.cc"
"src/common/algebra/matrix.hh"
"src/common/algebra/matrix.cc"
"src/common/algebra/moebius.hh"
"src/common/algebra/moebius.cc"
"src/common/algebra/rotation.hh"
"src/common/algebra/rotation.cc"
"src/common/geometry/hyperbolic.hh"
"src/common/geometry/hyperbolic.cc"
"src/common/geometry/hyperbolic/ray.hh"
"src/common/geometry/hyperbolic/ray.cc"
"src/common/geometry/hyperbolic/plane.hh"
"src/common/geometry/hyperbolic/plane.cc"
"src/common/geometry/hyperbolic/horosphere.hh"
"src/common/geometry/hyperbolic/horosphere.cc"
"src/common/random.hh"
"src/common/random.cc"
"src/common/material.hh"
"src/common/material.cc"
"src/common/object.hh"
"src/common/object.cc"
"src/common/view.hh"
"src/common/view.cc"
)
set(HOST_SRC
${COMMON_SRC}
"src/host/opencl/search.hpp"
"src/host/opencl/search.cpp"
"src/host/opencl/include.hpp"
"src/host/opencl/include.cpp"
"src/host/opencl/opencl.hpp"
"src/host/opencl/opencl.cpp"
"src/host/sdl/base.hpp"
"src/host/sdl/base.cpp"
"src/host/sdl/controller.hpp"
"src/host/sdl/controller.cpp"
"src/host/sdl/viewer.hpp"
"src/host/sdl/viewer.cpp"
"src/host/renderer.hpp"
"src/host/renderer.cpp"
"src/host/scenario.hpp"
"src/host/scenario.cpp"
)
include_directories(
"src/host"
"src/common"
)
add_library(${PROJECT_NAME} OBJECT ${HOST_SRC})
target_compile_definitions(${PROJECT_NAME} PUBLIC
"-DCL_TARGET_OPENCL_VERSION=120"
"-DOPENCL_INTEROP"
)
target_link_libraries(${PROJECT_NAME} OpenCL SDL2 SDL2_image)
if(MSYS)
include_directories("/mingw64/include")
link_directories("/mingw64/lib")
target_compile_definitions(${PROJECT_NAME} PUBLIC
"-DSDL_MAIN_HANDLED"
)
target_link_libraries(${PROJECT_NAME} SDL2main)
endif()
# Examples
file(GLOB EXAMPLES "src/host/examples/*.cpp")
foreach(EXAMPLE_PATH ${EXAMPLES})
get_filename_component(EXAMPLE_NAME ${EXAMPLE_PATH} NAME_WE)
add_executable(${EXAMPLE_NAME} ${EXAMPLE_PATH})
target_link_libraries(${EXAMPLE_NAME} ${PROJECT_NAME})
endforeach()
# Tests
add_executable(test ${COMMON_SRC} "src/host/tests/unit_test.cpp")
target_compile_definitions(test PRIVATE
"-DUNIT_TEST"
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(test PRIVATE
"--coverage"
)
endif()
target_link_libraries(test gcov)