mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 19:37:04 +01:00
cmake: Set top-level target output locations
This change: 1. Collects build artifacts in dedicated locations. 2. Allows running bitcoin-chainstate.exe with bitcoinkernel.dll directly from the build tree on Windows.
This commit is contained in:
parent
db63bfbe7c
commit
026bb226e9
9 changed files with 64 additions and 45 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -238,10 +238,10 @@ jobs:
|
|||
if: matrix.job-type == 'standard'
|
||||
working-directory: build
|
||||
env:
|
||||
BITCOIND: '${{ github.workspace }}\build\src\Release\bitcoind.exe'
|
||||
BITCOINCLI: '${{ github.workspace }}\build\src\Release\bitcoin-cli.exe'
|
||||
BITCOINUTIL: '${{ github.workspace }}\build\src\Release\bitcoin-util.exe'
|
||||
BITCOINWALLET: '${{ github.workspace }}\build\src\Release\bitcoin-wallet.exe'
|
||||
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
|
||||
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
|
||||
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
|
||||
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
|
||||
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
|
||||
shell: cmd
|
||||
run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA%
|
||||
|
@ -258,7 +258,7 @@ jobs:
|
|||
if: matrix.job-type == 'fuzz'
|
||||
working-directory: build
|
||||
env:
|
||||
BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe'
|
||||
BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe'
|
||||
shell: cmd
|
||||
run: |
|
||||
py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora
|
||||
|
|
|
@ -609,9 +609,6 @@ endif()
|
|||
add_subdirectory(test)
|
||||
add_subdirectory(doc)
|
||||
|
||||
include(cmake/crc32c.cmake)
|
||||
include(cmake/leveldb.cmake)
|
||||
include(cmake/minisketch.cmake)
|
||||
add_subdirectory(src)
|
||||
|
||||
include(cmake/tests.cmake)
|
||||
|
|
|
@ -8,10 +8,10 @@ declare -A LIBS
|
|||
LIBS[cli]="libbitcoin_cli.a"
|
||||
LIBS[common]="libbitcoin_common.a"
|
||||
LIBS[consensus]="libbitcoin_consensus.a"
|
||||
LIBS[crypto]="crypto/libbitcoin_crypto.a"
|
||||
LIBS[crypto]="libbitcoin_crypto.a"
|
||||
LIBS[node]="libbitcoin_node.a"
|
||||
LIBS[util]="util/libbitcoin_util.a"
|
||||
LIBS[wallet]="wallet/libbitcoin_wallet.a"
|
||||
LIBS[util]="libbitcoin_util.a"
|
||||
LIBS[wallet]="libbitcoin_wallet.a"
|
||||
|
||||
# Declare allowed dependencies "X Y" where X is allowed to depend on Y. This
|
||||
# list is taken from doc/design/libraries.md.
|
||||
|
@ -187,7 +187,7 @@ fi
|
|||
# shellcheck disable=SC2046
|
||||
cmake --build "$BUILD_DIR" -j"$(nproc)" -t $(lib_targets)
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
cd "$BUILD_DIR/src"
|
||||
cd "$BUILD_DIR/lib"
|
||||
extract_symbols "$TEMP_DIR"
|
||||
if check_libraries "$TEMP_DIR"; then
|
||||
echo "Success! No unexpected dependencies were detected."
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
export LC_ALL=C
|
||||
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
||||
BUILDDIR=${BUILDDIR:-$TOPDIR/build}
|
||||
BINDIR=${BINDIR:-$BUILDDIR/src}
|
||||
BINDIR=${BINDIR:-$BUILDDIR/bin}
|
||||
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
||||
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples}
|
||||
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf}
|
||||
|
|
|
@ -9,12 +9,12 @@ import tempfile
|
|||
import argparse
|
||||
|
||||
BINARIES = [
|
||||
'src/bitcoind',
|
||||
'src/bitcoin-cli',
|
||||
'src/bitcoin-tx',
|
||||
'src/bitcoin-wallet',
|
||||
'src/bitcoin-util',
|
||||
'src/qt/bitcoin-qt',
|
||||
'bin/bitcoind',
|
||||
'bin/bitcoin-cli',
|
||||
'bin/bitcoin-tx',
|
||||
'bin/bitcoin-wallet',
|
||||
'bin/bitcoin-util',
|
||||
'bin/bitcoin-qt',
|
||||
]
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
|
|
|
@ -7,28 +7,18 @@ include(AddWindowsResources)
|
|||
configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-build-config.h.in bitcoin-build-config.h USE_SOURCE_PERMISSIONS @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_custom_target(generate_build_info
|
||||
BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h
|
||||
COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake
|
||||
COMMENT "Generating bitcoin-build-info.h"
|
||||
VERBATIM
|
||||
)
|
||||
add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL
|
||||
clientversion.cpp
|
||||
)
|
||||
target_link_libraries(bitcoin_clientversion
|
||||
PRIVATE
|
||||
core_interface
|
||||
)
|
||||
add_dependencies(bitcoin_clientversion generate_build_info)
|
||||
|
||||
add_subdirectory(crypto)
|
||||
#=============================
|
||||
# Subprojects
|
||||
#=============================
|
||||
# Subprojects include subdirectories that do or could have tests
|
||||
# and/or benchmark binaries, such as all subtrees and univalue.
|
||||
# These need to be included before CMAKE_*_OUTPUT_DIRECTORY variables
|
||||
# are set, so output locations of subproject tests and libraries are
|
||||
# not overridden.
|
||||
include(../cmake/crc32c.cmake)
|
||||
include(../cmake/leveldb.cmake)
|
||||
include(../cmake/minisketch.cmake)
|
||||
add_subdirectory(univalue)
|
||||
add_subdirectory(util)
|
||||
if(WITH_MULTIPROCESS)
|
||||
add_subdirectory(ipc)
|
||||
endif()
|
||||
|
||||
#=============================
|
||||
# secp256k1 subtree
|
||||
#=============================
|
||||
|
@ -78,6 +68,38 @@ set_target_properties(secp256k1 PROPERTIES
|
|||
)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Set top-level target output locations.
|
||||
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
endif()
|
||||
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||
endif()
|
||||
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||
endif()
|
||||
|
||||
add_custom_target(generate_build_info
|
||||
BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h
|
||||
COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake
|
||||
COMMENT "Generating bitcoin-build-info.h"
|
||||
VERBATIM
|
||||
)
|
||||
add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL
|
||||
clientversion.cpp
|
||||
)
|
||||
target_link_libraries(bitcoin_clientversion
|
||||
PRIVATE
|
||||
core_interface
|
||||
)
|
||||
add_dependencies(bitcoin_clientversion generate_build_info)
|
||||
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(util)
|
||||
if(WITH_MULTIPROCESS)
|
||||
add_subdirectory(ipc)
|
||||
endif()
|
||||
|
||||
add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL
|
||||
arith_uint256.cpp
|
||||
consensus/merkle.cpp
|
||||
|
|
|
@ -255,7 +255,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
for binary, [attribute_name, env_variable_name] in binaries.items():
|
||||
default_filename = os.path.join(
|
||||
self.config["environment"]["BUILDDIR"],
|
||||
"src",
|
||||
"bin",
|
||||
binary + self.config["environment"]["EXEEXT"],
|
||||
)
|
||||
setattr(self.options, attribute_name, os.getenv(env_variable_name, default=default_filename))
|
||||
|
@ -272,8 +272,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
self.set_binary_paths()
|
||||
|
||||
os.environ['PATH'] = os.pathsep.join([
|
||||
os.path.join(config['environment']['BUILDDIR'], 'src'),
|
||||
os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH']
|
||||
os.path.join(config['environment']['BUILDDIR'], 'bin'),
|
||||
os.environ['PATH']
|
||||
])
|
||||
|
||||
# Set up temp directory and start logging
|
||||
|
|
|
@ -109,7 +109,7 @@ def main():
|
|||
logging.error("Must have fuzz executable built")
|
||||
sys.exit(1)
|
||||
|
||||
fuzz_bin=os.getenv("BITCOINFUZZ", default=os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', 'fuzz'))
|
||||
fuzz_bin=os.getenv("BITCOINFUZZ", default=os.path.join(config["environment"]["BUILDDIR"], 'bin', 'fuzz'))
|
||||
|
||||
# Build list of tests
|
||||
test_list_all = parse_test_list(
|
||||
|
|
|
@ -73,7 +73,7 @@ def bctest(testDir, testObj, buildenv):
|
|||
are not as expected. Error is caught by bctester() and reported.
|
||||
"""
|
||||
# Get the exec names and arguments
|
||||
execprog = os.path.join(buildenv["BUILDDIR"], "src", testObj["exec"] + buildenv["EXEEXT"])
|
||||
execprog = os.path.join(buildenv["BUILDDIR"], "bin", testObj["exec"] + buildenv["EXEEXT"])
|
||||
if testObj["exec"] == "./bitcoin-util":
|
||||
execprog = os.getenv("BITCOINUTIL", default=execprog)
|
||||
elif testObj["exec"] == "./bitcoin-tx":
|
||||
|
|
Loading…
Add table
Reference in a new issue