Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable and fix for windows build by cmake project file #462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.idea is already in this file, and cmake build directories should be placed outside the repo rather than listed here.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enabled modules here should match the ones set by configure (which they currently do). Why are you turning on extra modules here by default?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've PR'd a different fix for this in #469


#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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wally can (or should be able to be) build as a DLL for windows too.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not compiled when building, so I don't think this change is needed.

#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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to #469


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