From 253899d07e2b4195a1c6ff976a30e5b8a8a21239 Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Tue, 25 Jun 2024 10:22:31 +1000 Subject: [PATCH] Update CaDiCaL to work on Windows --- .github/workflows/rust.yml | 50 +++++++------------------ .gitmodules | 3 +- crates/pindakaas-cadical/build.rs | 6 +++ crates/pindakaas-cadical/vendor/cadical | 2 +- crates/pindakaas-derive/src/lib.rs | 2 + 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 95b8ede9b9..1eb59afa02 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,28 +13,11 @@ env: RUST_FMT_CHANNEL: nightly jobs: - # build: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # crate: [] - # steps: - # - uses: actions/checkout@v3 - # - name: Install Rust toolchain - # run: | - # rustup toolchain install --profile minimal --no-self-update ${{ env.RUST_CHANNEL }} - # rustup default ${{ env.RUST_CHANNEL }} - # - name: Cache dependencies - # uses: Swatinem/rust-cache@v2 - # - name: Build ${{ matrix.crate }} - # run: cargo install --root dist/ --path crates/${{ matrix.crate }} - # - name: Upload build artifact - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ matrix.crate }}-${{ matrix.os }} - # path: dist/ test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 with: @@ -43,10 +26,14 @@ jobs: run: | rustup toolchain install --profile minimal --no-self-update ${{ env.RUST_CHANNEL }} rustup default ${{ env.RUST_CHANNEL }} - - name: Cache dependencies - uses: Swatinem/rust-cache@v2 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.5 + - name: Run cargo test + run: cargo test --features splr,cadical,kissat,intel-sat,ipasir-up + if: matrix.os == 'ubuntu-latest' - name: Run cargo test - run: cargo test --all-features + run: cargo test -p pindakaas --features splr,cadical,ipasir-up + if: matrix.os == 'windows-latest' clippy: runs-on: ubuntu-latest steps: @@ -57,8 +44,8 @@ jobs: run: | rustup toolchain install --profile minimal --component clippy --no-self-update ${{ env.RUST_CHANNEL }} rustup default ${{ env.RUST_CHANNEL }} - - name: Cache dependencies - uses: Swatinem/rust-cache@v2 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.5 - name: Run clippy run: cargo clippy --tests --features splr,cadical,kissat,intel-sat,ipasir-up -- -D warnings format: @@ -73,14 +60,3 @@ jobs: rustup default ${{ env.RUST_CHANNEL }} - name: Run cargo format run: cargo +nightly fmt --all --check - # TODO: Re-enable after first release - # semver: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # submodules: true - # - name: Check semver - # uses: obi1kenobi/cargo-semver-checks-action@v2 - # with: - # crate-name: pindakaas diff --git a/.gitmodules b/.gitmodules index bb758f9e93..d999a7c127 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "crates/pindakaas-cadical/vendor/cadical"] path = crates/pindakaas-cadical/vendor/cadical - url = https://github.com/arminbiere/cadical.git + url = https://github.com/pindakaashq/cadical.git + branch = track/pindakaas [submodule "crates/pindakaas-intel-sat/vendor/intel_sat"] path = crates/pindakaas-intel-sat/vendor/intel_sat url = https://github.com/alexander-nadel/intel_sat_solver.git diff --git a/crates/pindakaas-cadical/build.rs b/crates/pindakaas-cadical/build.rs index 7ba8069fa8..43dd62c4f2 100644 --- a/crates/pindakaas-cadical/build.rs +++ b/crates/pindakaas-cadical/build.rs @@ -1,3 +1,5 @@ +use std::path::Path; + fn main() { let src = [ "src/ccadical_override.cpp", @@ -94,6 +96,10 @@ fn main() { .define("NTRACING", None) .define("QUIET", None); + if build.get_compiler().is_like_msvc() { + build.include(Path::new("vendor/cadical/contrib/msvc")); + } + assert_eq!( env!("CARGO_PKG_VERSION"), include_str!("vendor/cadical/VERSION").trim() diff --git a/crates/pindakaas-cadical/vendor/cadical b/crates/pindakaas-cadical/vendor/cadical index 2df7b7fed0..e1657dca37 160000 --- a/crates/pindakaas-cadical/vendor/cadical +++ b/crates/pindakaas-cadical/vendor/cadical @@ -1 +1 @@ -Subproject commit 2df7b7fed0f9c522fd4cdf6e88cecad4cac8a2df +Subproject commit e1657dca37a65644b72a3985bd2835f710bb808f diff --git a/crates/pindakaas-derive/src/lib.rs b/crates/pindakaas-derive/src/lib.rs index 711bcf15bf..2fd5e8f289 100644 --- a/crates/pindakaas-derive/src/lib.rs +++ b/crates/pindakaas-derive/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::manual_unwrap_or_default)] // TODO: Remove this when fixed in darling + use darling::FromDeriveInput; use proc_macro::TokenStream; use quote::{format_ident, quote};