Commit Graph

652 Commits

Author SHA1 Message Date
Brad King
48ed3bae58 Merge topic 'pch-instantiate-templates'
8c8f03422e PCH: Template instantiation support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Cristian Adam <cristian.adam@gmail.com>
Tested-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5168
2020-09-10 16:32:39 -04:00
Brad King
6d77487eb7 Merge topic 'ios-pch-x-lang-header'
8d61294c3e PCH: Mark CMake PCH source files as -x <lang>-header

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5188
2020-09-09 11:23:34 -04:00
Cristian Adam
8d61294c3e PCH: Mark CMake PCH source files as -x <lang>-header
Fixes: #21163
2020-09-04 19:23:17 +02:00
Tobias Hieta
8c8f03422e PCH: Template instantiation support
Adds PCH_INSTANTIATE_TEMPLATES target property for enabling template
instantiation in precompiled headers.
Enabled by default. Currently only supported for Clang 11 and newer.

Implements #21133.
2020-09-02 08:30:55 +02:00
Hugues Kamba
fa7ba5fbf5 ARMClang: Pass defines to assembler
This is useful when the assembly file(s) is passed to
the pre-processor.
2020-09-01 18:03:49 +01:00
Brad King
f10682b796 Merge topic 'ispc_lang_support'
5ece12b7e4 gitlab-ci: add ISPC to the Fedora CI image
8976817d6d ISPC: Update help documentation to include ISPC
2368f46ba4 ISPC: Support building with the MSVC toolchain
e783bf8aa6 ISPC: Support ISPC header generation byproducts and parallel builds
34cc6acc81 Add ISPC compiler support to CMake
419d70d490 Refactor some swift only logic to be re-used by other languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5065
2020-09-01 09:15:39 -04:00
Robert Maynard
34cc6acc81 Add ISPC compiler support to CMake 2020-08-28 11:21:31 -04:00
Brad King
57c1be6e15 Merge topic 'cuda-std-for-msvc' into release-3.18
bed315a0da CUDA: Support setting CUDA14/17 when using MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5160
2020-08-26 10:25:44 -04:00
Brad King
bf0262f41e Merge topic 'cuda-std-for-msvc'
bed315a0da CUDA: Support setting CUDA14/17 when using MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5160
2020-08-26 10:25:44 -04:00
Brad King
4294526504 Merge topic 'msvc_static_assert'
95bc11dbb4 MSVC: Record support for c_static_assert

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5148
2020-08-25 10:26:54 -04:00
Robert Maynard
bed315a0da CUDA: Support setting CUDA14/17 when using MSVC
Fixes #20953
2020-08-24 09:53:38 -04:00
Raul Tambre
95bc11dbb4 MSVC: Record support for c_static_assert
Supported since MSVC 19.28.29115 (VS 16.8.0 Preview 1.0).
2020-08-20 09:45:47 -04:00
Brad King
b3196fe864 Merge topic 'msvc_c11'
f7347f28c7 MSVC: Record support for C11 and c_restrict

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5115
2020-08-12 11:14:52 -04:00
Raul Tambre
f7347f28c7 MSVC: Record support for C11 and c_restrict
MSVC >=19.27 supports a C11 switch.
The `c_restrict` feature has also been implemented.

Fixes: #21069
2020-08-11 09:08:21 -04:00
Brad King
3d27b17347 Merge topic 'clang-msvc-cxx-std'
21e497fe63 Clang: Fix fallback compile features when simulating old MSVC versions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !5082
2020-07-30 08:39:58 -04:00
Brad King
21e497fe63 Clang: Fix fallback compile features when simulating old MSVC versions
Refactoring in commit 25439c7d62 (Clang: Refactor CXX standard flags
into __compiler_clang_cxx_standards(), 2020-03-16, v3.18.0-rc1~362^2~4)
accidentally broke the `cxx_std_*` fallback feature names.

Issue: #21033
2020-07-29 13:02:21 -04:00
Brad King
64e5c239d3 Merge topic 'pgi-no-A'
52eee19389 PGI: Remove -A from the C++ flags we use when CXX_EXTENSIONS is OFF

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Chuck Atkins <chuck.atkins@kitware.com>
Merge-request: !5025
2020-07-23 08:29:02 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Tin Huynh
52eee19389 PGI: Remove -A from the C++ flags we use when CXX_EXTENSIONS is OFF
Since commit 9b97cb5562 (PGI: Add language standards for PGI,
2017-05-01, v3.9.0-rc1~174^2), we have passed the `-A` flag to
the PGI C++ compiler when specifying a C++ standard flag with
compiler extensions turned off.  The flag is not meant for that.
The PGI C++ standard flags do not turn extensions on by default
and have a separate `--gnu_extensions` flag for that which we
already use when CXX_EXTENSIONS is ON.  Simply drop the `-A` flag.

