Go to file
Viktor Szakats 3f8fc25720
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
2023-06-07 13:06:08 +00:00
.circleci circleci: install impacket & wolfssl 5.6.0 2023-05-31 08:34:22 +02:00
.github cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
.lift tests/http: more tests with specific clients 2023-04-26 23:24:46 +02:00
.reuse mlc_config.json: remove this linkcheck CI job config file 2023-05-15 13:23:54 +02:00
CMake cmake: speed up and extend picky clang/gcc options 2023-04-16 22:28:25 +00:00
docs examples/websocket.c: websocket example using CONNECT_ONLY 2023-06-07 14:56:02 +02:00
include haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
lib cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
LICENSES copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
m4 misc: fix spelling mistakes 2023-05-23 10:42:09 +02:00
packages CURLOPT_MAIL_RCPT_ALLOWFAILS: replace CURLOPT_MAIL_RCPT_ALLLOWFAILS 2023-06-03 23:29:04 +02:00
plan9 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
projects build-openssl.bat: keep OpenSSL 3 engine binaries 2023-02-18 19:02:24 -05:00
scripts scripts: Fix GHA matrix job detection in cijobs.pl 2023-05-30 16:54:13 -07:00
src cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tests cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
winbuild winbuild: fix makefile clean 2023-02-23 03:49:37 -05:00
.azure-pipelines.yml CI: don't run CI jobs if only another CI was changed 2023-04-24 20:46:09 -07:00
.cirrus.yml CI: add an Alpine build with MUSL 2023-05-22 16:00:08 -07:00
.dcignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.dir-locals.el copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.git-blame-ignore-revs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitattributes copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.mailmap rtsp: skip malformed RTSP interleaved frame data 2023-03-30 09:59:09 +02:00
acinclude.m4 build: drop unused/redundant HAVE_WINLDAP_H 2023-06-05 16:31:38 +00:00
appveyor.yml cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
buildconf copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
buildconf.bat copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
CHANGES
CMakeLists.txt cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
configure.ac build: drop unused/redundant HAVE_WINLDAP_H 2023-06-05 16:31:38 +00:00
COPYING copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-config.in copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
GIT-INFO GIT-INFO: add --with-openssl 2023-05-14 23:22:23 +02:00
libcurl.pc.in copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
MacOSX-Framework copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
Makefile.am cmake: speed up and extend picky clang/gcc options 2023-04-16 22:28:25 +00:00
Makefile.dist copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
maketgz copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
README docs: minor grammar fixes 2022-09-29 10:44:12 +02:00
README.md README.md: updated link to opencollective 2023-06-02 11:29:15 +02:00
RELEASE-NOTES RELEASE-NOTES: synced 2023-06-03 23:52:39 +02:00
SECURITY.md copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.

Website

Visit the curl website for the latest news and downloads.

Git

To download the latest source from the Git server, do this:

git clone https://github.com/curl/curl.git

(you will get a directory named curl created, filled with the source code)

Security problems

Report suspected security problems via our HackerOne page and not in public.

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 Become a backer.

Sponsors

Support this project by becoming a sponsor.