Skip to content

Commit 76543d0

Browse files
committed
Handle build type in rs_port.
Signed-off-by: Tricster <[email protected]>
1 parent bb8bec3 commit 76543d0

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,3 @@ jobs:
4747
DEBIAN_FRONTEND: noninteractive
4848
NODE_PATH: /usr/lib/node_modules
4949
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
50-
- name: Setup tmate session
51-
uses: mxschmitt/action-tmate@v3
52-
timeout-minutes: 30

source/ports/rs_port/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ add_dependencies(${target}
4747
#
4848

4949
add_test(NAME ${target}
50-
COMMAND ${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} RUSTFLAGS=-Zmacro-backtrace ${Rust_CARGO_EXECUTABLE} test
50+
COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} RUSTFLAGS=-Zmacro-backtrace ${Rust_CARGO_EXECUTABLE} test
5151
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5252
)
5353

source/ports/rs_port/build.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ fn main() {
33
// when running tests
44
if let Ok(val) = env::var("CMAKE_BINARY_DIR") {
55
println!("cargo:rustc-link-search={val}");
6-
// try to link the debug version when running tests
7-
println!("cargo:rustc-link-lib=metacalld");
6+
7+
match env::var("CMAKE_BUILD_TYPE") {
8+
Ok(val) => {
9+
if val == "Debug" {
10+
// try to link the debug version when running tests
11+
println!("cargo:rustc-link-lib=metacalld");
12+
} else {
13+
println!("cargo:rustc-link-lib=metacall");
14+
}
15+
}
16+
Err(_) => {
17+
println!("cargo:rustc-link-lib=metacall");
18+
}
19+
}
20+
821
println!("cargo:rustc-env=LD_LIBRARY_PATH={val}");
922
println!("cargo:rustc-env=CONFIGURATION_PATH={val}/configurations/global.json")
1023
} else {

0 commit comments

Comments
 (0)