Skip to content

Commit

Permalink
Use different C++ build directories for debug/release and roundtrips
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Nov 20, 2023
1 parent c2b3ae0 commit 2c5f573
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
15 changes: 13 additions & 2 deletions docs/code-examples/roundtrips.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

# fmt: on

cpp_build_dir = "build/roundtrips"


def run(
args: list[str], *, env: dict[str, str] | None = None, timeout: int | None = None, cwd: str | None = None
Expand Down Expand Up @@ -119,7 +121,16 @@ def main() -> None:
build_type = "Debug"
if args.release:
build_type = "Release"
configure_args = ["cmake", f"-DCMAKE_BUILD_TYPE={build_type}", "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", ".."]
configure_args = [
"cmake",
"-G",
"Ninja",
"-B",
cpp_build_dir,
f"-DCMAKE_BUILD_TYPE={build_type}",
"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
"..",
]
run(
configure_args,
env=build_env,
Expand Down Expand Up @@ -299,7 +310,7 @@ def cmake_build(target: str, release: bool) -> None:
build_process_args = [
"cmake",
"--build",
".",
cpp_build_dir,
"--config",
config,
"--target",
Expand Down
20 changes: 10 additions & 10 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ py-test = { cmd = "python -m pytest -vv rerun_py/tests/unit", depends_on = [
] }

# All the cpp-* tasks can be configured with environment variables, e.g.: RERUN_WERROR=ON CXX=clang++
cpp-prepare-release = "cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=Release"
cpp-prepare = "cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=Debug"
cpp-build-all = { cmd = "cmake --build build --config Debug --target all", depends_on = [
cpp-prepare-release = "cmake -G 'Ninja' -B build/release -S . -DCMAKE_BUILD_TYPE=Release"
cpp-prepare = "cmake -G 'Ninja' -B build/debug -S . -DCMAKE_BUILD_TYPE=Debug"
cpp-build-all = { cmd = "cmake --build build/debug --config Debug --target all", depends_on = [
"cpp-prepare",
] }
cpp-clean = "rm -rf build CMakeCache.txt CMakeFiles"
cpp-build-tests = { cmd = "cmake --build build --config Debug --target rerun_sdk_tests", depends_on = [
cpp-build-tests = { cmd = "cmake --build build/debug --config Debug --target rerun_sdk_tests", depends_on = [
"cpp-prepare",
] }
cpp-build-roundtrips = { cmd = "cmake --build build --config Debug --target roundtrips", depends_on = [
cpp-build-roundtrips = { cmd = "cmake --build build/debug --config Debug --target roundtrips", depends_on = [
"cpp-prepare",
] }
cpp-build-examples = { cmd = "cmake --build build --config Debug --target examples", depends_on = [
cpp-build-examples = { cmd = "cmake --build build/debug --config Debug --target examples", depends_on = [
"cpp-prepare",
] }
cpp-build-doc-examples = { cmd = "cmake --build build --config Debug --target doc_examples", depends_on = [
cpp-build-doc-examples = { cmd = "cmake --build build/debug --config Debug --target doc_examples", depends_on = [
"cpp-prepare",
] }
cpp-build-log-benchmark = { cmd = "cmake --build build --config Release --target log_benchmark", depends_on = [
cpp-build-log-benchmark = { cmd = "cmake --build build/release --config Release --target log_benchmark", depends_on = [
"cpp-prepare-release",
] }
cpp-test = { cmd = "export RERUN_STRICT=1 && ./build/rerun_cpp/tests/rerun_sdk_tests", depends_on = [
cpp-test = { cmd = "export RERUN_STRICT=1 && ./build/debug/rerun_cpp/tests/rerun_sdk_tests", depends_on = [
"cpp-build-tests",
] }
cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/tests/cpp/log_benchmark/log_benchmark", depends_on = [
cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/release/tests/cpp/log_benchmark/log_benchmark", depends_on = [
"cpp-build-log-benchmark",
] }
cpp-build-and-test-all = { depends_on = ["cpp-build-all", "cpp-test"] }
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/log_benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// For better whole-executable timing capture you can also first build the executable and then run:
// ```
// pixi run cpp-build-log-benchmark
// ./build/tests/cpp/log_benchmark/log_benchmark
// ./build/release/tests/cpp/log_benchmark/log_benchmark
// ```
//

Expand Down
15 changes: 13 additions & 2 deletions tests/roundtrips.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"time_series_scalar": ["cpp", "py", "rust"], # Don't need it, API example roundtrips cover it all
}

cpp_build_dir = "build/roundtrips"


def run(
args: list[str], *, env: dict[str, str] | None = None, timeout: int | None = None, cwd: str | None = None
Expand Down Expand Up @@ -84,7 +86,16 @@ def main() -> None:
build_type = "Debug"
if args.release:
build_type = "Release"
configure_args = ["cmake", f"-DCMAKE_BUILD_TYPE={build_type}", "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", ".."]
configure_args = [
"cmake",
"-G",
"Ninja",
"-B",
cpp_build_dir,
f"-DCMAKE_BUILD_TYPE={build_type}",
"-DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
"..",
]
run(
configure_args,
env=build_env,
Expand Down Expand Up @@ -240,7 +251,7 @@ def cmake_build(target: str, release: bool) -> None:
build_process_args = [
"cmake",
"--build",
".",
cpp_build_dir,
"--config",
config,
"--target",
Expand Down

0 comments on commit 2c5f573

Please sign in to comment.