Skip to content

Commit 062afe8

Browse files
committed
Change environment variable to point to library directory
1 parent 2b26a01 commit 062afe8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

.github/workflows/pull-request-check-rust-api.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
VERSION=$(ruby -ne 'puts $~.captures if /^CBMC_VERSION\ =\ (\d+.\d+.\d+)$/' src/config.inc)
6565
cd src/libcprover-rust;\
6666
cargo clean;\
67-
CBMC_BUILD_DIR=../../${{env.default_build_dir}} CBMC_VERSION=$VERSION cargo test -- --test-threads=1
67+
CBMC_LIB_DIR=../../${{env.default_build_dir}}/lib CBMC_VERSION=$VERSION cargo test -- --test-threads=1
6868
6969
7070
check-macos-12-cmake-clang-rust:
@@ -104,4 +104,4 @@ jobs:
104104
VERSION=$(ruby -ne 'puts $~.captures if /^CBMC_VERSION\ =\ (\d+.\d+.\d+)$/' src/config.inc)
105105
cd src/libcprover-rust;\
106106
cargo clean;\
107-
CBMC_BUILD_DIR=../../${{env.default_build_dir}} CBMC_VERSION=$VERSION cargo test -- --test-threads=1
107+
CBMC_LIB_DIR=../../${{env.default_build_dir}}/lib CBMC_VERSION=$VERSION cargo test -- --test-threads=1

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ else()
275275

276276
corrosion_import_crate(MANIFEST_PATH src/libcprover-rust/Cargo.toml)
277277
list(JOIN sat_impl " " sat_impl_str)
278-
corrosion_set_env_vars(cprover-api-rust CBMC_BUILD_DIR=${CMAKE_BINARY_DIR} CBMC_VERSION=${CBMC_VERSION})
278+
corrosion_set_env_vars(cprover-api-rust CBMC_LIB_DIR=${CMAKE_BINARY_DIR} CBMC_VERSION=${CBMC_VERSION})
279279
corrosion_link_libraries(cprover-api-rust cprover-api-cpp)
280280
install(TARGETS cprover-api-rust RUNTIME DESTINATION lib)
281281
# NOTE: We want to rename to a name consistent with the name of the

src/libcprover-rust/build.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fn get_current_working_dir() -> std::io::Result<PathBuf> {
88
env::current_dir()
99
}
1010

11-
fn get_build_directory() -> Result<String, VarError> {
12-
env::var("CBMC_BUILD_DIR")
11+
fn get_lib_directory() -> Result<String, VarError> {
12+
env::var("CBMC_LIB_DIR")
1313
}
1414

1515
// Passed by the top-level CMakeLists.txt to control which version of the
@@ -20,16 +20,15 @@ fn get_cbmc_version() -> Result<String, VarError> {
2020
}
2121

2222
fn get_library_build_dir() -> std::io::Result<PathBuf> {
23-
let env_var_fetch_result = get_build_directory();
23+
let env_var_fetch_result = get_lib_directory();
2424
if let Ok(build_dir) = env_var_fetch_result {
2525
let mut path = PathBuf::new();
2626
path.push(build_dir);
27-
path.push("lib/");
2827
return Ok(path);
2928
}
3029
Err(Error::new(
3130
ErrorKind::Other,
32-
"failed to get build output directory",
31+
"Please set the environment variable CBMC_LIB_DIR with the path that contains the libcprover.x.y.z.a library on your system",
3332
))
3433
}
3534

0 commit comments

Comments
 (0)