Commit Graph

1441 Commits

Author SHA1 Message Date
Joseph Snyder
2709f07b4d VS: Add minimal support for Windows Kernel Mode Drivers
Extend the experimental support for `WindowsKernelModeDriver` to the
Visual Studio generators.  Hard-code some settings for now.
2024-12-03 14:18:52 -05:00
Marc Chevrier
a4ff2b01e3 IntelLLVM-Windows: add definitions for ARCHIVER: prefix
Configure ARCHIVER: prefix to enable the archive libraries management
with Windows-IntelLLVM.

Issue: #26300
2024-11-26 19:26:08 +01:00
Matthew Woehlke
99ac59d31b style: Remove trailing blank lines from all CMake sources
Our development workflow tooling prevents trailing blank lines
from being added, but some such lines remain from before that
was enforced.  Remove them to make it easier to rename files
without triggering enforcement.
2024-11-21 15:48:02 -05:00
Brad King
af3a48a591 Merge topic 'Linux-deduplication-static-libs'
0445190d2f LLD linker: avoid regression on archive libraries deduplication

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10010
2024-11-19 10:14:42 -05:00
Marc Chevrier
0445190d2f LLD linker: avoid regression on archive libraries deduplication
Due to a bug on LLD linker for ELF binaries, deduplication should
occur only if CMP0156 and CMP0179 are NEW.

Fixes: #26447
2024-11-18 21:02:50 +01:00
Brad King
79a83ddb08 Apple: Enable linking during iOS/tvOS/visionOS/watchOS toolchain inspection
Since commit 11da882a12 (Apple: Introduce separate system name for iOS,
tvOS, and watchOS, 2018-01-15, v3.14.0-rc1~14^2~1) our toolchain
inspection steps, like ABI detection, tell `try_compile` to use a
`STATIC_LIBRARY` instead of an `EXECUTABLE`.  This was needed at the
time to avoid codesign requirements.  However, commit d3a64c4e3f (Xcode:
Explicitly turn off signing in try_compile projects, 2020-07-16,
v3.19.0-rc1~483^2) introduced a more general solution to that problem.
Restore linking during toolchain inspection so that we can detect and
identify the linker.

Suggested-by: Marc Chevrier <marc.chevrier@gmail.com>
Fixes: #26443
2024-11-14 11:06:49 -05:00
Brad King
fe872cc98c Merge topic 'musl-linux-any'
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9991
2024-11-13 09:19:25 -05:00
Brad King
6a25904983 Merge topic 'musl-linux-any' into release-3.31
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9991
2024-11-13 09:19:23 -05:00
Brad King
8d652dc191 Merge topic 'WHOLE_ARCHIVE-various-systems'
d2997ab601 Linker configuration: Add missing platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9992
2024-11-13 09:17:25 -05:00
Timo Röhling
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any
When bootstrapping Debian for musl-linux-any, the multiarch directories
are not found due to an overly-specific regular expression.

See https://bugs.debian.org/1085507 for the original bug report.
2024-11-12 10:47:40 -05:00
Marc Chevrier
d2997ab601 Linker configuration: Add missing platforms
The following platforms were missing:
* Android
* WindowsCE, WindowsPhone, WindowsStore and WindowsKernelModeDriver

And enhance various Apple platforms support (iOS, tvOS, etc...)

Fixes: #26439
2024-11-12 16:46:54 +01:00
Brad King
7b19531291 macOS: Do not pass any SDK/-isysroot to compilers by default
On modern macOS, compiler wrappers like `/usr/bin/cc` automatically
choose a SDK to pass via `-isysroot` to an underlying compiler from
Xcode or the CommandLineTools.  Other toolchains like Homebrew's `gcc-*`
come with a default SDK too.  Therefore, when targeting macOS, we no
longer need to choose any SDK or pass an `-isysroot` flag by default.

Update initialization of `CMAKE_OSX_SYSROOT` to be empty by default when
targeting macOS.

