From 4a2a724a808825339a86d7bc6ead354a83cbeadc Mon Sep 17 00:00:00 2001 From: Anand Krishnamoorthi <35780660+anakrish@users.noreply.github.com> Date: Wed, 19 Jun 2024 19:01:29 -0400 Subject: [PATCH] Fix c,cpp,no-std binding examples (#272) - Use regorus_ffi in target_link_libraries instead of regorus-ffi. Something seems to have changed in corrosion-rs to need this. - Workaround for cmake issue where FFI header may not be generated in time Signed-off-by: Anand Krishnamoorthi --- .github/workflows/test-c-cpp.yml | 5 +++++ .github/workflows/test-ffi.yml | 2 +- bindings/c-nostd/CMakeLists.txt | 2 +- bindings/c/CMakeLists.txt | 2 +- bindings/cpp/CMakeLists.txt | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-c-cpp.yml b/.github/workflows/test-c-cpp.yml index 609fee3f..7f01ab3b 100644 --- a/.github/workflows/test-c-cpp.yml +++ b/.github/workflows/test-c-cpp.yml @@ -18,6 +18,11 @@ jobs: - name: Setup gcc, g++, cmake, ninja run: sudo apt update && sudo apt install -y gcc g++ cmake ninja-build + - name: Workaround to ensure that regorus.h is generated + run: | + cargo build -r + working-directory: ./bindings/ffi + - name: Test c binding run: | mkdir bindings/c/build diff --git a/.github/workflows/test-ffi.yml b/.github/workflows/test-ffi.yml index 991a327b..086b4036 100644 --- a/.github/workflows/test-ffi.yml +++ b/.github/workflows/test-ffi.yml @@ -1,4 +1,4 @@ -name: bindings/c-cpp +name: bindings/ffi on: push: diff --git a/bindings/c-nostd/CMakeLists.txt b/bindings/c-nostd/CMakeLists.txt index 3cc4e93b..82bf42be 100644 --- a/bindings/c-nostd/CMakeLists.txt +++ b/bindings/c-nostd/CMakeLists.txt @@ -38,4 +38,4 @@ corrosion_import_crate( add_executable(regorus_test main.c) # Add path to /bindings/ffi target_include_directories(regorus_test PRIVATE "../ffi") -target_link_libraries(regorus_test regorus-ffi) +target_link_libraries(regorus_test regorus_ffi) diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index 6acbb727..b32a258c 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -31,4 +31,4 @@ corrosion_import_crate( add_executable(regorus_test main.c) # Add path to /bindings/ffi target_include_directories(regorus_test PRIVATE "../ffi") -target_link_libraries(regorus_test regorus-ffi) +target_link_libraries(regorus_test regorus_ffi) diff --git a/bindings/cpp/CMakeLists.txt b/bindings/cpp/CMakeLists.txt index 04870fc0..5b7e3c99 100644 --- a/bindings/cpp/CMakeLists.txt +++ b/bindings/cpp/CMakeLists.txt @@ -31,4 +31,4 @@ corrosion_import_crate( add_executable(regorus_test main.cpp) # Add path to /bindings/ffi target_include_directories(regorus_test PRIVATE "../ffi") -target_link_libraries(regorus_test regorus-ffi) +target_link_libraries(regorus_test regorus_ffi)