@@ -9,9 +9,9 @@ add_compile_options(-std=c++17)
9
9
set(CMAKE_CXX_STANDARD 17)
10
10
11
11
# find components of a specific rmagine version
12
- # '2.2.1... ' will get the newest rmagine which
13
- # is greater than 2.2.1
14
- find_package(rmagine 2.2.1...
12
+ # '2.2.8 ' will get the newest rmagine which
13
+ # is greater equal 2.2.8
14
+ find_package(rmagine 2.2.8
15
15
COMPONENTS
16
16
core
17
17
embree
@@ -27,6 +27,49 @@ target_link_libraries(my_rmagine_app
27
27
)
28
28
```
29
29
30
+ ## CMake - Optional Components
31
+
32
+ ``` cmake
33
+ add_compile_options(-std=c++17)
34
+ set(CMAKE_CXX_STANDARD 17)
35
+
36
+ # find components of a specific rmagine version
37
+ # '2.2.8' will get the newest rmagine which
38
+ # is greater equal 2.2.8
39
+ find_package(rmagine 2.2.8
40
+ COMPONENTS
41
+ core
42
+ OPTIONAL_COMPONENTS
43
+ embree
44
+ cuda
45
+ optix
46
+ )
47
+
48
+ if(TARGET rmagine::embree)
49
+ # Compile app with embree support,
50
+ # if rmagine::embree was found
51
+ add_executable(my_rmagine_embree_app
52
+ src/my_rmagine_embree_app.cpp)
53
+ target_link_libraries(my_rmagine_embree_app
54
+ rmagine::core
55
+ rmagine::embree
56
+ )
57
+ endif(TARGET rmagine::embree)
58
+
59
+ if(TARGET rmagine::optix)
60
+ # Compile app with optix support,
61
+ # if rmagine::optix was found
62
+ add_executable(my_rmagine_optix_app
63
+ src/my_rmagine_optix_app.cpp)
64
+ target_link_libraries(my_rmagine_optix_app
65
+ rmagine::core
66
+ rmagine::cuda
67
+ rmagine::optix
68
+ )
69
+ endif(TARGET rmagine::optix)
70
+ ```
71
+
72
+
30
73
## CMake - FetchContent
31
74
32
75
Rmagine is compatible with CMake's FetchContent functionality. The following ` CMakeListst.txt ` shows how to use ` FetchContent ` and checks if the required targets have been built successfully.
@@ -39,24 +82,22 @@ add_compile_options(-std=c++17)
39
82
set(CMAKE_CXX_STANDARD 17)
40
83
41
84
include(FetchContent)
42
-
43
85
set(FETCHCONTENT_QUIET FALSE)
44
-
45
86
FetchContent_Declare(
46
87
rmagine
47
88
GIT_REPOSITORY https://github.com/uos/rmagine.git
48
89
GIT_TAG v2.2.9 # put 'main' here for latest
49
90
GIT_PROGRESS TRUE
50
91
)
51
-
52
92
FetchContent_MakeAvailable(rmagine)
53
93
54
94
if(NOT TARGET rmagine::embree)
55
95
message(FATAL "Could not build rmagine's embree backand which is required for this executable")
56
96
endif(NOT TARGET rmagine::embree)
57
97
58
- add_executable(my_rmagine_app src/my_rmagine_app.cpp)
59
- target_link_libraries(my_rmagine_app
98
+ add_executable(my_rmagine_embree_app
99
+ src/my_rmagine_embree_app.cpp)
100
+ target_link_libraries(my_rmagine_embree_app
60
101
rmagine::core
61
102
rmagine::embree)
62
103
```
0 commit comments