Fixes: #19180
2024-11-07 09:46:10 -05:00
Brad King
3b8b70fe72 macOS: Simplify logic converting CMAKE_OSX_SYSROOT to a path 2024-11-07 09:46:10 -05:00
Joseph Snyder
54bbd00448 WindowsKernelModeDriver: Switch to appending to variables
When using the WindowsKernelModeDriver, do not add the new paths
if the variable was not previously defined.  Instead, append them
to the existing value.

Add a new GUID for the Experimental mode gate
2024-10-24 13:20:08 -04:00
Brad King
9c5f6d22f3 Merge topic 'windows-kernel-mode-driver-includes'
b151bcfc9e WindowsKernelModeDriver: Add WDK include and link paths on MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9705
2024-09-05 09:21:35 -04:00
Joseph Snyder
b151bcfc9e WindowsKernelModeDriver: Add WDK include and link paths on MSVC
Detect Windows Kernel-Mode Driver include directories and library search
paths from the WDK command-line environment.  Require toolchain files to
specify the KMDF target version via a new variable.

Since this changes the behavior of the WindowsKernelModeDriver
experimental feature, update its UUID.
2024-09-03 11:10:35 -04:00
Rüdiger Ihle
09a47c7972 MSVC: Restore support for non-incremental linking with v100 toolset and older
Since commit 0b552eb877 (MSVC: Embed manifests directly for
non-incremental vs_link_exe links, 2023-02-20, v3.27.0-rc1~438^2) we use
`/MANIFEST:EMBED`, but that is not supported by older MSVC linkers.
Restore use of the standalone manifest tool.

Update `Tests/MSManifest` to recognize `dpiAwareness` in the manifest
content as written by MSVC v100 tooling.

Fixes: #26179
2024-09-03 10:58:28 -04:00
Brad King
7a3961cc94 Merge topic 'android-ndk-27'
24cd4ff844 Android: Fix build with NDK 27

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9766
2024-08-26 09:46:36 -04:00
Lars Schmertmann
24cd4ff844 Android: Fix build with NDK 27
`NDK_PROC_*_ABI` and `NDK_ARCH_*_ABI` were removed in the Android
NDK 27 but will be reintroduced in the Android NDK 27b:

* https://github.com/android/ndk/issues/2049
* https://android-review.googlesource.com/c/platform/ndk/+/3196345

Both are only used when `CMAKE_ANDROID_ARCH_ABI` is NOT given. But
currently the existence is also checked when `CMAKE_ANDROID_ARCH_ABI`
is given. So we move the checks to the position they are required.
2024-08-22 09:30:01 -04:00
Tudy Gourmelen
4b84596dcf Android: Fix condition detecting no APIs found in the NDK
Fixes: #26210
2024-08-14 08:16:24 +02:00
Marc Chevrier
1e35163ae8 WHOLE_ARCHIVE link feature: rely now on linker configuration
Fixes: #26019
2024-07-22 16:58:51 +02:00
Marc Chevrier
c1c4cf9545 Linker configuration: introduce a new architecture
A new set of files are dedicated to linker configuration.
This set of files enable a fine-tuned configuration based of the linker
type as identified during compiler detection.

Fixes: #25360
2024-07-20 19:05:54 +02:00
Brad King
a8d8f26828 Merge topic 'aix-archive-shared-libraries'
d27fe9dfba AIX: Add option to archive shared libraries
98013ad1ca cmXCOFF: Add support for editing binary inside an archive

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9606
2024-07-19 09:55:58 -04:00
Aditya Vidyadhar Kamath
d27fe9dfba AIX: Add option to archive shared libraries
Add option `CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`.

There will no versions for the shared objects when this option is used.

