Commit Graph

970 Commits

Author SHA1 Message Date
Robert Maynard
aa8facefe8 CUDA: Visual Studio propagate objects to device linking
When given objects via `target_link_libraries(consumer PRIVATE producer)` the VisualStudio solution adds the objects
under as `<Object>` entries in the solution.

This works for host side linking but isn't handled by
the cuda msbuild extensions. So to work around this we
manually add the objects as additional link items.
2023-09-22 11:54:12 -04:00
Brad King
5b590882fa Merge topic 'cxxmodules-non-compiled-source'
24a9b00f83 Merge branch 'cxxmodules-non-compiled-source-release' into cxxmodules-non-compiled-source
458e3974a8 cxxmodules: detect and message about non-compiled sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8773
2023-09-14 13:01:21 -04:00
Ben Boeckel
24a9b00f83 Merge branch 'cxxmodules-non-compiled-source-release' into cxxmodules-non-compiled-source
* cxxmodules-non-compiled-source-release:
  cxxmodules: detect and message about non-compiled sources
2023-09-12 14:47:20 -04:00
Ben Boeckel
458e3974a8 cxxmodules: detect and message about non-compiled sources
Previously an internal error was raised which ended up causing an
internal exception to be thrown. This is a typo situation that should
fall into an explicit error.

Fixes: #25207
2023-09-12 14:46:36 -04:00
Brad King
93d813d87c Merge topic 'vs-cuda-object-libs'
6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8794
2023-09-12 09:06:15 -04:00
Robert Maynard
6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries
Without `CudaLink` fields, MSBuild tries to perform a device link step
for object libraries with CUDA_SEPARABLE_COMPILATION on them even when
not needed.  This commonly was encountered when generating PTX or
OPTIX-IR output.
2023-09-11 16:49:35 -04:00
Brad King
863891adb2 Merge topic 'modules-better-messages'
571b5e1f2c cxxmodules: improve error messages for C++ module setup
8b4d32c18b cmStandardLevelResolver: add query for the effective standard level
17ddc4ac76 cmStandardLevelResolver: compare with static string literals
6f1dae2b01 cmStandardLevelResolver: use `cmStrCat` where possible
0d45d40e13 cmStandardLevelResolver: use character literals where possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8755
2023-08-25 11:27:27 -04:00
Ben Boeckel
571b5e1f2c cxxmodules: improve error messages for C++ module setup
Make it clear that:

- the quoted string is a target name; and
- C++ sources that export modules is the important detail.
2023-08-23 16:47:29 -04:00
Ben Boeckel
159585967a cmGeneratorTarget: classify BMI-only C++ module sources 2023-08-17 14:42:53 -04:00
Ben Boeckel
36bd3d82f8 cmSystemTools: move ComputeCertificateThumbprint to the only consumer
There's no need to have this API on `cmSystemTools` with only a single
consumer.
2023-08-08 14:25:01 -04:00
Ben Boeckel
ec5f1c489a cmCryptoHash: prefer to cmSystemTools::ComputeStringMD5
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.
2023-08-08 13:22:13 -04:00
Brad King
1972a7b6e3 Merge branch 'backport-revert-vs-show-cmake-files' 2023-08-02 12:11:11 -04:00
Brad King
0d1529000d VS: Revert "Add CMake input files to ZERO_CHECK"
Since commit df58dbb0e9 (VS: Add CMake input files to ZERO_CHECK,
2023-03-19, v3.27.0-rc1~157^2), projects that specify the same file both
as input to `configure_file` and as the `MAIN_DEPENDENCY` of a custom
command fail to configure.  Revert the change pending further
investigation.  Add a test case demonstrating the problem.

