Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Regular rebasing of the cmake-staging branch #264

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b1a4dc5
contrib: use c++ rather than c for binary tests
theuni Jul 3, 2024
b6c4b6a
contrib: rename cc to cxx in binary checking scripts
theuni Jul 3, 2024
80474a3
contrib: c++ify test stubs after switching to c++ compilers
theuni Jul 4, 2024
0960519
cmake: Add root `CMakeLists.txt` file
hebasto Apr 16, 2024
048b312
cmake: Introduce interface libraries to encapsulate common flags
hebasto Jul 13, 2024
e9313a9
cmake: Print compiler and linker flags in summary
hebasto Jul 3, 2024
34b595c
cmake: Add `config/bitcoin-config.h` support
hebasto Mar 23, 2024
f45f6e0
cmake: Add introspection module
hebasto Mar 23, 2024
1dde345
cmake: Add position independent code support
hebasto Jan 9, 2024
fa83767
cmake: Add POSIX threads support
hebasto Jun 30, 2024
384b8df
cmake: Add `TryAppendCXXFlags` module
hebasto Jan 9, 2024
be7c4e5
cmake: Add `TryAppendLinkerFlag` module
hebasto Jan 9, 2024
1d8a097
cmake: Add global compiler and linker flags
hebasto Jul 3, 2024
2bcc91b
cmake: Redefine/adjust per-configuration flags
hebasto Jun 30, 2024
29508ae
cmake: Add `ccache` support
hebasto Jun 30, 2024
b5b6404
cmake: Build `secp256k1` subtree
hebasto Jul 3, 2024
b60087e
cmake: Build `crc32c` static library
hebasto Jul 13, 2024
08c7eb4
cmake: Build `leveldb` static library
hebasto Jul 3, 2024
3c328e1
cmake: Build `minisketch` static library
hebasto Jul 3, 2024
fc8e52a
cmake: Generate `obj/build.h` header
hebasto Jan 9, 2024
7b10ca4
cmake: Build `univalue` static library
hebasto Jan 9, 2024
f329d3e
cmake: Build `bitcoin_crypto` library
hebasto Jun 29, 2024
0f2798c
cmake: Build `bitcoin_util` static library
hebasto Jun 30, 2024
c5a248c
cmake: Build `bitcoin_consensus` library
hebasto Jun 30, 2024
e8de64a
cmake: Add `FindLibevent` module
hebasto May 17, 2024
66ace2a
cmake: Build `bitcoind` executable
hebasto Jul 13, 2024
970de7c
cmake: Build `bitcoin-cli` executable
hebasto May 20, 2024
b75d37c
cmake: Build `test_bitcoin` executable
hebasto Jul 13, 2024
6122ea1
cmake: Create test suite for `ctest`
hebasto Jan 9, 2024
38db354
cmake: Add wallet functionality
hebasto Jun 30, 2024
282ae5e
cmake: Build `bitcoin-tx` executable
hebasto Jun 30, 2024
498b0bb
cmake: Build `bitcoin-util` executable
hebasto Jan 9, 2024
360d9e7
cmake: Add `libnatpmp` optional package support
hebasto Jun 4, 2024
f65fb3b
cmake: Add `libminiupnpc` optional package support
hebasto Apr 29, 2024
603dd24
cmake: Add `libzmq` optional package support
hebasto Apr 29, 2024
71f4027
cmake: Add `systemtap-sdt` optional package support
hebasto Apr 29, 2024
2018256
cmake: Add external signer support
hebasto Jun 4, 2024
73f31a3
cmake: Build `bench_bitcoin` executable
hebasto Jul 13, 2024
eb4b794
cmake: Add `SANITIZERS` option
hebasto Jul 3, 2024
405261e
cmake: Add fuzzing options
hebasto Jul 3, 2024
2a27f35
qa: Consider `cache` and `config.ini` relative to invocation directory
hebasto Jul 13, 2024
920c162
qa: Do not assume running `feature_asmap.py` from source directory
hebasto Jun 8, 2024
bb2fe59
cmake: Add Python-based tests
hebasto May 20, 2024
f1b5f49
cmake: Add `HARDENING` option
hebasto Jun 30, 2024
baa1829
cmake: Add `REDUCE_EXPORTS` option
hebasto Jul 3, 2024
5104c0a
cmake: Add `WERROR` option
hebasto Jul 3, 2024
e74e17d
cmake: Build `bitcoin-qt` executable
hebasto Jul 13, 2024
2e928a1
cmake: Add `libqrencode` optional package support
hebasto Apr 29, 2024
254a539
cmake: Add `WITH_DBUS` option
hebasto Apr 28, 2024
acc089d
cmake: Build `test_bitcoin-qt` executable
hebasto Jul 13, 2024
bf795ae
cmake: Build `bitcoinkernel` library
hebasto Jul 13, 2024
b8bbad9
cmake: Build `bitcoin-chainstate` executable
hebasto Jun 30, 2024
2a7c2c8
cmake: Add `MULTIPROCESS` option
hebasto Jun 30, 2024
c4ea72c
depends: Fix CMake-generated `libevent*.pc` files
hebasto Jul 13, 2024
925e6e0
depends: Fix Autotools-generated `libzmq.pc` file
hebasto Mar 20, 2024
6cac654
depends: Amend handling flags environment variables
hebasto Feb 4, 2024
a9cc122
depends: Bump libmultiprocess source
hebasto Mar 30, 2024
39259c5
Revert "build, qt: Do not install *.prl files"
hebasto Jan 17, 2024
977d480
depends: Rename `cmake_system` -> `cmake_system_name`
hebasto May 15, 2024
4aacb3e
depends: Add host-specific `cmake_system_version` variables
hebasto May 15, 2024
da96cc8
build: Generate `toolchain.cmake` in depends
hebasto Jun 30, 2024
b0b2eb4
qt, build: Drop `QT_STATICPLUGIN` macro
hebasto Mar 1, 2024
d9907d3
qt: Drop `Q_IMPORT_PLUGIN` macros
hebasto Mar 1, 2024
50f11d0
cmake: Add cross-compiling support
hebasto Jul 3, 2024
4a19500
cmake: Implement `install` build target
hebasto Jun 30, 2024
730d4bc
cmake: Add `AddWindowsResources` module
hebasto Jan 27, 2024
406c6e2
cmake: Add `APPEND_{CPP,C,CXX,LD}FLAGS` cache variables
hebasto Apr 26, 2024
b9e8625
cmake: Add `Maintenance` module
hebasto Jul 3, 2024
ffb7128
cmake: Migrate Guix build scripts to CMake
hebasto Jun 4, 2024
971703a
cmake: Add compiler diagnostic flags
hebasto Jun 29, 2024
d6b2509
Fix MSVC warning C4273 "inconsistent dll linkage"
hebasto Feb 26, 2024
da55106
test: Fix MSVC warning C4101 "unreferenced local variable"
hebasto Feb 26, 2024
49a00eb
cmake: Add `docs` build target
hebasto Apr 23, 2024
273e25e
cmake: Add `Coverage` and `CoverageFuzz` scripts
hebasto May 6, 2024
b061c43
cmake: Add vcpkg manifest file
hebasto Jun 4, 2024
0829b87
cmake: Add useful presets
hebasto Feb 8, 2024
8218799
cmake, lint: Adjust `lint_includes_build_config`
hebasto Apr 28, 2024
7eaf2b1
Remove unused `#include <config/bitcoin-config.h>`
hebasto Jun 30, 2024
08e0047
ci: Migrate CI scripts to CMake
hebasto Jun 4, 2024
a24bc91
doc: Update for CMake-based build system
hebasto Jun 30, 2024
ceee2bf
ci: Test CMake edge cases
hebasto Jun 30, 2024
a952e1e
cmake, ci: Skip `miniupnpc` package in depends
hebasto May 22, 2024
a7f3ca7
cmake: Remove legacy MSVC build system
hebasto Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
145 changes: 32 additions & 113 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,17 @@ jobs:
if: github.repository != 'bitcoin-core/gui' || github.event_name == 'pull_request'

