From 410f99faed47e27fca77531a864383b6119e7b0b Mon Sep 17 00:00:00 2001 From: CallMeMisterOwl Date: Sun, 14 Nov 2021 15:00:29 +0100 Subject: build_msvc/bitcoin_config.h is generated using build_msvc/msvc-autogen.py --- build_msvc/bitcoin_config.h | 214 ----------------------------------------- build_msvc/bitcoin_config.h.in | 214 +++++++++++++++++++++++++++++++++++++++++ build_msvc/msvc-autogen.py | 36 +++++++ 3 files changed, 250 insertions(+), 214 deletions(-) delete mode 100644 build_msvc/bitcoin_config.h create mode 100644 build_msvc/bitcoin_config.h.in (limited to 'build_msvc') diff --git a/build_msvc/bitcoin_config.h b/build_msvc/bitcoin_config.h deleted file mode 100644 index e2930f3ea9..0000000000 --- a/build_msvc/bitcoin_config.h +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2018-2020 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_BITCOIN_CONFIG_H -#define BITCOIN_BITCOIN_CONFIG_H - -/* Version Build */ -#define CLIENT_VERSION_BUILD 0 - -/* Version is release */ -#define CLIENT_VERSION_IS_RELEASE false - -/* Major version */ -#define CLIENT_VERSION_MAJOR 22 - -/* Minor version */ -#define CLIENT_VERSION_MINOR 99 - -/* Copyright holder(s) before %s replacement */ -#define COPYRIGHT_HOLDERS "The %s developers" - -/* Copyright holder(s) */ -#define COPYRIGHT_HOLDERS_FINAL "The Bitcoin Core developers" - -/* Replacement for %s in copyright holders string */ -#define COPYRIGHT_HOLDERS_SUBSTITUTION "Bitcoin Core" - -/* Copyright year */ -#define COPYRIGHT_YEAR 2021 - -/* Define to 1 to enable wallet functions */ -#define ENABLE_WALLET 1 - -/* Define to 1 to enable BDB wallet */ -#define USE_BDB 1 - -/* Define to 1 to enable SQLite wallet */ -#define USE_SQLITE 1 - -/* Define to 1 to enable ZMQ functions */ -#define ENABLE_ZMQ 1 - -/* define if the Boost library is available */ -#define HAVE_BOOST /**/ - -/* define if the Boost::Filesystem library is available */ -#define HAVE_BOOST_FILESYSTEM /**/ - -/* define if external signer support is enabled (requires Boost::Process) */ -#define ENABLE_EXTERNAL_SIGNER /**/ - -/* define if the Boost::System library is available */ -#define HAVE_BOOST_SYSTEM /**/ - -/* define if the Boost::Unit_Test_Framework library is available */ -#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/ - -/* Define this symbol if the consensus lib has been built */ -#define HAVE_CONSENSUS_LIB 1 - -/* define if the compiler supports basic C++17 syntax */ -#define HAVE_CXX17 1 - -/* Define to 1 if you have the declaration of `be16toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE16TOH 0 - -/* Define to 1 if you have the declaration of `be32toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE32TOH 0 - -/* Define to 1 if you have the declaration of `be64toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE64TOH 0 - -/* Define to 1 if you have the declaration of `bswap_16', and to 0 if you - don't. */ -#define HAVE_DECL_BSWAP_16 0 - -/* Define to 1 if you have the declaration of `bswap_32', and to 0 if you - don't. */ -#define HAVE_DECL_BSWAP_32 0 - -/* Define to 1 if you have the declaration of `bswap_64', and to 0 if you - don't. */ -#define HAVE_DECL_BSWAP_64 0 - -/* Define to 1 if you have the declaration of `fork', and to 0 if you don't. - */ -#define HAVE_DECL_FORK 0 - -/* Define to 1 if you have the declaration of `htobe16', and to 0 if you - don't. */ -#define HAVE_DECL_HTOBE16 0 - -/* Define to 1 if you have the declaration of `htobe32', and to 0 if you - don't. */ -#define HAVE_DECL_HTOBE32 0 - -/* Define to 1 if you have the declaration of `htobe64', and to 0 if you - don't. */ -#define HAVE_DECL_HTOBE64 0 - -/* Define to 1 if you have the declaration of `htole16', and to 0 if you - don't. */ -#define HAVE_DECL_HTOLE16 0 - -/* Define to 1 if you have the declaration of `htole32', and to 0 if you - don't. */ -#define HAVE_DECL_HTOLE32 0 - -/* Define to 1 if you have the declaration of `htole64', and to 0 if you - don't. */ -#define HAVE_DECL_HTOLE64 0 - -/* Define to 1 if you have the declaration of `le16toh', and to 0 if you - don't. */ -#define HAVE_DECL_LE16TOH 0 - -/* Define to 1 if you have the declaration of `le32toh', and to 0 if you - don't. */ -#define HAVE_DECL_LE32TOH 0 - -/* Define to 1 if you have the declaration of `le64toh', and to 0 if you - don't. */ -#define HAVE_DECL_LE64TOH 0 - -/* Define to 1 if you have the declaration of `setsid', and to 0 if you don't. - */ -#define HAVE_DECL_SETSID 0 - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#define HAVE_DECL_STRERROR_R 0 - -/* Define to 1 if you have the declaration of `strnlen', and to 0 if you - don't. */ -#define HAVE_DECL_STRNLEN 1 - -/* Define if the dllexport attribute is supported. */ -#define HAVE_DLLEXPORT_ATTRIBUTE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MINIUPNPC_MINIUPNPC_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MINIUPNPC_UPNPCOMMANDS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MINIUPNPC_UPNPERRORS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Bitcoin Core" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Bitcoin Core 22.99.0" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "https://bitcoincore.org/" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "22.99.0" - -/* Define this symbol if the minimal qt platform exists */ -#define QT_QPA_PLATFORM_MINIMAL 1 - -/* Define this symbol if the qt platform is windows */ -#define QT_QPA_PLATFORM_WINDOWS 1 - -/* Define this symbol if qt plugins are static */ -#define QT_STATICPLUGIN 1 - -/* Windows Universal Platform constraints */ -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -/* Either a desktop application without API restrictions, or and older system - before these macros were defined. */ - -/* ::wsystem is available */ -#define HAVE_SYSTEM 1 - -#endif // !WINAPI_FAMILY || WINAPI_FAMILY_DESKTOP_APP - -#endif //BITCOIN_BITCOIN_CONFIG_H diff --git a/build_msvc/bitcoin_config.h.in b/build_msvc/bitcoin_config.h.in new file mode 100644 index 0000000000..83e53c8d56 --- /dev/null +++ b/build_msvc/bitcoin_config.h.in @@ -0,0 +1,214 @@ +// Copyright (c) 2018-2020 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_BITCOIN_CONFIG_H +#define BITCOIN_BITCOIN_CONFIG_H + +/* Version Build */ +#define CLIENT_VERSION_BUILD $ + +/* Version is release */ +#define CLIENT_VERSION_IS_RELEASE $ + +/* Major version */ +#define CLIENT_VERSION_MAJOR $ + +/* Minor version */ +#define CLIENT_VERSION_MINOR $ + +/* Copyright holder(s) before %s replacement */ +#define COPYRIGHT_HOLDERS "The %s developers" + +/* Copyright holder(s) */ +#define COPYRIGHT_HOLDERS_FINAL "The Bitcoin Core developers" + +/* Replacement for %s in copyright holders string */ +#define COPYRIGHT_HOLDERS_SUBSTITUTION "Bitcoin Core" + +/* Copyright year */ +#define COPYRIGHT_YEAR $ + +/* Define to 1 to enable wallet functions */ +#define ENABLE_WALLET 1 + +/* Define to 1 to enable BDB wallet */ +#define USE_BDB 1 + +/* Define to 1 to enable SQLite wallet */ +#define USE_SQLITE 1 + +/* Define to 1 to enable ZMQ functions */ +#define ENABLE_ZMQ 1 + +/* define if the Boost library is available */ +#define HAVE_BOOST /**/ + +/* define if the Boost::Filesystem library is available */ +#define HAVE_BOOST_FILESYSTEM /**/ + +/* define if external signer support is enabled (requires Boost::Process) */ +#define ENABLE_EXTERNAL_SIGNER /**/ + +/* define if the Boost::System library is available */ +#define HAVE_BOOST_SYSTEM /**/ + +/* define if the Boost::Unit_Test_Framework library is available */ +#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/ + +/* Define this symbol if the consensus lib has been built */ +#define HAVE_CONSENSUS_LIB 1 + +/* define if the compiler supports basic C++17 syntax */ +#define HAVE_CXX17 1 + +/* Define to 1 if you have the declaration of `be16toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE16TOH 0 + +/* Define to 1 if you have the declaration of `be32toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE32TOH 0 + +/* Define to 1 if you have the declaration of `be64toh', and to 0 if you + don't. */ +#define HAVE_DECL_BE64TOH 0 + +/* Define to 1 if you have the declaration of `bswap_16', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_16 0 + +/* Define to 1 if you have the declaration of `bswap_32', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_32 0 + +/* Define to 1 if you have the declaration of `bswap_64', and to 0 if you + don't. */ +#define HAVE_DECL_BSWAP_64 0 + +/* Define to 1 if you have the declaration of `fork', and to 0 if you don't. + */ +#define HAVE_DECL_FORK 0 + +/* Define to 1 if you have the declaration of `htobe16', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE16 0 + +/* Define to 1 if you have the declaration of `htobe32', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE32 0 + +/* Define to 1 if you have the declaration of `htobe64', and to 0 if you + don't. */ +#define HAVE_DECL_HTOBE64 0 + +/* Define to 1 if you have the declaration of `htole16', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE16 0 + +/* Define to 1 if you have the declaration of `htole32', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE32 0 + +/* Define to 1 if you have the declaration of `htole64', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE64 0 + +/* Define to 1 if you have the declaration of `le16toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE16TOH 0 + +/* Define to 1 if you have the declaration of `le32toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE32TOH 0 + +/* Define to 1 if you have the declaration of `le64toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE64TOH 0 + +/* Define to 1 if you have the declaration of `setsid', and to 0 if you don't. + */ +#define HAVE_DECL_SETSID 0 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 0 + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#define HAVE_DECL_STRNLEN 1 + +/* Define if the dllexport attribute is supported. */ +#define HAVE_DLLEXPORT_ATTRIBUTE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_MINIUPNPC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_UPNPCOMMANDS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MINIUPNPC_UPNPERRORS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Bitcoin Core" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING $ + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://bitcoincore.org/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION $ + +/* Define this symbol if the minimal qt platform exists */ +#define QT_QPA_PLATFORM_MINIMAL 1 + +/* Define this symbol if the qt platform is windows */ +#define QT_QPA_PLATFORM_WINDOWS 1 + +/* Define this symbol if qt plugins are static */ +#define QT_STATICPLUGIN 1 + +/* Windows Universal Platform constraints */ +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +/* Either a desktop application without API restrictions, or and older system + before these macros were defined. */ + +/* ::wsystem is available */ +#define HAVE_SYSTEM 1 + +#endif // !WINAPI_FAMILY || WINAPI_FAMILY_DESKTOP_APP + +#endif //BITCOIN_BITCOIN_CONFIG_H diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py index a1ed935996..6ce65f3fa3 100755 --- a/build_msvc/msvc-autogen.py +++ b/build_msvc/msvc-autogen.py @@ -57,6 +57,41 @@ def set_common_properties(toolset): with open(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), 'w', encoding='utf-8',newline='\n') as wfile: wfile.write(s) +def parse_config_into_btc_config(): + def find_between( s, first, last ): + try: + start = s.index( first ) + len( first ) + end = s.index( last, start ) + return s[start:end] + except ValueError: + return "" + + config_info = [] + with open(os.path.join(SOURCE_DIR,'../configure.ac'), encoding="utf8") as f: + for line in f: + if line.startswith("define"): + config_info.append(find_between(line, "(_", ")")) + + config_info = [c for c in config_info if not c.startswith("COPYRIGHT_HOLDERS")] + + config_dict = dict(item.split(", ") for item in config_info) + config_dict["PACKAGE_VERSION"] = f"\"{config_dict['CLIENT_VERSION_MAJOR']}.{config_dict['CLIENT_VERSION_MINOR']}.{config_dict['CLIENT_VERSION_BUILD']}\"" + version = config_dict["PACKAGE_VERSION"].strip('"') + config_dict["PACKAGE_STRING"] = f"\"Bitcoin Core {version}\"" + + with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h.in'), "r", encoding="utf8") as template_file: + template = template_file.readlines() + + for index, line in enumerate(template): + header = "" + if line.startswith("#define"): + header = line.split(" ")[1] + if header in config_dict: + template[index] = line.replace("$", f"{config_dict[header]}") + + with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), "w", encoding="utf8") as btc_config: + btc_config.writelines(template) + def main(): parser = argparse.ArgumentParser(description='Bitcoin-core msbuild configuration initialiser.') parser.add_argument('-toolset', nargs='?',help='Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.' @@ -79,6 +114,7 @@ def main(): with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file: vcxproj_file.write(vcxproj_in_file.read().replace( '@SOURCE_FILES@\n', content)) + parse_config_into_btc_config() copyfile(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), os.path.join(SOURCE_DIR, 'config/bitcoin-config.h')) copyfile(os.path.join(SOURCE_DIR,'../build_msvc/libsecp256k1_config.h'), os.path.join(SOURCE_DIR, 'secp256k1/src/libsecp256k1-config.h')) -- cgit v1.2.3