Issue: #24557
Fixes: #25149
2023-08-02 11:53:48 -04:00
Ben Boeckel
e166bbef7b cmComputeLinkInformation: prepare Item consumers for OBJECT libraries
After b665966933 (cmComputeLinkInformation: track `OBJECT` library
dependencies, 2023-07-22), introduced in !8645 as a fix for #25112,
`OBJECT` libraries were tracked in a separate member to reduce the risk
of further regressions. This commit prepares consumers to handle
`OBJECT` libraries once they start appearing as link items.
2023-08-01 10:06:02 -04:00
Brad King
d8b6a750a0 Merge topic 'windows-tidy-cmstrcat'
d58253d155 clang-tidy: fix `performance-faster-string-find` lints
a19ec77200 clang-tidy: fix `readability-static-accessed-through-instance` lints
3d03629f20 cmWIXRichTextFormatWriter: remove identity cast
1df29567ac clang-tidy: fix `modernize-use-equals-default` lints
32fe862b8c clang-tidy: fix `readability-container-size-empty` lints
7eaab9a957 clang-tidy: fix `modernize-raw-string-literal` lints
ffa49c23aa clang-tidy: fix `readability-else-after-return` lints
4489e9a85c clang-tidy: fix `modernize-use-auto` lints
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8668
2023-08-01 09:31:45 -04:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Ben Boeckel
d4144b9c0a strings: use emplace_back with cmStrCat arguments 2023-07-27 20:15:51 -04:00
Ben Boeckel
809248a0c9 strings: use character literals where possible 2023-07-27 20:00:59 -04:00
Ben Boeckel
7137b17835 cmStrCat: use in Windows-specific sources 2023-07-27 20:00:59 -04:00
Ben Boeckel
2409f62d18 strings: simplify streaming sequences 2023-07-27 19:10:39 -04:00
Ben Boeckel
a5ba00bdf8 strings: combine string literals where possible 2023-07-27 19:10:39 -04:00
Ben Boeckel
3f1378fbca strings: compare to static string_view instances in Windows-only code 2023-07-27 19:10:39 -04:00
Brad King
4938a0cbdd Merge topic 'vs-cxxmodules-same-src-name'
b9c99830c5 VS: Fix C++ modules in source files with the same name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8596
2023-06-30 09:28:20 -04:00
Brad King
b9c99830c5 VS: Fix C++ modules in source files with the same name
When multiple source files in a single target have the same name, we
already set `ObjectFileName` explicitly to avoid a `.obj` collision. For
C++ module sources, set `Module{Output,Dependencies}File` to avoid
`.ifc` and `.module.json` collisions.

Fixes: #25038
2023-06-28 06:43:10 -04:00
Brad King
93c379430d Merge topic 'vs-cxxmodules-public-bmis'
d90a61d671 VS: Make C++ module BMIs public by default for shared libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8549
2023-06-23 10:48:15 -04:00
Andreas Weis
d90a61d671 VS: Make C++ module BMIs public by default for shared libraries
Enable the `AllProjectBMIsArePublic` option for shared libraries in the
VS project files when building with C++20 modules support.
2023-06-22 14:22:56 -04:00
Brad King
f444f172c3 cmVisualStudio10TargetGenerator: Remove unused VS-10-only code
Remove code that is not used since commit 8d6f015d59 (Drop Visual Studio
10 2010 generator, 2022-09-26, v3.25.0-rc1~78^2).
2023-06-13 13:47:28 -04:00
Ben Boeckel
6ff5cdc533 cxxmodules: remove support for CXX_MODULE_HEADER_UNITS filesets
There's no backing implementation for header units anyways, so just
remove it for now.
2023-05-31 10:57:11 -04:00
Brad King
406a103318 VS: Add support for C++ module internal partitions in VS 17.6 and newer
VS 17.6 now implements `ScanSourceforModuleDependencies` using the same
`cl /scanDependencies` scanner that our Ninja generator uses.  It can
distinguish module internal partitions from module interface units based
on their content.  Switch from `CompileAsCppModule` to `CompileAsCpp`
for `CXX_MODULES` sources so that MSBuild can scan and classify them.
2023-05-17 11:59:24 -04:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Alexander Neundorf
df58dbb0e9 VS: Add CMake input files to ZERO_CHECK
Add all cmake input files to the `ZERO_CHECK` project.  Place files
under `CMAKE_SOURCE_DIR` in a folder structure matching the directory
structure.  This way they are easier to find, and Visual Studio does not
close them when reloading the project.

