@@ -21,29 +21,73 @@ readme = "README.md"
21
21
repository = " https://github.com/rerun-io/cpp-example-opencv-eigen"
22
22
version = " 0.1.0"
23
23
24
+ # The following activation scripts make the tasks portable cross-platform.
25
+ #
26
+ # They define:
27
+ # - CMAKE_GENERATOR
28
+ # - BUILD_FOLDER
29
+ # - EXE_PATH
30
+ #
31
+ # In particular, BUILD_FOLDER will be set to either:
32
+ # - build_fetchcontent
33
+ # - build_findpackage
34
+ # depending on the feature being used.
35
+ [activation ]
36
+ scripts = [" pixi/env.sh" ]
37
+
38
+ [target .win-64 .activation ]
39
+ scripts = [" pixi/env.bat" ]
40
+
41
+ # ###############################################################################
42
+ # Common Tasks
43
+ # ###############################################################################
24
44
25
45
[tasks ]
26
- # Note: extra CLI argument after `pixi run TASK` are passed to the task cmd.
27
- clean = { cmd = " rm -rf build bin CMakeFiles/" }
46
+
28
47
print-env = { cmd = " echo $PATH" }
29
48
30
- [target .win-64 .tasks ]
31
- prepare = " cmake -G 'Visual Studio 17 2022' -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo"
32
- build = { cmd = " cmake --build build --config RelWithDebInfo" , depends_on = [
33
- " prepare" ,
34
- ] }
35
- example = { cmd = " build/RelWithDebInfo/rerun_ext_example.exe" , depends_on = [
36
- " build" ,
49
+ [target .unix .tasks ]
50
+ # This task only runs properly Unix systems.
51
+ format = { cmd = " clang-format -i src/*" }
52
+
53
+ # ###############################################################################
54
+ # Building against Rerun using the default of FetchContent.
55
+ #
56
+ # The rerun-cpp source will be downloaded and built as part of the build.
57
+ # ###############################################################################
58
+ [feature .fetchcontent .tasks ]
59
+
60
+ prepare-fetchcontent = " cmake -B $BUILD_FOLDER -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo"
61
+
62
+ build-fetchcontent = { cmd = " cmake --build $BUILD_FOLDER --config RelWithDebInfo" , depends_on = [
63
+ " prepare-fetchcontent" ,
37
64
] }
38
65
39
- [target .unix .tasks ]
40
- prepare = " cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo"
41
- build = { cmd = " cmake --build build --config RelWithDebInfo --target all" , depends_on = [
42
- " prepare" ,
66
+ example = { cmd = " $EXE_PATH" , depends_on = [" build-fetchcontent" ] }
67
+
68
+ clean = { cmd = " rm -rf $BUILD_FOLDER bin CMakeFiles/" }
69
+
70
+ # ###############################################################################
71
+ # Alternatively, build by locating Rerun via find_package
72
+ #
73
+ # In this case rerun is provided by the `librerun-sdk` package in the
74
+ # conda environment.
75
+ # ###############################################################################
76
+ [feature .findpackage .tasks ]
77
+
78
+ prepare-findpackage = " cmake -B $BUILD_FOLDER -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DRERUN_FIND_PACKAGE:BOOL=ON"
79
+
80
+ build-findpackage = { cmd = " cmake --build $BUILD_FOLDER --config RelWithDebInfo" , depends_on = [
81
+ " prepare-findpackage" ,
43
82
] }
44
- example = { cmd = " build/rerun_ext_example" , depends_on = [" build" ] }
45
- format = { cmd = " clang-format -i src/*" }
46
83
84
+ example-findpackage = { cmd = " $EXE_PATH" , depends_on = [" build-findpackage" ] }
85
+
86
+ clean = { cmd = " rm -rf $BUILD_FOLDER bin CMakeFiles/" }
87
+
88
+ # ###############################################################################
89
+ # Dependencies
90
+ # ###############################################################################
47
91
[dependencies ]
48
92
# Build tools:
49
93
clang-tools = " >=15,<16" # clang-format
@@ -63,3 +107,11 @@ ninja = "1.11.1"
63
107
[target .win-64 .dependencies ]
64
108
# Build tools:
65
109
vs2022_win-64 = " 19.37.32822"
110
+
111
+ [feature .findpackage .dependencies ]
112
+ librerun-sdk = " 0.17.0.*"
113
+
114
+ [environments ]
115
+ default = { solve-group = " defaultgroup" }
116
+ fetchcontent = { features = [" fetchcontent" ], solve-group = " defaultgroup" }
117
+ findpackage = { features = [" findpackage" ], solve-group = " defaultgroup" }
0 commit comments