env:
CCACHE_MAXSIZE: '200M'
CI_CCACHE_VERSION: '4.7.5'
CI_QT_CONF: '-release -silent -opensource -confirm-license -opengl desktop -static -static-runtime -mp -qt-zlib -qt-pcre -qt-libpng -nomake examples -nomake tests -nomake tools -no-angle -no-dbus -no-gif -no-gtk -no-ico -no-icu -no-libjpeg -no-libudev -no-sql-sqlite -no-sql-odbc -no-sqlite -no-vulkan -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip doc -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -no-openssl -no-feature-bearermanagement -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sql -no-feature-sqlmodel -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-xml'
CI_QT_DIR: 'qt-everywhere-src-5.15.11'
CI_QT_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.11/single/qt-everywhere-opensource-src-5.15.11.zip'
PYTHONUTF8: 1
TEST_RUNNER_TIMEOUT_FACTOR: 40

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Remove non-MSVC tool installations
run: |
Remove-Item -Path "$env:ProgramFiles/CMake" -Recurse -Force

- name: Configure Developer Command Prompt for Microsoft Visual C++
# Using microsoft/setup-msbuild is not enough.
uses: ilammy/msvc-dev-cmd@v1
Expand All @@ -159,141 +158,60 @@ jobs:

- name: Get tool information
run: |
cmake -version | Tee-Object -FilePath "cmake_version"
Write-Output "---"
msbuild -version | Tee-Object -FilePath "msbuild_version"
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
$env:CI_QT_URL | Out-File -FilePath "qt_url"
$env:CI_QT_CONF | Out-File -FilePath "qt_conf"
py -3 --version
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"

- name: Restore static Qt cache
id: static-qt-cache
uses: actions/cache/restore@v4
with:
path: C:\Qt_static
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}

- name: Build static Qt. Download
if: steps.static-qt-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
curl --location --output C:\qt-src.zip %CI_QT_URL%
choco install --yes --no-progress jom

- name: Build static Qt. Expand source archive
if: steps.static-qt-cache.outputs.cache-hit != 'true'
shell: cmd
run: tar -xf C:\qt-src.zip -C C:\

- name: Build static Qt. Create build directory
if: steps.static-qt-cache.outputs.cache-hit != 'true'
run: |
Rename-Item -Path "C:\$env:CI_QT_DIR" -NewName "C:\qt-src"
New-Item -ItemType Directory -Path "C:\qt-src\build"

- name: Build static Qt. Configure
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: ..\configure %CI_QT_CONF% -prefix C:\Qt_static

- name: Build static Qt. Build
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: jom

- name: Build static Qt. Install
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: jom install

- name: Save static Qt cache
if: steps.static-qt-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: C:\Qt_static
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}

- name: Ccache installation cache
id: ccache-installation-cache
uses: actions/cache@v4
with:
path: |
C:\ProgramData\chocolatey\lib\ccache
C:\ProgramData\chocolatey\bin\ccache.exe
C:\ccache\cl.exe
key: ${{ github.job }}-ccache-installation-${{ env.CI_CCACHE_VERSION }}

- name: Install Ccache
if: steps.ccache-installation-cache.outputs.cache-hit != 'true'
run: |
choco install --yes --no-progress ccache --version=$env:CI_CCACHE_VERSION
New-Item -ItemType Directory -Path "C:\ccache"
Copy-Item -Path "$env:ChocolateyInstall\lib\ccache\tools\ccache-$env:CI_CCACHE_VERSION-windows-x86_64\ccache.exe" -Destination "C:\ccache\cl.exe"

- name: Restore Ccache cache
id: ccache-cache
uses: actions/cache/restore@v4
with:
path: ~/AppData/Local/ccache
key: ${{ github.job }}-ccache-${{ github.run_id }}
restore-keys: ${{ github.job }}-ccache-

- name: Using vcpkg with MSBuild
run: |
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
Add-Content -Path "triplets\x64-windows.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
.\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
git rev-parse HEAD | Tee-Object -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit"

- name: vcpkg tools cache
uses: actions/cache@v4
with:
path: C:/vcpkg/downloads/tools
key: ${{ github.job }}-vcpkg-tools

- name: vcpkg binary cache
uses: actions/cache@v4
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
id: vcpkg-binary-cache
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'toolset_version', 'build_msvc/vcpkg.json') }}

- name: Generate project files
run: py -3 build_msvc\msvc-autogen.py
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

- name: Build
shell: cmd
- name: Generate build system
run: |
ccache --zero-stats
msbuild build_msvc\bitcoin.sln -property:CLToolPath=C:\ccache;CLToolExe=cl.exe;UseMultiToolTask=true;Configuration=Release -maxCpuCount -verbosity:minimal -noLogo

- name: Ccache stats
run: ccache --show-stats
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON

- name: Save Ccache cache
- name: Save vcpkg binary cache
uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true'
with:
path: ~/AppData/Local/ccache
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ github.job }}-ccache-${{ github.run_id }}

- name: Run unit tests
run: src\test_bitcoin.exe -l test_suite

- name: Run benchmarks
run: src\bench_bitcoin.exe -sanity-check
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

- name: Run util tests
run: py -3 test\util\test_runner.py
- name: Build
working-directory: build
run: |
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release

- name: Run rpcauth test
run: py -3 test\util\rpcauth-test.py
- name: Run test suite
working-directory: build
run: |
ctest -j $env:NUMBER_OF_PROCESSORS -C Release

- name: Run functional tests
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'
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%
Expand All @@ -306,8 +224,9 @@ jobs:
git log -1

- name: Run fuzz binaries
working-directory: build
env:
BITCOINFUZZ: "${{ github.workspace}}\\src\\fuzz.exe"
BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe'
shell: cmd
run: py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_seed_corpus

Expand Down
Loading
Loading