mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:43:31 +03:00
cmake: add support for "unity" builds
Aka "jumbo" or "amalgamation" builds. It means to compile all sources per target as a single C source. This is experimental. You can enable it by passing `-DCMAKE_UNITY_BUILD=ON` to cmake. It requires CMake 3.16 or newer. It makes builds (much) faster, allows for better optimizations and tends to promote less ambiguous code. Also add a new AppVeyor CI job and convert an existing one to use "unity" mode (one MSVC, one MinGW), and enable it for one macOS CI job. Fix related issues: - add missing include guard to `easy_lock.h`. - rename static variables and functions (and a macro) with names reused across sources, or shadowed by local variables. - add an `#undef` after use. - add a missing `#undef` before use. - move internal definitions from `ftp.h` to `ftp.c`. - `curl_memory.h` fixes to make it work when included repeatedly. - stop building/linking curlx bits twice for a static-mode curl tool. These caused doubly defined symbols in unity builds. - silence missing extern declarations compiler warning for ` _CRT_glob`. - fix extern declarations for `tool_freq` and `tool_isVistaOrGreater`. - fix colliding static symbols in debug mode: `debugtime()` and `statename`. - rename `ssl_backend_data` structure to unique names for each TLS-backend, along with the `ssl_connect_data` struct member referencing them. This required adding casts for each access. - add workaround for missing `[P]UNICODE_STRING` types in certain Windows builds when compiling `lib/ldap.c`. To support "unity" builds, we had to enable `SCHANNEL_USE_BLACKLISTS` for Schannel (a Windows `schannel.h` option) _globally_. This caused an indirect inclusion of Windows `schannel.h` from `ldap.c` via `winldap.h` to have it enabled as well. This requires `[P]UNICODE_STRING` types, which is apperantly not defined automatically (as seen with both MSVS and mingw-w64). This patch includes `<subauth.h>` to fix it. Ref: https://github.com/curl/curl/runs/13987772013 Ref: https://dev.azure.com/daniel0244/curl/_build/results?buildId=15827&view=logs&jobId=2c9f582d-e278-56b6-4354-f38a4d851906&j=2c9f582d-e278-56b6-4354-f38a4d851906&t=90509b00-34fa-5a81-35d7-5ed9569d331c - tweak unity builds to compile `lib/memdebug.c` separately in memory trace builds to avoid PP confusion. - force-disable unity for test programs. - do not compile and link libcurl sources to libtests _twice_ when libcurl is built in static mode. KNOWN ISSUES: - running tests with unity builds may fail in cases. - some build configurations/env may not compile in unity mode. E.g.: https://ci.appveyor.com/project/curlorg/curl/builds/47230972/job/51wfesgnfuauwl8q#L250 Ref: https://github.com/libssh2/libssh2/issues/1034 Ref: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html Ref: https://en.wikipedia.org/wiki/Unity_build Closes #11095
This commit is contained in:
parent
e812473d1e
commit
3f8fc25720
57 changed files with 1188 additions and 899 deletions
|
|
@ -112,7 +112,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
|
|||
static void process_pending_handles(struct Curl_multi *multi);
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
static const char * const statename[]={
|
||||
static const char * const multi_statename[]={
|
||||
"INIT",
|
||||
"PENDING",
|
||||
"CONNECT",
|
||||
|
|
@ -201,7 +201,7 @@ static void mstate(struct Curl_easy *data, CURLMstate state
|
|||
|
||||
infof(data,
|
||||
"STATE: %s => %s handle %p; line %d (connection #%ld)",
|
||||
statename[oldstate], statename[data->mstate],
|
||||
multi_statename[oldstate], multi_statename[data->mstate],
|
||||
(void *)data, lineno, connection_id);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -3798,7 +3798,7 @@ void Curl_multi_dump(struct Curl_multi *multi)
|
|||
/* only display handles that are not completed */
|
||||
fprintf(stderr, "handle %p, state %s, %d sockets\n",
|
||||
(void *)data,
|
||||
statename[data->mstate], data->numsocks);
|
||||
multi_statename[data->mstate], data->numsocks);
|
||||
for(i = 0; i < data->numsocks; i++) {
|
||||
curl_socket_t s = data->sockets[i];
|
||||
struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue