Commit Graph

1299 Commits

Author SHA1 Message Date
William R. Dieter
6823db0c5a Enable IPO for IntelLLVM compilers on Linux and Windows
Replicate and adapt Linux IPO options for Intel for IntelLLVM compilers
on Linux and Windows.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-08-01 19:34:49 -04:00
William R. Dieter
5d5a712303 IntelLLVM: Pass linker flags to the compiler when used as linker
When linking an executable, DLL, or static library, the compiler sometimes
needs to see the linking options.  Typically `<FLAGS>` is not passed
for linking, because some of the options are only used for compilation.
Previously, `<LINK_FLAGS>` was passed after the `/link` flag because
the compiler did not understand some of the linking options.

This change wraps the initial linker options borrowed from Windows-MSVC
individually, so that they are passed directly to the linker.

This change is helpful both for interprocedural optimization, which needs
to pass `-Qipo` to the compiler at link time, and for SYCL which needs
to pass `-fsycl` and possibly other options to the compiler at link time.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-08-01 19:34:49 -04:00
William Marlow
74e3ac2b7e AIX: Export symbols from IBMClang IPA objects
When interprocedural analysis is enabled on the IBMClang family of
compilers (via the `-flto` option) then the resulting object files
contain LLVM IR rather than XCOFF objects[1].

ExportImportList needs to detect LLVM IR objects and use the
`ibm-llvm-nm` tool that ships with the compiler to create the extract
the defined symbols.

Without this change, such objects result in an error message from
`dump` and no symbols being exported from the object file.

[1]: https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.0?topic=compatibility-link-time-optimization-lto
2022-07-12 07:41:25 +01:00
Craig Scott
c86c99fb54 Merge topic 'LINK_LIBRARY-Darwin-LIBRARY-features-enhancements'
537861664a Genex LINK_LIBRARY: MacOS: enhance *_LIBRARY features
c55d42eb42 Darwin.cmake: Fix indenting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7433
2022-07-04 23:53:14 -04:00
Marc Chevrier
537861664a Genex LINK_LIBRARY: MacOS: enhance *_LIBRARY features 2022-07-03 14:43:23 +10:00
Craig Scott
c55d42eb42 Darwin.cmake: Fix indenting 2022-07-03 14:43:23 +10:00
Brad King
808cbb7162 Merge topic 'lcc-liblfortran-renamed'
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7407
2022-06-28 09:15:24 -04:00
Brad King
746bed40f2 Merge topic 'lcc-liblfortran-renamed' into release-3.24
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7407
2022-06-28 09:15:23 -04:00
Igor Molchanov
57da7a4925 LCC: link with -lgfortran instead of -llfortran since 1.26.03
Since LCC 1.26.03, compiler developers decided to rename
liblfortran to libgfortran (internal reference: mcstbug#131633),
and despite it's stated that "-llfortran will be automatically
treated as -lgfortran", it actually does not work (and there's
even no symlinks like liblfortran.* -> libgfortran.*); so we
have to explicitly choose which library we have to link in.

Fixes: #23646
2022-06-27 13:02:53 -04:00
Andrew Kaster
45ca894164 SerenityOS: Add Platform module
Add an initial Platform module for SerenityOS [1]. This module is a mix
of the platform module currently used to build the Serenity Kernel and
Userspace applications and libraries, and the platform module included
in the CMake Port [2] which still has some work to do on the system
before its other patches could be considered for upstream.

As such, the platform module is currently only useful when used with a
suitably patched GCC or LLVM cross-compiler toolchain.

[1] https://github.com/SerenityOS/serenity
[2] https://github.com/SerenityOS/serenity/tree/master/Ports/cmake/patches

Issue: #23589
2022-06-14 15:31:17 -04:00
Brad King
7d73e88d3a MSVC: Revert "Default to -ZI instead of /Zi for x86 and x64"
Revert commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86
and x64, 2022-05-24).  The `-ZI` flag is incompatible with the `-GL`
flag used for IPO, and so is not an unconditionally better default.
Revert the change pending future design of a first-class setting for
MSVC debug info format that can be automatically reconciled with IPO
settings.

That commit introduced policy CMP0138, but we already have later policy
numbers used too.  Leave placeholder text to avoid policy renumbering.

Issue: #23607, #10189
2022-06-09 12:24:33 -04:00
Glen Chung
5fcadc481e MSVC: Default to -ZI instead of /Zi for x86 and x64
Add a policy for compatibility.

