Skip to content

Commit 4ffb41d

Browse files
committed
Use different C++ build directories for debug/release and roundtrips
1 parent c2b3ae0 commit 4ffb41d

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

docs/code-examples/roundtrips.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656

5757
# fmt: on
5858

59+
cpp_build_dir = "build/roundtrips"
60+
5961

6062
def run(
6163
args: list[str], *, env: dict[str, str] | None = None, timeout: int | None = None, cwd: str | None = None
@@ -119,7 +121,16 @@ def main() -> None:
119121
build_type = "Debug"
120122
if args.release:
121123
build_type = "Release"
122-
configure_args = ["cmake", f"-DCMAKE_BUILD_TYPE={build_type}", "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", ".."]
124+
configure_args = [
125+
"cmake",
126+
"-G",
127+
"Ninja",
128+
"-B",
129+
cpp_build_dir,
130+
f"-DCMAKE_BUILD_TYPE={build_type}",
131+
"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
132+
"..",
133+
]
123134
run(
124135
configure_args,
125136
env=build_env,
@@ -299,15 +310,15 @@ def cmake_build(target: str, release: bool) -> None:
299310
build_process_args = [
300311
"cmake",
301312
"--build",
313+
cpp_build_dir,
302314
".",
303-
"--config",
304315
config,
305316
"--target",
306317
target,
307318
"--parallel",
308319
str(multiprocessing.cpu_count()),
309320
]
310-
run(build_process_args, cwd="build")
321+
run(build_process_args, cwd=cpp_build_dir)
311322

312323

313324
def run_comparison(rrd0_path: str, rrd1_path: str, full_dump: bool) -> None:

pixi.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,31 @@ py-test = { cmd = "python -m pytest -vv rerun_py/tests/unit", depends_on = [
4848
] }
4949

5050
# All the cpp-* tasks can be configured with environment variables, e.g.: RERUN_WERROR=ON CXX=clang++
51-
cpp-prepare-release = "cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=Release"
52-
cpp-prepare = "cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=Debug"
53-
cpp-build-all = { cmd = "cmake --build build --config Debug --target all", depends_on = [
51+
cpp-prepare-release = "cmake -G 'Ninja' -B build/release -S . -DCMAKE_BUILD_TYPE=Release"
52+
cpp-prepare = "cmake -G 'Ninja' -B build/debug -S . -DCMAKE_BUILD_TYPE=Debug"
53+
cpp-build-all = { cmd = "cmake --build build/debug --config Debug --target all", depends_on = [
5454
"cpp-prepare",
5555
] }
5656
cpp-clean = "rm -rf build CMakeCache.txt CMakeFiles"
57-
cpp-build-tests = { cmd = "cmake --build build --config Debug --target rerun_sdk_tests", depends_on = [
57+
cpp-build-tests = { cmd = "cmake --build build/debug --config Debug --target rerun_sdk_tests", depends_on = [
5858
"cpp-prepare",
5959
] }
60-
cpp-build-roundtrips = { cmd = "cmake --build build --config Debug --target roundtrips", depends_on = [
60+
cpp-build-roundtrips = { cmd = "cmake --build build/debug --config Debug --target roundtrips", depends_on = [
6161
"cpp-prepare",
6262
] }
63-
cpp-build-examples = { cmd = "cmake --build build --config Debug --target examples", depends_on = [
63+
cpp-build-examples = { cmd = "cmake --build build/debug --config Debug --target examples", depends_on = [
6464
"cpp-prepare",
6565
] }
66-
cpp-build-doc-examples = { cmd = "cmake --build build --config Debug --target doc_examples", depends_on = [
66+
cpp-build-doc-examples = { cmd = "cmake --build build/debug --config Debug --target doc_examples", depends_on = [
6767
"cpp-prepare",
6868
] }
69-
cpp-build-log-benchmark = { cmd = "cmake --build build --config Release --target log_benchmark", depends_on = [
69+
cpp-build-log-benchmark = { cmd = "cmake --build build/release --config Release --target log_benchmark", depends_on = [
7070
"cpp-prepare-release",
7171
] }
72-
cpp-test = { cmd = "export RERUN_STRICT=1 && ./build/rerun_cpp/tests/rerun_sdk_tests", depends_on = [
72+
cpp-test = { cmd = "export RERUN_STRICT=1 && ./build/debug/rerun_cpp/tests/rerun_sdk_tests", depends_on = [
7373
"cpp-build-tests",
7474
] }
75-
cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/tests/cpp/log_benchmark/log_benchmark", depends_on = [
75+
cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/release/tests/cpp/log_benchmark/log_benchmark", depends_on = [
7676
"cpp-build-log-benchmark",
7777
] }
7878
cpp-build-and-test-all = { depends_on = ["cpp-build-all", "cpp-test"] }

tests/cpp/log_benchmark/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// For better whole-executable timing capture you can also first build the executable and then run:
2626
// ```
2727
// pixi run cpp-build-log-benchmark
28-
// ./build/tests/cpp/log_benchmark/log_benchmark
28+
// ./build/release/tests/cpp/log_benchmark/log_benchmark
2929
// ```
3030
//
3131

tests/roundtrips.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"time_series_scalar": ["cpp", "py", "rust"], # Don't need it, API example roundtrips cover it all
2929
}
3030

31+
cpp_build_dir = "build/roundtrips"
32+
3133

3234
def run(
3335
args: list[str], *, env: dict[str, str] | None = None, timeout: int | None = None, cwd: str | None = None
@@ -84,7 +86,16 @@ def main() -> None:
8486
build_type = "Debug"
8587
if args.release:
8688
build_type = "Release"
87-
configure_args = ["cmake", f"-DCMAKE_BUILD_TYPE={build_type}", "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", ".."]
89+
configure_args = [
90+
"cmake",
91+
"-G",
92+
"Ninja",
93+
"-B",
94+
cpp_build_dir,
95+
f"-DCMAKE_BUILD_TYPE={build_type}",
96+
"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
97+
"..",
98+
]
8899
run(
89100
configure_args,
90101
env=build_env,
@@ -248,7 +259,7 @@ def cmake_build(target: str, release: bool) -> None:
248259
"--parallel",
249260
str(multiprocessing.cpu_count()),
250261
]
251-
run(build_process_args, cwd="build")
262+
run(build_process_args, cwd=cpp_build_dir)
252263

253264

254265
def run_comparison(rrd0_path: str, rrd1_path: str, full_dump: bool) -> None:

0 commit comments

Comments
 (0)