Skip to content

Commit

Permalink
Some windows tweaks around uint128 library
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe committed Oct 31, 2024
1 parent 9e051b8 commit 42d5914
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 4 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<CXX_COMPILER_ID:MSVC>: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()

Expand Down Expand Up @@ -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)
Expand All @@ -213,12 +214,6 @@ target_link_libraries(RunTests PRIVATE fse Threads::Threads Catch2::Catch2WithMa
$<$<NOT:$<PLATFORM_ID:Darwin,OpenBSD,FreeBSD,Windows>>:stdc++fs>
)

IF (BUILD_STATIC_CHIAPOS_LIBRARY)
target_link_libraries(chiapos_static PRIVATE # fse Threads::Threads
$<$<CXX_COMPILER_ID:MSVC>:uint128>
# $<$<NOT:$<PLATFORM_ID:Darwin,OpenBSD,FreeBSD,Windows>>:stdc++fs>
)
ENDIF()

if (${CP_LINK_BLADEBIT_HARVESTER})

Expand Down
4 changes: 4 additions & 0 deletions rust-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 42d5914

Please sign in to comment.