Closes: #26033
2024-07-17 11:52:09 -04:00
Brad King
25abc95715 Merge topic 'LLVMFlang-aix'
e37d8e28e8 LLVMFlang: Add support for AIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9661
2024-07-17 09:48:24 -04:00
Kelvin Li
e37d8e28e8 LLVMFlang: Add support for AIX 2024-07-16 14:32:19 -04:00
Jacob Hummer
68cd5281e4 WASI: Add platform modules
Add minimal platform modules to support toolchain files like those in

* https://github.com/WebAssembly/wasi-sdk

or direct use of `-DCMAKE_SYSTEM_NAME="WASI"`

Fixes: #19223
2024-07-16 12:28:19 -04:00
moyo1997
b2a2865205 MSVC: Remove outdated preprocessor flags for targeting ARM64EC
Remove `/DAMD64` and `/DARM64EC` flags added by commit 4ea3a88625 (MSVC:
Add support for targeting ARM64EC, 2020-12-30, v3.20.0-rc1~121^2) that
are not longer expected.
2024-07-09 14:21:21 -04:00
Brad King
639346f319 Merge topic 'ios-mac-catalyst'
2785364b7b iOS: Add support for Mac Catalyst

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9595
2024-07-08 11:13:09 -04:00
Raul Metsma
2785364b7b iOS: Add support for Mac Catalyst
Issue: #20132
Signed-off-by: Raul Metsma <raul@metsma.ee>
2024-07-03 11:15:45 -04:00
Brad King
05b4883bfe Merge topic 'find_library-per-arch-lib-with-sysroot'
e74fba3d9c find_library: Search per-arch lib directories when compiling with sysroot

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9614
2024-06-24 09:29:52 -04:00
Marc Chevrier
576567f028 Link feature attributes: stabilization
* enhance OVERRIDE handling
* Update wording
2024-06-21 11:18:20 +02:00
Marc Chevrier
5617c34c31 Libraries processing: update configuration wording 2024-06-21 11:18:12 +02:00
Harmen Stoppels
e74fba3d9c find_library: Search per-arch lib directories when compiling with sysroot
When using Gentoo Prefix on Debian, find_library for libm.so fails,
because it needs to locate the lib in $sysroot/usr/lib64/libm.so, i.e.
lib64/ not lib/.

To fix this, do not disable per-arch lib directories when a sysroot is
set.

Fixes: #26069
2024-06-21 10:53:16 +02:00
Jonathan Schwender
93a1a17d4c OHOS: Add support for OpenHarmony OS
Closes #25987
2024-05-22 09:45:55 +02:00
Marc Chevrier
6e5e7968c3 GenEx $<LINK_LIBRARY>: Add the support of properties attached to features
Fixes: #24504, #25954
2024-05-15 10:02:36 +02:00
Brad King
8f7049112d Merge topic 'nag-fortran-ninja'
4af20bb794 NAG-Fortran: Do not repeat preprocessing with Ninja on Apple platforms
91bb8dd872 NAG-Fortran: Fix MODULE library creation on Apple platforms
e056006116 NAG-Fortran: Tell the Ninja generator how to preprocess Fortran sources
765a611956 NAG-Fortran: Added initial default compilation flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9407
2024-04-16 08:53:56 -04:00
Brad King
1c9e514d28 Merge topic 'swift-module-libraries'
56e5cea600 Swift: Support module libraries with command-line build systems

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9379
2024-04-16 08:47:11 -04:00
Simon Maertens
4af20bb794 NAG-Fortran: Do not repeat preprocessing with Ninja on Apple platforms
The Ninja generator uses separate preprocessing and compilation steps.
Do not pass `-fpp` when compiling an already-preprocessed source.

