mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-15 12:19:46 +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'
|
if: matrix.job-type == 'standard'
|
||||||
working-directory: build
|
working-directory: build
|
||||||
env:
|
env:
|
||||||
BITCOIND: '${{ github.workspace }}\build\src\Release\bitcoind.exe'
|
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
|
||||||
BITCOINCLI: '${{ github.workspace }}\build\src\Release\bitcoin-cli.exe'
|
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
|
||||||
BITCOINUTIL: '${{ github.workspace }}\build\src\Release\bitcoin-util.exe'
|
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
|
||||||
BITCOINWALLET: '${{ github.workspace }}\build\src\Release\bitcoin-wallet.exe'
|
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
|
||||||
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
|
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
|
||||||
shell: cmd
|
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%
|
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'
|
if: matrix.job-type == 'fuzz'
|
||||||
working-directory: build
|
working-directory: build
|
||||||
env:
|
env:
|
||||||
BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe'
|
BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe'
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora
|
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(test)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
|
|
||||||
include(cmake/crc32c.cmake)
|
|
||||||
include(cmake/leveldb.cmake)
|
|
||||||
include(cmake/minisketch.cmake)
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
include(cmake/tests.cmake)
|
include(cmake/tests.cmake)
|
||||||
|
|
|
@ -8,10 +8,10 @@ declare -A LIBS
|
||||||
LIBS[cli]="libbitcoin_cli.a"
|
LIBS[cli]="libbitcoin_cli.a"
|
||||||
LIBS[common]="libbitcoin_common.a"
|
LIBS[common]="libbitcoin_common.a"
|
||||||
LIBS[consensus]="libbitcoin_consensus.a"
|
LIBS[consensus]="libbitcoin_consensus.a"
|
||||||
LIBS[crypto]="crypto/libbitcoin_crypto.a"
|
LIBS[crypto]="libbitcoin_crypto.a"
|
||||||
LIBS[node]="libbitcoin_node.a"
|
LIBS[node]="libbitcoin_node.a"
|
||||||
LIBS[util]="util/libbitcoin_util.a"
|
LIBS[util]="libbitcoin_util.a"
|
||||||
LIBS[wallet]="wallet/libbitcoin_wallet.a"
|
LIBS[wallet]="libbitcoin_wallet.a"
|
||||||
|
|
||||||
# Declare allowed dependencies "X Y" where X is allowed to depend on Y. This
|
# Declare allowed dependencies "X Y" where X is allowed to depend on Y. This
|
||||||
# list is taken from doc/design/libraries.md.
|
# list is taken from doc/design/libraries.md.
|
||||||
|
@ -187,7 +187,7 @@ fi
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
cmake --build "$BUILD_DIR" -j"$(nproc)" -t $(lib_targets)
|
cmake --build "$BUILD_DIR" -j"$(nproc)" -t $(lib_targets)
|
||||||
TEMP_DIR="$(mktemp -d)"
|
TEMP_DIR="$(mktemp -d)"
|
||||||
cd "$BUILD_DIR/src"
|
cd "$BUILD_DIR/lib"
|
||||||
extract_symbols "$TEMP_DIR"
|
extract_symbols "$TEMP_DIR"
|
||||||
if check_libraries "$TEMP_DIR"; then
|
if check_libraries "$TEMP_DIR"; then
|
||||||
echo "Success! No unexpected dependencies were detected."
|
echo "Success! No unexpected dependencies were detected."
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
||||||
BUILDDIR=${BUILDDIR:-$TOPDIR/build}
|
BUILDDIR=${BUILDDIR:-$TOPDIR/build}
|
||||||
BINDIR=${BINDIR:-$BUILDDIR/src}
|
BINDIR=${BINDIR:-$BUILDDIR/bin}
|
||||||
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
||||||
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples}
|
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples}
|
||||||
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf}
|
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf}
|
||||||
|
|
|
@ -9,12 +9,12 @@ import tempfile
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
BINARIES = [
|
BINARIES = [
|
||||||
'src/bitcoind',
|
'bin/bitcoind',
|
||||||
'src/bitcoin-cli',
|
'bin/bitcoin-cli',
|
||||||
'src/bitcoin-tx',
|
'bin/bitcoin-tx',
|
||||||
'src/bitcoin-wallet',
|
'bin/bitcoin-wallet',
|
||||||
'src/bitcoin-util',
|
'bin/bitcoin-util',
|
||||||
'src/qt/bitcoin-qt',
|
'bin/bitcoin-qt',
|
||||||
]
|
]
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
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)
|
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})
|
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
|
# Subprojects
|
||||||
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"
|
# Subprojects include subdirectories that do or could have tests
|
||||||
VERBATIM
|
# and/or benchmark binaries, such as all subtrees and univalue.
|
||||||
)
|
# These need to be included before CMAKE_*_OUTPUT_DIRECTORY variables
|
||||||
add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL
|
# are set, so output locations of subproject tests and libraries are
|
||||||
clientversion.cpp
|
# not overridden.
|
||||||
)
|
include(../cmake/crc32c.cmake)
|
||||||
target_link_libraries(bitcoin_clientversion
|
include(../cmake/leveldb.cmake)
|
||||||
PRIVATE
|
include(../cmake/minisketch.cmake)
|
||||||
core_interface
|
|
||||||
)
|
|
||||||
add_dependencies(bitcoin_clientversion generate_build_info)
|
|
||||||
|
|
||||||
add_subdirectory(crypto)
|
|
||||||
add_subdirectory(univalue)
|
add_subdirectory(univalue)
|
||||||
add_subdirectory(util)
|
|
||||||
if(WITH_MULTIPROCESS)
|
|
||||||
add_subdirectory(ipc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#=============================
|
#=============================
|
||||||
# secp256k1 subtree
|
# secp256k1 subtree
|
||||||
#=============================
|
#=============================
|
||||||
|
@ -78,6 +68,38 @@ set_target_properties(secp256k1 PROPERTIES
|
||||||
)
|
)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
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
|
add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL
|
||||||
arith_uint256.cpp
|
arith_uint256.cpp
|
||||||
consensus/merkle.cpp
|
consensus/merkle.cpp
|
||||||
|
|
|
@ -255,7 +255,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||||
for binary, [attribute_name, env_variable_name] in binaries.items():
|
for binary, [attribute_name, env_variable_name] in binaries.items():
|
||||||
default_filename = os.path.join(
|
default_filename = os.path.join(
|
||||||
self.config["environment"]["BUILDDIR"],
|
self.config["environment"]["BUILDDIR"],
|
||||||
"src",
|
"bin",
|
||||||
binary + self.config["environment"]["EXEEXT"],
|
binary + self.config["environment"]["EXEEXT"],
|
||||||
)
|
)
|
||||||
setattr(self.options, attribute_name, os.getenv(env_variable_name, default=default_filename))
|
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()
|
self.set_binary_paths()
|
||||||
|
|
||||||
os.environ['PATH'] = os.pathsep.join([
|
os.environ['PATH'] = os.pathsep.join([
|
||||||
os.path.join(config['environment']['BUILDDIR'], 'src'),
|
os.path.join(config['environment']['BUILDDIR'], 'bin'),
|
||||||
os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH']
|
os.environ['PATH']
|
||||||
])
|
])
|
||||||
|
|
||||||
# Set up temp directory and start logging
|
# Set up temp directory and start logging
|
||||||
|
|
|
@ -109,7 +109,7 @@ def main():
|
||||||
logging.error("Must have fuzz executable built")
|
logging.error("Must have fuzz executable built")
|
||||||
sys.exit(1)
|
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
|
# Build list of tests
|
||||||
test_list_all = parse_test_list(
|
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.
|
are not as expected. Error is caught by bctester() and reported.
|
||||||
"""
|
"""
|
||||||
# Get the exec names and arguments
|
# 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":
|
if testObj["exec"] == "./bitcoin-util":
|
||||||
execprog = os.getenv("BITCOINUTIL", default=execprog)
|
execprog = os.getenv("BITCOINUTIL", default=execprog)
|
||||||
elif testObj["exec"] == "./bitcoin-tx":
|
elif testObj["exec"] == "./bitcoin-tx":
|
||||||
|
|
Loading…
Add table
Reference in a new issue