Skip to content

Commit d3de510

Browse files
committed
Allow specifying a C++ std for building Rust
Signed-off-by: Scott Wilson <scott@propersquid.com>
1 parent 85a8add commit d3de510

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.github/workflows/build-steps.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ jobs:
157157
- name: Rust Test
158158
if: inputs.rust == '1'
159159
shell: bash
160+
env:
161+
OIIO_CXX_STANDARD: c++${{inputs.cxx_std}}
160162
run: src/build-scripts/ci-rust-test.bash
161163
- name: Code coverage
162164
if: inputs.coverage == '1'

src/build-scripts/ci-rust-test.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ fi
1414
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OpenImageIO_ROOT/lib
1515
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$OpenImageIO_ROOT/lib/pkgconfig
1616

17+
echo "Using C++ STD ${OIIO_CXX_STANDARD}"
18+
1719
echo "Running Rust oiio-sys tests"
1820

1921
pushd src/rust/oiio-sys

src/rust/oiio-sys/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ fn main() -> Result<()> {
1919
let pkgconfig = pkg_config::probe_library("OpenImageIO")?;
2020
include_paths.extend(pkgconfig.include_paths);
2121

22+
let std_version = std::env::var("OIIO_CXX_STANDARD").unwrap_or("c++17".to_string());
23+
2224
cxx_build::bridges(NAMES.iter().map(|s| format!("src/{}.rs", s)))
2325
.files(NAMES.iter().map(|s| format!("src/{}.cpp", s)))
24-
.std("c++17")
26+
.std(&std_version)
2527
.includes(&include_paths)
2628
.compile("oiio-sys");
2729

0 commit comments

Comments
 (0)