Skip to content

[WIP] Write Rust Bindings #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ result/
sftp-config.json
# Clangd cache
*.cache/
libcachesim-rs/target/
zstd-1.5.0/
zstd-1.5.0.tar.gz
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ elseif(${CMAKE_BUILD_TYPE} MATCHES "Debug")
if(LOG_LEVEL STREQUAL "NONE")
set(LOG_LEVEL DEBUG)
endif()
# elseif($(CMAKE_BUILD_TYPE) MATCHES "Rust")
# if(LOG_LEVEL STREQUAL "NONE")
# set(LOG_LEVEL INFO)
# endif()
else()
set(LOG_LEVEL INFO)
endif()
Expand Down Expand Up @@ -180,6 +184,13 @@ if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
endif()
endif()

# # Check if the build type is Rust, if so, we turn on -fkeep-inline-functions
# if (${CMAKE_BUILD_TYPE} MATCHES "Rust")
# message(STATUS "Turn on -fkeep-inline-functions for bindgen to handle inline functions")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fkeep-inline-functions")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fkeep-inline-functions")
# endif()

find_package(Threads)

# find_package(Boost REQUIRED)
Expand Down
Empty file added data/trace.csv
Empty file.
327 changes: 327 additions & 0 deletions libcachesim-rs/Cargo.lock

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

27 changes: 27 additions & 0 deletions libcachesim-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

[package]
name = "libcachesim-rs"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libc = "0.2" # For C types
bindgen = { version = "0.71.1", features = ["experimental"] }

[lib]
name = "libcachesim_rs"
path = "src/lib.rs"

[build]
rustflags = []

[build-dependencies]
cc = "1.0" # For compiling the C library
bindgen = { version = "0.71.1", features = ["experimental"] }
pkg-config = "0.3"

[[bin]]
name = "main"
path = "src/main.rs"
Loading