Skip to content

Add cmake and an example - #23

Merged
alilleybrinker merged 5 commits into
pact_matching_ffifrom
add-cmake-and-an-example
Jun 22, 2020
Merged

Add cmake and an example#23
alilleybrinker merged 5 commits into
pact_matching_ffifrom
add-cmake-and-an-example

Conversation

@alilleybrinker

Copy link
Copy Markdown

Closes #11
Closes #12

@alilleybrinker alilleybrinker added C-enhancement Category: Enhancement New feature or request A-ffi Area: Foreign Function Interface labels Jun 19, 2020
@alilleybrinker alilleybrinker added this to the Pact Matching FFI v1 milestone Jun 19, 2020
@alilleybrinker alilleybrinker self-assigned this Jun 19, 2020
@alilleybrinker

Copy link
Copy Markdown
Author

CC @asteffey, @djorgensen-mitre

Finally got CMake and Cargo/Cbindgen to play together nicely. The file example/CMakeLists.txt shows how easy it is for other CMake users to use the project. If the user isn't using CMake, they can still run cmake --install <build path> --prefix <where to install> to install the library file(s) and header, and they should be able to use it as any C library.

One funny note (I wasn't aware of this before) is that Windows doesn't have an equivalent to RPATH or LD_LIBRARY_PATH, so if the install location for the project isn't in one of Windows' usual directories for finding DLLs, in the PATH, or in the same directory as the user's executable, Windows won't find it. This can be worked around by running any command that uses the DLL like so: PATH=<path to DLL folder> ./<my_executable>.exe. This is a Windows issue, not a CMake or Rust one.

@alilleybrinker alilleybrinker left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure of this one issue here. Would appreciate thoughts.

Comment thread rust/pact_matching_ffi/Cargo.toml
@alilleybrinker
alilleybrinker merged commit 8e234e9 into pact_matching_ffi Jun 22, 2020
@alilleybrinker
alilleybrinker deleted the add-cmake-and-an-example branch June 22, 2020 13:29
alilleybrinker added a commit that referenced this pull request Jun 24, 2020
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Jul 17, 2020
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Sep 23, 2020
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Nov 4, 2020
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Dec 4, 2020
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Feb 2, 2021
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
alilleybrinker added a commit that referenced this pull request Apr 22, 2021
Adds CMake to both power Cargo compilation and generation of header files with cbindgen, and enable easy use of the FFI from other languages with a more accessible build system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ffi Area: Foreign Function Interface C-enhancement Category: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant