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 #202

Closed
wants to merge 95 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
b2d4400
cmake: Add root `CMakeLists.txt` file
hebasto Apr 16, 2024
79ee6fb
cmake: Introduce core interface libraries to encapsulate common flags
hebasto Mar 23, 2024
b919daf
cmake: Add `config/bitcoin-config.h` support
hebasto Mar 23, 2024
ba97abc
cmake: Check system headers
hebasto Mar 23, 2024
7f5601d
cmake: Check system symbols
hebasto Apr 29, 2024
5dd7939
cmake: Check compiler features
hebasto Mar 23, 2024
fe4e6ce
cmake: Add position independent code support
hebasto Jan 9, 2024
d8574bd
cmake: Add platform-specific definitions and properties
hebasto Mar 23, 2024
ab7ff3a
cmake: Build `crc32c` static library
hebasto Mar 23, 2024
4ba3568
cmake: Build `leveldb` static library
hebasto Mar 23, 2024
6d6e051
cmake: Build `minisketch` static library
hebasto Mar 23, 2024
8554b77
cmake: Build `secp256k1` static library
hebasto Mar 23, 2024
ca618c0
cmake: Build `univalue` static library
hebasto Jan 9, 2024
aacf8e2
cmake: Build `bitcoin_crypto` library
hebasto Mar 8, 2024
5b90087
cmake: Build `bitcoin_util` static library
hebasto Apr 3, 2024
772c250
cmake: Build `bitcoin_consensus` library
hebasto Jan 9, 2024
6329a69
depends: Fix Autotools-generated `libevent*.pc` files
hebasto Apr 22, 2024
4c525ae
cmake: Add `FindLibevent` module
hebasto May 17, 2024
a6df072
cmake: Build `bitcoind` executable
hebasto May 4, 2024
d9de438
depends: Amend handling flags environment variables
hebasto Feb 4, 2024
33e0aef
build: Generate `toolchain.cmake` in depends
hebasto May 20, 2024
3d982a5
cmake: Add cross-compiling support
hebasto May 20, 2024
a2565fb
cmake: Add `TristateOption` module
hebasto Jan 9, 2024
01f8064
cmake: Add `ccache` support
hebasto Jan 9, 2024
96ac6de
cmake: Add `libnatpmp` optional package support
hebasto Jan 9, 2024
15dbc55
cmake: Add `libminiupnpc` optional package support
hebasto Apr 29, 2024
f17d3c9
depends: Fix Autotools-generated `libzmq.pc` file
hebasto Mar 20, 2024
d5ec8c4
cmake: Add `libzmq` optional package support
hebasto Apr 29, 2024
fd640ad
cmake: Add `systemtap-sdt` optional package support
hebasto Apr 29, 2024
a409d63
cmake: Build `bitcoin-cli` executable
hebasto May 20, 2024
8357295
cmake: Build `bitcoin-tx` executable
hebasto Jan 9, 2024
7f32e4e
cmake: Build `bitcoin-util` executable
hebasto Jan 9, 2024
c845284
cmake: Add wallet functionality
hebasto May 4, 2024
fcf842b
cmake: Add test config and runners
hebasto May 20, 2024
8cbdbdc
cmake: Build `bench_bitcoin` executable
hebasto Mar 23, 2024
97da5b8
cmake: Build `test_bitcoin` executable
hebasto May 20, 2024
e1faabb
cmake: Include CTest
hebasto Jan 9, 2024
b050520
cmake: Add `TryAppendCXXFlags` module
hebasto Jan 9, 2024
2c85010
cmake: Add `TryAppendLinkerFlag` module
hebasto Jan 9, 2024
c4cf51b
cmake: Add platform-specific compiler flags
hebasto Mar 23, 2024
db90ac8
cmake: Add platform-specific linker flags
hebasto Jan 9, 2024
ce666a1
cmake: Redefine/adjust per-configuration flags
hebasto Apr 3, 2024
fdf4a12
cmake: Add general compile options
hebasto Mar 23, 2024
7634cd2
cmake: Add `HARDENING` option
hebasto Mar 23, 2024
13c9caf
cmake: Add `REDUCE_EXPORTS` option
hebasto Mar 23, 2024
745f2a6
cmake: Add `WERROR` option
hebasto Mar 23, 2024
2d5b29c
cmake: Implement `make install`
hebasto Jan 9, 2024
f79a582
cmake: Generate `obj/build.h` header
hebasto Jan 9, 2024
a6bef79
Revert "build, qt: Do not install *.prl files"
hebasto Jan 17, 2024
5abd9b9
qt, build: Drop `QT_STATICPLUGIN` macro
hebasto Mar 1, 2024
0cca944
cmake: Build `bitcoin-qt` executable
hebasto May 4, 2024
a53a7ac
cmake: Build `test_bitcoin-qt` executable
hebasto Mar 9, 2024
891d991
qt: Drop `Q_IMPORT_PLUGIN` macros
hebasto Mar 1, 2024
702ae40
cmake: Add `libqrencode` optional package support
hebasto Apr 29, 2024
a6780ad
cmake: Add `SANITIZERS` option
hebasto Mar 23, 2024
7d4688c
cmake: Add external signer support
hebasto Feb 24, 2024
9f24eec
cmake: Add fuzzing options
hebasto May 20, 2024
c44d9ba
cmake: Add `AddWindowsResources` module
hebasto Jan 27, 2024
3278823
cmake: Add `Maintenance` module
hebasto May 20, 2024
20dd73a
cmake: Migrate Guix build scripts to CMake
hebasto Jan 16, 2024
0a71df6
cmake: Add vcpkg manifest file
hebasto Apr 16, 2024
cd36289
cmake: Add preset for MSVC build
hebasto Feb 8, 2024
0db9c9c
Fix MSVC warning C4273 "inconsistent dll linkage"
hebasto Feb 26, 2024
1928f40
cmake: Add compiler diagnostic flags
hebasto Mar 25, 2024
250fe7c
test: Fix MSVC warning C4101 "unreferenced local variable"
hebasto Feb 26, 2024
e30348e
cmake: Build `bitcoinkernel` library
hebasto May 20, 2024
3dee0f9
cmake: Build `bitcoin-chainstate` executable
hebasto Apr 1, 2024
67e76a5
cmake: Remove legacy MSVC build system
hebasto Mar 8, 2024
3154a6d
depends: Bump libmultiprocess source
hebasto Mar 30, 2024
1015222
cmake: Add `MULTIPROCESS` option
hebasto Mar 12, 2024
b70ba0d
cmake: Add `docs` build target
hebasto Apr 23, 2024
37835c9
cmake [KILL 3-STATE]: Switch `WITH_NATPMP` to boolean w/ default OFF
hebasto Apr 21, 2024
f0fdecc
cmake [KILL 3-STATE]: Switch `WITH_MINIUPNPC` to boolean w/ default OFF
hebasto Apr 21, 2024
c6db3ed
cmake [KILL 3-STATE]: Switch `WITH_ZMQ` to boolean w/ default OFF
hebasto Apr 29, 2024
f09524a
cmake [KILL 3-STATE]: Switch `MULTIPROCESS` to boolean w/ default OFF
hebasto Apr 21, 2024
61e0fa9
cmake [KILL 3-STATE]: Switch `WITH_QRENCODE` to boolean w/ default ON
hebasto Apr 24, 2024
d2ab145
cmake [KILL 3-STATE]: Switch `WITH_USDT` to boolean w/ default OFF
hebasto Apr 22, 2024
41087e6
cmake [KILL 3-STATE]: Switch `WITH_{SQLITE,BDB}` to boolean
hebasto Apr 22, 2024
70204aa
cmake [KILL 3-STATE]: Make WITH_GUI binary option w/ default OFF
hebasto May 1, 2024
aed136e
cmake [KILL 3-STATE]: Rename WITH_GUI to BUILD_GUI
hebasto Apr 27, 2024
1c11d8b
cmake: Add `WITH_DBUS` option
hebasto Apr 28, 2024
50d4b09
cmake, doc: Update `release-process.md`
hebasto Feb 26, 2024
5d751d7
cmake, docs: Update MSVC build docs
hebasto May 20, 2024
ade7d48
cmake, doc: Update `build-freebsd.md`
hebasto May 20, 2024
0da5317
cmake, doc: Update `build-osx.md`
hebasto May 20, 2024
9ca2ee1
cmake, doc: Update `build-openbsd.md`
hebasto May 20, 2024
6f6d262
cmake, doc: Update `depends/README.md`
hebasto Apr 27, 2024
2151d3e
cmake, vcpkg: Pin `libevent` version
hebasto May 13, 2024
3dd5385
cmake: Add `APPEND_{CPP,C,CXX,LD}FLAGS` cache variables
hebasto Apr 26, 2024
926290d
cmake: Dispaly `APPEND_{CPP,C,CXX,LD}FLAGS` in summary
hebasto May 9, 2024
1770a46
depends: Rename `cmake_system` > `cmake_system_name`
hebasto May 15, 2024
16f39d4
depends: Add `CMAKE_SYSTEM_VERSION` to CMake toolchain file
hebasto May 15, 2024
390f987
cmake: Add CI-specific presets
hebasto May 20, 2024
82c401e
ci: Test CMake edge cases
hebasto May 20, 2024
e8e0e69
ci: Migrate CI scripts to CMake
hebasto Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 47 additions & 103 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ jobs:

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 @@ -153,122 +153,67 @@ jobs:

- name: Get tool information
run: |
cmake --version | Out-File -FilePath "cmake_version"
Get-Content -Path "cmake_version"
Write-Output "---"
msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version"
Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version"
$env:VCToolsVersion | Out-File -FilePath "$env:GITHUB_WORKSPACE\toolset_version"
Write-Host "VCToolsVersion $(Get-Content -Path "$env:GITHUB_WORKSPACE\toolset_version")"
$env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url"
$env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\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-
choco install --yes --no-progress ccache

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

- 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') }}
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

- name: Generate build system
run: |
cmake -B build --preset vs2022 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DWERROR=ON

- name: Generate project files
run: py -3 build_msvc\msvc-autogen.py
- name: Save vcpkg binary cache
uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true'
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

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

- name: Build
shell: cmd
working-directory: build
run: |
ccache --zero-stats
msbuild build_msvc\bitcoin.sln -property:CLToolPath=C:\ccache;CLToolExe=cl.exe;UseMultiToolTask=true;Configuration=Release -maxCpuCount -verbosity:minimal -noLogo
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release

- name: Ccache stats
run: ccache --show-stats
run: |
ccache --version | head -n 1
ccache --show-stats --verbose

- name: Save Ccache cache
uses: actions/cache/save@v4
Expand All @@ -278,20 +223,18 @@ jobs:
# 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

- name: Run util tests
run: py -3 test\util\test_runner.py

- 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 @@ -304,7 +247,8 @@ 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
Loading
Loading