Skip to content
Merged
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
File renamed without changes.
23 changes: 22 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- name: Test libmimalloc-sys crate bindings (secure)
run: cargo run --features secure -p libmimalloc-sys-test

- name: Test libmimalloc-sys crate bindings (v3)
run: cargo run --features v3 -p libmimalloc-sys-test

- name: Build (no secure)
run: cargo build

Expand All @@ -60,6 +63,12 @@ jobs:
- name: Test (extended)
run: cargo test --features extended

- name: Test (v3)
run: cargo test --features v3

- name: Test (extended, v3)
run: cargo test --features extended,v3

- name: Test libmimalloc-sys crate bindings (extended)
run: cargo run --features extended -p libmimalloc-sys-test

Expand Down Expand Up @@ -153,7 +162,7 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.14.1
version: 0.15.2

- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
Expand Down Expand Up @@ -187,19 +196,31 @@ jobs:
if [[ "${{ matrix.settings.target }}" == *"musl"* ]]; then
yarn build --target ${{ matrix.settings.target }} -x
yarn build --target ${{ matrix.settings.target }} -x --release
yarn build --target ${{ matrix.settings.target }} -x --features v3
yarn build --target ${{ matrix.settings.target }} -x --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then
export TARGET_CFLAGS="-fuse-ld=lld"
export TARGET_CC=clang
yarn build --target ${{ matrix.settings.target }} --use-napi-cross
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --release
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"msvc"* ]]; then
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3
yarn build --target ${{ matrix.settings.target }} --features v3 --release
mkdir -p .cargo
echo "[target.${{ matrix.settings.target }}]" >> .cargo/config.toml
echo "rustflags = [\"-C\", \"target-feature=+crt-static\"]" >> .cargo/config.toml
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"wasm"* ]]; then
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
else
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3
yarn build --target ${{ matrix.settings.target }} --features v3 --release
fi
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "libmimalloc-sys/c_src/mimalloc"]
path = libmimalloc-sys/c_src/mimalloc
url = https://github.com/microsoft/mimalloc.git
[submodule "libmimalloc-sys/c_src/mimalloc3"]
path = libmimalloc-sys/c_src/mimalloc3
url = https://github.com/microsoft/mimalloc.git
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ no_thp = ["libmimalloc-sys2/no_thp"]
no_opt_arch = ["libmimalloc-sys2/no_opt_arch"]
extended = ["libmimalloc-sys2/extended"]
skip_collect_on_exit = ["libmimalloc-sys2/skip_collect_on_exit"]

etw = ["libmimalloc-sys2/etw"]
v3 = ["libmimalloc-sys2/v3"]
3 changes: 3 additions & 0 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[features]
v3 = ["mimalloc-safe/v3"]

[dependencies]
napi = "3"
napi-derive = "3"
Expand Down
1 change: 1 addition & 0 deletions libmimalloc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ no_thp = []
skip_collect_on_exit = []
# turn off `MI_OPT_ARCH`, default is `ON`
no_opt_arch = []
v3 = []

# Show `extended` on docs.rs since it's the full API surface.
[package.metadata.docs.rs]
Expand Down
3 changes: 3 additions & 0 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use std::env;
use cmake::Config;

fn main() {
#[cfg(not(feature = "v3"))]
let mut cmake_config = Config::new("c_src/mimalloc");
#[cfg(feature = "v3")]
let mut cmake_config = Config::new("c_src/mimalloc3");

let mut mimalloc_base_name = Cow::Borrowed("mimalloc");

Expand Down
1 change: 1 addition & 0 deletions libmimalloc-sys/c_src/mimalloc3
Submodule mimalloc3 added at 7a2a41
3 changes: 2 additions & 1 deletion libmimalloc-sys/sys-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
name = "libmimalloc-sys-test"
version = "0.1.0"
authors = ["Thom Chiovoloni <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Bindings test for libmimalloc-sys"
license = "MIT"
publish = false

[features]
secure = ["libmimalloc-sys2/secure"]
extended = ["libmimalloc-sys2/extended"]
v3 = ["libmimalloc-sys2/v3"]

[dependencies]
libmimalloc-sys2 = { path = "..", features = ["extended"] }
Expand Down
Loading