Fixes: #20997
2020-07-22 07:26:01 -04:00
Josef Angstenberger
98fea8205e Compiler/TI: Avoid response file usage for linker
The object and library files have to be listed after the `--run-linker`
flag.

But after this flag the `--cmd_file` flag for response files cannot be
used any more.

Putting the whole command line into a response file would work, but
this is not supported by CMake (yet).
2020-07-14 02:41:51 +02:00
Josef Angstenberger
5dec322f33 Compiler/TI: Add compiler flags to linker
By adding the compiler flags via `<FLAGS>` to the linker call,
the linker can decide which default library to use.

CMake replaces `<FLAGS>` by the content of `CMAKE_<LANG>_FLAGS`.
So any relevant flag needs to be defined in this variable, preferably
in a toolchain file.

The compiler flags have to be specified before the `--run_linker`
flag and the linker flags afterwards.

Replaces Merge-request !4890
2020-07-14 02:41:50 +02:00
Josef Angstenberger
763b44e519 Compiler/TI: Avoid usage of ranlib
If a ranlib executable has been found it is used for finishing
an archive.

In case of the TI compiler the archive file gets corrupted.

Fixes: #14876
2020-07-14 02:23:58 +02:00
Josef Angstenberger
ef528f10bf Compiler/TI: Sync ASM settings to C/CXX
For assembler the same compiler executable is used as for C/CXX.

So the setting shall be kept in sync.
2020-07-14 02:23:57 +02:00
Josef Angstenberger
a548a52230 Compiler/TI: Refactor C/CXX to use a common file 2020-07-14 02:23:57 +02:00
Brad King
df8ba4f10d Merge topic 'intel-c++20' into release-3.18
99c8dbf497 Intel: Add flags for C++20

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4946
2020-06-29 08:16:16 -04:00
Brad King
85b151ff5b Merge branch 'backport-intel-c++20' into intel-c++20 2020-06-26 08:24:46 -04:00
Brad King
99c8dbf497 Intel: Add flags for C++20
Patch-by: Matheus Izvekov
Fixes: #20880
2020-06-26 08:21:21 -04:00
Brad King
cadc658e9d Merge topic 'armclang-typo'
2ff68c00e0 ARMClang: Fix typo in -Xlinker flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4916
2020-06-18 09:37:47 -04:00
Osama Moharam
2ff68c00e0 ARMClang: Fix typo in -Xlinker flag
Fix a typo from commit ef816610be (ARMClang: allow fallback to -march
and correct setting of --cpu flags, 2020-06-03, v3.18.0-rc1~18^2).
2020-06-18 07:43:22 -04:00
Brad King
8e61ebb75e Merge topic 'clang_cxx20'
b365385d66 Clang: Record Clang 6.0+ as fully supporting C++17
5d26efe38f Clang: Add final C++20 flag for Clang 11.0+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4887
2020-06-15 09:01:44 -04:00
Raul Tambre
b365385d66 Clang: Record Clang 6.0+ as fully supporting C++17 2020-06-13 11:29:55 +03:00
Raul Tambre
5d26efe38f Clang: Add final C++20 flag for Clang 11.0+
-std=c++20 superseded -std=c++2a in upstream Clang commit
24ad121582454e625bdad125c90d9ac0dae948c8.
2020-06-13 11:29:51 +03:00
Brad King
7925279c20 Merge topic 'add_explicit_lang_flag_to_compile_object_rule'
74b1c9fc8e Explicitly specify language flag when source LANGUAGE property is set
457170a476 CXX: Compile when possible with explicit `Cxx` language flag set
644d3b86eb C: Compile when possible with explicit `C` language flag set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4780
2020-06-11 07:47:30 -04:00
Robert Maynard
95700be52d CUDA: Teach CMake that NVCC 11 supports cuda_std_17 2020-06-10 13:27:51 -04:00
Robert Maynard
457170a476 CXX: Compile when possible with explicit Cxx language flag set
Issue: #14516, #20716
2020-06-09 16:20:53 -04:00
Robert Maynard
644d3b86eb C: Compile when possible with explicit C language flag set
Issue: #14516, #20716
2020-06-09 16:20:53 -04:00
Raul Tambre
0f88b7a592 CUDA: Fix Clang depfile flags when simulating MSVC
__compiler_clang() doesn't call __compiler_gnu() if we're emulating MSVC. Thus
CMAKE_DEPFILE_FLAGS_CUDA remains unset and compiling doesn't work, due to NVCC
dependency injection workaround in CMakeCUDAInformation.cmake, which triggers
for Ninja if they're not set.
Always set the depfile flags to fix this. Most other compiler modules seem to
do the same.
2020-06-08 07:54:51 -04:00
Osama Moharam
ef816610be ARMClang: allow fallback to -march and correct setting of --cpu flags
allows cmake to fall back to CMAKE_SYSTEM_ARCH in case CMAKE_SYSTEM_PROCESSOR is not in armclang -mcpu=list
additionally checks if CMAKE_SYSTEM_PROCESSOR belongs to armlink --cpu=list

