Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
We shouldn't be passing gcc params to MSVC

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Apr 12, 2024
1 parent 434d302 commit 9387435
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: cargo clippy ${{ matrix.build-args }} -- -D warnings

build-msrv-1660:
name: Build
name: Windows
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -35,6 +35,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Submodules
run: git submodule update --init --recursive
- name: Cache
uses: actions/cache@v3
with:
Expand Down
27 changes: 18 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,24 @@ fn main() {
])
.include("nostrdb/deps/lmdb")
.include("nostrdb/deps/flatcc/include")
.include("nostrdb/deps/secp256k1/include")
// Add other include paths
//.flag("-Wall")
.flag("-Wno-sign-compare")
.flag("-Wno-misleading-indentation")
.flag("-Wno-unused-function")
.flag("-Wno-unused-parameter");
//.flag("-Werror")
//.flag("-g")
.include("nostrdb/deps/secp256k1/include");

// Detect the compiler being used: MSVC or GCC (like MinGW on Windows)
if env::var("TARGET").unwrap().contains("msvc") {
// MSVC-specific flags
// Example: build.flag("/W4"); // Set warning level to 4 for MSVC
// Suppress specific warnings in MSVC:
build.flag("/wd4100"); // unreferenced formal parameter
// Add more MSVC-specific flags as needed
} else {
// GCC-specific flags
build
.flag("-Wno-sign-compare")
.flag("-Wno-misleading-indentation")
.flag("-Wno-unused-function")
.flag("-Wno-unused-parameter");
// Add more GCC-specific flags as needed
}

if env::var("PROFILE").unwrap() == "debug" {
build.flag("-DDEBUG");
Expand Down

0 comments on commit 9387435

Please sign in to comment.