forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: Build
bitcoin_util
static library
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) 2023 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
function(add_threads_if_needed) | ||
# TODO: Not all targets, which will be added in the future, | ||
# require Threads. Therefore, a proper check will be | ||
# appropriate here. | ||
|
||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads REQUIRED) | ||
|
||
set(thread_local) | ||
if(MINGW) | ||
#[=[ | ||
mingw32's implementation of thread_local has been shown to behave | ||
erroneously under concurrent usage. | ||
See: | ||
- https://github.com/bitcoin/bitcoin/pull/15849 | ||
- https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605 | ||
]=] | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") | ||
#[=[ | ||
FreeBSD's implementation of thread_local is buggy. | ||
See: | ||
- https://github.com/bitcoin/bitcoin/pull/16059 | ||
- https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ | ||
]=] | ||
elseif(THREADLOCAL) | ||
set(thread_local "$<$<COMPILE_FEATURES:cxx_thread_local>:HAVE_THREAD_LOCAL>") | ||
endif() | ||
set(THREAD_LOCAL_IF_AVAILABLE "${thread_local}" PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright (c) 2023 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL | ||
asmap.cpp | ||
bip32.cpp | ||
bytevectorhash.cpp | ||
check.cpp | ||
error.cpp | ||
fees.cpp | ||
getuniquepath.cpp | ||
hasher.cpp | ||
message.cpp | ||
moneystr.cpp | ||
rbf.cpp | ||
readwritefile.cpp | ||
settings.cpp | ||
serfloat.cpp | ||
sock.cpp | ||
spanparsing.cpp | ||
strencodings.cpp | ||
string.cpp | ||
syscall_sandbox.cpp | ||
syserror.cpp | ||
system.cpp | ||
thread.cpp | ||
threadinterrupt.cpp | ||
threadnames.cpp | ||
time.cpp | ||
tokenpipe.cpp | ||
../chainparamsbase.cpp | ||
../clientversion.cpp | ||
../fs.cpp | ||
../logging.cpp | ||
../random.cpp | ||
../randomenv.cpp | ||
../support/cleanse.cpp | ||
../support/lockedpool.cpp | ||
../sync.cpp | ||
) | ||
|
||
target_compile_definitions(bitcoin_util | ||
PRIVATE | ||
${THREAD_LOCAL_IF_AVAILABLE} | ||
$<$<CXX_COMPILER_ID:MSVC>:_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING> | ||
) | ||
|
||
target_link_libraries(bitcoin_util | ||
PRIVATE | ||
bitcoin_crypto | ||
univalue | ||
Threads::Threads | ||
$<TARGET_NAME_IF_EXISTS:std_filesystem> | ||
$<$<BOOL:${MINGW}>:ws2_32> | ||
) |