Fixes: #19962
2020-06-03 16:58:31 +02:00
Brad King
007109b20f Merge topic 'armclang-armlink'
73fb6ac82b ARMClang: Add support for armlink

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4811
2020-06-03 06:10:14 -04:00
Osama Moharam
73fb6ac82b ARMClang: Add support for armlink
sets CMAKE_LIBRARY_PATH_FLAG to '--userlibpath=' when using armlink.

Fixes: #20761
2020-06-02 11:32:32 -04:00
Brad King
e76c11aa7c Merge branch 'backport-3.17-pch-no-Fortran' into pch-no-Fortran 2020-06-02 08:24:11 -04:00
Brad King
10c88c4337 PCH: Do not enable GNU or Intel PCH settings for Fortran
The PCH settings are shared by C and CXX languages but do not make sense
for Fortran.  In particular, `CMAKE_PCH_EXTENSION` should not be set
because it can overwrite the value set for C/C++ languages, which may
have a different compiler vendor than the Fortran compiler.

Fixes: #20752
2020-06-02 08:23:40 -04:00
Kyle Edwards
97fa63c09b ASM: Fix preprocessor definition flags for GNU 'as' tool
Fixes: #20780
2020-06-01 14:43:37 -04:00
Brad King
eb705b9531 Update links to gitlab.kitware.com repos to add -/
GitLab now uses a `/-/` component between the `group/project` part of
the URL and the `{issues,merge_requests,tree}` part so that it can
support `group/subgroup/project` with arbitrary depth.
2020-05-26 11:38:01 -04:00
Brad King
62816ff88c Merge topic 'fortran-preprocess-property'
3888de23da Ninja: Skip Fortran preprocessing if Fortran_PREPROCESS is OFF
66c4e87282 Ninja: Add helper functions to generate Fortran build
5cca1ec893 Ninja: Add helper functions to generate Fortran preprocess rule
b0a6161190 Fortran: Add Fortran_PREPROCESS property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4659
2020-05-22 10:35:10 -04:00
Brad King
d8eee80e30 Merge branch 'backport-cuda-default-runtime' into cuda-default-runtime 2020-05-22 06:50:19 -04:00
Peter Hill
b0a6161190 Fortran: Add Fortran_PREPROCESS property
Issue: #18870
2020-05-21 11:44:14 -04:00
Robert Maynard
e55b21e24e CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchain
Since commit 0d0145138f (CUDA: Add abstraction for cuda runtime
selection, 2019-11-29, v3.17.0-rc1~83^2) we add CUDA runtime library
selection flags by default.

To maintain backwards compatibility the default CUDA runtime
library needs to be computed based on what libraries are found
on the initial compiler invocation. For example a toolchain
could establish initial flags that have all CUDA compilations
using the runtime version, and if we don't detect this we will
try to link to both the static and shared runtime.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #20708
2020-05-21 11:15:03 -04:00
Raul Tambre
5df21adf46 CUDA: Add support for Clang compiler
When crosscompiling we pass the sysroot.

We need to try various architecture flags. Clang doesn't automatically
select one that works.  First try the ones that are more likely to work
for modern installations:

* <=sm_50 is deprecated since CUDA 10.2, try sm_52 first for
          future compatibility.
* <=sm_20 is removed since CUDA 9.0, try sm_30.

Otherwise fallback to Clang's current default. Currently that's `sm_20`,
the lowest it supports.

Separable compilation isn't supported yet.

Fixes: #16586
2020-05-15 17:46:51 +03:00
Jiri Malak
d3640dbdd5 OpenWatcom: Organize and update C/C++ toolchain command lines 2020-04-28 09:36:05 -04:00