@@ -38,7 +38,10 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
3838# Configurable options.
3939# When adding a new option, end the <help_text> with a full stop for consistency.
4040include (CMakeDependentOption)
41+ option (BUILD_DAEMON "Build bitcoind executable." ON )
42+ option (ASM "Use assembly routines." ON )
4143cmake_dependent_option(CXX20 "Enable compilation in C++20 mode." OFF "NOT MSVC" ON )
44+ option (THREADLOCAL "Enable features that depend on the C++ thread_local keyword (currently just thread names in debug logs)." ON )
4245
4346if (CXX20)
4447 set (CMAKE_CXX_STANDARD 20)
@@ -60,17 +63,70 @@ else()
6063endif ()
6164set (CMAKE_POSITION_INDEPENDENT_CODE ON )
6265
66+ if (WIN32 )
67+ #[=[
68+ This build system supports two ways to build binaries for Windows.
69+
70+ 1. Building on Windows using MSVC.
71+ Implementation notes:
72+ - /DWIN32 and /D_WINDOWS definitions are included into the CMAKE_CXX_FLAGS_INIT
73+ and CMAKE_CXX_FLAGS_INIT variables by default.
74+ - A run-time library is selected using the CMAKE_MSVC_RUNTIME_LIBRARY variable.
75+ - MSVC-specific options, for example, /Zc:__cplusplus, are additionally required.
76+
77+ 2. Cross-compiling using MinGW.
78+ Implementation notes:
79+ - WIN32 and _WINDOWS definitions must be provided explicitly.
80+ - A run-time library must be specified explicitly using _MT definition.
81+ ]=]
82+
83+ add_compile_definitions (_WIN32_WINNT=0x0601 _WIN32_IE=0x0501 WIN32_LEAN_AND_MEAN NOMINMAX)
84+
85+ if (MSVC )
86+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" )
87+ add_compile_options (/utf-8 /Zc:__cplusplus)
88+ endif ()
89+
90+ if (MINGW)
91+ add_compile_definitions (WIN32 _WINDOWS _MT)
92+ # We require Windows 7 (NT 6.1) or later.
93+ add_link_options (-Wl,--major-subsystem-version ,6 -Wl,--minor-subsystem-version ,1)
94+ endif ()
95+ endif ()
96+
97+ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
98+ add_compile_definitions (MAC_OSX)
99+ endif ()
100+
101+ include (AddThreadsIfNeeded)
102+ add_threads_if_needed()
103+
104+ include (AddBoostIfNeeded)
105+ add_boost_if_needed()
106+
63107include (CheckSourceCompilesAndLinks)
108+
109+ include (AddLibeventIfNeeded)
110+ add_libevent_if_needed()
111+
64112include (cmake/introspection.cmake)
65113
66114include (cmake/crc32c.cmake)
67115include (cmake/leveldb.cmake)
116+ include (cmake/minisketch.cmake)
117+ include (cmake/secp256k1.cmake)
118+
119+ include (CheckStdFilesystem)
120+ check_std_filesystem()
68121
69122add_subdirectory (src)
70123
71124message ("\n " )
72125message ("Configure summary" )
73126message ("=================" )
127+ message ("Executables:" )
128+ message (" bitcoind ............................ ${BUILD_DAEMON} " )
129+ message ("" )
74130get_directory_property (definitions COMPILE_DEFINITIONS )
75131string (REPLACE ";" " " definitions "${definitions} " )
76132message ("Preprocessor defined macros ........... ${definitions} " )
@@ -105,6 +161,7 @@ else()
105161 message (" - LDFLAGS for executables ............ ${CMAKE_EXE_LINKER_FLAGS_RELEASE} " )
106162 message (" - LDFLAGS for shared libraries ....... ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} " )
107163endif ()
164+ message ("Use assembly routines ................. ${ASM} " )
108165message ("\n " )
109166if (configure_warnings)
110167 message (" ******\n " )
0 commit comments