Issue: #25900
2024-04-15 13:48:15 -04:00
Simon Maertens
91bb8dd872 NAG-Fortran: Fix MODULE library creation on Apple platforms
Previously we passed `-bundle` to the NAG Fortran front-end, which
does not support it.  Pass it through to the linker instead.
2024-04-15 13:35:08 -04:00
Evan Wilde
56e5cea600 Swift: Support module libraries with command-line build systems
Wire up the flags needed to support module libraries built and used with
Swift. We need to pass `-bundle` to the linker when linking module
libraries on Darwin, and we need to pass `-export-dynamic` to the linker
when emitting an executable that exports symbols on Linux. This patch
wires up `CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS` and
`CMAKE_SHARED_MODULE_LOADER_Swift_FLAG` on Darwin, and hooks up
`CMAKE_EXE_EXPORTS_Swift_FLAG` on Linux in order to support passing
things correctly.

We can't expose `CMAKE_EXE_LINKER_FLAGS` to Swift, as it contains flags
that the Swift compiler doesn't recognize, but the other
language-specific variables are safe to expose.
2024-04-15 08:23:39 -07:00
Brad King
d616df8ad1 Merge topic 'aix-export-tdata'
b4d1ab42b8 AIX: Consider tdata symbols in ExportImportList

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9422
2024-04-12 09:28:46 -04:00
David Tenty
b4d1ab42b8 AIX: Consider tdata symbols in ExportImportList
Thread-local variables are put in the tdata section on AIX / XCOFF [1]. Unfortunately
the ExportImportList script currently doesn't consider this section when looking for
symbols to export.

This results in linking failures in applications (such as LLVM) when building which expect these thread local variables to be exported from their shared libraries.

[1]: https://www.ibm.com/docs/en/aix/7.3?topic=formats-xcoff-object-file-format
2024-04-11 12:18:41 -04:00
Brad King
7b1b5fd287 Merge topic 'artos-lib-prefix'
e6b63b5cb2 ARTOS: Add support for finding library files named with 'lib' prefix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Bert Ezendam <bert.ezendam@alliander.com>
Merge-request: !9399
2024-04-03 09:36:20 -04:00
Brad King
2ce6dfe90e Merge topic 'vs-intel-oneapi'
3f5cd0389f IntelLLVM: Fix link flags with Visual Studio generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9398
2024-04-03 09:35:20 -04:00
Brad King
3c8d4ed51a Merge topic 'swift-linker-selection'
3fb4092826 Swift: Add CMAKE_LINKER_TYPE support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9380
2024-04-03 09:34:06 -04:00
Brad King
3f5cd0389f IntelLLVM: Fix link flags with Visual Studio generators
The link flag wrapping added by commit 5d5a712303 (IntelLLVM: Pass
linker flags to the compiler when used as linker, 2022-05-27,
v3.25.0-rc1~344^2~4) is not needed with Visual Studio generators because
MSBuild invokes the linker directly.  Furthermore, that commit omitted
wrapping of the per-config linker flags.

Revise the logic to add the link flag wrapping more precisely.

Fixes: #25533
2024-04-02 12:54:01 -04:00
Brad King
e6b63b5cb2 ARTOS: Add support for finding library files named with 'lib' prefix
Update the platform module added by commit 462fbd1eca (Add support for
ARTOS platform using GNU C with ac compiler driver, 2015-08-13,
v3.4.0-rc1~201^2) to tell `find_library` to consider library file names
starting in `lib`.

FindEXPAT needs this on ARTOS since commit 13079f382b (FindEXPAT: Fix
for debug and other modified builds, 2023-02-18, v3.27.0-rc1~463^2)
removed its explicit `libexpat` library name candidate.

Fixes: #25776
2024-04-02 12:48:24 -04:00
Evan Wilde
3fb4092826 Swift: Add CMAKE_LINKER_TYPE support
Extend commit 96a953b1ed (Add options to specify linker tool, 2023-09-27,
v3.29.0-rc1~577^2) with the `CMAKE_Swift_USING_LINKER_*` variables
needed to support `CMAKE_LINKER_TYPE` for Swift.
2024-04-02 10:42:12 -04:00
Juan Ramos
3cd64287fe Modules: Fix CMP0159 warnings in modules when tracing
Closes: #25829
2024-03-29 13:51:59 -07:00