From 7a3c6dc0ea72a42f6c14a46535ff966fcf416bca Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 23 Sep 2024 11:25:42 -0400 Subject: [PATCH 1/7] Test all platforms --- .github/workflows/rust.yml | 67 ++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9ec65ab1b..3da09d8cd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -32,16 +32,11 @@ jobs: cd rust-bindings cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=600 || exit 255" - build_crate: - name: Build crate + lint: + name: Lint runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Rust uses: dtolnay/rust-toolchain@stable @@ -54,9 +49,67 @@ jobs: - name: Clippy run: cargo clippy + test: + name: Test (${{ matrix.os.name }} ${{ matrix.arch.name }}) + runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} + + strategy: + fail-fast: false + matrix: + os: + - name: macOS + matrix: macos + runs-on: + arm: [macos-13-arm64] + intel: [macos-13] + cibw-archs-macos: + arm: arm64 + intel: x86_64 + - name: Ubuntu + matrix: ubuntu + runs-on: + arm: [Linux, ARM64] + intel: [ubuntu-latest] + - name: Windows + matrix: windows + runs-on: + intel: [windows-latest] + + arch: + - name: ARM + matrix: arm + - name: Intel + matrix: intel + + exclude: + - os: + name: Windows + matrix: windows + runs-on: + intel: [windows-latest] + arch: + name: ARM + matrix: arm + + steps: + - uses: actions/checkout@v4 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + - name: Tests run: cargo test && cargo test --release + build_crate: + name: Build crate + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - uses: actions/checkout@v4 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + - name: Build run: cargo build --release From b753f178643bfa5c13705a71dcf20277d1ba0010 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 23 Sep 2024 12:43:10 -0400 Subject: [PATCH 2/7] link uint128_t --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9ae4c210..64d41cadd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,6 +211,13 @@ target_link_libraries(RunTests PRIVATE fse Threads::Threads Catch2::Catch2WithMa $<$>:stdc++fs> ) +IF (BUILD_STATIC_CHIAPOS_LIBRARY) + target_link_libraries(chiapos_static PRIVATE # fse Threads::Threads + $<$:uint128> + # $<$>:stdc++fs> + ) +ENDIF() + if (${CP_LINK_BLADEBIT_HARVESTER}) set(bb_defs From 4e2d86b3f12f6b41d33c300051eedd8f68c6d0c4 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 23 Sep 2024 12:50:19 -0400 Subject: [PATCH 3/7] private? --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64d41cadd..209fbc459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,7 @@ option(BUILD_STATIC_CHIAPOS_LIBRARY "Build chiapos static library (verify-only)" IF (BUILD_STATIC_CHIAPOS_LIBRARY) message("Build chiapos static library (verify-only)") add_library(chiapos_static STATIC src/chacha8.c c-bindings/wrapper.cpp) - target_link_libraries(chiapos_static PUBLIC blake3) + target_link_libraries(chiapos_static PRIVATE blake3) target_include_directories(chiapos_static PUBLIC lib/include) ENDIF() From e7d8698c24e2a875f65d28bd20cc6514034e77f7 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 23 Sep 2024 13:04:38 -0400 Subject: [PATCH 4/7] add flags? --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 209fbc459..6bbcceaeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,7 @@ option(BUILD_STATIC_CHIAPOS_LIBRARY "Build chiapos static library (verify-only)" IF (BUILD_STATIC_CHIAPOS_LIBRARY) message("Build chiapos static library (verify-only)") add_library(chiapos_static STATIC src/chacha8.c c-bindings/wrapper.cpp) + target_link_libraries(chiapos_static PUBLIC -static -Wl,--whole-archive -lrt -lpthread -Wl,--no-whole-archive) target_link_libraries(chiapos_static PRIVATE blake3) target_include_directories(chiapos_static PUBLIC lib/include) ENDIF() From 44768e2c5b1d8fc9c0af9c802f4fe29728295cb7 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Mon, 23 Sep 2024 13:08:21 -0400 Subject: [PATCH 5/7] revert --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bbcceaeb..209fbc459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,6 @@ option(BUILD_STATIC_CHIAPOS_LIBRARY "Build chiapos static library (verify-only)" IF (BUILD_STATIC_CHIAPOS_LIBRARY) message("Build chiapos static library (verify-only)") add_library(chiapos_static STATIC src/chacha8.c c-bindings/wrapper.cpp) - target_link_libraries(chiapos_static PUBLIC -static -Wl,--whole-archive -lrt -lpthread -Wl,--no-whole-archive) target_link_libraries(chiapos_static PRIVATE blake3) target_include_directories(chiapos_static PUBLIC lib/include) ENDIF() From 42d5914373a9e831b76c56897e2ee25a1218a081 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Thu, 31 Oct 2024 09:26:02 -0700 Subject: [PATCH 6/7] Some windows tweaks around uint128 library --- CMakeLists.txt | 13 ++++--------- rust-bindings/build.rs | 4 ++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a87d6a43..a40c39193 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,8 +156,8 @@ option(BUILD_STATIC_CHIAPOS_LIBRARY "Build chiapos static library (verify-only)" IF (BUILD_STATIC_CHIAPOS_LIBRARY) message("Build chiapos static library (verify-only)") add_library(chiapos_static STATIC src/chacha8.c c-bindings/wrapper.cpp) - target_link_libraries(chiapos_static PRIVATE blake3) - target_include_directories(chiapos_static PUBLIC lib/include) + target_link_libraries(chiapos_static PRIVATE blake3 $<$:uint128>) + target_include_directories(chiapos_static PUBLIC lib/include uint128_t) set_target_properties(chiapos_static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib$<0:>") ENDIF() @@ -189,7 +189,8 @@ endif() find_package(Threads REQUIRED) add_library(uint128 STATIC uint128_t/uint128_t.cpp) -target_include_directories(uint128 PUBLIC uint128_t) +target_include_directories(uint128 PUBLIC uint128_t +set_target_properties(uint128 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib$<0:>")) target_compile_features(fse PUBLIC cxx_std_17) target_compile_features(chiapos PUBLIC cxx_std_17) @@ -213,12 +214,6 @@ target_link_libraries(RunTests PRIVATE fse Threads::Threads Catch2::Catch2WithMa $<$>:stdc++fs> ) -IF (BUILD_STATIC_CHIAPOS_LIBRARY) - target_link_libraries(chiapos_static PRIVATE # fse Threads::Threads - $<$:uint128> - # $<$>:stdc++fs> - ) -ENDIF() if (${CP_LINK_BLADEBIT_HARVESTER}) diff --git a/rust-bindings/build.rs b/rust-bindings/build.rs index 2e0e664ef..019ee7680 100644 --- a/rust-bindings/build.rs +++ b/rust-bindings/build.rs @@ -33,6 +33,10 @@ fn main() { println!("cargo:rustc-link-lib=static=chiapos_static"); println!("cargo:rustc-link-lib=static=blake3"); + if cfg!(target_os = "windows") { + println!("cargo:rustc-link-lib=static=uint128"); + } + let bindings = bindgen::Builder::default() .header( cpp_dir From 315489d98a7646a76f398e243ba8fbf80a54daf4 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Thu, 31 Oct 2024 09:28:28 -0700 Subject: [PATCH 7/7] fixup typo --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a40c39193..145383d89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,8 +189,8 @@ endif() find_package(Threads REQUIRED) add_library(uint128 STATIC uint128_t/uint128_t.cpp) -target_include_directories(uint128 PUBLIC uint128_t -set_target_properties(uint128 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib$<0:>")) +target_include_directories(uint128 PUBLIC uint128_t) +set_target_properties(uint128 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib$<0:>") target_compile_features(fse PUBLIC cxx_std_17) target_compile_features(chiapos PUBLIC cxx_std_17)