Skip to content

Commit

Permalink
Enable and fix for windows build by cmake project file
Browse files Browse the repository at this point in the history
  • Loading branch information
Khachik Shahzadyan authored and qwerity committed Nov 20, 2024
1 parent 230f62c commit 2f4e84c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@ wallycore.wasm
*.pdb
*.ilk
*.exp

.idea
cmake-build-*
12 changes: 8 additions & 4 deletions _CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ option(WALLYCORE_INSTALL "Enable install" OFF)
option(WALLYCORE_COVERAGE "Enable coverage" OFF)
option(WALLYCORE_BUILD_ELEMENTS "Build elements" ON)

if (NOT BUILD_SHARED_LIBS)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

include(cmake/utils.cmake)
generate_config_file()
configure_file(src/ccan_config.h ccan_config.h COPYONLY)
Expand All @@ -23,15 +27,15 @@ set(SECP256K1_ENABLE_MODULE_ECDH ON)
set(SECP256K1_ENABLE_MODULE_RECOVERY ON)
set(SECP256K1_ENABLE_MODULE_EXTRAKEYS ON)
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
set(SECP256K1_ENABLE_MODULE_ELLSWIFT OFF)
set(SECP256K1_ENABLE_MODULE_ELLSWIFT ON)
set(SECP256K1_ENABLE_MODULE_GENERATOR ON)
set(SECP256K1_ENABLE_MODULE_RANGEPROOF ON)
set(SECP256K1_ENABLE_MODULE_SURJECTIONPROOF ON)
set(SECP256K1_ENABLE_MODULE_WHITELIST ON)
set(SECP256K1_ENABLE_MODULE_MUSIG OFF)
set(SECP256K1_ENABLE_MODULE_ECDSA_ADAPTOR OFF)
set(SECP256K1_ENABLE_MODULE_MUSIG ON)
set(SECP256K1_ENABLE_MODULE_ECDSA_ADAPTOR ON)
set(SECP256K1_ENABLE_MODULE_ECDSA_S2C ON)
set(SECP256K1_ENABLE_MODULE_BPPP OFF)
set(SECP256K1_ENABLE_MODULE_BPPP ON)
set(SECP256K1_BUILD_BENCHMARK OFF)
set(SECP256K1_BUILD_TESTS OFF)
set(SECP256K1_BUILD_EXHAUSTIVE_TESTS OFF)
Expand Down
5 changes: 5 additions & 0 deletions _cmake/config.h.in → cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
# endif
#endif

#ifdef _WIN32
#if (!defined(_SSIZE_T_DECLARED)) && (!defined(_ssize_t)) && (!defined(ssize_t))
#define ssize_t long long
#endif
#endif

#include "ccan_config.h"
#endif /*LIBWALLYCORE_CONFIG_H*/
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_CMakeLists.txt → src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ file(
)

# wallycore
add_library(wallycore)
add_library(wallycore STATIC)
target_sources(wallycore PRIVATE ${ccan_srcs} ${wallycore_srcs})
set_target_properties(wallycore PROPERTIES PUBLIC_HEADER "${wallycore_public_headers}")
target_include_directories(
Expand Down
5 changes: 3 additions & 2 deletions src/ccan/ccan/tap/tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#ifndef _WIN32
#include <unistd.h>
#endif
#include "tap.h"

static int no_plan = 0;
Expand Down
10 changes: 6 additions & 4 deletions src/ctest/_CMakeLists.txt → src/ctest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ target_include_directories(test_bech32 PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(test_bech32 PRIVATE wallycore)
add_test(test_bech32 test_bech32)

add_executable(test_clear test_clear.c)
target_include_directories(test_clear PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(test_clear PRIVATE wallycore pthread)
add_test(test_clear test_clear)
if(NOT WIN32)
add_executable(test_clear test_clear.c)
target_include_directories(test_clear PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(test_clear PRIVATE wallycore pthread)
add_test(test_clear test_clear)
endif()

add_executable(test_coinselection test_coinselection.c)
target_include_directories(test_coinselection PRIVATE ${CMAKE_BINARY_DIR})
Expand Down

0 comments on commit 2f4e84c

Please sign in to comment.