Skip to content

Commit a57f493

Browse files
committed
curl: switch to cmake unity with 8.5.0 [ci skip]
Switch from `curl-gnumake.sh` to `curl-cmake.sh` with upcoming curl release v8.5.0. cmake builds are now _faster_ for Windows builds than raw gnumake (aka `Makefile.mk`). They also use 'unity' mode, which makes builds run fast with the side-effect of also creating potentially more efficient binaries by allowing better compiler optimizations. This also makes curl-for-win use the same build system for all target platforms (`Makefile.mk` is not available for *nix platforms). Initially on 2022-07-04 cmake was 25% slower than gnumake. By 2022-09-26 this reduced to 20%, by 2023-07-29 to 18% and after the latest round of updates gnumake came out 7% slower than cmake. This is for Windows, for a triple x64, arm64 and x86 build. In absolute times this is 27m22s for cmake and 29m11s for gnumake. (FWIW autotools builds are 52% slower than cmake unity builds now.) Making cmake builds fast was a multi-year effort with these major steps: 1. add support for cmake builds in curl-for-win. 420e73c 2. bring it in-line with gnumake and autotools builds and tidy-up as much as possible. Scattered to a many commits. 3. delete a whole bunch of unused feature detections. curl/curl@4d73854 curl/curl#9044 (and a lot more smaller commits) 4. speed up picky warning option initialization by avoiding brute-force all options. (first in libssh2, then in curl, then applied also ngtcp2, nghttp3, nghttp2) curl/curl@9c543de curl/curl#10973 5. implement single build run for shared and static libcurl + tool (first in libssh2) curl/curl@1199308 curl/curl#11505 53dcd49 6. implement single build pass for shared and static libcurl (for Windows initially) curl/curl@2ebc74c curl/curl#11546 7. extend above to non-Windows (e.g. macOS) curl/curl@fc9bfb1 curl/curl#11627 bafa77d (mac) 1b27304 (linux) 8. implement unity builds: single compiler invocation for libcurl + tool curl/curl@3f8fc25 curl/curl#11095 curl/curl@f42a279 curl/curl#11928 67d7fd3 9. speed up 4x the cmake initialization phase (for Windows) curl/curl@2100d9f curl/curl#12044 10. speed up cmake initialization even more by pre-filling detection results for our well-known mingw-w64 environments. 74dd967 5a43c61 +1: speed up autotools initialization by mitigating a brute-force feature detection on Windows. This reduced total build times by 5 minutes at the time, for the 3 Windows targets in total. curl/curl@6adcff6 curl/curl#9591 Also update build times for cmake-unity and gnumake, based on runs: cmake-unity: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/48357875 gnumake: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/48358005
1 parent a75acd5 commit a57f493

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

_build.sh

+5-8
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p
8181
# curl-linux-musl / curl-mac / curl-x64.exe / curl-x86.exe / curl-a64.exe
8282
# (or similar)
8383
# - change default TLS to BoringSSL (with OPENSSL_SMALL?) or LibreSSL?
84-
# - win: switch to curl-cmake.sh (from curl-gnumake.sh) to use the same build
85-
# method for all target platforms. This will have a 20% build-performance
86-
# hit for curl builds.
8784
# - switch to libssh2-cmake.sh by default? (both for libssh2.sh and as
8885
# non-Windows fallback in libssh2-gnumake.sh). Consider enabling unity mode.
8986
# The advantage of autotools here is that it allows to exercise the
@@ -117,10 +114,10 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p
117114
# - https://sourceware.org/git/binutils-gdb.git
118115
# - https://github.com/netwide-assembler/nasm
119116

120-
# Build times (2023-07-29):
121-
# - gnumake: 33 min 18 sec 1998s 100%
122-
# - cmake with dual patch: 39 min 12 sec 2352s 118% 100%
123-
# - autotools: 41 min 40 sec 2500s 125% 106%
117+
# Build times for windows (2023-10-25):
118+
# - cmake-unity: 27 min 22 sec 1642s 100%
119+
# - gnumake: 29 min 11 sec 1751s 107% 100%
120+
# - autotools: 41 min 40 sec 2500s 152% 143%
124121

125122
# Supported build tools:
126123
#
@@ -145,7 +142,7 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p
145142
# wolfssh autotools
146143
# libssh cmake
147144
# libssh2 autotools, gnumake [windows-only], cmake-unity
148-
# curl gnumake [windows-only], cmake-unity [non-windows default], autotools
145+
# curl cmake-unity [non-windows default], autotools, gnumake [windows-only]
149146

150147
cd "$(dirname "$0")"
151148

curl-gnumake.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
88

99
# Unixy platforms require the configure phase, thus cannot build with pure GNU Make.
10-
if [ "${_OS}" != 'win' ]; then
10+
if [ "${_OS}" != 'win' ] || [ "${CURL_VER_}" != '8.4.0' ]; then
1111
./curl-cmake.sh "$@"
1212
exit
1313
fi

0 commit comments

Comments
 (0)