diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4aae797..bbdceba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.gitmodules b/.gitmodules index 9226cc2..6dc00a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 6eaf77c..a58d31d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] \ No newline at end of file diff --git a/example/Cargo.toml b/example/Cargo.toml index 03b39cb..b1fd84a 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -7,6 +7,9 @@ publish = false [lib] crate-type = ["cdylib", "lib"] +[features] +v3 = ["mimalloc-safe/v3"] + [dependencies] napi = "3" napi-derive = "3" diff --git a/libmimalloc-sys/Cargo.toml b/libmimalloc-sys/Cargo.toml index f991233..31898ec 100644 --- a/libmimalloc-sys/Cargo.toml +++ b/libmimalloc-sys/Cargo.toml @@ -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] diff --git a/libmimalloc-sys/build.rs b/libmimalloc-sys/build.rs index f7d469a..2d565eb 100644 --- a/libmimalloc-sys/build.rs +++ b/libmimalloc-sys/build.rs @@ -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"); diff --git a/libmimalloc-sys/c_src/mimalloc3 b/libmimalloc-sys/c_src/mimalloc3 new file mode 160000 index 0000000..7a2a411 --- /dev/null +++ b/libmimalloc-sys/c_src/mimalloc3 @@ -0,0 +1 @@ +Subproject commit 7a2a41134a544f34df9f58c5d7077e63228637ca diff --git a/libmimalloc-sys/sys-test/Cargo.toml b/libmimalloc-sys/sys-test/Cargo.toml index afe7951..cc75183 100644 --- a/libmimalloc-sys/sys-test/Cargo.toml +++ b/libmimalloc-sys/sys-test/Cargo.toml @@ -2,7 +2,7 @@ name = "libmimalloc-sys-test" version = "0.1.0" authors = ["Thom Chiovoloni "] -edition = "2018" +edition = "2021" description = "Bindings test for libmimalloc-sys" license = "MIT" publish = false @@ -10,6 +10,7 @@ publish = false [features] secure = ["libmimalloc-sys2/secure"] extended = ["libmimalloc-sys2/extended"] +v3 = ["libmimalloc-sys2/v3"] [dependencies] libmimalloc-sys2 = { path = "..", features = ["extended"] }