Joel Rosdahl [Mon, 24 Jun 2024 18:55:33 +0000 (20:55 +0200)]
build: Bundle Fmt again
Fmt is currently the only required C++ dependency that isn't bundled.
Since the Fmt API is still evolving, it's convenient for Ccache users
that lack a proper Fmt version locally to be able to build without
having to download Fmt. Thus, bundle Fmt again for now. (When we can
bump compiler requirements to versions that implement std::format
properly in the future we will switch to std::format instead.)
Sam James [Sat, 8 Jun 2024 14:11:48 +0000 (15:11 +0100)]
build: Find CppHttplib named libhttplib.so as well (#1465)
On Gentoo, the library name is 'httplib', not 'cpp-httplib'. Search
for that first (as it appears to be "more vanilla"), then fall back
to 'cpp-httplib'.
Joel Rosdahl [Wed, 29 May 2024 18:54:31 +0000 (20:54 +0200)]
build: Fix zstd build for older CMake versions
With CMake 3.17.5 on CentOS7:
-- Downloading Zstd from the internet since Zstd>=1.3.4 was not found locally and DEPS=AUTO
CMake Error at cmake/FindZstd.cmake:60 (set_target_properties):
set_target_properties Can not find target to add properties to:
libzstd_static
Call Stack (most recent call first):
cmake/Dependencies.cmake:29 (find_package)
CMakeLists.txt:88 (include)
CMake Error at cmake/FindZstd.cmake:68 (add_library):
add_library cannot create ALIAS target "dep_zstd" because target
"libzstd_static" does not already exist.
Call Stack (most recent call first):
cmake/Dependencies.cmake:29 (find_package)
CMakeLists.txt:88 (include)
Silver Zachara [Tue, 28 May 2024 17:03:29 +0000 (19:03 +0200)]
build: Fix MSVC /Zc:preprocessor warning (#1461)
Don't add the /Zc:preprocessor- compiler flag when it's not needed, to
avoid the following warning:
D9025 : overriding '/Zc:preprocessor' with '/Zc:preprocessor-
The latest Windows SDK v10.0.22621 compiles fine with conforming
preprocessor enabled, the bug was in older SDK-s like <=10.0.20348.0.
Add the /Zc:preprocessor for msvc >=v19.25, it didn't exist before this
version (it existed as /experimental:preprocessor before).
Silver Zachara [Fri, 17 May 2024 19:12:25 +0000 (21:12 +0200)]
feat: Add --print-version option (#1454)
I have added a new `--print-version` option as ccache will support PCH
on msvc and I will need to somehow detect the ccache version to
correctly decide if PCH should be disabled
(`CMAKE_DISABLE_PRECOMPILE_HEADERS`).
So if ccache >=4.10 then don't disable PCH and if it's below then set
`CMAKE_DISABLE_PRECOMPILE_HEADERS=ON`.
Silver Zachara [Wed, 15 May 2024 18:44:21 +0000 (20:44 +0200)]
fix: Handle -Yc without filepath for msvc (#1448)
This PR further fixes the #1384. Fixes the case when the `/Yc` option is
without the filepath and the `/Fppathname` is also defined.
The `/Yc` can be passed in two ways with and w/o the filepath. When it's
passed w/o the filepath it must take the value of the `/Fp` option and
if the `/Fp` option isn't defined then the resulting .pch file must have
the same base name as the base source file with appended `.pch`
extension (this case isn't handled correctly by ccache).
The `/Yc` option doesn't support passing a filepath with the space
between like `/Yc filepath`. Because of this the `TAKES_ARG` must be
removed. All occurrences of `compopt_takes_path()` can't be invoked for
I have also added a new unittest for this case: "MSVC PCH options with
empty -Yc" and also tested it manually on my example project. Just now,
I have also tested it on a big project with 200 TU with qmake and cmake
build systems with msvc and also clang-cl with msvc compilers with 100%
cache hits (PCH enabled and /Zi replaced with /Z7).
Jiri Slaby [Sun, 12 May 2024 07:48:28 +0000 (09:48 +0200)]
feat: Add support for -fdump-ipa-clones (#1449)
Fixes #1447. Citing:
`-fdump-ipa-clones` is used heavily for live patching. Especially, when
one builds a distro kernel (like SLE 15 SP6), the build uses the option
to generate additional `.000i.ipa-clones` files.
Joel Rosdahl [Wed, 8 May 2024 18:45:13 +0000 (20:45 +0200)]
fix: Force run_second_cpp=true when generating profiling information
If run_second_cpp=false the coverage report will refer to the temporary
preprocessed file instead of the source file. Fix this by forcing
run_second_cpp=true if profiling information is being generated.
Joel Rosdahl [Sun, 28 Apr 2024 19:50:58 +0000 (21:50 +0200)]
chore: Remove unnecessary depend_extra_args
The ordinary compiler_args list can be used for executing the compiler
in the depend mode since dependency arguments are present there after 07b55f13e119a2a35d166a73929643911ea69d52.
Joel Rosdahl [Sat, 27 Apr 2024 13:22:40 +0000 (15:22 +0200)]
feat: Support -Xpreprocessor -fopenmp in direct mode
All uses of -Xpreprocessor disable the direct mode as a safety measure
since the command line could include things like
-Xpreprocessor -MF -Xpreprocessor file.d
which ccache needs to understand as
-MF file.d
Ideally, ccache should handle this in a generic way. Meanwhile, let's
allow it in the a special case of "-Xpreprocessor -fopenmp" since that's
required on macOS to enable OpenMP.
Joel Rosdahl [Thu, 25 Apr 2024 19:32:16 +0000 (21:32 +0200)]
refactor: Improve dependency file parsing
- Use Depfile::tokenize to parse the dep file in rewrite_source_paths
instead of an even more ad-hoc parser.
- Add Depfile::untokenize to go from tokens back to text representation.
Joel Rosdahl [Sat, 27 Apr 2024 08:30:18 +0000 (10:30 +0200)]
build: Improve handling of dependencies (#1429)
- Introduced a new CMake variable called `DEPS` with the following
semantics:
- `AUTO` (the default): Use dependencies from the local system if
available. Otherwise: Use bundled dependencies if available. Otherwise:
Download dependencies from the internet (dependencies will then be
linked statically).
- `DOWNLOAD`: Use bundled dependencies if available. Otherwise: Download
recommended versions from the internet (dependencies will then be linked
statically).
- `LOCAL`: Use dependencies from the local system if available.
Otherwise: Use bundled dependencies if available.
The old `HIREDIS_FROM_INTERNET`, `ZSTD_FROM_INTERNET` and `OFFLINE`
variables have been removed in favor of `DEPS`.
- Streamlined the CMake code for hiredis and zstd.
- Removed bundled `getopt_long` implementation.
It seems likely that getopt_long is available on all platforms where
ccache is built nowadays, except Windows. Therefore, remove the bundled
getopt_long implementation for now.
If it turns out that somebody wants to compile ccache on a system that
lacks getopt_long we can add support specifying a system or downloaded
version.
- Implemented our own AVX2 runtime detection instead of using a blake3's
ditto. This opens up for using blake3 from the system.
- Added support for using blake3, httplib, nonstd/span and tl/expected
from the system instead of bundled versions.
- Removed bundled doctest, fmt and xxhash dependencies. Instead,
download them if missing.