Skip to content

Commit abe11c5

Browse files
committed
added fetch content example
1 parent 5d4fb0c commit abe11c5

File tree

5 files changed

+74
-5
lines changed

5 files changed

+74
-5
lines changed

docs/extra/cmake_advanced.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# CMake - Advanced
2+
3+
## CMake - Standard
4+
5+
The standard way of including Rmagine is by first installing it and then importing it to another project via CMake's `find_package` command as follows:
6+
7+
```cmake
8+
add_compile_options(-std=c++17)
9+
set(CMAKE_CXX_STANDARD 17)
10+
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...
15+
COMPONENTS
16+
core
17+
embree
18+
)
19+
20+
add_executable(my_rmagine_app
21+
src/my_rmagine_app.cpp)
22+
23+
# link against rmagine targets
24+
target_link_libraries(my_rmagine_app
25+
rmagine::core
26+
rmagine::embree
27+
)
28+
```
29+
30+
## CMake - FetchContent
31+
32+
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.
33+
34+
```cmake
35+
cmake_minimum_required(VERSION 3.16)
36+
project(my_rmagine_app)
37+
38+
add_compile_options(-std=c++17)
39+
set(CMAKE_CXX_STANDARD 17)
40+
41+
include(FetchContent)
42+
43+
set(FETCHCONTENT_QUIET FALSE)
44+
45+
FetchContent_Declare(
46+
rmagine
47+
GIT_REPOSITORY https://github.com/uos/rmagine.git
48+
GIT_TAG v2.2.9 # put 'main' here for latest
49+
GIT_PROGRESS TRUE
50+
)
51+
52+
FetchContent_MakeAvailable(rmagine)
53+
54+
if(NOT TARGET rmagine::embree)
55+
message(FATAL "Could not build rmagine's embree backand which is required for this executable")
56+
endif(NOT TARGET rmagine::embree)
57+
58+
add_executable(my_rmagine_app src/my_rmagine_app.cpp)
59+
target_link_libraries(my_rmagine_app
60+
rmagine::core
61+
rmagine::embree)
62+
```

docs/getting_started/integration.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,7 @@ target_link_libraries(my_rmagine_app
105105
rmagine::cuda
106106
rmagine::optix
107107
)
108-
```
108+
```
109+
110+
111+
For more details and alternate ways of integrating Rmagine into your CMake project we refer to: [CMake - Advanced](/extra/cmake_advanced.md).

docs/getting_started/simulation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,6 @@ auto ranges5 = result.ranges(5 * model.size(), 6 * model.size());
9797
std::cout << "printing the first ray's range of the fifth scan: " << ranges5[0] << std::endl;
9898
9999
// slicing and other useful operations will be described at another Wiki page.
100-
```
100+
```
101+
102+
## TODO: Explain TF a bit

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ When using the Rmagine library or any related ideas in your scientific work, ple
4343

4444
- [Tools](extra/tools)
4545
- [Data](extra/data)
46-
- [News](extra/news)
4746
- [Embree 3](extra/embree3)
47+
- [CMake - Advanced](extra/cmake_advanced)
4848
- [Contributions](extra/contributions)
49+
- [News](extra/news)
4950

5051
## Contributions
5152

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ nav:
4848
- Extra:
4949
- Tools: extra/tools.md
5050
- Data: extra/data.md
51-
- News: extra/news.md
5251
- Embree 3: extra/embree3.md
53-
- Contributions: extra/contributions.md
52+
- CMake - Advanced: extra/cmake_advanced.md
53+
- Contributions: extra/contributions.md
54+
- News: extra/news.md

0 commit comments

Comments
 (0)