mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
SYCL: Initial language implementation
Add experimental support for SYCL under an experimental gate. The IntelLLVM and Adaptivecpp compilers are recognized, as well as upstream Clang with libsycl support. Fixes: #27219, #27905
This commit is contained in:
394 files changed
+6870
-349
No files matched your search
@@ -13,10 +13,10 @@ Add expected compiler features to a target.
|
||||
|
||||
Specifies compiler features required when compiling a given target. If the
|
||||
feature is not listed in the :variable:`CMAKE_C_COMPILE_FEATURES`,
|
||||
:variable:`CMAKE_CUDA_COMPILE_FEATURES`, or :variable:`CMAKE_CXX_COMPILE_FEATURES`
|
||||
variables, then an error will be reported by CMake. If the use of the feature requires
|
||||
an additional compiler flag, such as ``-std=gnu++11``, the flag will be added
|
||||
automatically.
|
||||
:variable:`CMAKE_CUDA_COMPILE_FEATURES`, :variable:`CMAKE_CXX_COMPILE_FEATURES`,
|
||||
or :variable:`CMAKE_SYCL_COMPILE_FEATURES` variables, then an error will be
|
||||
reported by CMake. If the use of the feature requires an additional compiler
|
||||
flag, such as ``-std=gnu++11``, the flag will be added automatically.
|
||||
|
||||
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
|
||||
specify the scope of the features. ``PRIVATE`` and ``PUBLIC`` items will
|
||||
|
||||
@@ -102,6 +102,20 @@ or ``PRIVATE`` and accepts the following arguments:
|
||||
types, the type does not need to be specified and the ``TYPE <type>``
|
||||
arguments can be omitted. For all other file set names, ``TYPE`` is required.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
``SYCL`` may be specified as an alias for ``SOURCES``. It initializes the
|
||||
file set's :prop_fs:`LANGUAGE` property to ``SYCL``.
|
||||
|
||||
``SYCL_HEADERS`` may be specified as an alias for ``HEADERS``. It also
|
||||
initializes :prop_fs:`LANGUAGE` to ``SYCL``. A target with such a file set
|
||||
in its own build specification, or reachable through linked interface
|
||||
properties, compiles all of its C++ sources as SYCL.
|
||||
|
||||
The canonical spellings ``FILE_SET SYCL TYPE SOURCES`` and
|
||||
``FILE_SET SYCL_HEADERS TYPE HEADERS`` are also accepted.
|
||||
|
||||
Both aliases are experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``BASE_DIRS <dirs>...``
|
||||
|
||||
An optional list of base directories of the file set. Any relative path
|
||||
|
||||
@@ -87,6 +87,8 @@ Try Compiling Source Files
|
||||
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]]
|
||||
[<LANG>_STANDARD <std>]
|
||||
[<LANG>_STANDARD_REQUIRED <bool>]
|
||||
[SYCL_CXX_STANDARD <std>]
|
||||
[SYCL_CXX_STANDARD_REQUIRED <bool>]
|
||||
[<LANG>_EXTENSIONS <bool>]
|
||||
)
|
||||
|
||||
@@ -139,6 +141,8 @@ The signature above is recommended for clarity.
|
||||
[COPY_FILE <fileName> [COPY_FILE_ERROR <var>]]
|
||||
[<LANG>_STANDARD <std>]
|
||||
[<LANG>_STANDARD_REQUIRED <bool>]
|
||||
[SYCL_CXX_STANDARD <std>]
|
||||
[SYCL_CXX_STANDARD_REQUIRED <bool>]
|
||||
[<LANG>_EXTENSIONS <bool>]
|
||||
)
|
||||
|
||||
@@ -303,6 +307,24 @@ The options for the above signatures are:
|
||||
:prop_tgt:`OBJCXX_STANDARD_REQUIRED`,or :prop_tgt:`CUDA_STANDARD_REQUIRED`
|
||||
target property of the generated project.
|
||||
|
||||
``SYCL_CXX_STANDARD <std>``
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Specify the :prop_tgt:`SYCL_CXX_STANDARD` target property of the generated
|
||||
project. This selects the C++ language version for SYCL compilation.
|
||||
|
||||
``SYCL_CXX_STANDARD_REQUIRED <bool>``
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Specify the :prop_tgt:`SYCL_CXX_STANDARD_REQUIRED` target property of the
|
||||
generated project.
|
||||
|
||||
``<LANG>_EXTENSIONS <bool>``
|
||||
.. versionadded:: 3.8
|
||||
|
||||
@@ -399,6 +421,17 @@ configuration:
|
||||
Their values are used to set the corresponding target properties in
|
||||
the generated project (unless overridden by an explicit option).
|
||||
|
||||
.. versionadded:: 4.5
|
||||
For SYCL compilations, :variable:`CMAKE_SYCL_CXX_STANDARD`,
|
||||
:variable:`CMAKE_SYCL_CXX_STANDARD_REQUIRED`, and
|
||||
:variable:`CMAKE_SYCL_EXTENSIONS` initialize the corresponding target
|
||||
properties under the same conditions. The ``SYCL_CXX_STANDARD`` and
|
||||
``SYCL_CXX_STANDARD_REQUIRED`` options also enable honoring language
|
||||
standard variables.
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. versionchanged:: 3.14
|
||||
For the :generator:`Green Hills MULTI` generator, the GHS toolset and target
|
||||
system customization cache variables are also propagated into the test
|
||||
|
||||
@@ -91,3 +91,39 @@ In order to activate support for Rust, set
|
||||
This UUID may change in future versions of CMake. Be sure to use the value
|
||||
documented here by the source tree of the version of CMake with which you are
|
||||
experimenting.
|
||||
|
||||
SYCL Support
|
||||
============
|
||||
|
||||
In order to activate support for SYCL, set
|
||||
|
||||
* variable ``CMAKE_EXPERIMENTAL_SYCL`` to
|
||||
* value ``c0d1fb10-2ece-420e-9d29-7d7f2b300f25``.
|
||||
|
||||
This UUID may change in future versions of CMake. Be sure to use the value
|
||||
documented here by the source tree of the version of CMake with which you are
|
||||
experimenting.
|
||||
|
||||
When activated, this experimental feature provides the following:
|
||||
|
||||
* The experimental ``SYCL`` language, including ``enable_language(SYCL)`` and
|
||||
``project(... LANGUAGES SYCL)``.
|
||||
|
||||
* Target properties and variables for SYCL language standard selection.
|
||||
|
||||
* The ``SYCL_EXTENSION_MODE`` target property, which controls whether SYCL
|
||||
sources use only SYCL language flags and feature requirements or prepend C++
|
||||
language flags and combine C++ feature and standard requirements.
|
||||
|
||||
* The ``SYCL`` and ``SYCL_HEADERS`` file set type aliases, which initialize the
|
||||
:prop_fs:`LANGUAGE` property. ``SYCL`` selects the language of a ``SOURCES``
|
||||
file set, while ``SYCL_HEADERS`` marks a ``HEADERS`` file set as requiring
|
||||
SYCL for C++ sources that can reach it.
|
||||
|
||||
The SYCL language is supported by Makefile, Ninja, FASTBuild, and Visual Studio
|
||||
generators with AdaptiveCpp, SYCL-capable Clang, or IntelLLVM compiler drivers.
|
||||
|
||||
:prop_tgt:`SYCL_SEPARABLE_COMPILATION` controls separate compilation of device
|
||||
code. :prop_tgt:`SYCL_RESOLVE_DEVICE_SYMBOLS` controls device linking, including
|
||||
for static libraries used by C++-only consumers. See these properties for
|
||||
supported compiler and generator configurations.
|
||||
@@ -0,0 +1,29 @@
|
||||
ACPP_TARGETS
|
||||
------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. include:: include/ENV_VAR.rst
|
||||
|
||||
Default device target selection for the AdaptiveCpp SYCL compiler. CMake
|
||||
reads this variable when first enabling SYCL if
|
||||
:variable:`CMAKE_SYCL_DEVICE_TARGETS` is not defined. The selection is used
|
||||
for compiler identification and testing, and as the default for targets
|
||||
whose :prop_tgt:`SYCL_DEVICE_TARGETS` property is unset or empty. Subsequent
|
||||
configurations retain the detected default selection.
|
||||
|
||||
The value is a semicolon-separated list of compilation flows, each optionally
|
||||
followed by a colon and a comma-separated list of architectures. See
|
||||
:prop_tgt:`SYCL_DEVICE_TARGETS` for examples of AdaptiveCpp target names.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ export ACPP_TARGETS='cuda.explicit-multipass:sm_80,sm_86;hip.explicit-multipass:gfx90a'
|
||||
|
||||
If this environment variable is not defined, CMake also checks
|
||||
:envvar:`HIPSYCL_TARGETS` before using the compiler's installation default.
|
||||
@@ -0,0 +1,15 @@
|
||||
HIPSYCL_TARGETS
|
||||
---------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. include:: include/ENV_VAR.rst
|
||||
|
||||
Legacy name for :envvar:`ACPP_TARGETS`. CMake reads this variable when first
|
||||
enabling SYCL with AdaptiveCpp only if neither
|
||||
:variable:`CMAKE_SYCL_DEVICE_TARGETS` nor the :envvar:`ACPP_TARGETS`
|
||||
environment variable is defined. It uses the same target format and
|
||||
configure-time default behavior as ``ACPP_TARGETS``.
|
||||
@@ -0,0 +1,24 @@
|
||||
SYCLCXX
|
||||
-------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. include:: include/ENV_VAR.rst
|
||||
|
||||
Preferred executable for compiling ``SYCL`` language files. Will only be used
|
||||
by CMake on the first configuration to determine the ``SYCL`` compiler, after
|
||||
which the value for ``SYCL`` is stored in the cache as
|
||||
:variable:`CMAKE_SYCL_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
|
||||
run (including the first), the environment variable will be ignored if the
|
||||
:variable:`CMAKE_SYCL_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
|
||||
|
||||
.. note::
|
||||
Options that are required to make the compiler work correctly can be included;
|
||||
they can not be changed.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ export SYCLCXX="custom-compiler --arg1 --arg2"
|
||||
@@ -0,0 +1,17 @@
|
||||
SYCLFLAGS
|
||||
---------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. include:: include/ENV_VAR.rst
|
||||
|
||||
Add default compilation flags to be used when compiling ``SYCL`` files.
|
||||
|
||||
.. |CMAKE_LANG_FLAGS| replace:: :variable:`CMAKE_SYCL_FLAGS <CMAKE_<LANG>_FLAGS>`
|
||||
.. |LANG| replace:: ``SYCL``
|
||||
.. include:: include/LANG_FLAGS.rst
|
||||
|
||||
See also :variable:`CMAKE_SYCL_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
|
||||
@@ -419,6 +419,35 @@ Acceptable file set types are:
|
||||
when building dependents. Sources specified by
|
||||
:prop_fs:`INTERFACE_SOURCES` propagate transitively to dependents.
|
||||
|
||||
``SYCL``
|
||||
.. versionadded:: 4.5
|
||||
|
||||
An alias for ``SOURCES`` that initializes the file set's
|
||||
:prop_fs:`LANGUAGE` property to ``SYCL``. Files in the set are compiled as
|
||||
SYCL sources even when their file name extension would normally select
|
||||
another language. The source file's :prop_sf:`LANGUAGE` property is not
|
||||
changed.
|
||||
|
||||
The file set is recorded as type ``SOURCES`` and otherwise has the same
|
||||
behavior and target properties as that type.
|
||||
|
||||
This alias is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``SYCL_HEADERS``
|
||||
.. versionadded:: 4.5
|
||||
|
||||
An alias for ``HEADERS`` that initializes the file set's
|
||||
:prop_fs:`LANGUAGE` property to ``SYCL``. A target compiles all of its C++
|
||||
sources as SYCL when this file set is visible to its own build, or is
|
||||
reachable through the interface of a linked target. This behavior
|
||||
propagates transitively through linked target interfaces.
|
||||
|
||||
The file set is recorded as type ``HEADERS`` and otherwise has the same
|
||||
behavior and target properties as that type. The header files themselves
|
||||
are not compiled.
|
||||
|
||||
This alias is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``CXX_MODULES``
|
||||
.. versionadded:: 3.28
|
||||
|
||||
|
||||
@@ -20,12 +20,16 @@ CMake provides a primary user interface based on granular handling of
|
||||
the features, not the language standard that introduced the feature.
|
||||
|
||||
The :prop_gbl:`CMAKE_C_KNOWN_FEATURES`, :prop_gbl:`CMAKE_CUDA_KNOWN_FEATURES`,
|
||||
and :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties contain all the
|
||||
features known to CMake, regardless of compiler support for the feature.
|
||||
The :variable:`CMAKE_C_COMPILE_FEATURES`, :variable:`CMAKE_CUDA_COMPILE_FEATURES`
|
||||
, and :variable:`CMAKE_CXX_COMPILE_FEATURES` variables contain all features
|
||||
CMake knows are known to the compiler, regardless of language standard
|
||||
or compile flags needed to use them.
|
||||
:prop_gbl:`CMAKE_CXX_KNOWN_FEATURES`, and :prop_gbl:`CMAKE_SYCL_KNOWN_FEATURES`
|
||||
global properties contain all the features known to CMake, regardless of
|
||||
compiler support for the feature. The :variable:`CMAKE_C_COMPILE_FEATURES`,
|
||||
:variable:`CMAKE_CUDA_COMPILE_FEATURES`, :variable:`CMAKE_CXX_COMPILE_FEATURES`,
|
||||
and :variable:`CMAKE_SYCL_COMPILE_FEATURES` variables contain all features CMake
|
||||
knows are known to the compiler, regardless of language standard or compile
|
||||
flags needed to use them.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Features known to CMake are named mostly following the same convention
|
||||
as the Clang feature test macros. There are some exceptions, such as
|
||||
@@ -37,6 +41,15 @@ the ``OBJC`` or ``OBJCXX`` languages. These are based off ``C`` or ``C++``
|
||||
respectively, so the properties and variables for their corresponding base
|
||||
language should be used instead.
|
||||
|
||||
SYCL uses the ``cxx_*`` names for granular C++ compile features in addition to
|
||||
the ``sycl_cxx_std_*`` meta-features. For a target containing only SYCL sources,
|
||||
these granular features select the target's :prop_tgt:`SYCL_CXX_STANDARD` rather
|
||||
than its :prop_tgt:`CXX_STANDARD`.
|
||||
|
||||
.. note::
|
||||
SYCL compile features are experimental and gated by
|
||||
``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Compile Feature Requirements
|
||||
============================
|
||||
|
||||
@@ -284,6 +297,18 @@ versions specified for each:
|
||||
* ``Clang``: Clang compiler 5.0+.
|
||||
* ``NVIDIA``: NVIDIA nvcc compiler 7.5+.
|
||||
|
||||
CMake is currently aware of the
|
||||
:prop_tgt:`C++ standards for SYCL <SYCL_CXX_STANDARD>` and their compile
|
||||
features available from the following
|
||||
:variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>`:
|
||||
|
||||
* ``AdaptiveCpp``: AdaptiveCpp compiler.
|
||||
* ``Clang``: SYCL-capable Clang distributions.
|
||||
* ``IntelLLVM``: Intel oneAPI DPC++/C++ compiler.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. _`Language Standard Flags`:
|
||||
|
||||
Language Standard Flags
|
||||
|
||||
@@ -87,6 +87,7 @@ Environment Variables for Languages
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
/envvar/ACPP_TARGETS
|
||||
/envvar/ASM_DIALECT
|
||||
/envvar/ASM_DIALECTFLAGS
|
||||
/envvar/CC
|
||||
@@ -103,6 +104,7 @@ Environment Variables for Languages
|
||||
/envvar/HIPCXX
|
||||
/envvar/HIPFLAGS
|
||||
/envvar/HIPHOSTCXX
|
||||
/envvar/HIPSYCL_TARGETS
|
||||
/envvar/ISPC
|
||||
/envvar/ISPCFLAGS
|
||||
/envvar/OBJC
|
||||
@@ -111,6 +113,8 @@ Environment Variables for Languages
|
||||
/envvar/OBJCXXFLAGS
|
||||
/envvar/RC
|
||||
/envvar/RCFLAGS
|
||||
/envvar/SYCLCXX
|
||||
/envvar/SYCLFLAGS
|
||||
/envvar/SWIFTC
|
||||
|
||||
Environment Variables for CTest
|
||||
|
||||
@@ -2475,6 +2475,26 @@ closely related to most of the expressions in this sub-section.
|
||||
``1`` if CMake's linker id of the HIP linker matches any one
|
||||
of the entries in ``linker_ids``, otherwise ``0``.
|
||||
|
||||
.. genex:: $<SYCL_COMPILER_LINKER_ID>
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
CMake's linker id of the SYCL linker used.
|
||||
|
||||
.. genex:: $<SYCL_COMPILER_LINKER_ID:linker_ids>
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
where ``linker_ids`` is a comma-separated list.
|
||||
``1`` if CMake's linker id of the SYCL linker matches any one
|
||||
of the entries in ``linker_ids``, otherwise ``0``.
|
||||
|
||||
.. genex:: $<C_COMPILER_LINKER_FRONTEND_VARIANT>
|
||||
|
||||
.. versionadded:: 4.2
|
||||
@@ -2573,6 +2593,26 @@ closely related to most of the expressions in this sub-section.
|
||||
``1`` if CMake's linker frontend variant of the HIP linker matches
|
||||
any one of the entries in ``variant_ids``, otherwise ``0``.
|
||||
|
||||
.. genex:: $<SYCL_COMPILER_LINKER_FRONTEND_VARIANT>
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
CMake's linker frontend variant of the SYCL linker used.
|
||||
|
||||
.. genex:: $<SYCL_COMPILER_LINKER_FRONTEND_VARIANT:variant_ids>
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
where ``variant_ids`` is a comma-separated list.
|
||||
``1`` if CMake's linker frontend variant of the SYCL linker matches
|
||||
any one of the entries in ``variant_ids``, otherwise ``0``.
|
||||
|
||||
|
||||
.. _`Source-Dependent Expressions`:
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ Properties of Global Scope
|
||||
/prop_gbl/CMAKE_CXX_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_HIP_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_LINK_WRAPPER_NAME
|
||||
/prop_gbl/CMAKE_SYCL_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_ROLE
|
||||
/prop_gbl/DEBUG_CONFIGURATIONS
|
||||
/prop_gbl/DISABLED_FEATURES
|
||||
@@ -471,6 +472,13 @@ Properties on Targets
|
||||
/prop_tgt/Swift_MODULE_NAME
|
||||
/prop_tgt/Swift_PACKAGE_NAME
|
||||
/prop_tgt/Swift_SEPARATE_MODULE_EMISSION
|
||||
/prop_tgt/SYCL_CXX_STANDARD
|
||||
/prop_tgt/SYCL_CXX_STANDARD_REQUIRED
|
||||
/prop_tgt/SYCL_DEVICE_TARGETS
|
||||
/prop_tgt/SYCL_EXTENSIONS
|
||||
/prop_tgt/SYCL_EXTENSION_MODE
|
||||
/prop_tgt/SYCL_RESOLVE_DEVICE_SYMBOLS
|
||||
/prop_tgt/SYCL_SEPARABLE_COMPILATION
|
||||
/prop_tgt/SYMBOLIC
|
||||
/prop_tgt/SYSTEM
|
||||
/prop_tgt/TEST_LAUNCHER
|
||||
|
||||
@@ -728,6 +728,13 @@ Variables for Languages
|
||||
/variable/CMAKE_OBJCXX_STANDARD
|
||||
/variable/CMAKE_OBJCXX_STANDARD_REQUIRED
|
||||
/variable/CMAKE_Swift_LANGUAGE_VERSION
|
||||
/variable/CMAKE_SYCL_COMPILE_FEATURES
|
||||
/variable/CMAKE_SYCL_CXX_STANDARD
|
||||
/variable/CMAKE_SYCL_CXX_STANDARD_REQUIRED
|
||||
/variable/CMAKE_SYCL_DEVICE_TARGETS
|
||||
/variable/CMAKE_SYCL_EXTENSIONS
|
||||
/variable/CMAKE_SYCL_RESOLVE_DEVICE_SYMBOLS
|
||||
/variable/CMAKE_SYCL_SEPARABLE_COMPILATION
|
||||
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE_LANG
|
||||
|
||||
Variables for CTest
|
||||
|
||||
@@ -8,3 +8,10 @@ The type of the file set.
|
||||
This read-only property can be used to retrieve the
|
||||
:ref:`type <File Sets>` of the given file set.
|
||||
Possible values are ``CXX_MODULES``, ``SOURCES``, or ``HEADERS``.
|
||||
|
||||
.. versionchanged:: 4.5
|
||||
The experimental ``SYCL`` and ``SYCL_HEADERS`` types accepted by
|
||||
:command:`target_sources` are stored as ``SOURCES`` and ``HEADERS``,
|
||||
respectively, with the :prop_fs:`LANGUAGE` property set to ``SYCL``.
|
||||
Therefore, this property reports the canonical type for file sets created
|
||||
with either alias. Both aliases are gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
@@ -0,0 +1,44 @@
|
||||
CMAKE_SYCL_KNOWN_FEATURES
|
||||
-------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
List of SYCL features known to this version of CMake.
|
||||
|
||||
The features listed in this global property may be known to be available to the
|
||||
SYCL compiler. If a feature is available with the SYCL compiler, it will be
|
||||
listed in the :variable:`CMAKE_SYCL_COMPILE_FEATURES` variable.
|
||||
|
||||
The features listed here may be used with the
|
||||
:command:`target_compile_features` command. See the
|
||||
:manual:`cmake-compile-features(7)` manual for information on compile features
|
||||
and a list of supported compilers.
|
||||
|
||||
The features known to this version of CMake are the ``cxx_*`` granular features
|
||||
listed by :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES`, plus:
|
||||
|
||||
``sycl_cxx_std_98``
|
||||
C++ compiler mode for SYCL is at least C++98.
|
||||
|
||||
``sycl_cxx_std_11``
|
||||
C++ compiler mode for SYCL is at least C++11.
|
||||
|
||||
``sycl_cxx_std_14``
|
||||
C++ compiler mode for SYCL is at least C++14.
|
||||
|
||||
``sycl_cxx_std_17``
|
||||
C++ compiler mode for SYCL is at least C++17.
|
||||
|
||||
``sycl_cxx_std_20``
|
||||
C++ compiler mode for SYCL is at least C++20.
|
||||
|
||||
``sycl_cxx_std_23``
|
||||
C++ compiler mode for SYCL is at least C++23.
|
||||
|
||||
``sycl_cxx_std_26``
|
||||
C++ compiler mode for SYCL is at least C++26.
|
||||
|
||||
.. include:: include/CMAKE_LANG_STD_FLAGS.rst
|
||||
@@ -4,7 +4,13 @@
|
||||
.. versionadded:: 3.4
|
||||
|
||||
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
|
||||
``Fortran``, ``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
``Fortran``, ``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, ``CUDA``, or ``SYCL``.
|
||||
|
||||
.. versionchanged:: 4.5
|
||||
Added support for ``SYCL``.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line
|
||||
for a compiler launching tool. The :ref:`Makefile Generators` and the
|
||||
|
||||
@@ -9,6 +9,7 @@ The variations are:
|
||||
* :prop_tgt:`HIP_EXTENSIONS`
|
||||
* :prop_tgt:`OBJC_EXTENSIONS`
|
||||
* :prop_tgt:`OBJCXX_EXTENSIONS`
|
||||
* :prop_tgt:`SYCL_EXTENSIONS`
|
||||
|
||||
These properties specify whether compiler-specific extensions are requested.
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ This property is implemented only when ``<LANG>`` is one of:
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
* ``SYCL``
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a
|
||||
command line for a linker launching tool. The :ref:`Makefile Generators` and the
|
||||
:generator:`Ninja` generator will run this tool and pass the linker and its
|
||||
|
||||
@@ -9,6 +9,10 @@ The variations are:
|
||||
* :prop_tgt:`HIP_STANDARD`
|
||||
* :prop_tgt:`OBJC_STANDARD`
|
||||
* :prop_tgt:`OBJCXX_STANDARD`
|
||||
* :prop_tgt:`SYCL_CXX_STANDARD` (C++ standard for SYCL compilations)
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
These properties specify language standard versions which are requested. When a
|
||||
newer standard is specified than is supported by the compiler, then it will
|
||||
|
||||
@@ -9,6 +9,10 @@ The variations are:
|
||||
* :prop_tgt:`HIP_STANDARD_REQUIRED`
|
||||
* :prop_tgt:`OBJC_STANDARD_REQUIRED`
|
||||
* :prop_tgt:`OBJCXX_STANDARD_REQUIRED`
|
||||
* :prop_tgt:`SYCL_CXX_STANDARD_REQUIRED`
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
These properties specify whether the value of :prop_tgt:`<LANG>_STANDARD` is a
|
||||
requirement. When false or unset, the :prop_tgt:`<LANG>_STANDARD` target
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
SYCL_CXX_STANDARD
|
||||
-----------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
The C++ standard whose features are requested for SYCL compilations of
|
||||
this target.
|
||||
|
||||
This property specifies the C++ standard whose features are requested for
|
||||
SYCL compilations of this target. For some compilers, this results in adding
|
||||
a flag such as ``-std=gnu++20`` to the compile line. It selects the C++
|
||||
language version, not the SYCL specification version.
|
||||
|
||||
Supported values are:
|
||||
|
||||
``98``
|
||||
C++98
|
||||
|
||||
``11``
|
||||
C++11
|
||||
|
||||
``14``
|
||||
C++14
|
||||
|
||||
``17``
|
||||
C++17
|
||||
|
||||
``20``
|
||||
C++20
|
||||
|
||||
``23``
|
||||
C++23
|
||||
|
||||
``26``
|
||||
C++26
|
||||
|
||||
If the value requested does not result in a compile flag being added for
|
||||
the compiler in use, a previous standard flag will be added instead. This
|
||||
means that using:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set_property(TARGET tgt PROPERTY SYCL_CXX_STANDARD 11)
|
||||
|
||||
with a compiler which does not support ``-std=gnu++11`` or an equivalent
|
||||
flag will not result in an error or warning, but will instead add the
|
||||
``-std=gnu++98`` flag if supported. This "decay" behavior may be controlled
|
||||
with the :prop_tgt:`SYCL_CXX_STANDARD_REQUIRED` target property.
|
||||
Additionally, the :prop_tgt:`SYCL_EXTENSIONS` target property may be used to
|
||||
control whether compiler-specific extensions are enabled on a per-target basis.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
|
||||
This property is initialized by the value of
|
||||
the :variable:`CMAKE_SYCL_CXX_STANDARD` variable if it is set when a target
|
||||
is created.
|
||||
@@ -0,0 +1,23 @@
|
||||
SYCL_CXX_STANDARD_REQUIRED
|
||||
--------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Boolean describing whether the value of :prop_tgt:`SYCL_CXX_STANDARD` is a
|
||||
requirement.
|
||||
|
||||
If this property is set to ``ON``, then the value of the
|
||||
:prop_tgt:`SYCL_CXX_STANDARD` target property is treated as a requirement. If this
|
||||
property is ``OFF`` or unset, the :prop_tgt:`SYCL_CXX_STANDARD` target property is
|
||||
treated as optional and may "decay" to a previous standard if the requested is
|
||||
not available.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
|
||||
This property is initialized by the value of
|
||||
the :variable:`CMAKE_SYCL_CXX_STANDARD_REQUIRED` variable if it is set when a
|
||||
target is created.
|
||||
@@ -0,0 +1,42 @@
|
||||
SYCL_DEVICE_TARGETS
|
||||
-------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
List of device targets to generate code for. Names are interpreted by the
|
||||
SYCL compiler:
|
||||
|
||||
* AdaptiveCpp accepts compilation flows with optional architecture lists,
|
||||
such as ``generic``, ``omp.accelerated``,
|
||||
``cuda.explicit-multipass:sm_80,sm_86``, and
|
||||
``hip.explicit-multipass:gfx90a``.
|
||||
* IntelLLVM accepts SYCL target triples or architecture aliases, such as
|
||||
``spir64`` and ``intel_gpu_pvc``.
|
||||
* Clang accepts offload target triples, such as ``spirv64-unknown-unknown``.
|
||||
|
||||
The compiler installation must support the requested targets. These values
|
||||
are not interchangeable across compilers.
|
||||
|
||||
This property is initialized by :variable:`CMAKE_SYCL_DEVICE_TARGETS` when a
|
||||
target is created. If unset or empty, the compiler's configure-time device
|
||||
target selection is used. A non-empty false value (for example ``OFF``)
|
||||
suppresses CMake-generated device target options.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_ID STREQUAL "AdaptiveCpp")
|
||||
set_property(TARGET app PROPERTY SYCL_DEVICE_TARGETS
|
||||
cuda.explicit-multipass:sm_80)
|
||||
elseif(CMAKE_SYCL_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
set_property(TARGET app PROPERTY SYCL_DEVICE_TARGETS intel_gpu_pvc)
|
||||
endif()
|
||||
|
||||
Selections are applied to SYCL compilation and linking, including standalone
|
||||
device linking when the host link uses another language. Set compatible
|
||||
selections on targets that compile device code and on the target that links
|
||||
it; this property is not a transitive usage requirement.
|
||||
@@ -0,0 +1,24 @@
|
||||
SYCL_EXTENSIONS
|
||||
---------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Boolean specifying whether compiler specific extensions are requested.
|
||||
|
||||
This property specifies whether compiler specific extensions should be
|
||||
used. For some compilers, this results in adding a flag such
|
||||
as ``-std=gnu++11`` instead of ``-std=c++11`` to the compile line. This
|
||||
property is ``ON`` by default. The basic SYCL/C++ standard level is
|
||||
controlled by the :prop_tgt:`SYCL_CXX_STANDARD` target property.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
|
||||
This property is initialized by the value of
|
||||
the :variable:`CMAKE_SYCL_EXTENSIONS` variable if set when a target is created
|
||||
and otherwise by the value of
|
||||
:variable:`CMAKE_SYCL_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>`
|
||||
(see :policy:`CMP0128`).
|
||||
@@ -0,0 +1,31 @@
|
||||
SYCL_EXTENSION_MODE
|
||||
-------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Controls whether C++ language flags and compile-feature requirements are
|
||||
combined with their SYCL counterparts for SYCL compilation and linking.
|
||||
|
||||
Supported values are:
|
||||
|
||||
``APPEND``
|
||||
Use :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its
|
||||
configuration-specific value before
|
||||
:variable:`CMAKE_SYCL_FLAGS <CMAKE_<LANG>_FLAGS>` and its
|
||||
configuration-specific value. C++ and SYCL compile-feature and
|
||||
language-standard requirements are combined. This is the default when the
|
||||
property is unset.
|
||||
|
||||
``REPLACE``
|
||||
Use only SYCL language flags and SYCL compile-feature and language-standard
|
||||
requirements.
|
||||
|
||||
This property does not change generator-expression language contexts. For a
|
||||
SYCL compilation, ``$<COMPILE_LANGUAGE:SYCL>`` is true and
|
||||
``$<COMPILE_LANGUAGE:CXX>`` is false. For a target linked with the SYCL
|
||||
driver, ``$<LINK_LANGUAGE:SYCL>`` is true and ``$<LINK_LANGUAGE:CXX>`` is
|
||||
false. Properties and usage requirements are not evaluated a second time in a
|
||||
C++ context.
|
||||
@@ -0,0 +1,35 @@
|
||||
SYCL_RESOLVE_DEVICE_SYMBOLS
|
||||
---------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
SYCL only: Enables device linking for the specific library target where
|
||||
required.
|
||||
|
||||
If set, this will tell the required compilers to enable device linking
|
||||
on the library target. Device linking is an additional link step
|
||||
required by some SYCL compilers when :prop_tgt:`SYCL_SEPARABLE_COMPILATION` is
|
||||
enabled. Normally device linking is deferred until a shared library or
|
||||
executable is generated, allowing for multiple static libraries to resolve
|
||||
device symbols at the same time when they are used by a shared library or
|
||||
executable.
|
||||
|
||||
If this property or :variable:`CMAKE_SYCL_RESOLVE_DEVICE_SYMBOLS` is unset,
|
||||
static libraries are treated as if it is disabled while shared, module,
|
||||
and executable targets behave as if it is on.
|
||||
|
||||
If :variable:`CMAKE_SYCL_RESOLVE_DEVICE_SYMBOLS` has been defined,
|
||||
this property is initialized to the value the variable and overriding
|
||||
the default behavior.
|
||||
|
||||
Note that device linking is not supported for :ref:`Object Libraries`.
|
||||
|
||||
|
||||
For instance:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set_property(TARGET mystaticlib PROPERTY SYCL_RESOLVE_DEVICE_SYMBOLS ON)
|
||||
@@ -0,0 +1,22 @@
|
||||
SYCL_SEPARABLE_COMPILATION
|
||||
--------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
SYCL only: Enables separate compilation of device code
|
||||
|
||||
If set this will enable separable compilation for all SYCL files for
|
||||
the given target.
|
||||
|
||||
For instance:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set_property(TARGET myexe PROPERTY SYCL_SEPARABLE_COMPILATION ON)
|
||||
|
||||
This property is initialized by the value of the
|
||||
:variable:`CMAKE_SYCL_SEPARABLE_COMPILATION` variable if it is set when a
|
||||
target is created.
|
||||
@@ -10,6 +10,7 @@ include:
|
||||
Value Name
|
||||
=============================== ===============================================
|
||||
``Absoft`` Absoft Fortran
|
||||
``AdaptiveCpp`` `AdaptiveCpp`_ (SYCL)
|
||||
``ADSP`` Analog VisualDSP++
|
||||
``AppleClang`` Apple Clang
|
||||
``ARMCC`` ARM Compiler
|
||||
@@ -60,7 +61,16 @@ Value Name
|
||||
This variable is not guaranteed to be defined for all compilers or
|
||||
languages.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
The ``AdaptiveCpp`` ID identifies the AdaptiveCpp SYCL compiler, formerly
|
||||
known as hipSYCL and Open SYCL. Its underlying host compiler is identified
|
||||
separately by :variable:`CMAKE_<LANG>_HOST_COMPILER_ID`.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
.. _LLVM Clang: https://clang.llvm.org
|
||||
.. _AdaptiveCpp: https://adaptivecpp.github.io/
|
||||
.. _Embarcadero: https://www.embarcadero.com
|
||||
.. _Classic Flang Fortran Compiler: https://github.com/flang-compiler/flang
|
||||
.. _LLVM Flang Fortran Compiler: https://github.com/llvm/llvm-project/tree/main/flang
|
||||
|
||||
@@ -6,7 +6,13 @@ CMAKE_<LANG>_COMPILER_LAUNCHER
|
||||
Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
|
||||
This variable is used to initialize the property on each target as it is
|
||||
created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``,
|
||||
``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
|
||||
``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``, ``CUDA``, or ``SYCL``.
|
||||
|
||||
.. versionchanged:: 4.5
|
||||
Added support for ``SYCL``.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
This variable is initialized to the :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER`
|
||||
environment variable if it is set.
|
||||
@@ -9,6 +9,7 @@ The variations are:
|
||||
* :variable:`CMAKE_HIP_EXTENSIONS`
|
||||
* :variable:`CMAKE_OBJC_EXTENSIONS`
|
||||
* :variable:`CMAKE_OBJCXX_EXTENSIONS`
|
||||
* :variable:`CMAKE_SYCL_EXTENSIONS`
|
||||
|
||||
Default values for :prop_tgt:`<LANG>_EXTENSIONS` target properties if set when
|
||||
a target is created. For the compiler's default setting see
|
||||
|
||||
@@ -8,3 +8,11 @@ and :variable:`CMAKE_<LANG>_COMPILER_ID` is ``NVIDIA``.
|
||||
It contains the identity of the host compiler invoked by ``nvcc``,
|
||||
either by default or as specified by :variable:`CMAKE_<LANG>_HOST_COMPILER`,
|
||||
among possibilities documented by :variable:`CMAKE_<LANG>_COMPILER_ID`.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
This variable is also available when ``<LANG>`` is ``SYCL`` and
|
||||
:variable:`CMAKE_<LANG>_COMPILER_ID` is ``AdaptiveCpp``. It identifies the
|
||||
underlying host compiler used by the AdaptiveCpp driver.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
@@ -8,3 +8,12 @@ and :variable:`CMAKE_<LANG>_COMPILER_ID` is ``NVIDIA``.
|
||||
It contains the version of the host compiler invoked by ``nvcc``,
|
||||
either by default or as specified by :variable:`CMAKE_<LANG>_HOST_COMPILER`,
|
||||
in the same format as :variable:`CMAKE_<LANG>_COMPILER_VERSION`.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
This variable is also available when ``<LANG>`` is ``SYCL`` and
|
||||
:variable:`CMAKE_<LANG>_COMPILER_ID` is ``AdaptiveCpp``. It contains the
|
||||
underlying host compiler's version; :variable:`CMAKE_<LANG>_COMPILER_VERSION`
|
||||
contains the AdaptiveCpp release version.
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
@@ -27,5 +27,12 @@ This is done only when ``<LANG>`` is one of:
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
* ``SYCL``
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
This variable is initialized to the :envvar:`CMAKE_<LANG>_LINKER_LAUNCHER`
|
||||
environment variable if it is set.
|
||||
@@ -9,6 +9,10 @@ The variations are:
|
||||
* :variable:`CMAKE_HIP_STANDARD`
|
||||
* :variable:`CMAKE_OBJC_STANDARD`
|
||||
* :variable:`CMAKE_OBJCXX_STANDARD`
|
||||
* :variable:`CMAKE_SYCL_CXX_STANDARD` (C++ standard for SYCL compilations)
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default values for :prop_tgt:`<LANG>_STANDARD` target properties if set when a
|
||||
target is created.
|
||||
|
||||
@@ -9,6 +9,10 @@ The variations are:
|
||||
* :variable:`CMAKE_HIP_STANDARD_REQUIRED`
|
||||
* :variable:`CMAKE_OBJC_STANDARD_REQUIRED`
|
||||
* :variable:`CMAKE_OBJCXX_STANDARD_REQUIRED`
|
||||
* :variable:`CMAKE_SYCL_CXX_STANDARD_REQUIRED`
|
||||
|
||||
.. note::
|
||||
SYCL support is experimental and gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default values for :prop_tgt:`<LANG>_STANDARD_REQUIRED` target properties if
|
||||
set when a target is created.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
CMAKE_SYCL_COMPILE_FEATURES
|
||||
---------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
List of features known to the SYCL compiler.
|
||||
|
||||
These features are known to be available for use with the SYCL compiler. This
|
||||
list is a subset of the features listed in the
|
||||
:prop_gbl:`CMAKE_SYCL_KNOWN_FEATURES` global property.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on compile
|
||||
features and a list of supported compilers.
|
||||
@@ -0,0 +1,13 @@
|
||||
CMAKE_SYCL_CXX_STANDARD
|
||||
-----------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value for :prop_tgt:`SYCL_CXX_STANDARD` target property if set when a
|
||||
target is created.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
@@ -0,0 +1,13 @@
|
||||
CMAKE_SYCL_CXX_STANDARD_REQUIRED
|
||||
--------------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value for :prop_tgt:`SYCL_CXX_STANDARD_REQUIRED` target property if set
|
||||
when a target is created.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
@@ -0,0 +1,20 @@
|
||||
CMAKE_SYCL_DEVICE_TARGETS
|
||||
-------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value of the :prop_tgt:`SYCL_DEVICE_TARGETS` target property. See
|
||||
that property for the supported compiler-specific values.
|
||||
|
||||
If set before first enabling SYCL, this variable also selects device targets for
|
||||
compiler identification and testing.
|
||||
|
||||
For AdaptiveCpp, if this variable is not defined when SYCL is first enabled,
|
||||
the default selection is taken from the :envvar:`ACPP_TARGETS` environment
|
||||
variable, then :envvar:`HIPSYCL_TARGETS`, or the compiler's installation
|
||||
default if neither environment variable is defined.
|
||||
|
||||
This variable is propagated into :command:`try_compile` projects.
|
||||
@@ -0,0 +1,13 @@
|
||||
CMAKE_SYCL_EXTENSIONS
|
||||
---------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value for :prop_tgt:`SYCL_EXTENSIONS` target property if set when a
|
||||
target is created.
|
||||
|
||||
See the :manual:`cmake-compile-features(7)` manual for information on
|
||||
compile features and a list of supported compilers.
|
||||
@@ -0,0 +1,13 @@
|
||||
CMAKE_SYCL_RESOLVE_DEVICE_SYMBOLS
|
||||
---------------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value for :prop_tgt:`SYCL_RESOLVE_DEVICE_SYMBOLS` target
|
||||
property when defined. By default this variable is not defined.
|
||||
|
||||
This variable is used to initialize the property on each target as
|
||||
it is created.
|
||||
@@ -0,0 +1,11 @@
|
||||
CMAKE_SYCL_SEPARABLE_COMPILATION
|
||||
--------------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. note::
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
Default value for :prop_tgt:`SYCL_SEPARABLE_COMPILATION` target property.
|
||||
This variable is used to initialize the property on each target as it is
|
||||
created.
|
||||
@@ -107,6 +107,10 @@ function(compiler_id_detection outvar lang)
|
||||
set(ordered_compilers NVIDIA Clang)
|
||||
endif()
|
||||
|
||||
if("x${lang}" STREQUAL "xSYCL")
|
||||
list(PREPEND ordered_compilers AdaptiveCpp)
|
||||
endif()
|
||||
|
||||
if(CID_ID_DEFINE)
|
||||
foreach(Id ${ordered_compilers})
|
||||
string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
|
||||
|
||||
@@ -358,6 +358,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU"
|
||||
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAdaptiveCpp"
|
||||
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang"
|
||||
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang"
|
||||
OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIBMClang"
|
||||
@@ -544,19 +545,24 @@ function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
|
||||
PLATFORM_DEFAULT_COMPILER
|
||||
)
|
||||
|
||||
if(lang MATCHES "^(CUDA|HIP)$")
|
||||
if(lang MATCHES "^(CUDA|HIP|SYCL)$")
|
||||
compiler_id_detection(CMAKE_${lang}_HOST_COMPILER_ID_CONTENT CXX
|
||||
PREFIX HOST_
|
||||
ID_STRING
|
||||
VERSION_STRINGS
|
||||
)
|
||||
if(lang STREQUAL "SYCL")
|
||||
set(host_compiler_condition "defined(__ADAPTIVECPP__) || defined(__ACPP__) || defined(__OPENSYCL__) || defined(__HIPSYCL__)")
|
||||
else()
|
||||
set(host_compiler_condition "defined(__NVCC__)")
|
||||
endif()
|
||||
string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT
|
||||
"\n"
|
||||
"\n"
|
||||
"/* Detect host compiler used by NVCC. */\n"
|
||||
"#ifdef __NVCC__\n"
|
||||
"/* Detect the underlying host compiler. */\n"
|
||||
"#if ${host_compiler_condition}\n"
|
||||
"${CMAKE_${lang}_HOST_COMPILER_ID_CONTENT}\n"
|
||||
"#endif /* __NVCC__ */\n"
|
||||
"#endif\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -737,6 +743,9 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
set(id_src "${src}")
|
||||
set(id_compile "ClCompile")
|
||||
if(lang STREQUAL SYCL)
|
||||
set(id_cl_var "CLToolExe")
|
||||
endif()
|
||||
if(id_cl_var)
|
||||
set(id_PostBuildEvent_Command "echo CMAKE_${lang}_COMPILER=$(${id_cl_var})")
|
||||
else()
|
||||
@@ -746,7 +755,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
set(id_Import_targets "")
|
||||
set(id_ItemDefinitionGroup_entry "")
|
||||
set(id_Link_AdditionalDependencies "")
|
||||
if(lang STREQUAL CUDA)
|
||||
set(id_project_template "VS-${v}.${ext}.in")
|
||||
if(lang STREQUAL SYCL)
|
||||
set(id_project_template "VS-SYCL.vcxproj.in")
|
||||
elseif(lang STREQUAL CUDA)
|
||||
if(NOT CMAKE_VS_PLATFORM_TOOLSET_CUDA)
|
||||
set(maybe_dir "")
|
||||
if(_CMAKE_VS_PLATFORM_TOOLSET_CUDA_INTEGRATION_DIR)
|
||||
@@ -793,7 +805,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart_static.lib</AdditionalDependencies>")
|
||||
endif()
|
||||
endif()
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/${id_project_template}
|
||||
${id_dir}/CompilerId${lang}.${ext} @ONLY)
|
||||
if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
|
||||
set(command "${CMAKE_VS_MSBUILD_COMMAND}" "CompilerId${lang}.${ext}"
|
||||
|
||||
@@ -295,6 +295,68 @@ function(cmake_determine_compiler_support lang)
|
||||
|
||||
message(CHECK_PASS "done")
|
||||
|
||||
elseif("x${lang}" STREQUAL "xSYCL" AND COMMAND cmake_record_sycl_compile_features)
|
||||
message(CHECK_START "Detecting ${lang} compile features")
|
||||
|
||||
set(CMAKE_SYCL98_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL11_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL14_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL17_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL20_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL23_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL26_COMPILE_FEATURES)
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
|
||||
|
||||
cmake_record_sycl_compile_features()
|
||||
|
||||
if(NOT _result EQUAL 0)
|
||||
message(CHECK_FAIL "failed")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYCL23_COMPILE_FEATURES AND CMAKE_SYCL26_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL26_COMPILE_FEATURES ${CMAKE_SYCL23_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_SYCL20_COMPILE_FEATURES AND CMAKE_SYCL23_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL23_COMPILE_FEATURES ${CMAKE_SYCL20_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_SYCL17_COMPILE_FEATURES AND CMAKE_SYCL20_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL20_COMPILE_FEATURES ${CMAKE_SYCL17_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_SYCL14_COMPILE_FEATURES AND CMAKE_SYCL17_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL17_COMPILE_FEATURES ${CMAKE_SYCL14_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_SYCL11_COMPILE_FEATURES AND CMAKE_SYCL14_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL14_COMPILE_FEATURES ${CMAKE_SYCL11_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_SYCL98_COMPILE_FEATURES AND CMAKE_SYCL11_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_SYCL11_COMPILE_FEATURES ${CMAKE_SYCL98_COMPILE_FEATURES})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILE_FEATURES)
|
||||
set(CMAKE_SYCL_COMPILE_FEATURES
|
||||
${CMAKE_SYCL98_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL11_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL14_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL17_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL20_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL23_COMPILE_FEATURES}
|
||||
${CMAKE_SYCL26_COMPILE_FEATURES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYCL_COMPILE_FEATURES ${CMAKE_SYCL_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL98_COMPILE_FEATURES ${CMAKE_SYCL98_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL11_COMPILE_FEATURES ${CMAKE_SYCL11_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL14_COMPILE_FEATURES ${CMAKE_SYCL14_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL17_COMPILE_FEATURES ${CMAKE_SYCL17_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL20_COMPILE_FEATURES ${CMAKE_SYCL20_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL23_COMPILE_FEATURES ${CMAKE_SYCL23_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_SYCL26_COMPILE_FEATURES ${CMAKE_SYCL26_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
|
||||
message(CHECK_PASS "done")
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
@@ -0,0 +1,246 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Xcode")
|
||||
message(FATAL_ERROR
|
||||
"The SYCL language is not supported by the \"${CMAKE_GENERATOR}\" "
|
||||
"generator.")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Record the selection used to identify the host toolchain and runtime.
|
||||
if(DEFINED CMAKE_SYCL_DEVICE_TARGETS)
|
||||
set(_CMAKE_SYCL_DEVICE_TARGETS "${CMAKE_SYCL_DEVICE_TARGETS}")
|
||||
endif()
|
||||
|
||||
# Load system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-SYCL OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-SYCL OPTIONAL)
|
||||
if(NOT CMAKE_SYCL_COMPILER_NAMES)
|
||||
set(CMAKE_SYCL_COMPILER_NAMES dpclang++ dpclang-cl icpx icx icx-cl dpcpp acpp syclcc clang++ clang-cl)
|
||||
endif()
|
||||
|
||||
if(NOT "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
if(NOT CMAKE_SYCL_COMPILER)
|
||||
set(CMAKE_SYCL_COMPILER_INIT NOTFOUND)
|
||||
|
||||
if(NOT $ENV{SYCLCXX} STREQUAL "")
|
||||
get_filename_component(CMAKE_SYCL_COMPILER_INIT $ENV{SYCLCXX} PROGRAM PROGRAM_ARGS CMAKE_SYCL_FLAGS_ENV_INIT)
|
||||
if(CMAKE_SYCL_FLAGS_ENV_INIT)
|
||||
set(CMAKE_SYCL_COMPILER_ARG1 "${CMAKE_SYCL_FLAGS_ENV_INIT}" CACHE STRING "Arguments to SYCL compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_SYCL_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find the compiler specified in the environment variable SYCLCXX:\n$ENV{SYCLCXX}.\n${CMAKE_SYCL_COMPILER_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR_SYCL AND NOT CMAKE_SYCL_COMPILER_INIT)
|
||||
set(CMAKE_SYCL_COMPILER_INIT ${CMAKE_GENERATOR_SYCL})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILER_INIT)
|
||||
set(CMAKE_SYCL_COMPILER_LIST dpclang++ dpclang-cl icpx icx icx-cl dpcpp acpp syclcc clang++ clang-cl)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(SYCL)
|
||||
else()
|
||||
_cmake_find_compiler_path(SYCL)
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_SYCL_COMPILER)
|
||||
|
||||
get_filename_component(_CMAKE_SYCL_COMPILER_NAME
|
||||
"${CMAKE_SYCL_COMPILER}" NAME_WE)
|
||||
if(_CMAKE_SYCL_COMPILER_NAME MATCHES "^(acpp|syclcc|syclcc-clang)$")
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST "-x c++")
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS "-c -x c++" "-x c++")
|
||||
else()
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST "-fsycl -x c++")
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS
|
||||
"-c -fsycl -x c++"
|
||||
"-fsycl -x c++"
|
||||
"-c -x c++"
|
||||
"-x c++")
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_COMPILER_NAME)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_TARGET)
|
||||
get_filename_component(_CMAKE_SYCL_COMPILER_NAME
|
||||
"${CMAKE_SYCL_COMPILER}" NAME_WE)
|
||||
if(_CMAKE_SYCL_COMPILER_NAME MATCHES "^(acpp|syclcc|syclcc-clang)$")
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST
|
||||
"-c --target=${CMAKE_SYCL_COMPILER_TARGET} -x c++")
|
||||
else()
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST
|
||||
"-c --target=${CMAKE_SYCL_COMPILER_TARGET} -fsycl -x c++")
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_COMPILER_NAME)
|
||||
endif()
|
||||
|
||||
get_filename_component(_CMAKE_SYCL_COMPILER_NAME
|
||||
"${CMAKE_SYCL_COMPILER}" NAME_WE)
|
||||
if(_CMAKE_SYCL_COMPILER_NAME MATCHES "^(acpp|syclcc|syclcc-clang)$")
|
||||
if(NOT DEFINED _CMAKE_SYCL_DEVICE_TARGETS)
|
||||
if(DEFINED ENV{ACPP_TARGETS})
|
||||
set(_CMAKE_SYCL_DEVICE_TARGETS "$ENV{ACPP_TARGETS}")
|
||||
elseif(DEFINED ENV{HIPSYCL_TARGETS})
|
||||
set(_CMAKE_SYCL_DEVICE_TARGETS "$ENV{HIPSYCL_TARGETS}")
|
||||
else()
|
||||
execute_process(COMMAND "${CMAKE_SYCL_COMPILER}" --help
|
||||
OUTPUT_VARIABLE _CMAKE_SYCL_DRIVER_HELP
|
||||
ERROR_QUIET)
|
||||
if(_CMAKE_SYCL_DRIVER_HELP MATCHES
|
||||
"--acpp-targets=[^\n]*\n[^\n]*\n[^\n]*\n \\[current value: ([^]\n]+)\\]")
|
||||
if(NOT CMAKE_MATCH_1 STREQUAL "NOT SET")
|
||||
set(_CMAKE_SYCL_DEVICE_TARGETS "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_DRIVER_HELP)
|
||||
endif()
|
||||
endif()
|
||||
# AdaptiveCpp supplies the backend's source language itself. A forwarded
|
||||
# -x c++ would override its -x cuda/-x hip during multipass compilation.
|
||||
string(TOLOWER "${_CMAKE_SYCL_DEVICE_TARGETS}" _CMAKE_SYCL_TARGET_FLOWS)
|
||||
if(_CMAKE_SYCL_TARGET_FLOWS MATCHES
|
||||
"(^|;)[ \t]*(cuda|hip)(\\.(integrated|explicit)-multipass)?[ \t]*(:|;|$)" OR
|
||||
(NOT "${CMAKE_SYCL_DEVICE_TARGETS}" STREQUAL "" AND
|
||||
NOT CMAKE_SYCL_DEVICE_TARGETS))
|
||||
string(REPLACE "-x c++" "" CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST
|
||||
"${CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST}")
|
||||
string(REPLACE "-x c++" "" CMAKE_SYCL_COMPILER_ID_TEST_FLAGS
|
||||
"${CMAKE_SYCL_COMPILER_ID_TEST_FLAGS}")
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_TARGET_FLOWS)
|
||||
set(_CMAKE_SYCL_DEVICE_TARGET_OPTION "--acpp-targets=")
|
||||
set(_CMAKE_SYCL_DEVICE_TARGET_VALUE "${_CMAKE_SYCL_DEVICE_TARGETS}")
|
||||
elseif(_CMAKE_SYCL_COMPILER_NAME MATCHES "^(clang\\+\\+|clang|clang-cl)(-[0-9]+)?$")
|
||||
set(_CMAKE_SYCL_DEVICE_TARGET_OPTION "--offload-targets=")
|
||||
string(REPLACE ";" "," _CMAKE_SYCL_DEVICE_TARGET_VALUE
|
||||
"${_CMAKE_SYCL_DEVICE_TARGETS}")
|
||||
else()
|
||||
set(_CMAKE_SYCL_DEVICE_TARGET_OPTION "-fsycl-targets=")
|
||||
string(REPLACE ";" "," _CMAKE_SYCL_DEVICE_TARGET_VALUE
|
||||
"${_CMAKE_SYCL_DEVICE_TARGETS}")
|
||||
endif()
|
||||
if(_CMAKE_SYCL_DEVICE_TARGETS)
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST
|
||||
"\"${_CMAKE_SYCL_DEVICE_TARGET_OPTION}${_CMAKE_SYCL_DEVICE_TARGET_VALUE}\" ${CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST}")
|
||||
string(REPLACE ";" "\\;" _CMAKE_SYCL_DEVICE_TARGET_VALUE
|
||||
"${_CMAKE_SYCL_DEVICE_TARGET_VALUE}")
|
||||
foreach(_flag IN LISTS CMAKE_SYCL_COMPILER_ID_TEST_FLAGS)
|
||||
# Subsequent attempts must not silently fall back to default targets.
|
||||
string(APPEND _CMAKE_SYCL_ID_TARGET_FLAGS
|
||||
"\"${_CMAKE_SYCL_DEVICE_TARGET_OPTION}${_CMAKE_SYCL_DEVICE_TARGET_VALUE}\" ${_flag};")
|
||||
endforeach()
|
||||
set(CMAKE_SYCL_COMPILER_ID_TEST_FLAGS "${_CMAKE_SYCL_ID_TARGET_FLAGS}")
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_COMPILER_NAME)
|
||||
unset(_CMAKE_SYCL_DEVICE_TARGET_OPTION)
|
||||
unset(_CMAKE_SYCL_DEVICE_TARGET_VALUE)
|
||||
unset(_CMAKE_SYCL_ID_TARGET_FLAGS)
|
||||
unset(_flag)
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILER_ID_RUN)
|
||||
set(CMAKE_SYCL_COMPILER_ID_RUN 1)
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_ID)
|
||||
set(CMAKE_SYCL_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_SYCL_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
list(APPEND CMAKE_SYCL_COMPILER_ID_VENDORS IAR)
|
||||
set(CMAKE_SYCL_COMPILER_ID_VENDOR_FLAGS_IAR )
|
||||
set(CMAKE_SYCL_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdSYCL/(\\./)?(CompilerIdSYCL.(framework|xctest|build/[^ \t\r\n]+)/)?CompilerIdSYCL[ \t\n\\\"]")
|
||||
set(CMAKE_SYCL_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
get_filename_component(_CMAKE_SYCL_COMPILER_NAME "${CMAKE_SYCL_COMPILER}" NAME_WE)
|
||||
if(_CMAKE_SYCL_COMPILER_NAME MATCHES "-cl$")
|
||||
string(APPEND CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST " -clang:-v")
|
||||
else()
|
||||
string(APPEND CMAKE_SYCL_COMPILER_ID_TEST_FLAGS_FIRST " -v")
|
||||
endif()
|
||||
unset(_CMAKE_SYCL_COMPILER_NAME)
|
||||
CMAKE_DETERMINE_COMPILER_ID(SYCL SYCLFLAGS CMakeSYCLCompilerId.sycl)
|
||||
|
||||
include(CMakeParseImplicitLinkInfo)
|
||||
cmake_parse_implicit_link_info2("${CMAKE_SYCL_COMPILER_PRODUCED_OUTPUT}" _CMAKE_SYCL_LINK_LOG ""
|
||||
LANGUAGE SYCL
|
||||
COMPUTE_IMPLICIT_LIBS CMAKE_SYCL_HOST_IMPLICIT_LINK_LIBRARIES
|
||||
COMPUTE_IMPLICIT_DIRS CMAKE_SYCL_HOST_IMPLICIT_LINK_DIRECTORIES
|
||||
COMPUTE_IMPLICIT_FWKS CMAKE_SYCL_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES)
|
||||
message(CONFIGURE_LOG "Parsed SYCL compiler-id link information:\n${_CMAKE_SYCL_LINK_LOG}\n")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_LIBRARIES}")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_DIRECTORIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_DIRECTORIES}")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}")
|
||||
include(Internal/CMakeSYCLFilterImplicitLibs)
|
||||
cmake_sycl_filter_implicit_libs(CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES)
|
||||
|
||||
_cmake_find_compiler_sysroot(SYCL)
|
||||
else()
|
||||
if(NOT DEFINED CMAKE_SYCL_COMPILER_FRONTEND_VARIANT)
|
||||
if(CMAKE_SYCL_COMPILER_ID STREQUAL "Clang" OR
|
||||
"x${CMAKE_SYCL_COMPILER_ID}" STREQUAL "xIntelLLVM")
|
||||
if("x${CMAKE_SYCL_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
set(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
elseif(CMAKE_SYCL_COMPILER_ID STREQUAL "AdaptiveCpp")
|
||||
set(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
else()
|
||||
set(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_SYCL_COMPILER}" PATH)
|
||||
endif()
|
||||
|
||||
if(NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
if(CMAKE_SYCL_COMPILER_ID MATCHES "GNU|Clang|IntelLLVM|QCC|LCC")
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_SYCL_COMPILER}" NAME)
|
||||
if(COMPILER_BASENAME MATCHES "^(.+-)?(dpclang\\+\\+|dpclang-cl|dpclang|clang\\+\\+|dpcpp|icpx|[gc]\\+\\+|clang-cl)(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3})
|
||||
set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
|
||||
elseif(CMAKE_SYCL_COMPILER_TARGET AND CMAKE_SYCL_COMPILER_ID MATCHES "Clang|IntelLLVM")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_SYCL_COMPILER_TARGET}-)
|
||||
endif()
|
||||
|
||||
if("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "SYCL")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_SYCL_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_SYCL_COMPILER_SYSROOT
|
||||
"set(CMAKE_SYCL_COMPILER_SYSROOT \"${CMAKE_SYCL_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_SYCL_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_SYCL_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
if(MSVC_SYCL_ARCHITECTURE_ID)
|
||||
set(SET_MSVC_SYCL_ARCHITECTURE_ID
|
||||
"set(MSVC_SYCL_ARCHITECTURE_ID ${MSVC_SYCL_ARCHITECTURE_ID})")
|
||||
endif()
|
||||
|
||||
# configure all variables set in this file
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeSYCLCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeSYCLCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_ENV_VAR "SYCLCXX")
|
||||
@@ -96,7 +96,7 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
endif()
|
||||
# Construct a regex to match linker lines. It must match both the
|
||||
# whole line and just the command (argv[0]).
|
||||
set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
|
||||
set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)(\\.exe)?\"?( |$)")
|
||||
set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
|
||||
|
||||
# Skip FASTBuild's output mangling, like:
|
||||
@@ -143,8 +143,8 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
if(linker_tool)
|
||||
# pick-up useful flags influencing linker behavior
|
||||
# these flags are meaningful only for LLVM and GNU linkers. Check will be done later
|
||||
if("${line}" MATCHES "-m ([a-zA-Z0-9]+)")
|
||||
list(APPEND linker_tool_arch -m "${CMAKE_MATCH_1}")
|
||||
if("${line}" MATCHES "(^|[ \t])-m[ \t]+([a-zA-Z0-9_]+)([ \t]|$)")
|
||||
list(APPEND linker_tool_arch -m "${CMAKE_MATCH_2}")
|
||||
string(APPEND log " link line: [${line}] ==> linker architecture flags [${linker_tool_arch}]\n")
|
||||
endif()
|
||||
endif()
|
||||
@@ -239,7 +239,12 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
list(APPEND implicit_libs_tmp ${lib})
|
||||
string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
|
||||
endif()
|
||||
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
|
||||
elseif("${arg}" MATCHES "^(-o|--output|-dynamic-linker|--dynamic-linker|-plugin|--plugin)$")
|
||||
# These paths are not implicit libraries, even when they name a
|
||||
# shared object (for example, the ELF interpreter or an LTO plugin).
|
||||
set(skip_value_of "${arg}")
|
||||
string(APPEND log " arg [${arg}] ==> ignore, skip following value\n")
|
||||
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so(\\.[0-9]+)*|dylib)$")
|
||||
if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
|
||||
# Unix library full path.
|
||||
list(APPEND implicit_libs_tmp ${arg})
|
||||
@@ -362,6 +367,10 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
|
||||
endif()
|
||||
if("x${lib}" MATCHES "^x(crt.*\\.o|gcc_eh.*|.*libgcc_eh.*|System.*|.*libclang_rt.*|msvcrt.*|libvcruntime.*|libucrt.*|libcmt.*)$")
|
||||
string(APPEND log " remove lib [${lib}]\n")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND
|
||||
lib MATCHES "libemscripten_js_symbols\\.so$")
|
||||
# This is a temporary symbol stub generated for this particular link.
|
||||
string(APPEND log " remove lib [${lib}]\n")
|
||||
elseif(search_static)
|
||||
# This library appears after a -Bstatic flag. Due to ordering
|
||||
# and filtering for mixed-language link lines, we do not preserve
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
set(CMAKE_SYCL_COMPILER "@CMAKE_SYCL_COMPILER@")
|
||||
set(CMAKE_SYCL_COMPILER_ARG1 "@CMAKE_SYCL_COMPILER_ARG1@")
|
||||
set(CMAKE_SYCL_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_SYCL_HOST_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_SYCL_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_SYCL_HOST_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_SYCL_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_SYCL_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
||||
set(CMAKE_SYCL_RUNTIME_LIBRARY_DEFAULT "@CMAKE_SYCL_RUNTIME_LIBRARY_DEFAULT@")
|
||||
set(CMAKE_SYCL_RUNTIME_LIBRARY_LINK_OPTIONS_DEFAULT "@CMAKE_SYCL_RUNTIME_LIBRARY_LINK_OPTIONS_DEFAULT@")
|
||||
set(CMAKE_SYCL_COMPILER_ID "@CMAKE_SYCL_COMPILER_ID@")
|
||||
set(CMAKE_SYCL_COMPILER_VERSION "@CMAKE_SYCL_COMPILER_VERSION@")
|
||||
set(CMAKE_SYCL_COMPILER_VERSION_INTERNAL "@CMAKE_SYCL_COMPILER_VERSION_INTERNAL@")
|
||||
set(_CMAKE_SYCL_DEVICE_TARGETS "@_CMAKE_SYCL_DEVICE_TARGETS@")
|
||||
set(CMAKE_SYCL_HOST_COMPILER_ID "@CMAKE_SYCL_HOST_COMPILER_ID@")
|
||||
set(CMAKE_SYCL_HOST_COMPILER_VERSION "@CMAKE_SYCL_HOST_COMPILER_VERSION@")
|
||||
set(CMAKE_SYCL_COMPILER_WRAPPER "@CMAKE_SYCL_COMPILER_WRAPPER@")
|
||||
set(CMAKE_SYCL_STANDARD_COMPUTED_DEFAULT "@CMAKE_SYCL_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_SYCL_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_SYCL_EXTENSIONS_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST "@CMAKE_SYCL_STANDARD_LATEST@")
|
||||
set(CMAKE_SYCL_COMPILE_FEATURES "@CMAKE_SYCL_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL98_COMPILE_FEATURES "@CMAKE_SYCL98_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL11_COMPILE_FEATURES "@CMAKE_SYCL11_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL14_COMPILE_FEATURES "@CMAKE_SYCL14_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL17_COMPILE_FEATURES "@CMAKE_SYCL17_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL20_COMPILE_FEATURES "@CMAKE_SYCL20_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL23_COMPILE_FEATURES "@CMAKE_SYCL23_COMPILE_FEATURES@")
|
||||
set(CMAKE_SYCL26_COMPILE_FEATURES "@CMAKE_SYCL26_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_SYCL_PLATFORM_ID "@CMAKE_SYCL_PLATFORM_ID@")
|
||||
set(CMAKE_SYCL_SIMULATE_ID "@CMAKE_SYCL_SIMULATE_ID@")
|
||||
set(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT "@CMAKE_SYCL_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_SYCL_COMPILER_APPLE_SYSROOT "@CMAKE_SYCL_COMPILER_APPLE_SYSROOT@")
|
||||
set(CMAKE_SYCL_SIMULATE_VERSION "@CMAKE_SYCL_SIMULATE_VERSION@")
|
||||
set(CMAKE_SYCL_COMPILER_ARCHITECTURE_ID "@CMAKE_SYCL_COMPILER_ARCHITECTURE_ID@")
|
||||
@_SET_CMAKE_SYCL_COMPILER_SYSROOT@
|
||||
@SET_MSVC_SYCL_ARCHITECTURE_ID@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_SYCL_COMPILER_AR "@CMAKE_SYCL_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_SYCL_COMPILER_RANLIB "@CMAKE_SYCL_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
|
||||
set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
|
||||
set(CMAKE_SYCL_COMPILER_LINKER "@CMAKE_SYCL_COMPILER_LINKER@")
|
||||
set(CMAKE_SYCL_COMPILER_LINKER_ARCHITECTURE_FLAGS "@CMAKE_SYCL_COMPILER_LINKER_ARCHITECTURE_FLAGS@")
|
||||
set(CMAKE_SYCL_COMPILER_LINKER_ID "@CMAKE_SYCL_COMPILER_LINKER_ID@")
|
||||
set(CMAKE_SYCL_COMPILER_LINKER_VERSION "@CMAKE_SYCL_COMPILER_LINKER_VERSION@")
|
||||
set(CMAKE_SYCL_COMPILER_LINKER_FRONTEND_VARIANT "@CMAKE_SYCL_COMPILER_LINKER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_TAPI "@CMAKE_TAPI@")
|
||||
set(CMAKE_SYCL_COMPILER_LOADED 1)
|
||||
set(CMAKE_SYCL_COMPILER_WORKS @CMAKE_SYCL_COMPILER_WORKS@)
|
||||
set(CMAKE_SYCL_ABI_COMPILED @CMAKE_SYCL_ABI_COMPILED@)
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_ENV_VAR "SYCLCXX")
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_SYCL_SOURCE_FILE_EXTENSIONS sycl)
|
||||
set(CMAKE_SYCL_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
|
||||
set(CMAKE_SYCL_LINKER_PREFERENCE 35)
|
||||
set(CMAKE_SYCL_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
set(CMAKE_SYCL_LINKER_DEPFILE_SUPPORTED @CMAKE_SYCL_LINKER_DEPFILE_SUPPORTED@)
|
||||
set(CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED @CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED@)
|
||||
set(CMAKE_SYCL_LINKER_PUSHPOP_STATE_SUPPORTED @CMAKE_SYCL_LINKER_PUSHPOP_STATE_SUPPORTED@)
|
||||
|
||||
set(CMAKE_SYCL_SIZEOF_DATA_PTR "@CMAKE_SYCL_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_SYCL_COMPILER_ABI "@CMAKE_SYCL_COMPILER_ABI@")
|
||||
set(CMAKE_SYCL_BYTE_ORDER "@CMAKE_SYCL_BYTE_ORDER@")
|
||||
set(CMAKE_SYCL_LIBRARY_ARCHITECTURE "@CMAKE_SYCL_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_SYCL_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_SYCL_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_SYCL_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_SYCL_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYCL_CL_SHOWINCLUDES_PREFIX "@CMAKE_SYCL_CL_SHOWINCLUDES_PREFIX@")
|
||||
if(CMAKE_SYCL_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_SYCL_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
@CMAKE_SYCL_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_SYCL_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_SYCL_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_SYCL_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_SYCL_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES "@CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_DIRECTORIES "@CMAKE_SYCL_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_SYCL_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
||||
set(CMAKE_SYCL_COMPILER_CLANG_RESOURCE_DIR "@CMAKE_SYCL_COMPILER_CLANG_RESOURCE_DIR@")
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for SYCL."
|
||||
#endif
|
||||
|
||||
#include "CMakeCompilerABI.h"
|
||||
#include <sycl/sycl.hpp>
|
||||
|
||||
class CMakeSYCLCompilerABI;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_sizeof_dptr[argc];
|
||||
require += info_byte_order_big_endian[argc];
|
||||
require += info_byte_order_little_endian[argc];
|
||||
#if defined(ABI_ID)
|
||||
require += info_abi[argc];
|
||||
#endif
|
||||
#if defined(ARCHITECTURE_ID)
|
||||
require += info_arch[argc];
|
||||
#endif
|
||||
(void)argv;
|
||||
sycl::queue queue;
|
||||
queue.single_task<CMakeSYCLCompilerABI>([] {}).wait();
|
||||
return require;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
/* This source file must have a .sycl extension so that CMake can classify it
|
||||
as SYCL during compiler identification. */
|
||||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for SYCL."
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
@CMAKE_SYCL_COMPILER_ID_CONTENT@
|
||||
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
@CMAKE_SYCL_COMPILER_ID_PLATFORM_CONTENT@
|
||||
@CMAKE_SYCL_COMPILER_ID_ERROR_FOR_TEST@
|
||||
|
||||
#ifdef HOST_COMPILER_ID
|
||||
char const* info_host_compiler = "INFO" ":" "host_compiler[" HOST_COMPILER_ID "]";
|
||||
#endif
|
||||
#ifdef HOST_COMPILER_VERSION_MAJOR
|
||||
char const info_host_compiler_version[] = {
|
||||
'I', 'N', 'F', 'O', ':','h','o','s','t','_',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
HOST_COMPILER_VERSION_MAJOR,
|
||||
# ifdef HOST_COMPILER_VERSION_MINOR
|
||||
'.', HOST_COMPILER_VERSION_MINOR,
|
||||
# ifdef HOST_COMPILER_VERSION_PATCH
|
||||
'.', HOST_COMPILER_VERSION_PATCH,
|
||||
# ifdef HOST_COMPILER_VERSION_TWEAK
|
||||
'.', HOST_COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
#define CXX_STD_98 199711L
|
||||
#define CXX_STD_11 201103L
|
||||
#define CXX_STD_14 201402L
|
||||
#define CXX_STD_17 201703L
|
||||
#define CXX_STD_20 202002L
|
||||
#define CXX_STD_23 202302L
|
||||
|
||||
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG)
|
||||
# if _MSVC_LANG > CXX_STD_17
|
||||
# define CXX_STD _MSVC_LANG
|
||||
# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
|
||||
# define CXX_STD CXX_STD_20
|
||||
# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17
|
||||
# define CXX_STD CXX_STD_20
|
||||
# elif _MSVC_LANG > CXX_STD_14
|
||||
# define CXX_STD CXX_STD_17
|
||||
# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD CXX_STD_14
|
||||
# elif defined(__INTEL_CXX11_MODE__)
|
||||
# define CXX_STD CXX_STD_11
|
||||
# else
|
||||
# define CXX_STD CXX_STD_98
|
||||
# endif
|
||||
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
|
||||
# if _MSVC_LANG > __cplusplus
|
||||
# define CXX_STD _MSVC_LANG
|
||||
# else
|
||||
# define CXX_STD __cplusplus
|
||||
# endif
|
||||
#elif defined(__NVCOMPILER)
|
||||
# if __cplusplus > CXX_STD_20 && defined(__cpp_pp_embed)
|
||||
# define CXX_STD (CXX_STD_23 + 1)
|
||||
# elif __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
|
||||
# define CXX_STD CXX_STD_20
|
||||
# else
|
||||
# define CXX_STD __cplusplus
|
||||
# endif
|
||||
#elif defined(__INTEL_COMPILER) || defined(__PGI)
|
||||
# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes)
|
||||
# define CXX_STD CXX_STD_17
|
||||
# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD CXX_STD_14
|
||||
# else
|
||||
# define CXX_STD __cplusplus
|
||||
# endif
|
||||
#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__)
|
||||
# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD CXX_STD_14
|
||||
# else
|
||||
# define CXX_STD __cplusplus
|
||||
# endif
|
||||
#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define CXX_STD CXX_STD_11
|
||||
#else
|
||||
# define CXX_STD __cplusplus
|
||||
#endif
|
||||
|
||||
const char* info_language_standard_default = "INFO" ":" "standard_default["
|
||||
#if CXX_STD > CXX_STD_23
|
||||
"26"
|
||||
#elif CXX_STD > CXX_STD_20
|
||||
"23"
|
||||
#elif CXX_STD > CXX_STD_17
|
||||
"20"
|
||||
#elif CXX_STD > CXX_STD_14
|
||||
"17"
|
||||
#elif CXX_STD > CXX_STD_11
|
||||
"14"
|
||||
#elif CXX_STD >= CXX_STD_11
|
||||
"11"
|
||||
#else
|
||||
"98"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
|
||||
defined(__TI_COMPILER_VERSION__) || defined(__RENESAS__)) && \
|
||||
!defined(__STRICT_ANSI__)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
#ifdef HOST_COMPILER_ID
|
||||
require += info_host_compiler[argc];
|
||||
#endif
|
||||
#ifdef HOST_COMPILER_VERSION_MAJOR
|
||||
require += info_host_compiler_version[argc];
|
||||
#endif
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
if(UNIX)
|
||||
set(CMAKE_SYCL_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_SYCL_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_SYCL_COMPILER_ID}-SYCL OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_SYCL_COMPILER}" NAME_WE)
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
if(CMAKE_SYCL_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_SYCL_COMPILER_ID}-SYCL-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if(NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_SYCL_COMPILER_ID}-SYCL OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if(NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(SYCL)
|
||||
endif()
|
||||
|
||||
if(NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if(NOT CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
message(FATAL_ERROR "Visual Studio SYCL support requires an MSVC-like compiler frontend.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_SIZEOF_DATA_PTR)
|
||||
foreach(f IN LISTS CMAKE_SYCL_ABI_FILES)
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_SYCL_ABI_FILES)
|
||||
endif()
|
||||
|
||||
if(_CMAKE_SYCL_REQUIRED_FLAG AND CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
foreach(rule CREATE_PREPROCESSED_SOURCE CREATE_ASSEMBLY_SOURCE)
|
||||
if(CMAKE_SYCL_${rule})
|
||||
string(REPLACE "<CMAKE_SYCL_COMPILER>" "<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG}"
|
||||
CMAKE_SYCL_${rule} "${CMAKE_SYCL_${rule}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_SYCL)
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_SYCL} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_SYCL "${_override}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYCL_FLAGS_INIT "$ENV{SYCLFLAGS} ${CMAKE_SYCL_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_SYCL_FLAGS "Flags used by the SYCL compiler")
|
||||
|
||||
if(CMAKE_SYCL_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_SYCL_STANDARD_LIBRARIES "${CMAKE_SYCL_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all SYCL applications.")
|
||||
mark_as_advanced(CMAKE_SYCL_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_SYCL_COMPILER_LAUNCHER})
|
||||
set(CMAKE_SYCL_COMPILER_LAUNCHER "$ENV{CMAKE_SYCL_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for SYCL.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_LINKER_LAUNCHER AND DEFINED ENV{CMAKE_SYCL_LINKER_LAUNCHER})
|
||||
set(CMAKE_SYCL_LINKER_LAUNCHER "$ENV{CMAKE_SYCL_LINKER_LAUNCHER}"
|
||||
CACHE STRING "Linker launcher for SYCL.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
_cmake_common_language_platform_flags(SYCL)
|
||||
|
||||
if(NOT CMAKE_SYCL_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_SYCL_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG} <CMAKE_SHARED_LIBRARY_SYCL_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_SYCL_CREATE_SHARED_MODULE ${CMAKE_SYCL_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SYCL_ARCHIVE_CREATE)
|
||||
set(CMAKE_SYCL_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_SYCL_ARCHIVE_APPEND)
|
||||
set(CMAKE_SYCL_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_SYCL_ARCHIVE_FINISH)
|
||||
set(CMAKE_SYCL_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILE_OBJECT)
|
||||
set(CMAKE_SYCL_COMPILE_OBJECT
|
||||
"<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_LINK_EXECUTABLE)
|
||||
set(CMAKE_SYCL_LINK_EXECUTABLE
|
||||
"<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_DEVICE_LINK_OPTIONS)
|
||||
set(CMAKE_SYCL_DEVICE_LINK_MODE DRIVER)
|
||||
set(CMAKE_SYCL_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_SYCL_LINKER_WRAPPER_FLAG})
|
||||
set(CMAKE_SYCL_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_SYCL_LINKER_WRAPPER_FLAG_SEP})
|
||||
set(CMAKE_SYCL_RESPONSE_FILE_DEVICE_LINK_FLAG "@")
|
||||
string(JOIN " " pic_options ${CMAKE_SYCL_COMPILE_OPTIONS_PIC})
|
||||
string(JOIN " " device_pic_options ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_PIC})
|
||||
string(JOIN " " device_options ${CMAKE_SYCL_DEVICE_LINK_OPTIONS})
|
||||
string(JOIN " " whole_archive ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_WHOLE_ARCHIVE})
|
||||
string(JOIN " " no_whole_archive ${CMAKE_SYCL_DEVICE_LINK_OPTIONS_NO_WHOLE_ARCHIVE})
|
||||
if(NOT CMAKE_SYCL_DEVICE_LINK_LIBRARY)
|
||||
set(CMAKE_SYCL_DEVICE_LINK_LIBRARY
|
||||
"<CMAKE_SYCL_COMPILER> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${pic_options} ${device_options} ${device_pic_options} -o <TARGET> ${whole_archive} <OBJECTS> <LINK_LIBRARIES> ${no_whole_archive}")
|
||||
endif()
|
||||
if(NOT CMAKE_SYCL_DEVICE_LINK_EXECUTABLE)
|
||||
set(CMAKE_SYCL_DEVICE_LINK_EXECUTABLE "${CMAKE_SYCL_DEVICE_LINK_LIBRARY}")
|
||||
endif()
|
||||
unset(device_options)
|
||||
unset(whole_archive)
|
||||
unset(no_whole_archive)
|
||||
unset(pic_options)
|
||||
unset(device_pic_options)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_VERBOSE_MAKEFILE)
|
||||
|
||||
set(CMAKE_SYCL_USE_LINKER_INFORMATION TRUE)
|
||||
|
||||
set(CMAKE_SYCL_INFORMATION_LOADED 1)
|
||||
@@ -0,0 +1,86 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_FORCED)
|
||||
set(CMAKE_SYCL_COMPILER_WORKS TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CMakeTestCompilerCommon)
|
||||
|
||||
set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
|
||||
if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
|
||||
endif()
|
||||
|
||||
unset(CMAKE_SYCL_COMPILER_WORKS CACHE)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ABI(SYCL ${CMAKE_ROOT}/Modules/CMakeSYCLCompilerABI.sycl)
|
||||
|
||||
if(CMAKE_SYCL_ABI_COMPILED)
|
||||
set(CMAKE_SYCL_COMPILER_WORKS TRUE)
|
||||
message(STATUS "Check for working SYCL compiler: ${CMAKE_SYCL_COMPILER} - skipped")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILER_WORKS)
|
||||
PrintTestCompilerStatus("SYCL")
|
||||
__TestCompiler_setTryCompileTargetType()
|
||||
string(CONCAT __TestCompiler_testSYCLCompilerSource
|
||||
"#ifndef __cplusplus\n"
|
||||
"# error \"The CMAKE_SYCL_COMPILER is not compiling as C++\"\n"
|
||||
"#endif\n"
|
||||
"#include <sycl/sycl.hpp>\n"
|
||||
"class CMakeSYCLCompilerTest;\n"
|
||||
"int main() {\n"
|
||||
" sycl::queue queue;\n"
|
||||
" queue.single_task<CMakeSYCLCompilerTest>([] {}).wait();\n"
|
||||
" return 0;\n"
|
||||
"}\n")
|
||||
unset(CMAKE_SYCL_COMPILER_WORKS)
|
||||
try_compile(CMAKE_SYCL_COMPILER_WORKS
|
||||
SOURCE_FROM_VAR testSYCLCompiler.sycl __TestCompiler_testSYCLCompilerSource
|
||||
NO_CACHE
|
||||
OUTPUT_VARIABLE __CMAKE_SYCL_COMPILER_OUTPUT)
|
||||
__TestCompiler_restoreTryCompileTargetType()
|
||||
unset(__TestCompiler_testSYCLCompilerSource)
|
||||
if(NOT CMAKE_SYCL_COMPILER_WORKS)
|
||||
PrintTestCompilerResult(CHECK_FAIL "broken")
|
||||
string(REPLACE "\n" "\n " _output "${__CMAKE_SYCL_COMPILER_OUTPUT}")
|
||||
message(FATAL_ERROR "The SYCL compiler\n \"${CMAKE_SYCL_COMPILER}\"\n"
|
||||
"is not able to compile a SYCL test program.\nIt fails "
|
||||
"with the following output:\n ${_output}\n\n"
|
||||
"CMake will not be able to correctly generate this project.")
|
||||
endif()
|
||||
PrintTestCompilerResult(CHECK_PASS "works")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES)
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_LIBRARIES}")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_DIRECTORIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_DIRECTORIES}")
|
||||
set(CMAKE_SYCL_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${CMAKE_SYCL_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}")
|
||||
endif()
|
||||
include(Internal/CMakeSYCLFilterImplicitLibs)
|
||||
cmake_sycl_filter_implicit_libs(CMAKE_SYCL_IMPLICIT_LINK_LIBRARIES)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_SUPPORT(SYCL)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_ROOT}/Modules/CMakeSYCLCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeSYCLCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeSYCLCompiler.cmake)
|
||||
|
||||
if(CMAKE_SYCL_SIZEOF_DATA_PTR)
|
||||
foreach(f ${CMAKE_SYCL_ABI_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_SYCL_ABI_FILES)
|
||||
endif()
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
|
||||
unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
|
||||
unset(__CMAKE_SYCL_COMPILER_OUTPUT)
|
||||
@@ -38,7 +38,7 @@ This module provides the following command:
|
||||
``<lang>``
|
||||
The language of the compiler used for the check. Supported languages
|
||||
are: ``C``, ``CXX``, ``CUDA``, ``Fortran``, ``HIP``, ``ISPC``, ``OBJC``,
|
||||
and ``OBJCXX``, and ``Swift``.
|
||||
``OBJCXX``, ``Swift``, and ``SYCL``.
|
||||
|
||||
.. versionadded:: 3.21
|
||||
Support for ``HIP`` language.
|
||||
@@ -46,6 +46,13 @@ This module provides the following command:
|
||||
.. versionadded:: 3.26
|
||||
Support for ``Swift`` language.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for ``SYCL`` language.
|
||||
|
||||
.. note::
|
||||
``SYCL`` support is experimental and gated by
|
||||
``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``<flag>``
|
||||
Compiler flag(s) to check. Multiple flags can be specified in one
|
||||
argument as a string using a :ref:`semicolon-separated list
|
||||
|
||||
@@ -92,6 +92,10 @@ macro(check_language lang)
|
||||
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
|
||||
|
||||
set(_input_variables "set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")\n")
|
||||
if("${lang}" STREQUAL "SYCL" AND DEFINED CMAKE_EXPERIMENTAL_SYCL)
|
||||
string(APPEND _input_variables
|
||||
"set(CMAKE_EXPERIMENTAL_SYCL \"${CMAKE_EXPERIMENTAL_SYCL}\")\n")
|
||||
endif()
|
||||
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list(REMOVE_ITEM _languages "NONE")
|
||||
if(NOT _languages STREQUAL "")
|
||||
|
||||
@@ -37,7 +37,7 @@ This module provides the following command:
|
||||
``<lang>``
|
||||
The language of the compiler used for the check. Supported languages are
|
||||
``C``, ``CXX``, ``CUDA``, ``Fortran``, ``HIP``, ``OBJC``, ``OBJCXX``,
|
||||
and ``Swift``.
|
||||
``Swift``, and ``SYCL``.
|
||||
|
||||
.. versionadded:: 3.19
|
||||
Support for ``CUDA`` language.
|
||||
@@ -48,6 +48,13 @@ This module provides the following command:
|
||||
.. versionadded:: 3.26
|
||||
Support for ``Swift`` language.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for ``SYCL`` language.
|
||||
|
||||
.. note::
|
||||
``SYCL`` support is experimental and gated by
|
||||
``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``<flag>``
|
||||
Linker flag(s) to check. Multiple flags can be specified in one
|
||||
argument as a string using a :ref:`semicolon-separated list
|
||||
|
||||
@@ -47,7 +47,7 @@ This module provides the following command:
|
||||
``<lang>``
|
||||
Language of the source code to check. Supported languages are:
|
||||
``C``, ``CXX``, ``CUDA``, ``Fortran``, ``HIP``, ``ISPC``, ``OBJC``,
|
||||
``OBJCXX``, and ``Swift``.
|
||||
``OBJCXX``, ``Swift``, and ``SYCL``.
|
||||
|
||||
.. versionadded:: 3.21
|
||||
Support for ``HIP`` language.
|
||||
@@ -55,6 +55,13 @@ This module provides the following command:
|
||||
.. versionadded:: 3.26
|
||||
Support for ``Swift`` language.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for ``SYCL`` language.
|
||||
|
||||
.. note::
|
||||
``SYCL`` support is experimental and gated by
|
||||
``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``<code>``
|
||||
The source code to check. This must be an entire program, as written
|
||||
in a file containing the body block. All symbols used in the source code
|
||||
|
||||
@@ -41,11 +41,18 @@ This module provides the following command:
|
||||
``<lang>``
|
||||
The programming language of the source ``<code>`` to check. Supported
|
||||
languages are: ``C``, ``CXX``, ``CUDA``, ``Fortran``, ``HIP``, ``OBJC``,
|
||||
and ``OBJCXX``.
|
||||
``OBJCXX``, and ``SYCL``.
|
||||
|
||||
.. versionadded:: 3.21
|
||||
Support for ``HIP`` language.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for ``SYCL`` language.
|
||||
|
||||
.. note::
|
||||
``SYCL`` support is experimental and gated by
|
||||
``CMAKE_EXPERIMENTAL_SYCL``.
|
||||
|
||||
``<code>``
|
||||
The source code to be tested. It must contain a valid source program.
|
||||
For example, it must contain at least a ``main()`` function (in C/C++),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
set(_compiler_id_pp_test "defined(__ADAPTIVECPP__) || defined(__ACPP__) || defined(__OPENSYCL__) || defined(__HIPSYCL__)")
|
||||
|
||||
set(_compiler_id_version_compute "
|
||||
# if __has_include(<AdaptiveCpp/common/config.hpp>)
|
||||
# include <AdaptiveCpp/common/config.hpp>
|
||||
# elif __has_include(<hipSYCL/common/config.hpp>)
|
||||
# include <hipSYCL/common/config.hpp>
|
||||
# endif
|
||||
# if defined(ACPP_VERSION_MAJOR)
|
||||
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(ACPP_VERSION_MAJOR)
|
||||
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(ACPP_VERSION_MINOR)
|
||||
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(ACPP_VERSION_PATCH)
|
||||
# elif defined(HIPSYCL_VERSION_MAJOR)
|
||||
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(HIPSYCL_VERSION_MAJOR)
|
||||
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(HIPSYCL_VERSION_MINOR)
|
||||
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(HIPSYCL_VERSION_PATCH)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
|
||||
# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
|
||||
# endif")
|
||||
|
||||
set(_compiler_id_simulate "
|
||||
# if defined(_MSC_VER)
|
||||
# define @PREFIX@SIMULATE_ID \"MSVC\"
|
||||
# endif")
|
||||
@@ -0,0 +1,8 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
set(_CMAKE_SYCL_ADAPTIVECPP_VERSION "${CMAKE_SYCL_COMPILER_VERSION}")
|
||||
set(CMAKE_SYCL_COMPILER_VERSION "${CMAKE_SYCL_HOST_COMPILER_VERSION}")
|
||||
include(Compiler/${CMAKE_SYCL_HOST_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
set(CMAKE_SYCL_COMPILER_VERSION "${_CMAKE_SYCL_ADAPTIVECPP_VERSION}")
|
||||
unset(_CMAKE_SYCL_ADAPTIVECPP_VERSION)
|
||||
@@ -0,0 +1,27 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
# Compiler options depend on the underlying compiler, not the AdaptiveCpp
|
||||
# release number. Restore the public version after initializing the options.
|
||||
set(_CMAKE_SYCL_ADAPTIVECPP_VERSION "${CMAKE_SYCL_COMPILER_VERSION}")
|
||||
set(CMAKE_SYCL_COMPILER_VERSION "${CMAKE_SYCL_HOST_COMPILER_VERSION}")
|
||||
set(_CMAKE_SYCL_REQUIRED_FLAG "")
|
||||
if(CMAKE_SYCL_HOST_COMPILER_ID STREQUAL "Clang")
|
||||
include(Compiler/Clang-SYCL)
|
||||
elseif(CMAKE_SYCL_HOST_COMPILER_ID STREQUAL "GNU")
|
||||
include(Compiler/GNU)
|
||||
__compiler_gnu(SYCL)
|
||||
__compiler_gnu_cxx_standards(SYCL)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN
|
||||
"-fvisibility-inlines-hidden")
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"AdaptiveCpp host compiler '${CMAKE_SYCL_HOST_COMPILER_ID}' is not supported.")
|
||||
endif()
|
||||
set(CMAKE_SYCL_COMPILER_VERSION "${_CMAKE_SYCL_ADAPTIVECPP_VERSION}")
|
||||
unset(_CMAKE_SYCL_ADAPTIVECPP_VERSION)
|
||||
|
||||
foreach(std IN ITEMS 98 11 14)
|
||||
unset(CMAKE_SYCL${std}_STANDARD_COMPILE_OPTION)
|
||||
unset(CMAKE_SYCL${std}_EXTENSION_COMPILE_OPTION)
|
||||
endforeach()
|
||||
@@ -143,6 +143,46 @@ macro(cmake_record_cxx_compile_features)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(cmake_record_sycl_compile_features)
|
||||
set(_result 0)
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL26_STANDARD_COMPILE_OPTION)
|
||||
_has_compiler_features_sycl(26)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL23_STANDARD_COMPILE_OPTION)
|
||||
_has_compiler_features_sycl(23)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL20_STANDARD_COMPILE_OPTION)
|
||||
_has_compiler_features_sycl(20)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL17_STANDARD_COMPILE_OPTION)
|
||||
_has_compiler_features_sycl(17)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL14_STANDARD_COMPILE_OPTION)
|
||||
if(CMAKE_SYCL14_STANDARD__HAS_FULL_SUPPORT)
|
||||
_has_compiler_features_sycl(14)
|
||||
else()
|
||||
_record_compiler_features_sycl(14)
|
||||
endif()
|
||||
unset(CMAKE_SYCL14_STANDARD__HAS_FULL_SUPPORT)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL11_STANDARD_COMPILE_OPTION)
|
||||
if(CMAKE_SYCL11_STANDARD__HAS_FULL_SUPPORT)
|
||||
_has_compiler_features_sycl(11)
|
||||
else()
|
||||
_record_compiler_features_sycl(11)
|
||||
endif()
|
||||
unset(CMAKE_SYCL11_STANDARD__HAS_FULL_SUPPORT)
|
||||
endif()
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_SYCL98_STANDARD_COMPILE_OPTION)
|
||||
if(CMAKE_SYCL98_STANDARD__HAS_FULL_SUPPORT)
|
||||
_has_compiler_features_sycl(98)
|
||||
else()
|
||||
_record_compiler_features_sycl(98)
|
||||
endif()
|
||||
unset(CMAKE_SYCL98_STANDARD__HAS_FULL_SUPPORT)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(cmake_record_cuda_compile_features)
|
||||
set(_result 0)
|
||||
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA26_STANDARD_COMPILE_OPTION)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
include(Compiler/Clang)
|
||||
__compiler_clang(SYCL)
|
||||
__compiler_clang_cxx_standards(SYCL)
|
||||
|
||||
if(NOT CMAKE_SYCL_COMPILER_ID STREQUAL "AdaptiveCpp")
|
||||
set(_CMAKE_SYCL_REQUIRED_FLAG "-fsycl")
|
||||
foreach(std IN ITEMS 98 11 14)
|
||||
unset(CMAKE_SYCL${std}_STANDARD_COMPILE_OPTION)
|
||||
unset(CMAKE_SYCL${std}_EXTENSION_COMPILE_OPTION)
|
||||
endforeach()
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 24)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_SEPARABLE_COMPILATION_ON "-fgpu-rdc")
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_SEPARABLE_COMPILATION_OFF "-fno-gpu-rdc")
|
||||
endif()
|
||||
set(CMAKE_SYCL_COMPILER_HAS_DEVICE_LINK_PHASE FALSE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN
|
||||
"-fvisibility-inlines-hidden")
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND "${CMAKE_SYCL_COMPILER}")
|
||||
if(CMAKE_SYCL_COMPILER_ARG1)
|
||||
separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_SYCL_COMPILER_ARG1}")
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
|
||||
unset(_COMPILER_ARGS)
|
||||
endif()
|
||||
if(CMAKE_SYCL_COMPILER_TARGET)
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_LESS 3.4.0)
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND
|
||||
"-target" "${CMAKE_SYCL_COMPILER_TARGET}")
|
||||
else()
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND
|
||||
"--target=${CMAKE_SYCL_COMPILER_TARGET}")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND
|
||||
${_CMAKE_SYCL_REQUIRED_FLAG} "-x" "c++" "-w" "-dM" "-E"
|
||||
"${CMAKE_ROOT}/Modules/CMakeSYCLCompilerABI.sycl")
|
||||
@@ -18,6 +18,7 @@ set(__pch_header_OBJCXX "objective-c++-header")
|
||||
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_SYCL_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
macro(__compiler_clang lang)
|
||||
endmacro()
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
include(Compiler/IntelLLVM)
|
||||
__compiler_intel_llvm(SYCL)
|
||||
|
||||
set(_CMAKE_SYCL_REQUIRED_FLAG "-fsycl")
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2026.0)
|
||||
set(CMAKE_SYCL_COMPILER_HAS_DEVICE_LINK_PHASE TRUE)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_SEPARABLE_COMPILATION_ON "-fgpu-rdc")
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_SEPARABLE_COMPILATION_OFF "-fno-gpu-rdc")
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS
|
||||
"-fsycl;-fsycl-link")
|
||||
if(NOT CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS_PIC "-shared")
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS_WHOLE_ARCHIVE "-Wl,--whole-archive")
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS_NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive")
|
||||
else()
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS_WHOLE_ARCHIVE
|
||||
"-Qoption,link,--whole-archive")
|
||||
set(CMAKE_SYCL_DEVICE_LINK_OPTIONS_NO_WHOLE_ARCHIVE
|
||||
"-Qoption,link,--no-whole-archive")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN
|
||||
"-fvisibility-inlines-hidden")
|
||||
|
||||
set(CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND "${CMAKE_SYCL_COMPILER}")
|
||||
if(CMAKE_SYCL_COMPILER_ARG1)
|
||||
separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_SYCL_COMPILER_ARG1}")
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS})
|
||||
unset(_COMPILER_ARGS)
|
||||
endif()
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND
|
||||
${_CMAKE_SYCL_REQUIRED_FLAG} "-x" "c++" "-w" "-dM" "-E"
|
||||
"${CMAKE_ROOT}/Modules/CMakeSYCLCompilerABI.sycl")
|
||||
if(CMAKE_SYCL_COMPILER_TARGET)
|
||||
list(APPEND CMAKE_SYCL_COMPILER_PREDEFINES_COMMAND
|
||||
"--target=${CMAKE_SYCL_COMPILER_TARGET}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
set(CMAKE_SYCL17_STANDARD_COMPILE_OPTION "-std=c++17")
|
||||
set(CMAKE_SYCL17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
|
||||
|
||||
set(CMAKE_SYCL20_STANDARD_COMPILE_OPTION "-std=c++20")
|
||||
set(CMAKE_SYCL20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
|
||||
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 20)
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
|
||||
set(CMAKE_SYCL23_STANDARD_COMPILE_OPTION "-std=c++23")
|
||||
set(CMAKE_SYCL23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 23)
|
||||
elseif(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
|
||||
set(CMAKE_SYCL23_STANDARD_COMPILE_OPTION "-std=c++2b")
|
||||
set(CMAKE_SYCL23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 23)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
|
||||
set(CMAKE_SYCL26_STANDARD_COMPILE_OPTION "-std=c++26")
|
||||
set(CMAKE_SYCL26_EXTENSION_COMPILE_OPTION "-std=gnu++26")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 26)
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_SYCL17_STANDARD_COMPILE_OPTION "-Qstd:c++17")
|
||||
set(CMAKE_SYCL17_EXTENSION_COMPILE_OPTION "-Qstd:c++17")
|
||||
|
||||
set(CMAKE_SYCL20_STANDARD_COMPILE_OPTION "-Qstd:c++20")
|
||||
set(CMAKE_SYCL20_EXTENSION_COMPILE_OPTION "-Qstd:c++20")
|
||||
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 20)
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
|
||||
set(CMAKE_SYCL23_STANDARD_COMPILE_OPTION "-Qstd=c++23")
|
||||
set(CMAKE_SYCL23_EXTENSION_COMPILE_OPTION "-Qstd=c++23")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 23)
|
||||
elseif(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
|
||||
set(CMAKE_SYCL23_STANDARD_COMPILE_OPTION "-Qstd:c++2b")
|
||||
set(CMAKE_SYCL23_EXTENSION_COMPILE_OPTION "-Qstd:c++2b")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 23)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
|
||||
set(CMAKE_SYCL26_STANDARD_COMPILE_OPTION "-Qstd=c++26")
|
||||
set(CMAKE_SYCL26_EXTENSION_COMPILE_OPTION "-Qstd=c++26")
|
||||
set(CMAKE_SYCL_STANDARD_LATEST 26)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
set(_CMAKE_SYCL_NDEBUG_FLAG " /DNDEBUG")
|
||||
else()
|
||||
set(_CMAKE_SYCL_NDEBUG_FLAG " -DNDEBUG")
|
||||
endif()
|
||||
string(APPEND CMAKE_SYCL_FLAGS_MINSIZEREL_INIT "${_CMAKE_SYCL_NDEBUG_FLAG}")
|
||||
string(APPEND CMAKE_SYCL_FLAGS_RELEASE_INIT "${_CMAKE_SYCL_NDEBUG_FLAG}")
|
||||
string(APPEND CMAKE_SYCL_FLAGS_RELWITHDEBINFO_INIT "${_CMAKE_SYCL_NDEBUG_FLAG}")
|
||||
unset(_CMAKE_SYCL_NDEBUG_FLAG)
|
||||
|
||||
__compiler_check_default_language_standard(SYCL 2020 17)
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|@id_platform@">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>@id_platform@</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
|
||||
<RootNamespace>CompilerIdSYCL</RootNamespace>
|
||||
<Keyword>@id_keyword@</Keyword>
|
||||
@id_system@
|
||||
@id_system_version@
|
||||
@id_WindowsTargetPlatformVersion@
|
||||
@id_WindowsSDKDesktopARMSupport@
|
||||
@id_ToolsetVCTargetsDir@
|
||||
@id_CustomGlobals@
|
||||
<CMakeSYCLLink>true</CMakeSYCLLink>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@id_toolset_version_props@
|
||||
<PropertyGroup>
|
||||
@id_PreferredToolArchitecture@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
@id_toolset@
|
||||
@id_api_level@
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<PropertyGroup>
|
||||
<CLToolExe>@CMAKE_SYCL_COMPILER@</CLToolExe>
|
||||
<SYCLToolExe>$(CLToolExe)</SYCLToolExe>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="@CMAKE_ROOT@/Templates/MSBuild/sycl.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<AdditionalOptions>%(AdditionalOptions) -fsycl</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>$(OutDir)CompilerIdSYCL.exe</OutputFile>
|
||||
<ToolExe>$(SYCLToolExe)</ToolExe>
|
||||
<AdditionalOptions>-fsycl -clang:-v /MDd /nologo __CMAKE_SYCL_OBJECTS__ /Fe"$(OutDir)CompilerIdSYCL.exe" /link /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFEST:EMBED</AdditionalOptions>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>@id_PostBuildEvent_Command@</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="@id_src@" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="@CMAKE_ROOT@/Templates/MSBuild/sycl.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
# Re-configure to save learned information.
|
||||
configure_file(
|
||||
${CMAKE_ROOT}/Modules/CMakeSYCLCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeSYCLCompiler.cmake
|
||||
@ONLY)
|
||||
@@ -0,0 +1,15 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
macro(cmake_sycl_filter_implicit_libs variable)
|
||||
foreach(library IN LISTS ${variable})
|
||||
if(library MATCHES "^sycl([0-9]+d?|-devicelib-host)?([.]lib)?$")
|
||||
list(APPEND CMAKE_SYCL_RUNTIME_LIBRARY_LINK_OPTIONS_DEFAULT "${library}")
|
||||
list(REMOVE_ITEM ${variable} "${library}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(CMAKE_SYCL_RUNTIME_LIBRARY_LINK_OPTIONS_DEFAULT)
|
||||
list(REMOVE_DUPLICATES CMAKE_SYCL_RUNTIME_LIBRARY_LINK_OPTIONS_DEFAULT)
|
||||
set(CMAKE_SYCL_RUNTIME_LIBRARY_DEFAULT DEFAULT)
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,39 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file sets the basic flags for the linker used by the SYCL compiler in CMake.
|
||||
# It also loads the available platform file for the system-linker
|
||||
# if it exists.
|
||||
# It also loads a system - linker - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(Internal/CMakeCommonLinkerInformation)
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
# Load linker-specific information.
|
||||
if(CMAKE_SYCL_COMPILER_LINKER_ID)
|
||||
include(Linker/${CMAKE_SYCL_COMPILER_LINKER_ID}-SYCL OPTIONAL)
|
||||
endif()
|
||||
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYCL_COMPILER_LINKER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_SYCL_COMPILER_LINKER_ID}-SYCL-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
|
||||
|
||||
# load the system- and linker specific files
|
||||
if(CMAKE_SYCL_COMPILER_LINKER_ID)
|
||||
include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_SYCL_COMPILER_LINKER_ID}-SYCL
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
|
||||
# We specify the platform linker information in the system file.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-SYCL OPTIONAL)
|
||||
endif ()
|
||||
|
||||
_cmake_common_linker_platform_flags(SYCL)
|
||||
|
||||
set(CMAKE_SYCL_LINKER_INFORMATION_LOADED 1)
|
||||
@@ -27,6 +27,13 @@ macro(CMAKE_CHECK_FLAG_COMMON_INIT _FUNC _LANG _SRC _PATTERNS)
|
||||
FAIL_REGEX "command[ -]line option [^\n]* is valid for [^\n]* but not for C\\+\\+" # Host GNU
|
||||
FAIL_REGEX "argument unused during compilation: [^\n]*" # Clang
|
||||
)
|
||||
elseif("${_LANG}" STREQUAL "SYCL")
|
||||
set(${_SRC} "int main() { return 0; }")
|
||||
set(${_PATTERNS}
|
||||
FAIL_REGEX "command[ -]line option [^\n]* is valid for [^\n]* but not for C\\+\\+"
|
||||
FAIL_REGEX "-Werror=[^\n]* argument [^\n]* is not valid for C\\+\\+"
|
||||
FAIL_REGEX "argument unused during compilation: [^\n]*" # Clang
|
||||
)
|
||||
elseif("${_LANG}" STREQUAL "Fortran")
|
||||
set(${_SRC} " program test\n stop\n end program")
|
||||
set(${_PATTERNS}
|
||||
|
||||
@@ -16,6 +16,9 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
|
||||
elseif(_lang STREQUAL "CUDA")
|
||||
set(_lang_textual "CUDA")
|
||||
set(_lang_ext "cu")
|
||||
elseif(_lang STREQUAL "SYCL")
|
||||
set(_lang_textual "SYCL")
|
||||
set(_lang_ext "sycl")
|
||||
elseif(_lang STREQUAL "Fortran")
|
||||
set(_lang_textual "Fortran")
|
||||
set(_lang_ext "F90")
|
||||
|
||||
@@ -16,6 +16,9 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
|
||||
elseif(_lang STREQUAL "CUDA")
|
||||
set(_lang_textual "CUDA")
|
||||
set(_lang_ext "cu")
|
||||
elseif(_lang STREQUAL "SYCL")
|
||||
set(_lang_textual "SYCL")
|
||||
set(_lang_ext "sycl")
|
||||
elseif(_lang STREQUAL "Fortran")
|
||||
set(_lang_textual "Fortran")
|
||||
set(_lang_ext "F90")
|
||||
|
||||
@@ -90,6 +90,16 @@ macro(_record_compiler_features_cxx std)
|
||||
unset(lang_level_has_features)
|
||||
endmacro()
|
||||
|
||||
macro(_record_compiler_features_sycl std)
|
||||
list(APPEND CMAKE_SYCL${std}_COMPILE_FEATURES sycl_cxx_std_${std})
|
||||
|
||||
get_property(lang_level_has_features GLOBAL PROPERTY CMAKE_SYCL${std}_KNOWN_FEATURES)
|
||||
if(lang_level_has_features)
|
||||
_record_compiler_features(SYCL "${CMAKE_SYCL${std}_STANDARD_COMPILE_OPTION}" CMAKE_SYCL${std}_COMPILE_FEATURES)
|
||||
endif()
|
||||
unset(lang_level_has_features)
|
||||
endmacro()
|
||||
|
||||
macro(_record_compiler_features_cuda std)
|
||||
list(APPEND CMAKE_CUDA${std}_COMPILE_FEATURES cuda_std_${std})
|
||||
|
||||
@@ -124,6 +134,20 @@ macro(_has_compiler_features_cxx std)
|
||||
list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std})
|
||||
_has_compiler_features(CXX ${std} "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES)
|
||||
endmacro()
|
||||
macro(_has_compiler_features_sycl std)
|
||||
list(APPEND CMAKE_SYCL${std}_COMPILE_FEATURES sycl_cxx_std_${std})
|
||||
_has_compiler_features(SYCL ${std} "${CMAKE_SYCL${std}_STANDARD_COMPILE_OPTION}" CMAKE_SYCL${std}_COMPILE_FEATURES)
|
||||
if(${std} GREATER_EQUAL 17)
|
||||
# SYCL starts at C++17, which includes all granular C++98/11/14 features.
|
||||
foreach(previous_std IN ITEMS 98 11 14)
|
||||
get_property(previous_features GLOBAL PROPERTY
|
||||
CMAKE_CXX${previous_std}_KNOWN_FEATURES)
|
||||
list(APPEND CMAKE_SYCL${std}_COMPILE_FEATURES ${previous_features})
|
||||
endforeach()
|
||||
unset(previous_features)
|
||||
unset(previous_std)
|
||||
endif()
|
||||
endmacro()
|
||||
macro(_has_compiler_features_cuda std)
|
||||
list(APPEND CMAKE_CUDA${std}_COMPILE_FEATURES cuda_std_${std})
|
||||
_has_compiler_features(CUDA ${std} "${CMAKE_CUDA${std}_STANDARD_COMPILE_OPTION}" CMAKE_CUDA${std}_COMPILE_FEATURES)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Windows-Clang-SYCL)
|
||||
@@ -0,0 +1,34 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
include(Platform/Windows-Clang)
|
||||
set(_COMPILE_SYCL_MSVC " ${_CMAKE_SYCL_REQUIRED_FLAG}")
|
||||
__windows_compiler_clang(SYCL)
|
||||
if(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" AND
|
||||
CMAKE_SYCL_SIMULATE_ID STREQUAL "MSVC")
|
||||
unset(CMAKE_INCLUDE_SYSTEM_FLAG_SYCL_WARNING)
|
||||
if(CMAKE_SYCL_COMPILER_ID MATCHES "^(Clang|IntelLLVM)$")
|
||||
# Let the driver apply CRT defines to the host compilation only and select
|
||||
# the matching libsycl dependency, including the debug runtime.
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -fms-runtime-lib=static)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -fms-runtime-lib=dll)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -fms-runtime-lib=static_dbg)
|
||||
set(CMAKE_SYCL_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -fms-runtime-lib=dll_dbg)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
|
||||
string(REPLACE "<CMAKE_SYCL_COMPILER>" "<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG}"
|
||||
CMAKE_SYCL_${rule} "${CMAKE_SYCL_${rule}}")
|
||||
# Let the SYCL driver add its runtime libraries.
|
||||
string(REPLACE "-nostartfiles -nostdlib " ""
|
||||
CMAKE_SYCL_${rule} "${CMAKE_SYCL_${rule}}")
|
||||
endforeach()
|
||||
unset(rule)
|
||||
set(CMAKE_SYCL_VERBOSE_FLAG "-v")
|
||||
else()
|
||||
__windows_compiler_clang_msvc_offload_link(SYCL "${_CMAKE_SYCL_REQUIRED_FLAG}" "")
|
||||
set(CMAKE_SYCL_VERBOSE_FLAG "-clang:-v")
|
||||
endif()
|
||||
unset(_COMPILE_SYCL_MSVC)
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
# This module is shared by multiple languages; use include blocker.
|
||||
if(__WINDOWS_CLANG)
|
||||
# A later enable_language() may introduce another compiler frontend.
|
||||
__verify_same_language_values(COMPILER_FRONTEND_VARIANT "C;CXX;CUDA;HIP;SYCL"
|
||||
"The current configuration uses the Clang compiler "
|
||||
"tool with mixed frontend variants, both the GNU and in MSVC CL "
|
||||
"like variants. This is not supported. Use either clang/clang++ "
|
||||
"or clang-cl as all C, C++, CUDA, HIP, and/or SYCL compilers.")
|
||||
return()
|
||||
endif()
|
||||
set(__WINDOWS_CLANG 1)
|
||||
@@ -192,18 +198,19 @@ endfunction()
|
||||
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_HIP_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
OR "x${CMAKE_HIP_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_SYCL_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
|
||||
__verify_same_language_values(COMPILER_ID "C;CXX;HIP"
|
||||
"The current configuration mixes Clang and MSVC or "
|
||||
"some other CL compatible compiler tool. This is not supported. "
|
||||
"Use either Clang or MSVC as the compiler for all of C, C++, and/or HIP.")
|
||||
|
||||
__verify_same_language_values(COMPILER_FRONTEND_VARIANT "C;CXX;CUDA;HIP"
|
||||
__verify_same_language_values(COMPILER_FRONTEND_VARIANT "C;CXX;CUDA;HIP;SYCL"
|
||||
"The current configuration uses the Clang compiler "
|
||||
"tool with mixed frontend variants, both the GNU and in MSVC CL "
|
||||
"like variants. This is not supported. Use either clang/clang++ "
|
||||
"or clang-cl as all C, C++, CUDA, and/or HIP compilers.")
|
||||
"or clang-cl as all C, C++, CUDA, HIP, and/or SYCL compilers.")
|
||||
|
||||
if(NOT CMAKE_RC_COMPILER_INIT)
|
||||
# Check if rc is already in the path
|
||||
@@ -226,7 +233,8 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_CUDA_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_HIP_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
|
||||
OR "x${CMAKE_HIP_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"
|
||||
OR "x${CMAKE_SYCL_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
|
||||
|
||||
include(Platform/Windows-MSVC)
|
||||
# Set the clang option forwarding prefix for clang-cl usage in the llvm-rc processing stage
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||
|
||||
if(CMAKE_SYCL_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
||||
include(Platform/Windows-Clang-SYCL)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(Platform/Windows-IntelLLVM)
|
||||
include(Platform/Windows-Clang)
|
||||
set(_COMPILE_SYCL " ${_CMAKE_SYCL_REQUIRED_FLAG}")
|
||||
__windows_compiler_intel(SYCL)
|
||||
|
||||
foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
|
||||
string(REPLACE "<CMAKE_SYCL_COMPILER>" "<CMAKE_SYCL_COMPILER> ${_CMAKE_SYCL_REQUIRED_FLAG}"
|
||||
CMAKE_SYCL_${rule} "${CMAKE_SYCL_${rule}}")
|
||||
endforeach()
|
||||
unset(rule)
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# Use the same clang-cl driver/linker boundary as Clang's offload rules.
|
||||
__windows_compiler_clang_msvc_offload_link(SYCL "${_CMAKE_SYCL_REQUIRED_FLAG}" "")
|
||||
endif()
|
||||
unset(_COMPILE_SYCL)
|
||||
@@ -41,9 +41,9 @@ macro(__windows_compiler_intel lang)
|
||||
set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LIBRARY_PATH_FLAG}")
|
||||
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> <FLAGS> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
|
||||
"${_CMAKE_VS_LINK_DLL}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
|
||||
"${_CMAKE_VS_LINK_DLL}<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
|
||||
if (NOT "${lang}" STREQUAL "Fortran" OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1)
|
||||
# The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1
|
||||
|
||||
@@ -394,17 +394,17 @@ unset(__WINDOWS_MSVC_CMP0184)
|
||||
|
||||
# Use manifest directly on the linker's command line.
|
||||
set(_CMAKE_FASTBUILD_MANIFESTS "")
|
||||
if(CMAKE_GENERATOR MATCHES "FASTBuild")
|
||||
if(CMAKE_GENERATOR MATCHES "FASTBuild|Visual Studio")
|
||||
string(APPEND _CMAKE_FASTBUILD_MANIFESTS " <MANIFESTS>")
|
||||
endif()
|
||||
|
||||
macro(__windows_compiler_msvc lang)
|
||||
if(NOT MSVC_VERSION LESS 1400 AND NOT CMAKE_GENERATOR MATCHES "FASTBuild")
|
||||
if(NOT MSVC_VERSION LESS 1400 AND NOT CMAKE_GENERATOR MATCHES "FASTBuild|Visual Studio")
|
||||
# for 2005 make sure the manifest is put in the dll with mt
|
||||
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --msvc-ver=${MSVC_VERSION} --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
|
||||
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --msvc-ver=${MSVC_VERSION} --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ")
|
||||
endif()
|
||||
if (CMAKE_GENERATOR MATCHES "FASTBuild")
|
||||
if (CMAKE_GENERATOR MATCHES "FASTBuild|Visual Studio")
|
||||
set(CMAKE_${lang}_LINKER_MANIFEST_FLAG " /MANIFEST:EMBED /MANIFESTINPUT:")
|
||||
endif()
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "")
|
||||
@@ -497,6 +497,7 @@ macro(__windows_compiler_msvc lang)
|
||||
if("x${lang}" STREQUAL "xC" OR
|
||||
"x${lang}" STREQUAL "xCXX" OR
|
||||
"x${lang}" STREQUAL "xHIP" OR
|
||||
"x${lang}" STREQUAL "xSYCL" OR
|
||||
("x${lang}" STREQUAL "xCUDA" AND
|
||||
CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
|
||||
if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
|
||||
|
||||
@@ -551,6 +551,16 @@ Entry const kEntries[] = {
|
||||
"If true, exclude build tree from Sublime Text 2 .sublime-project file if build tree is inside source tree."_s },
|
||||
{ "CMAKE_SUPPRESS_REGENERATION"_s,
|
||||
"If true, CMake does not add special regeneration target or perform build system checks for source changes."_s },
|
||||
{ "CMAKE_SYCL_CXX_STANDARD"_s,
|
||||
"Default value used to initialize the SYCL_CXX_STANDARD target property when a target is created. See the cmake-compile-features(7) manual for the list of supported standards and compilers."_s },
|
||||
{ "CMAKE_SYCL_CXX_STANDARD_REQUIRED"_s,
|
||||
"Default value for SYCL_CXX_STANDARD_REQUIRED target property if set when a target is created. See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers."_s },
|
||||
{ "CMAKE_SYCL_EXTENSIONS"_s,
|
||||
"Default value for SYCL_EXTENSIONS target property if set when a target is created. See the cmake-compile-features(7) manual for information on compile features and a list of supported compilers."_s },
|
||||
{ "CMAKE_SYCL_RESOLVE_DEVICE_SYMBOLS"_s,
|
||||
"Default value for SYCL_RESOLVE_DEVICE_SYMBOLS target property if set when a target is created."_s },
|
||||
{ "CMAKE_SYCL_SEPARABLE_COMPILATION"_s,
|
||||
"Default value for SYCL_SEPARABLE_COMPILATION target property if set when a target is created."_s },
|
||||
{ "CMAKE_SYSROOT"_s,
|
||||
"Path passed to the compiler via --sysroot (when supported) and used as a prefix for find_*() searches. May only be set in a toolchain file (CMAKE_TOOLCHAIN_FILE)."_s },
|
||||
{ "CMAKE_SYSTEM_NAME"_s,
|
||||
|
||||
@@ -427,7 +427,8 @@ std::vector<std::string> cmCommonTargetGenerator::GetCompilerLauncher(
|
||||
{
|
||||
std::vector<std::string> compilerLauncher;
|
||||
if (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
|
||||
lang == "HIP" || lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX") {
|
||||
lang == "HIP" || lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX" ||
|
||||
lang == "SYCL") {
|
||||
// FIXME(#27402,#28110): The FASTBuild generator's limitations w.r.t.
|
||||
// shell escaping and command line ordering means we can't support
|
||||
// wrappers for now.
|
||||
|
||||
@@ -1113,8 +1113,24 @@ void cmComputeLinkDepends::AddLinkEntries(cm::optional<size_t> depender_index,
|
||||
dependee_index = ale.first;
|
||||
LinkEntry& entry = this->EntryList[dependee_index];
|
||||
bool supportedItem = true;
|
||||
auto const& itemFeature =
|
||||
std::string itemFeature =
|
||||
this->GetCurrentFeature(entry.Item.Value, item.Feature);
|
||||
if (entry.Target &&
|
||||
entry.Target->GetType() == cm::TargetType::STATIC_LIBRARY &&
|
||||
entry.Target->GetPropertyAsBool("SYCL_RESOLVE_DEVICE_SYMBOLS") &&
|
||||
(entry.Target->IsImported() ||
|
||||
entry.Target->Makefile->IsOn(
|
||||
"CMAKE_SYCL_COMPILER_HAS_DEVICE_LINK_PHASE"))) {
|
||||
if (itemFeature != LinkEntry::DEFAULT &&
|
||||
itemFeature != "WHOLE_ARCHIVE") {
|
||||
this->CMakeInstance->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Finalized SYCL static library \"", entry.Item.Value,
|
||||
"\" requires the WHOLE_ARCHIVE link-library feature."),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
itemFeature = "WHOLE_ARCHIVE";
|
||||
}
|
||||
if (group && ale.second && entry.Target &&
|
||||
(entry.Target->GetType() == cm::TargetType::OBJECT_LIBRARY ||
|
||||
entry.Target->GetType() == cm::TargetType::INTERFACE_LIBRARY)) {
|
||||
|
||||
@@ -1052,11 +1052,9 @@ void cmComputeLinkInformation::AddImplicitLinkInfo()
|
||||
this->Target->GetLinkClosure(this->Config);
|
||||
for (std::string const& li : lc->Languages) {
|
||||
|
||||
if (li == "CUDA" || li == "HIP") {
|
||||
if (li == "CUDA" || li == "HIP" || li == "SYCL") {
|
||||
// These need to go before the other implicit link information
|
||||
// as they could require symbols from those other library
|
||||
// Currently restricted as CUDA and HIP are the only languages
|
||||
// we have documented runtime behavior controls for
|
||||
this->AddRuntimeLinkLibrary(li);
|
||||
}
|
||||
|
||||
@@ -1092,6 +1090,10 @@ std::string const gcc_s_asneeded = "gcc_s_asneeded";
|
||||
|
||||
void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
|
||||
{
|
||||
std::string const& libraries = this->Makefile->GetSafeDefinition(
|
||||
cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_LIBRARIES"));
|
||||
std::string const& directories = this->Makefile->GetSafeDefinition(
|
||||
cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_DIRECTORIES"));
|
||||
auto const impliedByLinkerLanguage = [this](std::string const& lib) -> bool {
|
||||
if (cm::contains(this->ImplicitLinkLibs, lib)) {
|
||||
return true;
|
||||
@@ -1109,9 +1111,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
|
||||
|
||||
// Add libraries for this language that are not implied by the
|
||||
// linker language.
|
||||
std::string libVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_LIBRARIES");
|
||||
if (cmValue libs = this->Makefile->GetDefinition(libVar)) {
|
||||
cmList libsList{ *libs };
|
||||
if (!libraries.empty()) {
|
||||
cmList libsList{ libraries };
|
||||
for (std::string const& i : libsList) {
|
||||
if (!impliedByLinkerLanguage(i)) {
|
||||
this->AddItem({ i });
|
||||
@@ -1121,9 +1122,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
|
||||
|
||||
// Add linker search paths for this language that are not
|
||||
// implied by the linker language.
|
||||
std::string dirVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_DIRECTORIES");
|
||||
if (cmValue dirs = this->Makefile->GetDefinition(dirVar)) {
|
||||
cmList dirsList{ *dirs };
|
||||
if (!directories.empty()) {
|
||||
cmList dirsList{ directories };
|
||||
this->OrderLinkerSearchPath->AddLanguageDirectories(dirsList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
namespace {
|
||||
constexpr char const* unique_binary_directory = "CMAKE_BINARY_DIR_USE_MKDTEMP";
|
||||
|
||||
std::array<cm::string_view, 9> const kLanguageNames{ {
|
||||
std::array<cm::string_view, 10> const kLanguageNames{ {
|
||||
"C"_s,
|
||||
"CUDA"_s,
|
||||
"CXX"_s,
|
||||
@@ -49,6 +49,7 @@ std::array<cm::string_view, 9> const kLanguageNames{ {
|
||||
"ISPC"_s,
|
||||
"OBJC"_s,
|
||||
"OBJCXX"_s,
|
||||
"SYCL"_s,
|
||||
"Swift"_s,
|
||||
} };
|
||||
|
||||
@@ -170,6 +171,9 @@ auto const TryCompileBaseSourcesArgParser =
|
||||
.BIND_LANG_PROPS(HIP)
|
||||
.BIND_LANG_PROPS(OBJC)
|
||||
.BIND_LANG_PROPS(OBJCXX)
|
||||
.Bind("SYCL_CXX_STANDARD"_s, TryCompileLangProp)
|
||||
.Bind("SYCL_CXX_STANDARD_REQUIRED"_s, TryCompileLangProp)
|
||||
.Bind("SYCL_EXTENSIONS"_s, TryCompileLangProp)
|
||||
/* keep semicolon on own line */;
|
||||
|
||||
auto const TryCompileBaseNewSourcesArgParser =
|
||||
@@ -1010,8 +1014,8 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
||||
std::vector<std::string> warnCMP0067Variables;
|
||||
|
||||
if (honorStandard || warnCMP0067) {
|
||||
static std::array<std::string, 6> const possibleLangs{
|
||||
{ "C", "CXX", "CUDA", "HIP", "OBJC", "OBJCXX" }
|
||||
static std::array<std::string, 7> const possibleLangs{
|
||||
{ "C", "CXX", "CUDA", "HIP", "OBJC", "OBJCXX", "SYCL" }
|
||||
};
|
||||
static std::array<cm::string_view, 3> const langPropSuffixes{
|
||||
{ "_STANDARD"_s, "_STANDARD_REQUIRED"_s, "_EXTENSIONS"_s }
|
||||
@@ -1021,7 +1025,10 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
||||
continue;
|
||||
}
|
||||
for (cm::string_view propSuffix : langPropSuffixes) {
|
||||
std::string langProp = cmStrCat(lang, propSuffix);
|
||||
std::string langProp = cmStrCat(
|
||||
lang == "SYCL" && propSuffix != "_EXTENSIONS"_s ? "SYCL_CXX"
|
||||
: lang,
|
||||
propSuffix);
|
||||
if (!arguments.LangProps.count(langProp)) {
|
||||
std::string langPropVar = cmStrCat("CMAKE_"_s, langProp);
|
||||
std::string value = this->Makefile->GetSafeDefinition(langPropVar);
|
||||
@@ -1102,6 +1109,12 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
||||
}
|
||||
|
||||
// Forward a set of variables to the inner project cache.
|
||||
if (cmValue val = this->Makefile->GetDefinition("CMAKE_EXPERIMENTAL_SYCL")) {
|
||||
arguments.CMakeFlags.emplace_back(
|
||||
cmStrCat("-DCMAKE_EXPERIMENTAL_SYCL=", *val));
|
||||
cmakeVariables.emplace("CMAKE_EXPERIMENTAL_SYCL", *val);
|
||||
}
|
||||
|
||||
if ((this->SrcFileSignature ||
|
||||
this->Makefile->GetPolicyStatus(cmPolicies::CMP0137) ==
|
||||
cmPolicies::NEW) &&
|
||||
@@ -1132,6 +1145,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
|
||||
vars.insert(kCMAKE_SYSROOT);
|
||||
vars.insert(kCMAKE_SYSROOT_COMPILE);
|
||||
vars.insert(kCMAKE_SYSROOT_LINK);
|
||||
vars.insert("CMAKE_SYCL_DEVICE_TARGETS");
|
||||
vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s);
|
||||
vars.emplace("CMAKE_WATCOM_RUNTIME_LIBRARY"_s);
|
||||
vars.emplace("CMAKE_MSVC_DEBUG_INFORMATION_FORMAT"_s);
|
||||
|
||||
@@ -260,9 +260,9 @@ std::string cmDocumentation::GeneralizeKeyword(std::string cname)
|
||||
{
|
||||
std::map<std::string, std::vector<std::string> const> conversions;
|
||||
std::vector<std::string> languages = {
|
||||
"C", "CXX", "CSharp", "CUDA", "OBJC",
|
||||
"OBJCXX", "Fortran", "HIP", "ISPC", "Swift",
|
||||
"ASM", "ASM_NASM", "ASM_MARMASM", "ASM_MASM", "ASM-ATT"
|
||||
"C", "CXX", "CSharp", "CUDA", "OBJC", "OBJCXX",
|
||||
"Fortran", "HIP", "ISPC", "Swift", "SYCL", "ASM",
|
||||
"ASM_NASM", "ASM_MARMASM", "ASM_MASM", "ASM-ATT"
|
||||
};
|
||||
std::vector<std::string> configs = { "DEBUG", "RELEASE", "RELWITHDEBINFO",
|
||||
"MINSIZEREL" };
|
||||
|
||||
@@ -54,6 +54,14 @@ cmExperimental::FeatureData const LookupTable[] = {
|
||||
"It is meant only for experimentation and feedback to CMake developers.",
|
||||
{},
|
||||
cmExperimental::TryCompileCondition::Never },
|
||||
// SYCL support
|
||||
{ "SYCL",
|
||||
"c0d1fb10-2ece-420e-9d29-7d7f2b300f25",
|
||||
"CMAKE_EXPERIMENTAL_SYCL",
|
||||
"CMake's support for the SYCL programming language is experimental. "
|
||||
"It is meant only for experimentation and feedback to CMake developers.",
|
||||
{},
|
||||
cmExperimental::TryCompileCondition::Never },
|
||||
};
|
||||
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
|
||||
static_cast<size_t>(cmExperimental::Feature::Sentinel),
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
MappedPackageInfo,
|
||||
ExportBuildDatabase,
|
||||
Rust,
|
||||
SYCL,
|
||||
|
||||
Sentinel,
|
||||
};
|
||||
|
||||
@@ -186,8 +186,14 @@ void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os)
|
||||
"cmake_policy(VERSION "
|
||||
<< this->RequiredCMakeVersionMajor << '.'
|
||||
<< this->RequiredCMakeVersionMinor << '.'
|
||||
<< this->RequiredCMakeVersionPatch << "...4.3)\n";
|
||||
<< this->RequiredCMakeVersionPatch;
|
||||
/* clang-format on */
|
||||
if (CMake_VERSION_ENCODE(
|
||||
this->RequiredCMakeVersionMajor, this->RequiredCMakeVersionMinor,
|
||||
this->RequiredCMakeVersionPatch) <= CMake_VERSION_ENCODE(4, 3, 0)) {
|
||||
os << "...4.3";
|
||||
}
|
||||
os << ")\n";
|
||||
}
|
||||
|
||||
void cmExportCMakeConfigGenerator::GeneratePolicyFooterCode(std::ostream& os)
|
||||
@@ -637,12 +643,16 @@ void cmExportCMakeConfigGenerator::GenerateTargetFileSets(
|
||||
std::string targetName = cmStrCat(this->Namespace, gte->GetExportName());
|
||||
for (auto const& type : types) {
|
||||
auto fsInfo = GetFileSetInformation(type);
|
||||
if (fsInfo &&
|
||||
std::any_of(gfs->GetInterfaceFileSets(type).begin(),
|
||||
gfs->GetInterfaceFileSets(type).end(),
|
||||
[](cmGeneratorFileSet const* fileSet) {
|
||||
return !fileSet->GetProperty("LANGUAGE").IsEmpty();
|
||||
})) {
|
||||
bool const requiresFileSetLanguage = fsInfo &&
|
||||
std::any_of(gfs->GetInterfaceFileSets(type).begin(),
|
||||
gfs->GetInterfaceFileSets(type).end(),
|
||||
[](cmGeneratorFileSet const* fileSet) {
|
||||
return fileSet->GetName() == cm::FileSetMetadata::SYCL ||
|
||||
fileSet->GetName() ==
|
||||
cm::FileSetMetadata::SYCL_HEADERS ||
|
||||
!fileSet->GetProperty("LANGUAGE").IsEmpty();
|
||||
});
|
||||
if (requiresFileSetLanguage) {
|
||||
fsInfo->CMakeVersion = "4.5.0"_s;
|
||||
}
|
||||
if (fsInfo) {
|
||||
@@ -674,12 +684,21 @@ void cmExportCMakeConfigGenerator::GenerateTargetFileSets(
|
||||
|
||||
if (fsInfo) {
|
||||
if (type == cm::FileSetMetadata::HEADERS) {
|
||||
os << "\nelse()\n set_property(TARGET " << targetName
|
||||
<< "\n APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES";
|
||||
for (auto const* fileSet : gfs->GetInterfaceFileSets(type)) {
|
||||
os << "\n " << this->GetFileSetDirectories(gte, fileSet, te);
|
||||
if (requiresFileSetLanguage) {
|
||||
os << "\nelse()\n message(FATAL_ERROR \"The target '"
|
||||
<< targetName
|
||||
<< "' cannot be imported because it relies on the 'LANGUAGE' "
|
||||
"property of a 'HEADERS' file set which is not supported "
|
||||
"by this CMake version.\")";
|
||||
} else {
|
||||
os << "\nelse()\n set_property(TARGET " << targetName
|
||||
<< "\n APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES";
|
||||
for (auto const* fileSet : gfs->GetInterfaceFileSets(type)) {
|
||||
os << "\n "
|
||||
<< this->GetFileSetDirectories(gte, fileSet, te);
|
||||
}
|
||||
os << "\n )";
|
||||
}
|
||||
os << "\n )";
|
||||
} else if (type == cm::FileSetMetadata::SOURCES) {
|
||||
os << "\nelse()\n message(FATAL_ERROR \"The target '" << targetName
|
||||
<< "' cannot be imported because it relies on 'FILE_SET' of type "
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cmFastbuildLinkLineComputer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "cmGlobalFastbuildGenerator.h"
|
||||
|
||||
class cmOutputConverter;
|
||||
@@ -20,3 +22,17 @@ std::string cmFastbuildLinkLineComputer::ConvertToLinkReference(
|
||||
{
|
||||
return this->GG->ConvertToFastbuildPath(lib);
|
||||
}
|
||||
|
||||
cmFastbuildLinkLineDeviceComputer::cmFastbuildLinkLineDeviceComputer(
|
||||
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir,
|
||||
cmGlobalFastbuildGenerator const* gg, std::string language)
|
||||
: cmLinkLineDeviceComputer(outputConverter, stateDir, std::move(language))
|
||||
, GG(gg)
|
||||
{
|
||||
}
|
||||
|
||||
std::string cmFastbuildLinkLineDeviceComputer::ConvertToLinkReference(
|
||||
std::string const& lib) const
|
||||
{
|
||||
return this->GG->ConvertToFastbuildPath(lib);
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "cmLinkLineComputer.h"
|
||||
#include "cmLinkLineDeviceComputer.h"
|
||||
|
||||
class cmGlobalFastbuildGenerator;
|
||||
class cmOutputConverter;
|
||||
@@ -29,3 +30,17 @@ public:
|
||||
private:
|
||||
cmGlobalFastbuildGenerator const* GG;
|
||||
};
|
||||
|
||||
class cmFastbuildLinkLineDeviceComputer : public cmLinkLineDeviceComputer
|
||||
{
|
||||
public:
|
||||
cmFastbuildLinkLineDeviceComputer(cmOutputConverter* outputConverter,
|
||||
cmStateDirectory const& stateDir,
|
||||
cmGlobalFastbuildGenerator const* gg,
|
||||
std::string language);
|
||||
|
||||
std::string ConvertToLinkReference(std::string const& input) const override;
|
||||
|
||||
private:
|
||||
cmGlobalFastbuildGenerator const* GG;
|
||||
};
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "cmCommonTargetGenerator.h"
|
||||
#include "cmCryptoHash.h"
|
||||
#include "cmFastbuildLinkLineComputer.h"
|
||||
#include "cmFastbuildTargetGenerator.h"
|
||||
#include "cmFileSetMetadata.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
@@ -240,15 +241,18 @@ void cmFastbuildNormalTargetGenerator::GetLinkerExecutableAndArgs(
|
||||
|
||||
LogMessage("Link Command: " + command);
|
||||
|
||||
auto const& compilers = this->GetGlobalGenerator()->Compilers;
|
||||
auto const linkerLauncherVarName = FASTBUILD_LINKER_LAUNCHER_PREFIX +
|
||||
this->GeneratorTarget->GetLinkerLanguage(Config);
|
||||
auto const iter = compilers.find(linkerLauncherVarName);
|
||||
auto const launcher = cmCommonTargetGenerator::GetLinkerLauncher(Config);
|
||||
// Tested in "RunCMake.LinkerLauncher" test.
|
||||
if (iter != compilers.end()) {
|
||||
LogMessage("Linker launcher: " + iter->first);
|
||||
outLinkerExecutable = iter->second.Executable;
|
||||
outLinkerArgs = cmStrCat(iter->second.Args, ' ', command);
|
||||
if (!launcher.empty() &&
|
||||
this->GeneratorTarget->GetType() != cm::TargetType::STATIC_LIBRARY) {
|
||||
outLinkerExecutable = launcher.front();
|
||||
outLinkerArgs.clear();
|
||||
for (std::size_t i = 1; i < launcher.size(); ++i) {
|
||||
outLinkerArgs = cmStrCat(
|
||||
std::move(outLinkerArgs),
|
||||
cmGlobalFastbuildGenerator::QuoteIfHasSpaces(launcher[i]), ' ');
|
||||
}
|
||||
outLinkerArgs += command;
|
||||
} else {
|
||||
SplitLinkerFromArgs(command, outLinkerExecutable, outLinkerArgs);
|
||||
}
|
||||
@@ -979,7 +983,7 @@ void cmFastbuildNormalTargetGenerator::Generate()
|
||||
std::vector<std::string> objectDepends;
|
||||
AddObjectDependencies(fastbuildTarget, objectDepends);
|
||||
|
||||
GenerateCudaDeviceLink(fastbuildTarget);
|
||||
GenerateDeviceLink(fastbuildTarget);
|
||||
|
||||
GenerateLink(fastbuildTarget, objectDepends);
|
||||
|
||||
@@ -1366,27 +1370,32 @@ std::vector<std::string> cmFastbuildNormalTargetGenerator::GetArches() const
|
||||
return arches;
|
||||
}
|
||||
|
||||
void cmFastbuildNormalTargetGenerator::GetCudaDeviceLinkLinkerAndArgs(
|
||||
std::string& linker, std::string& args) const
|
||||
void cmFastbuildNormalTargetGenerator::GetDeviceLinkLinkerAndArgs(
|
||||
std::string const& language, std::string& linker, std::string& args) const
|
||||
{
|
||||
std::string linkCmd =
|
||||
this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_"
|
||||
"LIBRARY");
|
||||
this->GeneratorTarget->GetLinkInformation(this->Config);
|
||||
cmGeneratorTarget::DeviceLinkSetter deviceLink(*this->GeneratorTarget);
|
||||
std::string linkCmd = this->GetMakefile()->GetSafeDefinition(
|
||||
cmStrCat("CMAKE_", language, "_DEVICE_LINK_LIBRARY"));
|
||||
auto vars = ComputeRuleVariables();
|
||||
vars.Language = "CUDA";
|
||||
vars.Objects = FASTBUILD_1_INPUT_PLACEHOLDER;
|
||||
vars.Language = language.c_str();
|
||||
// Libraries2 tracks archive changes; the computed link line already contains
|
||||
// these archives in driver-required order, so expand only local objects
|
||||
// here.
|
||||
vars.Objects = FASTBUILD_1_0_INPUT_PLACEHOLDER;
|
||||
vars.Target = FASTBUILD_2_INPUT_PLACEHOLDER;
|
||||
std::unique_ptr<cmLinkLineDeviceComputer> linkLineComputer(
|
||||
new cmLinkLineDeviceComputer(
|
||||
new cmFastbuildLinkLineDeviceComputer(
|
||||
this->LocalGenerator,
|
||||
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
|
||||
this->LocalGenerator->GetStateSnapshot().GetDirectory(),
|
||||
this->GetGlobalGenerator(), language));
|
||||
std::string linkLibs;
|
||||
std::string targetFlags;
|
||||
std::string linkFlags;
|
||||
std::string frameworkPath;
|
||||
std::string linkPath;
|
||||
// So that the call to "GetTargetFlags" does not pollute "LinkLibs" and
|
||||
// "LinkFlags" with unneeded values.
|
||||
// GetTargetFlags also collects host link flags and libraries, which are not
|
||||
// part of the device link.
|
||||
std::string dummyLinkLibs;
|
||||
std::string dummyLinkFlags;
|
||||
this->LocalCommonGenerator->GetDeviceLinkFlags(
|
||||
@@ -1404,22 +1413,23 @@ void cmFastbuildNormalTargetGenerator::GetCudaDeviceLinkLinkerAndArgs(
|
||||
SplitLinkerFromArgs(linkCmd, linker, args);
|
||||
}
|
||||
|
||||
void cmFastbuildNormalTargetGenerator::GenerateCudaDeviceLink(
|
||||
void cmFastbuildNormalTargetGenerator::GenerateDeviceLink(
|
||||
FastbuildTarget& target) const
|
||||
{
|
||||
auto const arches = this->GetArches();
|
||||
if (!requireDeviceLinking(*this->GeneratorTarget, *this->GetLocalGenerator(),
|
||||
Config)) {
|
||||
std::string const language = deviceLinkLanguage(
|
||||
*this->GeneratorTarget, *this->GetLocalGenerator(), Config);
|
||||
if (language.empty()) {
|
||||
return;
|
||||
}
|
||||
LogMessage("GenerateCudaDeviceLink(...)");
|
||||
LogMessage("GenerateDeviceLink(...)");
|
||||
for (auto const& arch : arches) {
|
||||
std::string linker;
|
||||
std::string args;
|
||||
GetCudaDeviceLinkLinkerAndArgs(linker, args);
|
||||
GetDeviceLinkLinkerAndArgs(language, linker, args);
|
||||
|
||||
FastbuildLinkerNode deviceLinkNode;
|
||||
deviceLinkNode.Name = cmStrCat(target.Name, "_cuda_device_link");
|
||||
deviceLinkNode.Name = cmStrCat(target.Name, "_device_link");
|
||||
deviceLinkNode.Type = FastbuildLinkerNode::SHARED_LIBRARY;
|
||||
deviceLinkNode.Linker = std::move(linker);
|
||||
deviceLinkNode.LinkerOptions = std::move(args);
|
||||
@@ -1428,16 +1438,36 @@ void cmFastbuildNormalTargetGenerator::GenerateCudaDeviceLink(
|
||||
FASTBUILD_DOLLAR_TAG "TargetOutDi"
|
||||
"r" FASTBUILD_DOLLAR_TAG "/cmake_device_link",
|
||||
(args.empty() ? "" : "_" + arch),
|
||||
this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_"
|
||||
"EXTENSION")));
|
||||
this->Makefile->GetSafeDefinition(
|
||||
cmStrCat("CMAKE_", language, "_OUTPUT_EXTENSION"))));
|
||||
|
||||
// Input
|
||||
for (auto const& objList : target.ObjectListNodes) {
|
||||
deviceLinkNode.LibrarianAdditionalInputs.push_back(objList.Name);
|
||||
}
|
||||
target.CudaDeviceLinkNode.emplace_back(std::move(deviceLinkNode));
|
||||
deviceLinkNode.PreBuildDependencies.emplace(
|
||||
target.Name + FASTBUILD_DEPS_ARTIFACTS_ALIAS_POSTFIX);
|
||||
if (auto const* linkInfo =
|
||||
this->GeneratorTarget->GetLinkInformation(this->Config)) {
|
||||
for (auto const& dependency : linkInfo->GetDepends()) {
|
||||
// ObjectList owns generated object nodes. Adding their paths here
|
||||
// would create File nodes before FASTBuild discovers the objects.
|
||||
if (cmHasLiteralSuffix(dependency, ".o") ||
|
||||
cmHasLiteralSuffix(dependency, ".obj")) {
|
||||
continue;
|
||||
}
|
||||
deviceLinkNode.Libraries2.push_back(
|
||||
this->ConvertToFastbuildPath(dependency));
|
||||
}
|
||||
}
|
||||
this->GetGlobalGenerator()->AddFileToClean(
|
||||
cmStrCat(this->GeneratorTarget->GetObjectDirectory(this->Config),
|
||||
"cmake_device_link", (args.empty() ? "" : "_" + arch),
|
||||
this->Makefile->GetSafeDefinition(
|
||||
cmStrCat("CMAKE_", language, "_OUTPUT_EXTENSION"))));
|
||||
target.DeviceLinkNodes.emplace_back(std::move(deviceLinkNode));
|
||||
}
|
||||
LogMessage("GenerateCudaDeviceLink end");
|
||||
LogMessage("GenerateDeviceLink end");
|
||||
}
|
||||
|
||||
void cmFastbuildNormalTargetGenerator::GenerateObjects(FastbuildTarget& target)
|
||||
@@ -1904,6 +1934,10 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
|
||||
" already linked... Skipping"));
|
||||
return;
|
||||
}
|
||||
if (UsingCommandLine || feature != "DEFAULT") {
|
||||
AppendCommandLineDep(linkerNode, item);
|
||||
return;
|
||||
}
|
||||
// Tested in "ExportImport" test.
|
||||
cmList const list{ GetImportedLoc(item) };
|
||||
for (std::string const& linkDep : list) {
|
||||
@@ -2038,7 +2072,7 @@ void cmFastbuildNormalTargetGenerator::AppendCommandLineDep(
|
||||
|
||||
std::string formatted;
|
||||
if (item.Target && item.Target->IsImported()) {
|
||||
formatted = GetImportedLoc(item);
|
||||
formatted = item.GetFormattedItem(GetImportedLoc(item)).Value;
|
||||
} else {
|
||||
formatted = item.GetFormattedItem(item.Value.Value).Value;
|
||||
}
|
||||
@@ -2057,6 +2091,10 @@ void cmFastbuildNormalTargetGenerator::AppendCommandLineDep(
|
||||
} else {
|
||||
// It's some link option, not a path.
|
||||
linkerNode.LinkerOptions += (" " + formatted);
|
||||
if (item.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
|
||||
AppendToLibraries2IfApplicable(
|
||||
linkerNode, this->ConvertToFastbuildPath(item.Value.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2149,7 +2187,7 @@ void cmFastbuildNormalTargetGenerator::AppendDirectObjectLibs(
|
||||
|
||||
void cmFastbuildNormalTargetGenerator::AppendLinkDeps(
|
||||
std::set<FastbuildTargetDep>& preBuildDeps, FastbuildLinkerNode& linkerNode,
|
||||
FastbuildLinkerNode& cudaDeviceLinkLinkerNode)
|
||||
FastbuildLinkerNode& deviceLinkNode)
|
||||
{
|
||||
std::set<std::string> linkedObjects;
|
||||
cmComputeLinkInformation const* linkInfo =
|
||||
@@ -2163,6 +2201,12 @@ void cmFastbuildNormalTargetGenerator::AppendLinkDeps(
|
||||
// Object libs that are linked directly to target (e.g.
|
||||
// add_executable(test_exe archiveObjs)
|
||||
AppendDirectObjectLibs(linkerNode, linkedObjects);
|
||||
AppendExternalObject(linkerNode, linkedObjects);
|
||||
if (!deviceLinkNode.Name.empty()) {
|
||||
std::set<std::string> deviceObjects;
|
||||
AppendDirectObjectLibs(deviceLinkNode, deviceObjects);
|
||||
AppendExternalObject(deviceLinkNode, deviceObjects);
|
||||
}
|
||||
std::size_t numberOfDirectlyLinkedObjects =
|
||||
linkerNode.LibrarianAdditionalInputs.size();
|
||||
// target_link_libraries.
|
||||
@@ -2214,29 +2258,20 @@ void cmFastbuildNormalTargetGenerator::AppendLinkDeps(
|
||||
else if (item.Target) {
|
||||
AppendTargetDep(linkerNode, linkedObjects, item);
|
||||
AppendPrebuildDeps(linkerNode, item);
|
||||
if (!item.Target->IsImported() &&
|
||||
item.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
|
||||
++numberOfDirectlyLinkedObjects;
|
||||
cudaDeviceLinkLinkerNode.LibrarianAdditionalInputs.emplace_back(
|
||||
cmStrCat(item.Target->GetName(), FASTBUILD_OBJECTS_ALIAS_POSTFIX));
|
||||
}
|
||||
|
||||
} else {
|
||||
AppendCommandLineDep(linkerNode, item);
|
||||
UsingCommandLine = true;
|
||||
}
|
||||
}
|
||||
AppendExternalObject(linkerNode, linkedObjects);
|
||||
|
||||
if (!cudaDeviceLinkLinkerNode.Name.empty()) {
|
||||
linkerNode.LibrarianAdditionalInputs.push_back(
|
||||
cudaDeviceLinkLinkerNode.Name);
|
||||
// CUDA device-link stub needs to go AFTER direct object dependencies, but
|
||||
if (!deviceLinkNode.Name.empty()) {
|
||||
// The device-link stub needs to go AFTER direct object dependencies, but
|
||||
// BEFORE all other dependencies. Needed for the correct left-to-right
|
||||
// symbols resolution on Linux.
|
||||
std::swap(
|
||||
linkerNode.LibrarianAdditionalInputs[numberOfDirectlyLinkedObjects],
|
||||
linkerNode.LibrarianAdditionalInputs.back());
|
||||
linkerNode.LibrarianAdditionalInputs.insert(
|
||||
linkerNode.LibrarianAdditionalInputs.begin() +
|
||||
numberOfDirectlyLinkedObjects,
|
||||
deviceLinkNode.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2387,11 +2422,11 @@ void cmFastbuildNormalTargetGenerator::GenerateLink(
|
||||
linkerNode.LinkerOptions += linkerOptions;
|
||||
|
||||
// Check if we have CUDA device link stub for this target.
|
||||
FastbuildLinkerNode dummyCudaDeviceLinkNode;
|
||||
FastbuildLinkerNode dummyDeviceLinkNode;
|
||||
AppendLinkDeps(target.PreBuildDependencies, linkerNode,
|
||||
target.CudaDeviceLinkNode.size() > i
|
||||
? target.CudaDeviceLinkNode[i]
|
||||
: dummyCudaDeviceLinkNode);
|
||||
target.DeviceLinkNodes.size() > i
|
||||
? target.DeviceLinkNodes[i]
|
||||
: dummyDeviceLinkNode);
|
||||
ApplyLWYUToLinkerCommand(linkerNode);
|
||||
|
||||
// On macOS, only the last LinkerNode performs lipo in POST_BUILD.
|
||||
|
||||
@@ -72,9 +72,10 @@ private:
|
||||
|
||||
std::vector<std::string> GetArches() const;
|
||||
|
||||
void GetCudaDeviceLinkLinkerAndArgs(std::string& linker,
|
||||
std::string& args) const;
|
||||
void GenerateCudaDeviceLink(FastbuildTarget& target) const;
|
||||
void GetDeviceLinkLinkerAndArgs(std::string const& language,
|
||||
std::string& linker,
|
||||
std::string& args) const;
|
||||
void GenerateDeviceLink(FastbuildTarget& target) const;
|
||||
void GenerateObjects(FastbuildTarget& target);
|
||||
FastbuildUnityNode GetOneUnity(std::set<std::string> const& excludedFiles,
|
||||
std::vector<std::string>& files,
|
||||
@@ -123,7 +124,7 @@ private:
|
||||
|
||||
void AppendLinkDeps(std::set<FastbuildTargetDep>& preBuildDeps,
|
||||
FastbuildLinkerNode& linkerNode,
|
||||
FastbuildLinkerNode& cudaDeviceLinkLinkerNode);
|
||||
FastbuildLinkerNode& deviceLinkNode);
|
||||
void AddLipoCommand(FastbuildTarget& target);
|
||||
void GenerateModuleDefinitionInfo(FastbuildTarget& target) const;
|
||||
std::vector<FastbuildExecNode> GetSymlinkExecs() const;
|
||||
|
||||
+13
-2
@@ -11,6 +11,7 @@
|
||||
#include <cmext/algorithm>
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmExperimental.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
@@ -268,10 +269,20 @@ void cmFileSet::SetProperty(std::string const& prop, cmValue value)
|
||||
this->InterfaceCompileDefinitions.emplace_back(value, lfbt);
|
||||
}
|
||||
} else if (prop == LANGUAGE) {
|
||||
if (this->GetType() != cm::FileSetMetadata::SOURCES) {
|
||||
if (this->GetType() != cm::FileSetMetadata::SOURCES &&
|
||||
this->GetType() != cm::FileSetMetadata::HEADERS) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"LANGUAGE property may only be set on a SOURCES file set.");
|
||||
"LANGUAGE property may only be set on a SOURCES or HEADERS file set.");
|
||||
return;
|
||||
}
|
||||
if (this->GetType() == cm::FileSetMetadata::HEADERS &&
|
||||
!cmExperimental::HasSupportEnabled(*this->Makefile,
|
||||
cmExperimental::Feature::SYCL)) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"LANGUAGE property on a HEADERS file set is experimental and must be "
|
||||
"enabled by the CMAKE_EXPERIMENTAL_SYCL gate.");
|
||||
return;
|
||||
}
|
||||
if (value && cmGeneratorExpression::Find(*value) != std::string::npos) {
|
||||
|
||||
@@ -77,6 +77,8 @@ bool VisibilityIsForInterface(Visibility vis)
|
||||
|
||||
cm::string_view const HEADERS = "HEADERS"_s;
|
||||
cm::string_view const SOURCES = "SOURCES"_s;
|
||||
cm::string_view const SYCL = "SYCL"_s;
|
||||
cm::string_view const SYCL_HEADERS = "SYCL_HEADERS"_s;
|
||||
cm::string_view const CXX_MODULES = "CXX_MODULES"_s;
|
||||
|
||||
namespace {
|
||||
@@ -94,6 +96,19 @@ std::map<cm::string_view, FileSetDescriptor> const FileSetDescriptors{
|
||||
DependencyMode ::Includables,
|
||||
{ cm::FileSetMetadata::FileSetAttributes::FrameworkCompatible,
|
||||
cm::FileSetMetadata::FileSetAttributes::UnityBuild } } },
|
||||
{ cm::FileSetMetadata::SYCL,
|
||||
{ cm::FileSetMetadata::SOURCES,
|
||||
cm::FileSetMetadata::FileSetLookup::Dependencies,
|
||||
{ DependencyMode ::IndependentFiles, DependencyMode ::Includables },
|
||||
DependencyMode ::Includables,
|
||||
{ cm::FileSetMetadata::FileSetAttributes::FrameworkCompatible,
|
||||
cm::FileSetMetadata::FileSetAttributes::UnityBuild } } },
|
||||
{ cm::FileSetMetadata::SYCL_HEADERS,
|
||||
{ cm::FileSetMetadata::HEADERS,
|
||||
cm::FileSetMetadata::FileSetLookup::Target,
|
||||
{ DependencyMode ::Includables },
|
||||
DependencyMode ::Includables,
|
||||
{ cm::FileSetMetadata::FileSetAttributes::FilesInMultipleFileSets } } },
|
||||
{ cm::FileSetMetadata::CXX_MODULES,
|
||||
{ cm::FileSetMetadata::CXX_MODULES,
|
||||
cm::FileSetMetadata::FileSetLookup::Target,
|
||||
@@ -102,7 +117,8 @@ std::map<cm::string_view, FileSetDescriptor> const FileSetDescriptors{
|
||||
{} } },
|
||||
};
|
||||
|
||||
std::vector<cm::string_view> KnownTypes{ HEADERS, SOURCES, CXX_MODULES };
|
||||
std::vector<cm::string_view> KnownTypes{ HEADERS, SOURCES, SYCL, SYCL_HEADERS,
|
||||
CXX_MODULES };
|
||||
|
||||
cmsys::RegularExpression const ValidNameRegex("^[a-z0-9][a-zA-Z0-9_]*$");
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ bool VisibilityIsForInterface(Visibility vis);
|
||||
// Pre-defined FileSet types
|
||||
extern cm::string_view const HEADERS;
|
||||
extern cm::string_view const SOURCES;
|
||||
extern cm::string_view const SYCL;
|
||||
extern cm::string_view const SYCL_HEADERS;
|
||||
extern cm::string_view const CXX_MODULES;
|
||||
|
||||
enum class FileSetLookup
|
||||
|
||||
@@ -3070,7 +3070,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
|
||||
static CompilerIdNode const cCompilerIdNode("C"), cxxCompilerIdNode("CXX"),
|
||||
cudaCompilerIdNode("CUDA"), objcCompilerIdNode("OBJC"),
|
||||
objcxxCompilerIdNode("OBJCXX"), fortranCompilerIdNode("Fortran"),
|
||||
hipCompilerIdNode("HIP"), ispcCompilerIdNode("ISPC");
|
||||
hipCompilerIdNode("HIP"), ispcCompilerIdNode("ISPC"),
|
||||
syclCompilerIdNode("SYCL");
|
||||
|
||||
struct CompilerVersionNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -3134,7 +3135,7 @@ static CompilerVersionNode const cCompilerVersionNode("C"),
|
||||
cxxCompilerVersionNode("CXX"), cudaCompilerVersionNode("CUDA"),
|
||||
objcCompilerVersionNode("OBJC"), objcxxCompilerVersionNode("OBJCXX"),
|
||||
fortranCompilerVersionNode("Fortran"), ispcCompilerVersionNode("ISPC"),
|
||||
hipCompilerVersionNode("HIP");
|
||||
hipCompilerVersionNode("HIP"), syclCompilerVersionNode("SYCL");
|
||||
|
||||
struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -3204,7 +3205,8 @@ static CompilerFrontendVariantNode const cCompilerFrontendVariantNode("C"),
|
||||
objcxxCompilerFrontendVariantNode("OBJCXX"),
|
||||
fortranCompilerFrontendVariantNode("Fortran"),
|
||||
hipCompilerFrontendVariantNode("HIP"),
|
||||
ispcCompilerFrontendVariantNode("ISPC");
|
||||
ispcCompilerFrontendVariantNode("ISPC"),
|
||||
syclCompilerFrontendVariantNode("SYCL");
|
||||
|
||||
struct PlatformIdNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -3814,7 +3816,8 @@ struct CompilerLinkerIdNode : public cmGeneratorExpressionNode
|
||||
static CompilerLinkerIdNode const cCompilerLinkerIdNode("C"),
|
||||
cxxCompilerLinkerIdNode("CXX"), cudaCompilerLinkerIdNode("CUDA"),
|
||||
objcCompilerLinkerIdNode("OBJC"), objcxxCompilerLinkerIdNode("OBJCXX"),
|
||||
fortranCompilerLinkerIdNode("Fortran"), hipCompilerLinkerIdNode("HIP");
|
||||
fortranCompilerLinkerIdNode("Fortran"), hipCompilerLinkerIdNode("HIP"),
|
||||
syclCompilerLinkerIdNode("SYCL");
|
||||
|
||||
struct CompilerLinkerFrontendVariantNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -3885,7 +3888,8 @@ static CompilerLinkerFrontendVariantNode const
|
||||
objcCompilerLinkerFrontendVariantNode("OBJC"),
|
||||
objcxxCompilerLinkerFrontendVariantNode("OBJCXX"),
|
||||
fortranCompilerLinkerFrontendVariantNode("Fortran"),
|
||||
hipCompilerLinkerFrontendVariantNode("HIP");
|
||||
hipCompilerLinkerFrontendVariantNode("HIP"),
|
||||
syclCompilerLinkerFrontendVariantNode("SYCL");
|
||||
|
||||
static const struct LinkLibraryNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -6485,6 +6489,7 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
|
||||
{ "CUDA_COMPILER_ID", &cudaCompilerIdNode },
|
||||
{ "Fortran_COMPILER_ID", &fortranCompilerIdNode },
|
||||
{ "HIP_COMPILER_ID", &hipCompilerIdNode },
|
||||
{ "SYCL_COMPILER_ID", &syclCompilerIdNode },
|
||||
{ "VERSION_GREATER", &versionGreaterNode },
|
||||
{ "VERSION_GREATER_EQUAL", &versionGreaterEqNode },
|
||||
{ "VERSION_LESS", &versionLessNode },
|
||||
@@ -6497,6 +6502,7 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
|
||||
{ "OBJCXX_COMPILER_VERSION", &objcxxCompilerVersionNode },
|
||||
{ "Fortran_COMPILER_VERSION", &fortranCompilerVersionNode },
|
||||
{ "HIP_COMPILER_VERSION", &hipCompilerVersionNode },
|
||||
{ "SYCL_COMPILER_VERSION", &syclCompilerVersionNode },
|
||||
{ "C_COMPILER_FRONTEND_VARIANT", &cCompilerFrontendVariantNode },
|
||||
{ "CXX_COMPILER_FRONTEND_VARIANT", &cxxCompilerFrontendVariantNode },
|
||||
{ "CUDA_COMPILER_FRONTEND_VARIANT", &cudaCompilerFrontendVariantNode },
|
||||
@@ -6505,6 +6511,7 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
|
||||
{ "Fortran_COMPILER_FRONTEND_VARIANT",
|
||||
&fortranCompilerFrontendVariantNode },
|
||||
{ "HIP_COMPILER_FRONTEND_VARIANT", &hipCompilerFrontendVariantNode },
|
||||
{ "SYCL_COMPILER_FRONTEND_VARIANT", &syclCompilerFrontendVariantNode },
|
||||
{ "PLATFORM_ID", &platformIdNode },
|
||||
{ "COMPILE_FEATURES", &compileFeaturesNode },
|
||||
{ "CONFIGURATION", &configurationNode },
|
||||
@@ -6619,6 +6626,7 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
|
||||
{ "CUDA_COMPILER_LINKER_ID", &cudaCompilerLinkerIdNode },
|
||||
{ "Fortran_COMPILER_LINKER_ID", &fortranCompilerLinkerIdNode },
|
||||
{ "HIP_COMPILER_LINKER_ID", &hipCompilerLinkerIdNode },
|
||||
{ "SYCL_COMPILER_LINKER_ID", &syclCompilerLinkerIdNode },
|
||||
{ "C_COMPILER_LINKER_FRONTEND_VARIANT",
|
||||
&cCompilerLinkerFrontendVariantNode },
|
||||
{ "CXX_COMPILER_LINKER_FRONTEND_VARIANT",
|
||||
@@ -6633,6 +6641,8 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
|
||||
&fortranCompilerLinkerFrontendVariantNode },
|
||||
{ "HIP_COMPILER_LINKER_FRONTEND_VARIANT",
|
||||
&hipCompilerLinkerFrontendVariantNode },
|
||||
{ "SYCL_COMPILER_LINKER_FRONTEND_VARIANT",
|
||||
&syclCompilerLinkerFrontendVariantNode },
|
||||
{ "LINK_LIBRARY", &linkLibraryNode },
|
||||
{ "LINK_GROUP", &linkGroupNode },
|
||||
{ "HOST_LINK", &hostLinkNode },
|
||||
|
||||
@@ -216,6 +216,12 @@ cm::optional<std::string> cmGeneratorFileSets::GetLanguageForSource(
|
||||
return language->second;
|
||||
}
|
||||
|
||||
bool cmGeneratorFileSets::HasSyclHeaders(std::string const& config) const
|
||||
{
|
||||
this->BuildInfoCache(config);
|
||||
return this->Configs[config].HasSyclHeaders;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<cm::TargetPropertyEntry>>
|
||||
cmGeneratorFileSets::GetSources(
|
||||
std::function<bool(cmGeneratorFileSet const*)> include,
|
||||
@@ -449,6 +455,32 @@ void GetInterfaceFiles(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool HasInterfaceSyclHeaders(
|
||||
cmGeneratorTarget const* target, cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
std::unordered_set<cmGeneratorTarget const*>& targets)
|
||||
{
|
||||
for (auto const* fileSet :
|
||||
target->GetInterfaceFileSets(cm::FileSetMetadata::HEADERS)) {
|
||||
if (fileSet->GetProperty("LANGUAGE") == cm::FileSetMetadata::SYCL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmLinkInterfaceLibraries const* iface =
|
||||
target->GetLinkInterfaceLibraries(config, headTarget,
|
||||
cmGeneratorTarget::UseTo::Compile)) {
|
||||
for (cmLinkItem const& lib : iface->Libraries) {
|
||||
if (lib.Target && lib.Target != target &&
|
||||
targets.insert(lib.Target).second &&
|
||||
HasInterfaceSyclHeaders(lib.Target, headTarget, config, targets)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void cmGeneratorFileSets::BuildInfoCache(std::string const& config) const
|
||||
@@ -461,6 +493,13 @@ void cmGeneratorFileSets::BuildInfoCache(std::string const& config) const
|
||||
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
|
||||
info.HasSyclHeaders = std::any_of(
|
||||
this->GetFileSets(cm::FileSetMetadata::HEADERS).begin(),
|
||||
this->GetFileSets(cm::FileSetMetadata::HEADERS).end(),
|
||||
[](cmGeneratorFileSet const* fileSet) {
|
||||
return fileSet->GetProperty("LANGUAGE") == cm::FileSetMetadata::SYCL;
|
||||
});
|
||||
|
||||
for (auto const& item : this->FileSets) {
|
||||
auto const* fileSet = item.second.get();
|
||||
if (!fileSet->IsForSelf()) {
|
||||
@@ -479,11 +518,17 @@ void cmGeneratorFileSets::BuildInfoCache(std::string const& config) const
|
||||
|
||||
// retrieve all files inherited from dependent targets
|
||||
std::unordered_set<cmGeneratorTarget const*> targets;
|
||||
std::unordered_set<cmGeneratorTarget const*> syclHeaderTargets;
|
||||
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
this->Target->GetLinkImplementationLibraries(
|
||||
config, cmGeneratorTarget::UseTo::Compile)) {
|
||||
for (cmLinkItem const& lib : impl->Libraries) {
|
||||
if (!info.HasSyclHeaders && lib.Target &&
|
||||
syclHeaderTargets.insert(lib.Target).second) {
|
||||
info.HasSyclHeaders = HasInterfaceSyclHeaders(
|
||||
lib.Target, this->Target, config, syclHeaderTargets);
|
||||
}
|
||||
if (lib.Target && targets.insert(lib.Target).second) {
|
||||
GetInterfaceFiles(lib.Target, this->Target, context, targets,
|
||||
info.InterfaceFileSetCache);
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
cmSourceFile const* sf) const;
|
||||
cm::optional<std::string> GetLanguageForSource(std::string const& config,
|
||||
cmSourceFile const* sf) const;
|
||||
bool HasSyclHeaders(std::string const& config) const;
|
||||
|
||||
std::vector<std::unique_ptr<TargetPropertyEntry>> GetSources(
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
@@ -122,6 +123,7 @@ private:
|
||||
std::map<std::string, std::unordered_set<cmGeneratorFileSet const*>>
|
||||
InterfaceFileSetCache;
|
||||
std::unordered_map<std::string, std::string> LanguageCache;
|
||||
bool HasSyclHeaders = false;
|
||||
};
|
||||
mutable std::map<std::string, InfoByConfig> Configs;
|
||||
|
||||
|
||||
+167
-12
@@ -38,6 +38,7 @@
|
||||
#include "cmGeneratorFileSets.h"
|
||||
#include "cmGeneratorOptions.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmLinkLineDeviceComputer.h"
|
||||
#include "cmList.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -930,8 +931,17 @@ BTs<std::string> const* cmGeneratorTarget::GetLanguageStandardProperty(
|
||||
return &langStandardIter->second;
|
||||
}
|
||||
|
||||
return this->Target->GetLanguageStandardProperty(
|
||||
cmStrCat(lang, "_STANDARD"));
|
||||
if (BTs<std::string> const* languageStandard =
|
||||
this->Target->GetLanguageStandardProperty(
|
||||
cmStandardLevelResolver::GetStandardPropertyName(lang))) {
|
||||
return languageStandard;
|
||||
}
|
||||
|
||||
if (this->IsSYCLAppendMode(lang)) {
|
||||
return this->GetLanguageStandardProperty("CXX", config);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cmValue cmGeneratorTarget::GetLanguageStandard(std::string const& lang,
|
||||
@@ -950,12 +960,17 @@ cmValue cmGeneratorTarget::GetLanguageStandard(std::string const& lang,
|
||||
cmValue cmGeneratorTarget::GetPropertyWithPairedLanguageSupport(
|
||||
std::string const& lang, char const* suffix) const
|
||||
{
|
||||
cmValue propertyValue = this->Target->GetProperty(cmStrCat(lang, suffix));
|
||||
std::string const property = std::string(suffix) == "_STANDARD_REQUIRED"
|
||||
? cmStrCat(cmStandardLevelResolver::GetStandardPropertyName(lang),
|
||||
"_REQUIRED")
|
||||
: cmStrCat(lang, suffix);
|
||||
cmValue propertyValue = this->Target->GetProperty(property);
|
||||
if (!propertyValue) {
|
||||
// Check if we should use the value set by another language.
|
||||
if (lang == "OBJC") {
|
||||
propertyValue = this->GetPropertyWithPairedLanguageSupport("C", suffix);
|
||||
} else if (lang == "OBJCXX" || lang == "CUDA" || lang == "HIP") {
|
||||
} else if (lang == "OBJCXX" || lang == "CUDA" || lang == "HIP" ||
|
||||
this->IsSYCLAppendMode(lang)) {
|
||||
propertyValue =
|
||||
this->GetPropertyWithPairedLanguageSupport("CXX", suffix);
|
||||
}
|
||||
@@ -975,6 +990,36 @@ bool cmGeneratorTarget::GetLanguageStandardRequired(
|
||||
.IsOn();
|
||||
}
|
||||
|
||||
cmGeneratorTarget::SYCLExtensionMode cmGeneratorTarget::GetSYCLExtensionMode()
|
||||
const
|
||||
{
|
||||
cmValue mode = this->GetProperty("SYCL_EXTENSION_MODE");
|
||||
if (mode.IsEmpty()) {
|
||||
return SYCLExtensionMode::Append;
|
||||
}
|
||||
|
||||
std::string normalizedMode = cmSystemTools::UpperCase(*mode);
|
||||
if (normalizedMode == "APPEND") {
|
||||
return SYCLExtensionMode::Append;
|
||||
}
|
||||
if (normalizedMode == "REPLACE") {
|
||||
return SYCLExtensionMode::Replace;
|
||||
}
|
||||
|
||||
this->LocalGenerator->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Target \"", this->GetName(),
|
||||
"\" has an invalid SYCL_EXTENSION_MODE value \"", *mode,
|
||||
"\". Expected APPEND or REPLACE."));
|
||||
return SYCLExtensionMode::Append;
|
||||
}
|
||||
|
||||
bool cmGeneratorTarget::IsSYCLAppendMode(std::string const& lang) const
|
||||
{
|
||||
return lang == "SYCL" &&
|
||||
this->GetSYCLExtensionMode() == SYCLExtensionMode::Append;
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::GetModuleDefinitionSources(
|
||||
std::vector<cmSourceFile const*>& data, std::string const& config) const
|
||||
{
|
||||
@@ -2135,7 +2180,7 @@ namespace {
|
||||
|
||||
bool IsSupportedClassifiedFlagsLanguage(std::string const& lang)
|
||||
{
|
||||
return lang == "CXX"_s;
|
||||
return lang == "CXX"_s || lang == "SYCL"_s;
|
||||
}
|
||||
|
||||
bool CanUseCompilerLauncher(std::string const& lang)
|
||||
@@ -2143,7 +2188,7 @@ bool CanUseCompilerLauncher(std::string const& lang)
|
||||
// Also found in `cmCommonTargetGenerator::GetCompilerLauncher`.
|
||||
return lang == "C"_s || lang == "CXX"_s || lang == "Fortran"_s ||
|
||||
lang == "CUDA"_s || lang == "HIP"_s || lang == "ISPC"_s ||
|
||||
lang == "OBJC"_s || lang == "OBJCXX"_s;
|
||||
lang == "SYCL"_s || lang == "OBJC"_s || lang == "OBJCXX"_s;
|
||||
}
|
||||
|
||||
// FIXME: return a vector of `cm::string_view` instead to avoid lots of tiny
|
||||
@@ -2666,9 +2711,13 @@ cmGeneratorTarget::SourceVariables cmGeneratorTarget::GetSourceVariables(
|
||||
void cmGeneratorTarget::AddExplicitLanguageFlags(
|
||||
std::string& flags, cmSourceFile const& sf, std::string const& config) const
|
||||
{
|
||||
if (auto const language =
|
||||
this->FileSets->GetLanguageForSource(config, &sf)) {
|
||||
this->LocalGenerator->AppendFeatureOptions(flags, *language,
|
||||
auto const fileSetLanguage =
|
||||
this->FileSets->GetLanguageForSource(config, &sf);
|
||||
std::string const effectiveLanguage =
|
||||
this->GetSourceFileLanguage(&sf, config);
|
||||
if (fileSetLanguage ||
|
||||
(!effectiveLanguage.empty() && effectiveLanguage != sf.GetLanguage())) {
|
||||
this->LocalGenerator->AppendFeatureOptions(flags, effectiveLanguage,
|
||||
"EXPLICIT_LANGUAGE");
|
||||
return;
|
||||
}
|
||||
@@ -2693,6 +2742,63 @@ void cmGeneratorTarget::AddExplicitLanguageFlags(
|
||||
"EXPLICIT_LANGUAGE");
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::AddSYCLDeviceTargetFlags(cmBuildStep compileOrLink,
|
||||
std::string const& config,
|
||||
std::string& flags) const
|
||||
{
|
||||
if (compileOrLink == cmBuildStep::Link && !this->IsDeviceLink() &&
|
||||
requireDeviceLinking(*this, *this->LocalGenerator, config, "SYCL")) {
|
||||
return;
|
||||
}
|
||||
std::string targets = this->GetSafeProperty("SYCL_DEVICE_TARGETS");
|
||||
auto const& compiler =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_SYCL_COMPILER_ID");
|
||||
bool const acpp = compiler == "AdaptiveCpp";
|
||||
auto const& baseline =
|
||||
this->Makefile->GetSafeDefinition("_CMAKE_SYCL_DEVICE_TARGETS");
|
||||
if (targets.empty()) {
|
||||
targets = baseline;
|
||||
}
|
||||
bool multipass = false;
|
||||
if (acpp) {
|
||||
static std::unordered_set<std::string> const multipassFlows{
|
||||
"cuda", "cuda.integrated-multipass", "cuda.explicit-multipass",
|
||||
"hip", "hip.integrated-multipass", "hip.explicit-multipass"
|
||||
};
|
||||
for (auto const& entry : cmList{ targets }) {
|
||||
std::string const flow = cmSystemTools::LowerCase(
|
||||
cmTrimWhitespace(entry.substr(0, entry.find(':'))));
|
||||
if (multipassFlows.find(flow) != multipassFlows.end()) {
|
||||
multipass = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!targets.empty() && !cmIsOff(targets)) {
|
||||
std::string option;
|
||||
if (acpp) {
|
||||
option = "--acpp-targets=" + targets;
|
||||
} else if (compiler == "IntelLLVM") {
|
||||
option = "-fsycl-targets=" + cmJoin(cmList{ targets }, ",");
|
||||
} else if (compiler == "Clang") {
|
||||
option = "--offload-targets=" + cmJoin(cmList{ targets }, ",");
|
||||
} else {
|
||||
this->LocalGenerator->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("SYCL_DEVICE_TARGETS is not supported by the ", compiler,
|
||||
" compiler."));
|
||||
return;
|
||||
}
|
||||
flags = cmStrCat(std::move(flags), ' ',
|
||||
this->LocalGenerator->EscapeForShell(option));
|
||||
}
|
||||
bool const callerSelectsLanguage =
|
||||
acpp && !targets.empty() && cmIsOff(targets);
|
||||
if (compileOrLink == cmBuildStep::Compile && !multipass &&
|
||||
!callerSelectsLanguage) {
|
||||
flags += " -x c++";
|
||||
}
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink,
|
||||
std::string const& config,
|
||||
std::string& flags) const
|
||||
@@ -3702,7 +3808,53 @@ bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config)
|
||||
bool cmGeneratorTarget::ComputeCompileFeatures(
|
||||
std::string const& config, std::set<LanguagePair> const& languagePairs)
|
||||
{
|
||||
cmStandardLevelResolver standardResolver(this->Makefile);
|
||||
for (auto const& language : languagePairs) {
|
||||
if (language.first == "SYCL") {
|
||||
if (!this->IsSYCLAppendMode(language.first)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string key =
|
||||
cmStrCat(cmSystemTools::UpperCase(config), '-', language.first);
|
||||
BTs<std::string> const* currentStandard = nullptr;
|
||||
auto current = this->LanguageStandardMap.find(key);
|
||||
if (current != this->LanguageStandardMap.end()) {
|
||||
currentStandard = ¤t->second;
|
||||
} else {
|
||||
currentStandard = this->Target->GetLanguageStandardProperty(
|
||||
cmStandardLevelResolver::GetStandardPropertyName(language.first));
|
||||
}
|
||||
|
||||
BTs<std::string> const* pairedStandard =
|
||||
this->GetLanguageStandardProperty(language.second, config);
|
||||
BTs<std::string> defaultStandard;
|
||||
if (!pairedStandard && !currentStandard) {
|
||||
if (cmValue value = this->Makefile->GetDefinition(
|
||||
cmStrCat("CMAKE_", language.second, "_STANDARD_DEFAULT"))) {
|
||||
defaultStandard = BTs<std::string>(*value);
|
||||
pairedStandard = &defaultStandard;
|
||||
}
|
||||
if (cmValue value =
|
||||
this->Makefile->GetDefinition("CMAKE_SYCL_STANDARD_DEFAULT")) {
|
||||
if (!pairedStandard ||
|
||||
standardResolver.IsLaterStandard(language.first, *value,
|
||||
pairedStandard->Value)) {
|
||||
defaultStandard = BTs<std::string>(*value);
|
||||
pairedStandard = &defaultStandard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pairedStandard &&
|
||||
(!currentStandard ||
|
||||
standardResolver.IsLaterStandard(
|
||||
language.first, pairedStandard->Value, currentStandard->Value))) {
|
||||
this->LanguageStandardMap[key] = *pairedStandard;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
BTs<std::string> const* generatorTargetLanguageStandard =
|
||||
this->GetLanguageStandardProperty(language.first, config);
|
||||
if (!generatorTargetLanguageStandard) {
|
||||
@@ -6322,11 +6474,14 @@ cmGeneratorFileSet const* cmGeneratorTarget::GetFileSetForSource(
|
||||
std::string cmGeneratorTarget::GetSourceFileLanguage(
|
||||
cmSourceFile const* source, std::string const& config) const
|
||||
{
|
||||
if (auto const language =
|
||||
std::string language = source->GetLanguage();
|
||||
if (auto const overrideLanguage =
|
||||
this->FileSets->GetLanguageForSource(config, source)) {
|
||||
return *language;
|
||||
language = *overrideLanguage;
|
||||
}
|
||||
return source->GetLanguage();
|
||||
return language == "CXX"_s && this->FileSets->HasSyclHeaders(config)
|
||||
? "SYCL"
|
||||
: language;
|
||||
}
|
||||
|
||||
std::string cmGeneratorTarget::BuildDatabasePath(
|
||||
|
||||
@@ -213,6 +213,14 @@ public:
|
||||
|
||||
bool GetLanguageStandardRequired(std::string const& lang) const;
|
||||
|
||||
enum class SYCLExtensionMode
|
||||
{
|
||||
Append,
|
||||
Replace
|
||||
};
|
||||
|
||||
SYCLExtensionMode GetSYCLExtensionMode() const;
|
||||
bool IsSYCLAppendMode(std::string const& lang) const;
|
||||
void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&,
|
||||
std::string const& config) const;
|
||||
void GetExternalObjects(std::vector<cmSourceFile const*>&,
|
||||
@@ -628,6 +636,9 @@ public:
|
||||
void AddHIPArchitectureFlags(cmBuildStep compileOrLink,
|
||||
std::string const& config,
|
||||
std::string& flags) const;
|
||||
void AddSYCLDeviceTargetFlags(cmBuildStep compileOrLink,
|
||||
std::string const& config,
|
||||
std::string& flags) const;
|
||||
|
||||
void AddISPCTargetFlags(std::string& flags) const;
|
||||
|
||||
|
||||
Loaded 100 of 394 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user