Skip to content

Commit

Permalink
Compile libsecp256k1 on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Mar 2, 2017
1 parent b0843c3 commit 188de99
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
11 changes: 7 additions & 4 deletions utils/secp256k1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# Copy src and include dirs.
#
# Copy CFLAGS from Makefile to target_compile_options().
# Copy CFLAGS from Makefile to COMPILE_OPTIONS.

# Reset definitions and includes.
# TODO: We should avoid using directory based configurations like add_definitions()
Expand All @@ -21,10 +21,13 @@ set(CMAKE_C_FLAGS "")
set(CMAKE_C_FLAGS_RELEASE "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
set(CMAKE_C_FLAGS_DEBUG "")
if (MSVC)
set(COMPILE_OPTIONS "")
else()
set(COMPILE_OPTIONS -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden)
endif()

add_library(secp256k1 STATIC src/secp256k1.c)
target_compile_definitions(secp256k1 INTERFACE ETH_HAVE_SECP256K1 PRIVATE HAVE_CONFIG_H)
target_include_directories(secp256k1 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(secp256k1 PRIVATE -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden)


target_compile_options(secp256k1 PRIVATE ${COMPILE_OPTIONS})
16 changes: 14 additions & 2 deletions utils/secp256k1/src/libsecp256k1-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
/* #undef ENABLE_OPENSSL_TESTS */

/* Define this symbol if __builtin_expect is available */
#if !defined(_MSC_VER)
#define HAVE_BUILTIN_EXPECT 1
#endif

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
Expand Down Expand Up @@ -60,7 +62,9 @@
#define HAVE_UNISTD_H 1

/* Define to 1 if the system has the type `__int128'. */
#if !defined(_MSC_VER)
#define HAVE___INT128 1
#endif

/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
Expand Down Expand Up @@ -103,10 +107,14 @@
/* #undef USE_EXTERNAL_ASM */

/* Define this symbol to use the FIELD_10X26 implementation */
/* #undef USE_FIELD_10X26 */
#if defined(_MSC_VER)
#define USE_FIELD_10X26 1
#endif

/* Define this symbol to use the FIELD_5X52 implementation */
#if !defined(_MSC_VER)
#define USE_FIELD_5X52 1
#endif

/* Define this symbol to use the native field inverse implementation */
#define USE_FIELD_INV_BUILTIN 1
Expand All @@ -121,10 +129,14 @@
#define USE_NUM_NONE 1

/* Define this symbol to use the 4x64 scalar implementation */
#if !defined(_MSC_VER)
#define USE_SCALAR_4X64 1
#endif

/* Define this symbol to use the 8x32 scalar implementation */
/* #undef USE_SCALAR_8X32 */
#if defined(_MSC_VER)
#define USE_SCALAR_8X32 1
#endif

/* Define this symbol to use the native scalar inverse implementation */
#define USE_SCALAR_INV_BUILTIN 1
Expand Down

0 comments on commit 188de99

Please sign in to comment.