Skip to content

Commit

Permalink
Merge pull request #231 from flaviojs/add-staticlib-rust-dynamips
Browse files Browse the repository at this point in the history
Add staticlib rust-dynamips
  • Loading branch information
grossmj authored Apr 7, 2024
2 parents 65552d3 + 9f37cd8 commit c636ef1
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Github CI
on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get -yq update
sudo apt-get -yq install libelf-dev libpcap0.8-dev
- name: Install rust
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.rustup.rs | sh -s -- -y -v
- name: Build
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDYNAMIPS_CODE=both ..
make
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ unstable/cmake_install.cmake
unstable/cmake_uninstall.cmake
unstable/common
unstable/unstable
/rust/target
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ if( APPLE OR (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") )
include_directories(include /opt/local/include/)
endif()

# Rust code
include ( FetchContent )
FetchContent_Declare (
Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG v0.4
)
FetchContent_MakeAvailable ( Corrosion )
corrosion_import_crate ( MANIFEST_PATH "${CMAKE_SOURCE_DIR}/rust/dynamips/Cargo.toml" PROFILE release-with-debug )
corrosion_experimental_cbindgen( MANIFEST_PATH "${CMAKE_SOURCE_DIR}/rust/dynamips/Cargo.toml" TARGET rust-dynamips HEADER_NAME "rust-dynamips.h" )
list ( APPEND DYNAMIPS_LIBRARIES rust-dynamips )

add_subdirectory ( man )
add_subdirectory ( common )
add_subdirectory ( stable )
Expand Down
7 changes: 7 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[workspace]
resolver = "2"
members = [
"dynamips",
]

# NOTE custom profiles need cargo 1.57

[profile.release-with-debug]
inherits = "release"
debug = true
10 changes: 10 additions & 0 deletions rust/dynamips/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "rust-dynamips"
version = "0.2.23"
edition = "2021"
workspace = ".."
publish = false
rust-version = "1.57" # custom profiles need 1.57

[lib]
crate-type = ["staticlib"]
4 changes: 4 additions & 0 deletions rust/dynamips/cbindgen.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language = "C"
include_version = true
include_guard = "RUST_DYNAMIPS_H"
pragma_once = true
Empty file added rust/dynamips/src/lib.rs
Empty file.

0 comments on commit c636ef1

Please sign in to comment.