From 52091066be15a86a38c4db182338808f9316c35a Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Tue, 2 Oct 2018 23:40:52 +0800 Subject: [PATCH] msvc: build secp256k1 locally --- .appveyor.yml | 2 +- .../bench_bitcoin/bench_bitcoin.vcxproj | 3 + build_msvc/bitcoin-tx/bitcoin-tx.vcxproj | 3 + build_msvc/bitcoin.sln | 13 +- build_msvc/bitcoind/bitcoind.vcxproj | 3 + build_msvc/common.vcxproj | 10 +- .../libbitcoin_common.vcxproj.in | 8 +- .../libbitcoinconsensus.vcxproj | 8 +- build_msvc/libsecp256k1/libsecp256k1.vcxproj | 157 ++++++++++++++++++ build_msvc/libsecp256k1_config.h | 29 ++++ build_msvc/test_bitcoin/test_bitcoin.vcxproj | 3 + .../testconsensus/testconsensus.vcxproj | 3 + 12 files changed, 230 insertions(+), 12 deletions(-) create mode 100644 build_msvc/libsecp256k1/libsecp256k1.vcxproj create mode 100644 build_msvc/libsecp256k1_config.h diff --git a/.appveyor.yml b/.appveyor.yml index 249d0b8df9..ac4a8df3e3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,7 +7,7 @@ clone_depth: 5 environment: APPVEYOR_SAVE_CACHE_ON_ERROR: true CLCACHE_SERVER: 1 - PACKAGES: boost-filesystem boost-signals2 boost-test libevent openssl zeromq berkeleydb secp256k1 leveldb + PACKAGES: boost-filesystem boost-signals2 boost-test libevent openssl zeromq berkeleydb leveldb PATH: 'C:\Python37-x64;C:\Python37-x64\Scripts;%PATH%' PYTHONUTF8: 1 cache: diff --git a/build_msvc/bench_bitcoin/bench_bitcoin.vcxproj b/build_msvc/bench_bitcoin/bench_bitcoin.vcxproj index b987a337c0..25eab8027d 100644 --- a/build_msvc/bench_bitcoin/bench_bitcoin.vcxproj +++ b/build_msvc/bench_bitcoin/bench_bitcoin.vcxproj @@ -61,6 +61,9 @@ {5724ba7d-a09a-4ba8-800b-c4c1561b3d69} + + {bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6} + 15.0 diff --git a/build_msvc/bitcoin-tx/bitcoin-tx.vcxproj b/build_msvc/bitcoin-tx/bitcoin-tx.vcxproj index a9fae6b739..86fd614990 100644 --- a/build_msvc/bitcoin-tx/bitcoin-tx.vcxproj +++ b/build_msvc/bitcoin-tx/bitcoin-tx.vcxproj @@ -38,6 +38,9 @@ {5724ba7d-a09a-4ba8-800b-c4c1561b3d69} + + {bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6} + 15.0 diff --git a/build_msvc/bitcoin.sln b/build_msvc/bitcoin.sln index b84a525afa..ee29d334b8 100644 --- a/build_msvc/bitcoin.sln +++ b/build_msvc/bitcoin.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2027 MinimumVisualStudioVersion = 10.0.40219.1 @@ -36,6 +36,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-wallet", "bitcoin-w EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_wallet_tool", "libbitcoin_wallet_tool\libbitcoin_wallet_tool.vcxproj", "{F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsecp256k1", "libsecp256k1\libsecp256k1.vcxproj", "{BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -180,6 +182,14 @@ Global {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Release|x64.Build.0 = Release|x64 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Release|x86.ActiveCfg = Release|Win32 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Release|x86.Build.0 = Release|Win32 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x64.ActiveCfg = Debug|x64 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x64.Build.0 = Debug|x64 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x86.ActiveCfg = Debug|Win32 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x86.Build.0 = Debug|Win32 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x64.ActiveCfg = Release|x64 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x64.Build.0 = Release|x64 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x86.ActiveCfg = Release|Win32 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -190,3 +200,4 @@ Global SolutionGuid = {D0CAE2D0-8DB1-4A0B-80EE-800AA6C64323} SolutionGuid = {DA7D16A6-E5F0-45B3-B194-C3FE64F1BFCD} EndGlobalSection +EndGlobal diff --git a/build_msvc/bitcoind/bitcoind.vcxproj b/build_msvc/bitcoind/bitcoind.vcxproj index bb43d9821e..cd00452fdd 100644 --- a/build_msvc/bitcoind/bitcoind.vcxproj +++ b/build_msvc/bitcoind/bitcoind.vcxproj @@ -180,6 +180,9 @@ {5724ba7d-a09a-4ba8-800b-c4c1561b3d69} + + {bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6} + diff --git a/build_msvc/common.vcxproj b/build_msvc/common.vcxproj index c7c20622e4..985b0becaa 100644 --- a/build_msvc/common.vcxproj +++ b/build_msvc/common.vcxproj @@ -3,15 +3,21 @@ - CopyConfig; + CopyBitcoinConfig; + CopySecp256k1Config; $(BuildDependsOn); - + + + /utf-8 %(AdditionalOptions) diff --git a/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in b/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in index 42145c15ad..b51cdb2991 100644 --- a/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in +++ b/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in @@ -91,7 +91,7 @@ Disabled WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\src;..\..\src\univalue\include; + ..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include; false MultiThreadedDebug @@ -109,7 +109,7 @@ Disabled WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\src;..\..\src\univalue\include; + ..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include; false MultiThreadedDebug @@ -129,7 +129,7 @@ true WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\src;..\..\src\univalue\include; + ..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include; false MultiThreaded @@ -151,7 +151,7 @@ true WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\src;..\..\src\univalue\include; + ..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include; false MultiThreaded diff --git a/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj b/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj index 2c6c0a8b7c..961225f9ba 100644 --- a/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj +++ b/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj @@ -126,7 +126,7 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) false - ..\..\src; + ..\..\src;..\..\src\secp256k1\include; Sync false MultiThreadedDebug @@ -143,7 +143,7 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) false - ..\..\src; + ..\..\src;..\..\src\secp256k1\include; Sync false MultiThreadedDebug @@ -162,7 +162,7 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) false - ..\..\src; + ..\..\src;..\..\src\secp256k1\include; Sync false MultiThreaded @@ -183,7 +183,7 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) false - ..\..\src; + ..\..\src;..\..\src\secp256k1\include; Sync false MultiThreaded diff --git a/build_msvc/libsecp256k1/libsecp256k1.vcxproj b/build_msvc/libsecp256k1/libsecp256k1.vcxproj new file mode 100644 index 0000000000..699c7d6871 --- /dev/null +++ b/build_msvc/libsecp256k1/libsecp256k1.vcxproj @@ -0,0 +1,157 @@ + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 15.0 + {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6} + Win32Proj + libunivalue + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + NotUsing + Level3 + Disabled + ENABLE_MODULE_ECDH;ENABLE_MODULE_RECOVERY;HAVE_CONFIG_H;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\secp256k1; + MultiThreadedDebug + + + Console + true + + + + + NotUsing + Level3 + Disabled + ENABLE_MODULE_ECDH;ENABLE_MODULE_RECOVERY;HAVE_CONFIG_H;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\secp256k1; + MultiThreadedDebug + + + Console + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + ENABLE_MODULE_ECDH;ENABLE_MODULE_RECOVERY;HAVE_CONFIG_H;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\secp256k1; + MultiThreaded + + + Console + true + true + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + ENABLE_MODULE_ECDH;ENABLE_MODULE_RECOVERY;HAVE_CONFIG_H;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\secp256k1; + MultiThreaded + + + Console + true + true + true + + + + diff --git a/build_msvc/libsecp256k1_config.h b/build_msvc/libsecp256k1_config.h new file mode 100644 index 0000000000..5187c946a0 --- /dev/null +++ b/build_msvc/libsecp256k1_config.h @@ -0,0 +1,29 @@ +/********************************************************************** + * Copyright (c) 2013, 2014 Pieter Wuille * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ + +#ifndef BITCOIN_LIBSECP256K1_CONFIG_H +#define BITCOIN_LIBSECP256K1_CONFIG_H + +#undef USE_ASM_X86_64 +#undef USE_ENDOMORPHISM +#undef USE_FIELD_10X26 +#undef USE_FIELD_5X52 +#undef USE_FIELD_INV_BUILTIN +#undef USE_FIELD_INV_NUM +#undef USE_NUM_GMP +#undef USE_NUM_NONE +#undef USE_SCALAR_4X64 +#undef USE_SCALAR_8X32 +#undef USE_SCALAR_INV_BUILTIN +#undef USE_SCALAR_INV_NUM + +#define USE_NUM_NONE 1 +#define USE_FIELD_INV_BUILTIN 1 +#define USE_SCALAR_INV_BUILTIN 1 +#define USE_FIELD_10X26 1 +#define USE_SCALAR_8X32 1 + +#endif /* BITCOIN_LIBSECP256K1_CONFIG_H */ diff --git a/build_msvc/test_bitcoin/test_bitcoin.vcxproj b/build_msvc/test_bitcoin/test_bitcoin.vcxproj index 2316e473aa..5073c5c012 100644 --- a/build_msvc/test_bitcoin/test_bitcoin.vcxproj +++ b/build_msvc/test_bitcoin/test_bitcoin.vcxproj @@ -54,6 +54,9 @@ {5724ba7d-a09a-4ba8-800b-c4c1561b3d69} + + {bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6} + 15.0 diff --git a/build_msvc/testconsensus/testconsensus.vcxproj b/build_msvc/testconsensus/testconsensus.vcxproj index d73988df1c..db2f8a6216 100644 --- a/build_msvc/testconsensus/testconsensus.vcxproj +++ b/build_msvc/testconsensus/testconsensus.vcxproj @@ -168,6 +168,9 @@ {b53a5535-ee9d-4c6f-9a26-f79ee3bc3754} + + {bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6} +