-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
121 lines (90 loc) · 3.07 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
cmake_minimum_required(VERSION 3.4)
project(rmagine_examples)
include(GNUInstallDirs)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS On)
add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)
find_package(assimp REQUIRED)
find_package(rmagine
COMPONENTS # required components
core
OPTIONAL_COMPONENTS # optional components. existence can be checked later
embree
cuda
optix
)
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif(OPENMP_FOUND)
message(STATUS "Rmagine Found:")
message(STATUS "- version: ${rmagine_VERSION}")
get_target_property(RMAGINE_CORE_INCLUDES rmagine::core INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "- includes: ${RMAGINE_CORE_INCLUDES}")
if(TARGET rmagine::optix)
get_target_property(RMAGINE_OPTIX_INCLUDES rmagine::optix INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "- optix includes: ${RMAGINE_OPTIX_INCLUDES}")
endif(TARGET rmagine::optix)
message(STATUS "OLD STYLE CMAKE VARS:")
message(STATUS "- rmagine_INCLUDE_DIR: ${rmagine_INCLUDE_DIR}")
message(STATUS "- rmagine_LIBRARIES: ${rmagine_LIBRARIES}")
include_directories(include)
if(TARGET rmagine::core)
add_executable(example_math src/example_math.cpp)
target_link_libraries(example_math
rmagine::core
)
endif(TARGET rmagine::core)
# Check if rmagine was compiled with embree support
if(TARGET rmagine::embree)
add_executable(example_cpu_sphere src/example_cpu_sphere.cpp)
target_link_libraries(example_cpu_sphere
rmagine::embree
)
add_executable(example_cpu_pinhole src/example_cpu_pinhole.cpp)
target_link_libraries(example_cpu_pinhole
rmagine::embree
)
add_executable(example_cpu_o1dn src/example_cpu_o1dn.cpp)
target_link_libraries(example_cpu_o1dn
rmagine::embree
)
add_executable(example_cpu_ondn src/example_cpu_ondn.cpp)
target_link_libraries(example_cpu_ondn
rmagine::embree
)
add_executable(example_cpu_change_map src/example_cpu_change_map.cpp)
target_link_libraries(example_cpu_change_map
rmagine::embree
)
add_executable(example_cpu_change_sim src/example_cpu_change_sim.cpp)
target_link_libraries(example_cpu_change_sim
rmagine::embree
)
endif(TARGET rmagine::embree)
# check if rmagine was compiled with optix support
if(TARGET rmagine::optix)
add_executable(example_gpu_sphere src/example_gpu_sphere.cpp)
target_link_libraries(example_gpu_sphere
rmagine::optix
)
add_executable(example_gpu_pinhole src/example_gpu_pinhole.cpp)
target_link_libraries(example_gpu_pinhole
rmagine::optix
)
add_executable(example_gpu_o1dn src/example_gpu_o1dn.cpp)
target_link_libraries(example_gpu_o1dn
rmagine::optix
)
add_executable(example_gpu_ondn src/example_gpu_ondn.cpp)
target_link_libraries(example_gpu_ondn
rmagine::optix
)
add_executable(example_gpu_change_map src/example_gpu_change_map.cpp)
target_link_libraries(example_gpu_change_map
rmagine::optix
)
endif(TARGET rmagine::optix)