For more information, see [1].

[1] https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170

Fixes: #10189
2022-05-26 09:06:01 -04:00
Brad King
faed1562fb Merge branch 'backport-3.23-clang-imsvc' into clang-imsvc 2022-05-17 11:20:15 -04:00
Brad King
23a52561c7 Clang: Use -imsvc flag without space to support Clang tools
Since commit bb61c2d024 (Clang: use -imsvc for system include dirs when
running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we use the `-imsvc`
flag followed by the include directory as a separate argument.  Some
versions of `clang-tidy` do not support the flag unless the include
directory is attached to it, so use that form instead.

A similar fix was made by commit 3a8b6653dc (MSVC: Use -external:I flag
without space to support Clang tools, 2022-01-11, v3.22.2~8^2).

Fixes: #23517
2022-05-17 11:09:15 -04:00
Brad King
79b64690d9 Merge topic 'werror-property'
76a08cd253 COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Michael Hirsch <michael@scivision.dev>
Merge-request: !7187
2022-05-10 10:30:42 -04:00
Martin Duffy
76a08cd253 COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors
Add `COMPILE_WARNING_AS_ERROR` target property and supporting
`CMAKE_COMPILE_WARNING_AS_ERROR` variable.

`COMPILE_WARNING_AS_ERROR` is initialized by
`CMAKE_COMPILE_WARNING_AS_ERROR`. It is a boolean variable. If it is
true, it expands to a different flag depending on the compiler such that
any warnings at compile will be treated as errors.

Supports compiler ids that I could find a relevant flag for.
2022-05-06 12:14:37 -04:00
Cameron Cawley
6a2b016bbd OpenWatcom: Support CMAKE_WATCOM_RUNTIME_LIBRARY with Linux and OS/2 builds 2022-05-06 10:40:59 -04:00
Cameron Cawley
33da5824ac OpenWatcom: Allow specifying the runtime library
Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the
runtime library selection.  Add policy CMP0136 to switch to
in place of the old hard-coded default flags.

Fixes: #23178
2022-05-06 10:40:58 -04:00
Brad King
bd8acc3a1b Merge topic 'clang-cl-asm-msvc-runtime'
b41fab9285 Clang: populate MSVC runtime library abstraction table

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7048
2022-04-22 09:01:35 -04:00
Saleem Abdulrasool
b41fab9285 Clang: populate MSVC runtime library abstraction table
!3211 overlooked populating the runtime library selection flags for
clang-cl in MSVC compatibility mode.  There is no flag that needs to be
passed, but the value is expected to be available by the generators.  We
simply provide the empty string to appease the generators without
emitting any additional flags.

Fixes: #23048
2022-04-17 21:13:44 -07:00
Robert Maynard
42f7e39789 Find: Support per call disabling of CMAKE_INSTALL_PREFIX
Fixes #23359
2022-04-15 09:33:55 -04:00
Chris Wright
87142bbd5f ADSP: Add dedicated platform module 2022-04-04 17:05:09 +01:00
Marc Chevrier
d658332782 Genex-LINK_GROUP: Add support feature RESCAN on BSD systems 2022-03-22 11:36:10 +01:00
Brad King
7e642a6fa0 Merge topic 'ghs_predefined_targets'
399e73b89a GHS: release note
829e946c69 GHS: Update tests for updated binary layout
93c1acd8ff GHS: List predefined targets before user targets in GUI
bdb213819c GHS: Do not include WindowsPaths
b3e9c72901 GHS: use INSTALL target
a645287784 GHS: update build command
724b5491ef GHS: Rearrange project files in binary directory
edff0f6a1d GHS: Use Custom Target for ALL_BUILD
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7079
2022-03-21 14:36:42 -04:00
Fred Baksik
bdb213819c GHS: Do not include WindowsPaths
This causes issues where CMAKE_SYSTEM_PREFIX_PATH contains incorrect
paths. GHS is a cross-compiler toolchain and doesn't use anything in
these locations.

Also WindowsPaths are always wrong on Linux hosts.
2022-03-17 19:11:46 -04:00
Marc Chevrier
dabe56de58 genex-LINK_LIBRARY: Add feature WHOLE_ARCHIVE 2022-03-17 23:07:59 +01:00
Brad King
49642079e5 Merge topic 'LINK_LIBRARY-libraries'
9fb1dff070 LINK_LIBRARY: Add features for library support on Apple
93a153bc7f Genx-LINK_LIBRARY: simplify framework features definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7029
2022-03-07 10:04:13 -05:00
Marc Chevrier
9fb1dff070 LINK_LIBRARY: Add features for library support on Apple 2022-03-05 13:57:45 +01:00
Marc Chevrier
b0fada9964 Genex-LINK_GROUP: Add feature RESCAN
Feature RESCAN can be used to manage circular references between
static libraries.
2022-03-05 12:40:26 +01:00
Marc Chevrier
93a153bc7f Genx-LINK_LIBRARY: simplify framework features definitions 2022-03-04 16:51:53 +01:00
Brad King
3de53510ac Merge topic 'ghs_fix_rtos_dir'
005c7dc9e7 GHS: Store full path of Integrity OS directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7017
2022-02-24 13:01:40 -05:00
Fred Baksik
005c7dc9e7 GHS: Store full path of Integrity OS directory
Fixes build project error because the OS directory was a relative
path from the binary directory.

Fixes issue during project regeneration where the `-os_dir` project option
was missing because GHS_OS_DIR was not properly stored in the cache
file.

This error was introduced by commit aa59eaac4f (GHS: Allow setting GHS
variables from toolchain file, 2021-11-15, v3.23.0-rc1~337^2).
2022-02-23 11:33:35 -05:00
Marc Chevrier
397ee55cd6 genex-LINK_LIBRARY: rename configuration variables
To be more consistent between genex and variables as well as
the forecomming LINK_GROUP genex, rename variable *_LINK_USING_<FEATURE>*
in *_LINK_LIBRARY_USING_<FEATURE>*
2022-02-16 18:34:28 +01:00
Marc Chevrier
a2cfa2da4f GenEx/LINK_LIBRARY: Add features for framework support on Apple 2022-02-15 10:53:33 +01:00
Brad King
5593a5d978 Merge topic 'clang-cross-compile-windows-pdb'
641cb1093b Windows/Clang: Support PDB when cross-compiling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6959
2022-02-10 09:09:10 -05:00
Brad King
5b480172c3 Merge topic 'clang-cross-compile-windows-pdb' into release-3.23
641cb1093b Windows/Clang: Support PDB when cross-compiling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !6959
2022-02-10 09:09:09 -05:00
Brad King
1e947fcb83 Merge branch 'backport-IntelLLVM-depfile-flags' into IntelLLVM-depfile-flags 2022-02-09 10:08:52 -05:00
William R. Dieter
a8b6bf9a38 IntelLLVM: Add dependencies on system header files on Windows
In commit a90d2a9eed (IntelLLVM: Add support for Intel LLVM-based
compilers, 2020-11-02, v3.20.0-rc1~89^2~20) the IntelLLVM depfile
generation flags were taken from `Platform/Windows-Intel-C`.  Those
flags were added by commit a624a3e1b3 (Ninja: Use deps=gcc for Intel
Compiler on Windows, 2019-01-30, v3.14.0-rc1~30^2), which forgot to
account for commit 6d74e7870b (Ninja: Add dependencies on
system-provided header files, 2016-03-15, v3.6.0-rc1~265^2).

The `-QMD` option generates Makefile dependencies.  The `-QMMD` option
generates Makefile dependencies, but excludes system header files.
Part of the BuildDepends test includes a header, cmake_pch.hxx, that
includes a second header, zot_pch.hxx.  The test builds a pch file for
cmake_pch.hxx, touches zot_pch.hxx, then verifes that cmake_pch.hxx.pch
is regenerated based on the dependencies.

The cmake_pch.hxx contains `#pragma system_header` before it includes
zot_pch.hxx.  `#pragma system_header` indicates that the portion of the
file following the pragma is to be treated as a system header.

When `-QMMD` is used to generate dependencies, the `#include` of
zot_pch.hxx is ignored because it `-QMMD` says to ignore system headers.

Using `-QMD` instead uses all headers when generating dependencies
and causes this test to pass.  The Clang configuration in
Platform/Windows-Clang.cmake also uses the `-MD` option for generating
pre-compiled headers, instead of `-MMD`.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-02-09 10:07:51 -05:00
Brad King
94f1bbdd54 Intel: Add dependencies on system header files on Windows
In commit a624a3e1b3 (Ninja: Use deps=gcc for Intel Compiler on Windows,
2019-01-30, v3.14.0-rc1~30^2) we forgot to account for commit 6d74e7870b
(Ninja: Add dependencies on system-provided header files, 2016-03-15,
v3.6.0-rc1~265^2).
2022-02-09 10:07:51 -05:00
Deniz Bahadir
641cb1093b Windows/Clang: Support PDB when cross-compiling 2022-02-09 00:38:09 +01:00
Brad King
07e2eb50f0 IBMClang: Do not use -fvisibility on AIX
Use of `-fvisibility=hidden` fails:

  unsupported option '-fvisibility=hidden' for target 'powerpc-ibm-aix7.2.0.0'

Apply the change from commit 4feba34d02 (GNU: Do not use -fvisibility on
AIX or HP-UX, 2016-09-03, v3.7.0-rc1~173^2~2) to IBMClang also.

Issue: #23157
2022-01-28 15:43:21 -05:00
Aaron Liu
6da99e671c IBMClang: Add support for IBM Open XL C/C++
Fixes: #22929
2022-01-27 09:38:01 -05:00
William R. Dieter
79921fb00c IntelLLVM: Set linker to compiler driver for Windows
For IntelLLVM, linking with the compiler driver is preferred over using
the linker directly.  This is especially true when doing offload to a
target accelerator, which can produce object files that the regular
linker will not handle properly.

Windows-IntelLLVM relies on Windows-MSVC.cmake for many definitions.
This commit does not change that, but does override the MSVC defaults
for linking executables, shared libraries, and static libraries so that
CMake will use the compiler driver instead of the linker.

Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2022-01-14 08:57:03 -05:00
Brad King
7b1099a52f Merge topic 'cmcldeps-cross'
d49e168e1b Ninja: Do not use cmcldeps for RC on non-Windows hosts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Dmitry Mikushin <dmitry@kernelgen.org>
Merge-request: !6843
2022-01-07 09:43:39 -05:00
Martin Storsjö
d49e168e1b Ninja: Do not use cmcldeps for RC on non-Windows hosts
The `cmcldeps` executable is only built on Windows.  If running MSVC on
a different OS (with various compatibility wrapping), don't try to use
`cmcldeps`, as the executable doesn't exist.

Fixes: #21760
2022-01-06 15:42:45 -05:00
moyo1997
26f52508f2 MSVC: update arm64ec default flags and lib
Update the support added by commit 4ea3a88625 (MSVC: Add support for
targeting ARM64EC, 2020-12-30, v3.20.0-rc1~121^2).

Add `softintrin.lib` to `CMAKE_C_STANDARD_LIBRARIES_INIT`.

Remove `/D_ARM64EC_WORKAROUND` from the flags as it was only ever needed
in preview versions of VS.

Issue: #21724
2022-01-06 15:31:32 -05:00
Brad King
7f6cce63fc Merge topic 'android-system-stl'
38b00f8801 Android: Fix linking android_support for pre-21 system STL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6799
2021-12-14 09:40:17 -05:00
Ryan Prichard
38b00f8801 Android: Fix linking android_support for pre-21 system STL
This typo was introduced in commit 4dca078829 (Android: Link c++abi and
android_support when necessary, 2020-10-29, v3.20.0-rc1~541^2).

Fixes: #23004
2021-12-13 10:43:14 -05:00
Brad King
3519c19091 Merge topic 'ghs_initial_setup'
aa59eaac4f GHS: Allow setting GHS variables from toolchain file
ab6f0b51b1 GHS: Add note about -T and path style
a55b5c4e18 GHS: Update BSP selection logic
0427f22539 GHS: Update RTOS selection logic
e006b87cc6 GHS: GHSMULTI - Update documentation to match implementation
83eb5695e9 GHS: Update toolset selection logic
8114ddcad1 GHS: Continue splitting variables used by generator
831607889f GHS: Update selection of primaryTarget in MULTI project file
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6715
2021-11-19 09:05:35 -05:00
Fred Baksik
aa59eaac4f GHS: Allow setting GHS variables from toolchain file
* Update generator to use the current variable definition,
  not the CACHE definition.
* Avoid overwriting toolchain variables and avoid developer warnings
  when setting up the GHS variables.
  -- A cache entry is only required when:
     a) The toolchain uses set( CACHE ) to set the variable
     b) A -D or preset value was used to set the variable

     The cache entry is required so that the TYPE gets set properly.

  -- Avoid the Policy CMP0126 warnings:
     setting cache variable when normal variable exists
* Move GHS_PRIMARY_TARGET back into area so non-GHS generator
  toolchain file can trigger the OS search.
2021-11-15 13:15:12 -05:00