Fixes: #24557
2023-04-25 17:35:39 -04:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Brad King
db4f4ad24e Merge topic 'support_cubin_fatbin_optix_cuda_output'
2def6a874b CUDA: Add support for CUBIN, FATBIN, and OPTIXIR compilation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8259
2023-03-14 09:35:00 -04:00
Robert Maynard
2def6a874b CUDA: Add support for CUBIN, FATBIN, and OPTIXIR compilation 2023-03-13 09:54:00 -04:00
Brad King
d6353e74b4 VS: Add policy to build custom commands concurrently
In commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19, v3.26.0-rc1~56^2) we added `BuildInParallel` to
custom commands in `.vcxproj` files, but that had to be reverted by
commit abb1c12162 (VS: Revert "Build custom commands concurrently when
possible", 2023-03-07, v3.26.0-rc6~3^2) because some projects may have
custom commands that accidentally rely on serial execution in MSBuild.

Add a policy to use `BuildInParallel` for custom commands in projects
that have been updated to set the policy to `NEW`.

Fixes: #18405
2023-03-12 07:51:58 -04:00
Brad King
12234b2851 Merge topic 'vs-props-order'
d3c4c6d630 VS: Import default C++ props file before toolset-specific props file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8294
2023-03-08 09:00:29 -05:00
Brad King
e939b82d2e Merge topic 'revert-vs-BuildInParallel'
abb1c12162 VS: Revert "Build custom commands concurrently when possible"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8297
2023-03-08 08:56:29 -05:00
Matthew Voss
d3c4c6d630 VS: Import default C++ props file before toolset-specific props file
This avoids overwriting toolset-specific settings like `VCRedistDir`
with default settings.

Fixes: #22420
2023-03-07 14:41:32 -05:00
Brad King
abb1c12162 VS: Revert "Build custom commands concurrently when possible"
Since commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19, v3.26.0-rc1~56^2) we add `BuildInParallel` to
custom commands in `.vcxproj` files.  However, this can break existing
projects that implicitly rely on serial execution of custom commands.
For example, custom commands in our FindCUDA module run MSVC (via nvcc)
with a common `vc*.pdb` file, and therefore cannot run in parallel.

Revert use of `BuildInParallel` while leaving most of the infrastructure
for it in place.  It can be restored later with an option or policy.

Fixes: #24576
Issue: #18405
2023-03-07 14:19:49 -05:00
Olivier PENA
0dff040f10 VS : Support WIN32_EXECUTABLE on SDK style projects 2023-02-28 09:25:09 +01:00
Sergey Markelov
74e0b5d9f5 VS: Fix wrong appxManifest if OUTPUT_NAME != target name
Fixes #24416
2023-02-15 20:35:50 -07:00
Brad King
24bcad5bac VS: Honor compile options for ASM_NASM
The Ninja and Makefile generators honor `target_compile_options` and
friends for ASM_NASM `.asm` sources.  Teach the VS generator to
honor them too for consistency.

Issue: #24289
2023-01-26 13:51:49 -05:00
Brad King
b44714a642 VS: Honor compile options for ASM_MARMASM
The Ninja and Makefile generators honor `target_compile_options` and
friends for ASM_MARMMASM `.asm` sources.  Teach the VS generator to
honor them too for consistency.

Issue: #24289
2023-01-26 12:56:25 -05:00
Brad King
8024c41685 VS: Do not concurrently build custom commands with generated MAIN_DEPENDENCY
Since commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19) several tests have failed intermittently with the
VS generator.  It seems that if the `BuildInParallel` setting is
attached to a generated input:

    <CustomBuild Include="generated_input.txt">
      <BuildInParallel Condition="...">true</BuildInParallel>
      <Command Condition="...">copy geneated_input.txt output.txt</Command>
      ...
    </CustomBuild>

then MSBuild does not wait for the input to be generated before running
the command.

This occurs when using `add_custom_command`'s `MAIN_DEPENDENCY`, so
avoid using `BuildInParallel` in that case.

Issue: #18405
2023-01-25 10:59:44 -05:00
Ivan Zinkevich
33c15ae2b9 VS: Build custom commands concurrently when possible
Enable the `BuildInParallel` setting in VS project files when supported.

Fixes: #18405
2023-01-23 10:38:07 -05:00
Vitaly Stakhovsky
b3edfcf46e cmValue: Use operator* explicitly to convert to std::string; avoid extra call 2023-01-15 23:39:02 -05:00
Brad King
81f670fa83 VS: Honor compile options for MASM
The Ninja and Makefile generators honor `target_compile_options`
and friends for MASM `.asm` sources.  Teach the VS generator to
honor them too for consistency.

Fixes: #24289
2023-01-12 14:35:38 -05:00
Brad King
f62a0f53bf Merge branch 'backport-masm-debug-format' into masm-debug-format 2022-12-15 11:55:09 -05:00
Brad King
a9bd1e34ef VS: Do not enable ASM_MASM debug information unless requested
MSBuild enables debug information with MASM by default, but for us
that is not consistent with behavior on other generators.
2022-12-15 11:53:40 -05:00
Quentin Berthet
c445dd2797 VS: Add Xaml and Resx files to .Net SDK style projects
Improve parity with classic MSBuild projects.

Fixes: #23415
2022-12-06 15:42:23 +01:00