deps: update cmake to 3.25.1

This commit is contained in:
alexey.lysiuk 2023-01-10 16:42:48 +02:00
parent 9e058ac20f
commit 8f83130649
1219 changed files with 12488 additions and 5859 deletions

BIN
deps/cmake/bin/cmake vendored

Binary file not shown.

View file

@ -13,7 +13,7 @@ fi
# $2: language (e.g. C/CXX/Fortran) # $2: language (e.g. C/CXX/Fortran)
# $3: The compiler ID, defaults to GNU. # $3: The compiler ID, defaults to GNU.
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI, # Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
# PathScale, Cray, SCO, MSVC # PathScale, Cray, SCO, MSVC, LCC
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8" # $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
# $5: optional path to cmake binary # $5: optional path to cmake binary
AC_DEFUN([CMAKE_FIND_PACKAGE], [ AC_DEFUN([CMAKE_FIND_PACKAGE], [

View file

@ -1,18 +0,0 @@
#ifndef __CUDACC__
# error "A C or C++ compiler has been selected for CUDA"
#endif
#include "CMakeCompilerABI.h"
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
(void)argv;
return require;
}

View file

@ -1,64 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeDependentOption
--------------------
Macro to provide an option dependent on other options.
This macro presents an option to the user only if a set of other
conditions are true.
Usage:
.. code-block:: cmake
cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>)
Where ``<option>`` is available to the user if ``<depends>`` is true. When
``<option>`` is available, the given ``<help_text>`` and initial ``<value>``
are used. If the ``<depends>`` condition is not true, ``<option>`` will not be
presented and will always have the value given by ``<force>``. Any value set by
the user is preserved for when the option is presented again. Each element in
the fourth parameter is evaluated as an if-condition, so
:ref:`Condition Syntax` can be used.
Example invocation:
.. code-block:: cmake
cmake_dependent_option(USE_FOO "Use Foo" ON
"USE_BAR;NOT USE_ZOT" OFF)
If ``USE_BAR`` is true and ``USE_ZOT`` is false, this provides an option called
``USE_FOO`` that defaults to ON. Otherwise, it sets ``USE_FOO`` to OFF and
hides the option from the user. If the status of ``USE_BAR`` or ``USE_ZOT``
ever changes, any value for the ``USE_FOO`` option is saved so that when the
option is re-enabled it retains its old value.
#]=======================================================================]
macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
if(${option}_ISSET MATCHES "^${option}_ISSET$")
set(${option}_AVAILABLE 1)
foreach(d ${depends})
string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
if(${CMAKE_DEPENDENT_OPTION_DEP})
else()
set(${option}_AVAILABLE 0)
endif()
endforeach()
if(${option}_AVAILABLE)
option(${option} "${doc}" "${default}")
set(${option} "${${option}}" CACHE BOOL "${doc}" FORCE)
else()
if(${option} MATCHES "^${option}$")
else()
set(${option} "${${option}}" CACHE INTERNAL "${doc}")
endif()
set(${option} ${force})
endif()
else()
set(${option} "${${option}_ISSET}")
endif()
endmacro()

View file

@ -1,101 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
("${CMAKE_GENERATOR}" MATCHES "Ninja") ) )
message(FATAL_ERROR "HIP language not currently supported by \"${CMAKE_GENERATOR}\" generator")
endif()
if(NOT CMAKE_HIP_COMPILER)
set(CMAKE_HIP_COMPILER_INIT NOTFOUND)
# prefer the environment variable HIPCXX
if(NOT $ENV{HIPCXX} STREQUAL "")
get_filename_component(CMAKE_HIP_COMPILER_INIT $ENV{HIPCXX} PROGRAM PROGRAM_ARGS CMAKE_HIP_FLAGS_ENV_INIT)
if(CMAKE_HIP_FLAGS_ENV_INIT)
set(CMAKE_HIP_COMPILER_ARG1 "${CMAKE_HIP_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CXX compiler")
endif()
if(NOT EXISTS ${CMAKE_HIP_COMPILER_INIT})
message(FATAL_ERROR "Could not find compiler set in environment variable HIPCXX:\n$ENV{HIPCXX}.\n${CMAKE_HIP_COMPILER_INIT}")
endif()
endif()
# finally list compilers to try
if(NOT CMAKE_HIP_COMPILER_INIT)
set(CMAKE_HIP_COMPILER_LIST hipcc clang++)
endif()
_cmake_find_compiler(HIP)
else()
_cmake_find_compiler_path(HIP)
endif()
mark_as_advanced(CMAKE_HIP_COMPILER)
# Build a small source file to identify the compiler.
if(NOT CMAKE_HIP_COMPILER_ID_RUN)
set(CMAKE_HIP_COMPILER_ID_RUN 1)
# Try to identify the compiler.
set(CMAKE_HIP_COMPILER_ID)
set(CMAKE_HIP_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_HIP_COMPILER_ID_PLATFORM_CONTENT)
list(APPEND CMAKE_HIP_COMPILER_ID_TEST_FLAGS_FIRST "-v")
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(HIP HIPFLAGS CMakeHIPCompilerId.hip)
_cmake_find_compiler_sysroot(HIP)
endif()
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_HIP_COMPILER}" PATH)
endif ()
set(_CMAKE_PROCESSING_LANGUAGE "HIP")
include(CMakeFindBinUtils)
include(Compiler/${CMAKE_HIP_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
if(CMAKE_HIP_COMPILER_SYSROOT)
string(CONCAT _SET_CMAKE_HIP_COMPILER_SYSROOT
"set(CMAKE_HIP_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")\n"
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")")
else()
set(_SET_CMAKE_HIP_COMPILER_SYSROOT "")
endif()
if(CMAKE_HIP_COMPILER_ARCHITECTURE_ID)
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID
"set(CMAKE_HIP_COMPILER_ARCHITECTURE_ID ${CMAKE_HIP_COMPILER_ARCHITECTURE_ID})")
else()
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID "")
endif()
if(MSVC_HIP_ARCHITECTURE_ID)
set(SET_MSVC_HIP_ARCHITECTURE_ID
"set(MSVC_HIP_ARCHITECTURE_ID ${MSVC_HIP_ARCHITECTURE_ID})")
endif()
if(NOT DEFINED CMAKE_HIP_ARCHITECTURES)
# Analyze output from hipcc to get the current GPU architecture.
if(CMAKE_HIP_COMPILER_PRODUCED_OUTPUT MATCHES " -target-cpu ([a-z0-9]+) ")
set(CMAKE_HIP_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "HIP architectures")
else()
message(FATAL_ERROR "Failed to find a working HIP architecture.")
endif()
endif()
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeHIPCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPCompiler.cmake
@ONLY
)
set(CMAKE_HIP_COMPILER_ENV_VAR "HIPCXX")

View file

@ -1,99 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
function(_CMAKE_FIND_HIP_RUNTIME )
# Determined when hipcc is the HIP compiler
set(_CMAKE_HIP_COMPILER_ROCM_ROOT "@_CMAKE_HIP_COMPILER_ROCM_ROOT@")
# Forward facing value that can be provided by the user
set(CMAKE_HIP_COMPILER_TOOLKIT_ROOT @CMAKE_HIP_COMPILER_TOOLKIT_ROOT@)
if(NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET)
set(message_on_found TRUE)
endif()
set(explicit_search_only FALSE)
set(rocm_root_dirs )
if(DEFINED CMAKE_HIP_COMPILER_TOOLKIT_ROOT)
set(rocm_root_dirs "${CMAKE_HIP_COMPILER_TOOLKIT_ROOT}")
set(explicit_search_only TRUE)
set(error_message_location "the variable CMAKE_HIP_COMPILER_TOOLKIT_ROOT [\"${CMAKE_HIP_COMPILER_TOOLKIT_ROOT}\"]")
elseif(DEFINED ENV{CMAKE_HIP_COMPILER_TOOLKIT_ROOT})
set(rocm_root_dirs "$ENV{CMAKE_HIP_COMPILER_TOOLKIT_ROOT}")
set(explicit_search_only TRUE)
set(error_message_location "CMAKE_HIP_COMPILER_TOOLKIT_ROOT")
set(error_message_location "the environment variable CMAKE_HIP_COMPILER_TOOLKIT_ROOT [\"$ENV{CMAKE_HIP_COMPILER_TOOLKIT_ROOT}\"]")
elseif(DEFINED _CMAKE_HIP_COMPILER_ROCM_ROOT)
set(rocm_root_dirs "${_CMAKE_HIP_COMPILER_ROCM_ROOT}")
set(explicit_search_only TRUE)
set(error_message_location "the associated hipconfig --rocmpath [\"${_CMAKE_HIP_COMPILER_ROCM_ROOT}\"]")
endif()
# Guess on where rocm is installed
if(NOT rocm_root_dirs AND (UNIX AND NOT APPLE))
set(platform_base "/opt/rocm-")
# Finad all default rocm installations
file(GLOB possible_paths "${platform_base}*")
set(versions)
foreach(p ${possible_paths})
# Extract version number from end of string
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+$" p_version ${p})
if(IS_DIRECTORY ${p} AND p_version)
list(APPEND versions ${p_version})
endif()
endforeach()
# Sort numerically in descending order, so we try the newest versions first.
list(SORT versions COMPARE NATURAL ORDER DESCENDING)
# With a descending list of versions, populate possible paths to search.
set(rocm_root_dirs "/opt/rocm")
foreach(v IN LISTS versions)
list(APPEND rocm_root_dirs "${platform_base}${v}")
endforeach()
endif()
set(search_rel_path "/lib/cmake/hip-lang/")
list(TRANSFORM rocm_root_dirs APPEND "${search_rel_path}")
find_package(hip-lang
CONFIG
PATHS ${rocm_root_dirs}
QUIET
NO_DEFAULT_PATH
)
if(NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET AND NOT explicit_search_only)
find_package(hip-lang CONFIG QUIET)
endif()
if(DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET)
set(CMAKE_HIP_RUNTIME_LIBRARIES_STATIC
${CMAKE_HIP_RUNTIME_LIBRARIES_STATIC}
${_CMAKE_HIP_DEVICE_RUNTIME_TARGET} PARENT_SCOPE)
set(CMAKE_HIP_RUNTIME_LIBRARIES_SHARED
${CMAKE_HIP_RUNTIME_LIBRARIES_SHARED}
${_CMAKE_HIP_DEVICE_RUNTIME_TARGET} PARENT_SCOPE)
endif()
if(DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET AND message_on_found)
message(STATUS "Found HIP runtime: ${hip-lang_DIR}")
elseif(NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET)
if(explicit_search_only)
set(error_message "Failed to find the HIP runtime, Could not find hip-lang-config.cmake at the following location(s):\n")
foreach(p IN LISTS rocm_root_dirs)
string(APPEND error_message "\t${p}\n")
endforeach()
string(APPEND "which are computed from the location specified by ${error_message_location}. \
Please specify CMAKE_HIP_COMPILER_TOOLKIT_ROOT to the location of")
message(FATAL_ERROR "${error_message}")
else()
message(FATAL_ERROR
"Failed to find the HIP runtime, Could not find hip-lang-config.cmake.\
Try setting CMAKE_HIP_COMPILER_TOOLKIT_ROOT")
endif()
endif()
endfunction()

View file

@ -1,10 +0,0 @@
set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)")
set(_compiler_id_version_compute "
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF)
#endif")

View file

@ -1,3 +0,0 @@
include(Compiler/Clang-CXX)
include(Compiler/ARMClang)
__compiler_armclang(CXX)

View file

@ -1,57 +0,0 @@
# This file is processed when the IAR compiler is used for an assembler file
include(Compiler/IAR)
if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISC-V")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_xlink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_xlink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s43;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_xlink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_xlink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa)
elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
__compiler_iar_ilink(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa)
else()
message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
endif()

View file

@ -1,39 +0,0 @@
# IAR Systems compiler for ARM embedded systems.
# http://www.iar.com
# http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
#
# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform:
# 9 and higher means C11 and C++14 as language default
# 8 means C99 and C++03 as language default
# 7 and lower means C89 and EC++ as language default.
# __ICCARM__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for ARM
# __VER__ An integer that identifies the version number of the IAR compiler in use. For example,
# version 5.11.3 is returned as 5011003.
#
# IAR Systems Compiler for AVR embedded systems
# http://supp.iar.com/FilesPublic/UPDINFO/007051/ew/doc/EWAVR_CompilerReference.pdf
#
# __IAR_SYSTEMS_ICC__ An integer that identifies the IAR compiler platform.
# __ICCAVR__ An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for AVR
# __VER__ An integer that identifies the version number of the IAR compiler in use.
# The value is calculated by (100 * VERSION_MAJOR + VERSION_MINOR). For example the version
# 3.34 is given as 334
# __SUBVERSION__ An integer that identifies the subversion number of the compiler version number
# for example 3 in 1.2.3.4. THis is used as the patch version, as seen when running iccavr
# from the command line
#
set(_compiler_id_pp_test "defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)")
set(_compiler_id_version_compute "
# if defined(__VER__) && defined(__ICCARM__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 1000000)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100))
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
# endif")

View file

@ -1,65 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/CMakeCommonCompilerMacros)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std:c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std:c11")
__compiler_check_default_language_standard(C 19.27 99)
else()
# MSVC has no specific options to set C language standards, but set them as
# empty strings anyways so the feature test infrastructure can at least check
# to see if they are defined.
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
# There is no meaningful default for this
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC)
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
# There are no C compiler modes so we hard-code the known compiler supported
# features. Override the default macro for this special case. Pretend that
# all language standards are available so that at least compilation
# can be attempted.
macro(cmake_record_c_compile_features)
list(APPEND CMAKE_C_COMPILE_FEATURES
c_std_90
c_std_99
c_std_11
c_function_prototypes
)
list(APPEND CMAKE_C90_COMPILE_FEATURES c_std_90 c_function_prototypes)
list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99)
list(APPEND CMAKE_C11_COMPILE_FEATURES c_std_11)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
list(APPEND CMAKE_C_COMPILE_FEATURES c_variadic_macros)
list(APPEND CMAKE_C99_COMPILE_FEATURES c_variadic_macros)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
list(APPEND CMAKE_C_COMPILE_FEATURES c_restrict)
list(APPEND CMAKE_C99_COMPILE_FEATURES c_restrict)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
list(APPEND CMAKE_C_COMPILE_FEATURES c_static_assert)
list(APPEND CMAKE_C11_COMPILE_FEATURES c_static_assert)
endif()
set(_result 0) # expected by cmake_determine_compile_features
endmacro()
# /JMC "Just My Code" is only supported by MSVC 19.05 onward.
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05)
set(CMAKE_C_COMPILE_OPTIONS_JMC "-JMC")
endif()

View file

@ -1,12 +0,0 @@
include(Compiler/PGI-C)
include(Compiler/NVHPC)
# Needed so that we support `LANGUAGE` property correctly
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
# Required since as of NVHPC 21.03 the `-MD` flag implicitly
# implies `-E` and therefore compilation and dependency generation
# can't occur in the same invocation
set(CMAKE_C_DEPENDS_EXTRA_COMMANDS "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
__compiler_nvhpc(C)

View file

@ -1,12 +0,0 @@
include(Compiler/PGI-CXX)
include(Compiler/NVHPC)
# Needed so that we support `LANGUAGE` property correctly
set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
# Required since as of NVHPC 21.03 the `-MD` flag implicitly
# implies `-E` and therefore compilation and dependency generation
# can't occur in the same invocation
set(CMAKE_CXX_DEPENDS_EXTRA_COMMANDS "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c++ -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
__compiler_nvhpc(CXX)

View file

@ -1,2 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(ASM)

View file

@ -1,7 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(C)
set(_rocm_clang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-C)
set(CMAKE_C_COMPILER_VERSION "${_rocm_clang_ver}")

View file

@ -1,7 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(CXX)
set(_rocm_clang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-CXX)
set(CMAKE_CXX_COMPILER_VERSION "${_rocm_clang_ver}")

View file

@ -1,19 +0,0 @@
set(_compiler_id_pp_test "defined(__clang__) && __has_include(<hip/hip_version.h>)")
set(_compiler_id_version_compute "
# if defined(__clang__) && __has_include(<hip/hip_version.h>)
# include <hip/hip_version.h>
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(HIP_VERSION_MAJOR)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(HIP_VERSION_MINOR)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(HIP_VERSION_PATCH)
# endif")
set(_compiler_id_simulate "
# if defined(_MSC_VER)
# define @PREFIX@SIMULATE_ID \"MSVC\"
# elif defined(__clang__)
# define @PREFIX@SIMULATE_ID \"Clang\"
# elif defined(__GNUC__)
# define @PREFIX@SIMULATE_ID \"GNU\"
# endif")

View file

@ -1 +0,0 @@
include(Compiler/Clang-FindBinUtils)

View file

@ -1,49 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(HIP)
set(_CMAKE_COMPILE_AS_HIP_FLAG "-x hip")
set(_CMAKE_HIP_RDC_FLAG "-fgpu-rdc")
if(NOT "x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
string(APPEND CMAKE_HIP_FLAGS_DEBUG_INIT " -O")
endif()
if(CMAKE_HIP_SIMULATE_ID STREQUAL "GNU")
set(CMAKE_HIP_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP ",")
elseif(CMAKE_HIP_SIMULATE_ID STREQUAL "Clang")
set(CMAKE_HIP_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP)
endif()
if(NOT CMAKE_HIP_COMPILER_VERSION VERSION_LESS 1.0)
set(CMAKE_HIP98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_HIP98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
set(CMAKE_HIP98_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_HIP11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_HIP11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_HIP11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_HIP14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_HIP14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_HIP14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_HIP17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_HIP17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
set(CMAKE_HIP17_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_HIP20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_HIP20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
endif()
set(CMAKE_HIP_RUNTIME_LIBRARY_DEFAULT "SHARED")
set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "")
set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "")
# Populated by CMakeHIPRuntime.cmake
set(CMAKE_HIP_RUNTIME_LIBRARIES_STATIC "")
set(CMAKE_HIP_RUNTIME_LIBRARIES_SHARED "")
__compiler_check_default_language_standard(HIP 3.5 11)

View file

@ -1,7 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(OBJC)
set(_rocm_clang_ver "${CMAKE_OBJC_COMPILER_VERSION_INTERNAL}")
set(CMAKE_OBJC_COMPILER_VERSION "${CMAKE_OBJC_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-OBJC)
set(CMAKE_OBJC_COMPILER_VERSION "${_rocm_clang_ver}")

View file

@ -1,7 +0,0 @@
include(Compiler/ROCMClang)
__compiler_rocmclang(OBJCXX)
set(_rocm_clang_ver "${CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL}")
set(CMAKE_OBJCXX_COMPILER_VERSION "${CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-OBJCXX)
set(CMAKE_OBJCXX_COMPILER_VERSION "${_rocm_clang_ver}")

View file

@ -1,35 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
include_guard()
include(Compiler/CMakeCommonCompilerMacros)
macro(__compiler_rocmclang lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
if(NOT "x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
# Feature flags.
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY -fvisibility=)
string(APPEND CMAKE_HIP_FLAGS_INIT " ")
string(APPEND CMAKE_HIP_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_HIP_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
string(APPEND CMAKE_HIP_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
string(APPEND CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
endif()
set(CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS -shared)
set(CMAKE_INCLUDE_SYSTEM_FLAG_HIP "-isystem ")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
endmacro()

File diff suppressed because it is too large Load diff

View file

@ -1,206 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindGLUT
--------
Find OpenGL Utility Toolkit (GLUT) library and include files.
IMPORTED Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.1
This module defines the :prop_tgt:`IMPORTED` targets:
``GLUT::GLUT``
Defined if the system has GLUT.
Result Variables
^^^^^^^^^^^^^^^^
This module sets the following variables:
::
GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
GLUT_LIBRARIES, the libraries to link against
GLUT_FOUND, If false, do not try to use GLUT.
Also defined, but not for general use are:
::
GLUT_glut_LIBRARY = the full path to the glut library.
GLUT_Xmu_LIBRARY = the full path to the Xmu library.
GLUT_Xi_LIBRARY = the full path to the Xi Library.
.. versionadded:: 3.13
Debug and Release variants are found separately.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
if (WIN32)
find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h
PATHS ${GLUT_ROOT_PATH}/include )
find_library( GLUT_glut_LIBRARY_RELEASE NAMES glut glut32 freeglut
PATHS
${OPENGL_LIBRARY_DIR}
${GLUT_ROOT_PATH}/Release
)
find_library( GLUT_glut_LIBRARY_DEBUG NAMES freeglutd
PATHS
${OPENGL_LIBRARY_DIR}
${GLUT_ROOT_PATH}/Debug
)
mark_as_advanced(GLUT_glut_LIBRARY_RELEASE GLUT_glut_LIBRARY_DEBUG)
select_library_configurations(GLUT_glut)
else ()
if (APPLE)
find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
mark_as_advanced(GLUT_glut_LIBRARY GLUT_cocoa_LIBRARY)
if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
add_library(GLUT::Cocoa UNKNOWN IMPORTED)
# Cocoa should always be a Framework, but we check to make sure.
if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_glut_cocoa "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_glut_cocoa}.tbd")
string(APPEND _glut_cocoa ".tbd")
endif()
set_target_properties(GLUT::Cocoa PROPERTIES
IMPORTED_LOCATION "${_glut_cocoa}")
else()
set_target_properties(GLUT::Cocoa PROPERTIES
IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
endif()
endif()
else ()
if (BEOS)
set(_GLUT_INC_DIR /boot/develop/headers/os/opengl)
set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86)
else()
find_library( GLUT_Xi_LIBRARY Xi
/usr/openwin/lib
)
mark_as_advanced(GLUT_Xi_LIBRARY)
find_library( GLUT_Xmu_LIBRARY Xmu
/usr/openwin/lib
)
mark_as_advanced(GLUT_Xmu_LIBRARY)
if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
add_library(GLUT::Xi UNKNOWN IMPORTED)
set_target_properties(GLUT::Xi PROPERTIES
IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
endif()
if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
add_library(GLUT::Xmu UNKNOWN IMPORTED)
set_target_properties(GLUT::Xmu PROPERTIES
IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
endif()
endif ()
find_path( GLUT_INCLUDE_DIR GL/glut.h
/usr/include/GL
/usr/openwin/share/include
/usr/openwin/include
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglut
${_GLUT_INC_DIR}
)
find_library( GLUT_glut_LIBRARY glut
/usr/openwin/lib
${_GLUT_glut_LIB_DIR}
)
mark_as_advanced(GLUT_glut_LIBRARY)
unset(_GLUT_INC_DIR)
unset(_GLUT_glut_LIB_DIR)
endif ()
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
if (GLUT_FOUND)
# Is -lXi and -lXmu required on all platforms that have it?
# If not, we need some way to figure out what platform we are on.
set( GLUT_LIBRARIES
${GLUT_glut_LIBRARY}
)
foreach(v GLUT_Xmu_LIBRARY GLUT_Xi_LIBRARY GLUT_cocoa_LIBRARY)
if(${v})
list(APPEND GLUT_LIBRARIES ${${v}})
endif()
endforeach()
if(NOT TARGET GLUT::GLUT)
add_library(GLUT::GLUT UNKNOWN IMPORTED)
set_target_properties(GLUT::GLUT PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}")
if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$")
set(_glut_glut "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}")
if(EXISTS "${_glut_glut}.tbd")
string(APPEND _glut_glut ".tbd")
endif()
set_target_properties(GLUT::GLUT PROPERTIES
IMPORTED_LOCATION "${_glut_glut}")
else()
if(GLUT_glut_LIBRARY_RELEASE)
set_property(TARGET GLUT::GLUT APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(GLUT::GLUT PROPERTIES
IMPORTED_LOCATION_RELEASE "${GLUT_glut_LIBRARY_RELEASE}")
endif()
if(GLUT_glut_LIBRARY_DEBUG)
set_property(TARGET GLUT::GLUT APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(GLUT::GLUT PROPERTIES
IMPORTED_LOCATION_DEBUG "${GLUT_glut_LIBRARY_DEBUG}")
endif()
if(NOT GLUT_glut_LIBRARY_RELEASE AND NOT GLUT_glut_LIBRARY_DEBUG)
set_property(TARGET GLUT::GLUT APPEND PROPERTY
IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
endif()
endif()
if(TARGET GLUT::Xmu)
set_property(TARGET GLUT::GLUT APPEND
PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu)
endif()
if(TARGET GLUT::Xi)
set_property(TARGET GLUT::GLUT APPEND
PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi)
endif()
if(TARGET GLUT::Cocoa)
set_property(TARGET GLUT::GLUT APPEND
PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa)
endif()
endif()
#The following deprecated settings are for backwards compatibility with CMake1.4
set (GLUT_LIBRARY ${GLUT_LIBRARIES})
set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
endif()
mark_as_advanced(GLUT_INCLUDE_DIR)

View file

@ -1,405 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJNI
-------
Find Java Native Interface (JNI) libraries.
JNI enables Java code running in a Java Virtual Machine (JVM) to call
and be called by native applications and libraries written in other
languages such as C, C++.
This module finds if Java is installed and determines where the
include files and libraries are. It also determines what the name of
the library is. The caller may set variable ``JAVA_HOME`` to specify a
Java installation prefix explicitly.
Result Variables
^^^^^^^^^^^^^^^^
This module sets the following result variables:
``JNI_INCLUDE_DIRS``
the include dirs to use
``JNI_LIBRARIES``
the libraries to use (JAWT and JVM)
``JNI_FOUND``
TRUE if JNI headers and libraries were found.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables are also available to set or use:
``JAVA_AWT_LIBRARY``
the path to the Java AWT Native Interface (JAWT) library
``JAVA_JVM_LIBRARY``
the path to the Java Virtual Machine (JVM) library
``JAVA_INCLUDE_PATH``
the include path to jni.h
``JAVA_INCLUDE_PATH2``
the include path to jni_md.h and jniport.h
``JAVA_AWT_INCLUDE_PATH``
the include path to jawt.h
#]=======================================================================]
# Expand {libarch} occurrences to java_libarch subdirectory(-ies) and set ${_var}
macro(java_append_library_directories _var)
# Determine java arch-specific library subdir
# Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
# 1.6.0_18 + icedtea patches. However, it would be much better to base the
# guess on the first part of the GNU config.guess platform triplet.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
set(_java_libarch "x32" "amd64" "i386")
else()
set(_java_libarch "amd64" "i386")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(_java_libarch "i386")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
set(_java_libarch "arm64" "aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
set(_java_libarch "alpha")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
# Subdir is "arm" for both big-endian (arm) and little-endian (armel).
set(_java_libarch "arm" "aarch32")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
# mips* machines are bi-endian mostly so processor does not tell
# endianness of the underlying system.
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}"
"mips" "mipsel" "mipseb" "mipsr6" "mipsr6el"
"mips64" "mips64el" "mips64r6" "mips64r6el"
"mipsn32" "mipsn32el" "mipsn32r6" "mipsn32r6el")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
set(_java_libarch "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
set(_java_libarch "ppc64" "ppc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
set(_java_libarch "ppc" "ppc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
# Both flavors can run on the same processor
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
set(_java_libarch "parisc" "parisc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
# s390 binaries can run on s390x machines
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
set(_java_libarch "sh")
else()
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
endif()
# Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
# system is non-Linux (where the code above has not been well tested)
if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
list(APPEND _java_libarch "i386" "amd64" "ppc")
endif()
# Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
# current value to a hardcoded list. Remove possible duplicates.
list(REMOVE_DUPLICATES _java_libarch)
foreach(_path ${ARGN})
if(_path MATCHES "{libarch}")
foreach(_libarch ${_java_libarch})
string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
if(EXISTS ${_newpath})
list(APPEND ${_var} "${_newpath}")
endif()
endforeach()
else()
if(EXISTS ${_path})
list(APPEND ${_var} "${_path}")
endif()
endif()
endforeach()
endmacro()
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
# Save CMAKE_FIND_FRAMEWORK
if(DEFINED CMAKE_FIND_FRAMEWORK)
set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
else()
unset(_JNI_CMAKE_FIND_FRAMEWORK)
endif()
if(_JAVA_HOME_EXPLICIT)
set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
set(JAVA_AWT_LIBRARY_DIRECTORIES)
if(_JAVA_HOME)
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
${_JAVA_HOME}/jre/lib/{libarch}
${_JAVA_HOME}/jre/lib
${_JAVA_HOME}/lib/{libarch}
${_JAVA_HOME}/lib
${_JAVA_HOME}
)
endif()
if (WIN32)
set (_JNI_HINTS)
execute_process(COMMAND REG QUERY HKLM\\SOFTWARE\\JavaSoft\\JDK
RESULT_VARIABLE _JNI_RESULT
OUTPUT_VARIABLE _JNI_VERSIONS
ERROR_QUIET)
if (NOT _JNI_RESULT)
string (REGEX MATCHALL "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\JDK\\\\[0-9.]+" _JNI_VERSIONS "${_JNI_VERSIONS}")
if (_JNI_VERSIONS)
# sort versions. Most recent first
## handle version 9 apart from other versions to get correct ordering
set (_JNI_V9 ${_JNI_VERSIONS})
list (FILTER _JNI_VERSIONS EXCLUDE REGEX "JDK\\\\9")
list (SORT _JNI_VERSIONS)
list (REVERSE _JNI_VERSIONS)
list (FILTER _JNI_V9 INCLUDE REGEX "JDK\\\\9")
list (SORT _JNI_V9)
list (REVERSE _JNI_V9)
list (APPEND _JNI_VERSIONS ${_JNI_V9})
foreach (_JNI_HINT IN LISTS _JNI_VERSIONS)
list(APPEND _JNI_HINTS "[${_JNI_HINT};JavaHome]")
endforeach()
endif()
endif()
foreach (_JNI_HINT IN LISTS _JNI_HINTS)
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${_JNI_HINT}/lib")
endforeach()
get_filename_component(java_install_version
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
)
endif()
set(_JNI_JAVA_DIRECTORIES_BASE
/usr/lib/jvm/java
/usr/lib/java
/usr/lib/jvm
/usr/local/lib/java
/usr/local/share/java
/usr/lib/j2sdk1.4-sun
/usr/lib/j2sdk1.5-sun
/opt/sun-jdk-1.5.0.04
/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-1.5.0-sun
/usr/lib/jvm/java-6-sun-1.6.0.00 # can this one be removed according to #8821 ? Alex
/usr/lib/jvm/java-6-openjdk
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 # fedora
# Debian specific paths for default JVM
/usr/lib/jvm/default-java
# Arch Linux specific paths for default JVM
/usr/lib/jvm/default
# Ubuntu specific paths for default JVM
/usr/lib/jvm/java-11-openjdk-{libarch} # Ubuntu 18.04 LTS
/usr/lib/jvm/java-8-openjdk-{libarch} # Ubuntu 15.10
/usr/lib/jvm/java-7-openjdk-{libarch} # Ubuntu 15.10
/usr/lib/jvm/java-6-openjdk-{libarch} # Ubuntu 15.10
# OpenBSD specific paths for default JVM
/usr/local/jdk-1.7.0
/usr/local/jre-1.7.0
/usr/local/jdk-1.6.0
/usr/local/jre-1.6.0
# FreeBSD specific paths for default JVM
/usr/local/openjdk15
/usr/local/openjdk14
/usr/local/openjdk13
/usr/local/openjdk12
/usr/local/openjdk11
/usr/local/openjdk8
/usr/local/openjdk7
# SuSE specific paths for default JVM
/usr/lib64/jvm/java
/usr/lib64/jvm/jre
)
set(_JNI_JAVA_AWT_LIBRARY_TRIES)
set(_JNI_JAVA_INCLUDE_TRIES)
foreach(_java_dir IN LISTS _JNI_JAVA_DIRECTORIES_BASE)
list(APPEND _JNI_JAVA_AWT_LIBRARY_TRIES
${_java_dir}/jre/lib/{libarch}
${_java_dir}/jre/lib
${_java_dir}/lib/{libarch}
${_java_dir}/lib
${_java_dir}
)
list(APPEND _JNI_JAVA_INCLUDE_TRIES
${_java_dir}/include
)
endforeach()
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
${_JNI_JAVA_AWT_LIBRARY_TRIES}
)
set(JAVA_JVM_LIBRARY_DIRECTORIES)
foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
"${dir}"
"${dir}/client"
"${dir}/server"
# IBM SDK, Java Technology Edition, specific paths
"${dir}/j9vm"
"${dir}/default"
)
endforeach()
set(JAVA_AWT_INCLUDE_DIRECTORIES)
if(_JAVA_HOME)
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
endif()
if (WIN32)
foreach (_JNI_HINT IN LISTS _JNI_HINTS)
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${_JNI_HINT}/include")
endforeach()
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
)
endif()
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
${_JNI_JAVA_INCLUDE_TRIES}
)
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
get_filename_component(jpath "${JAVA_PROG}" PATH)
foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
if(EXISTS ${jpath}/${JAVA_INC_PATH})
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
endif()
endforeach()
foreach(JAVA_LIB_PATH
../lib ../jre/lib ../jre/lib/i386
../java/lib ../java/jre/lib ../java/jre/lib/i386
../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
if(EXISTS ${jpath}/${JAVA_LIB_PATH})
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
endif()
endforeach()
endforeach()
if(APPLE)
if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
set(_JNI_SEARCHES FRAMEWORK)
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
set(_JNI_SEARCHES NORMAL)
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
set(_JNI_SEARCHES NORMAL FRAMEWORK)
else()
set(_JNI_SEARCHES FRAMEWORK NORMAL)
endif()
set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
else()
set(_JNI_SEARCHES NORMAL)
endif()
set(_JNI_NORMAL_JVM
NAMES jvm
PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
)
set(_JNI_NORMAL_JAWT
NAMES jawt
PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
)
foreach(search ${_JNI_SEARCHES})
find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
if(JAVA_JVM_LIBRARY)
break()
endif()
endforeach()
unset(_JNI_SEARCHES)
unset(_JNI_FRAMEWORK_JVM)
unset(_JNI_FRAMEWORK_JAWT)
unset(_JNI_NORMAL_JVM)
unset(_JNI_NORMAL_JAWT)
# Find headers matching the library.
if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
set(CMAKE_FIND_FRAMEWORK ONLY)
else()
set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
# add in the include path
find_path(JAVA_INCLUDE_PATH jni.h
${JAVA_AWT_INCLUDE_DIRECTORIES}
)
find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h
PATHS
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH}/darwin
${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux
${JAVA_INCLUDE_PATH}/freebsd
${JAVA_INCLUDE_PATH}/openbsd
${JAVA_INCLUDE_PATH}/solaris
${JAVA_INCLUDE_PATH}/hp-ux
${JAVA_INCLUDE_PATH}/alpha
${JAVA_INCLUDE_PATH}/aix
)
find_path(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_INCLUDE_PATH}
)
# Restore CMAKE_FIND_FRAMEWORK
if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
unset(_JNI_CMAKE_FIND_FRAMEWORK)
else()
unset(CMAKE_FIND_FRAMEWORK)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY
JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH
JAVA_INCLUDE_PATH2
JAVA_AWT_INCLUDE_PATH)
mark_as_advanced(
JAVA_AWT_LIBRARY
JAVA_JVM_LIBRARY
JAVA_AWT_INCLUDE_PATH
JAVA_INCLUDE_PATH
JAVA_INCLUDE_PATH2
)
set(JNI_LIBRARIES
${JAVA_AWT_LIBRARY}
${JAVA_JVM_LIBRARY}
)
set(JNI_INCLUDE_DIRS
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
${JAVA_AWT_INCLUDE_PATH}
)

View file

@ -1,47 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindJasper
----------
Try to find the Jasper JPEG2000 library
Once done this will define
::
JASPER_FOUND - system has Jasper
JASPER_INCLUDE_DIR - the Jasper include directory
JASPER_LIBRARIES - the libraries needed to use Jasper
JASPER_VERSION_STRING - the version of Jasper found (since CMake 2.8.8)
#]=======================================================================]
find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
if (NOT JASPER_LIBRARIES)
find_package(JPEG)
find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper)
find_library(JASPER_LIBRARY_DEBUG NAMES jasperd)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
SELECT_LIBRARY_CONFIGURATIONS(JASPER)
endif ()
if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*")
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
VERSION_VAR JASPER_VERSION_STRING)
if (JASPER_FOUND)
set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} )
endif ()
mark_as_advanced(JASPER_INCLUDE_DIR)

View file

@ -1,157 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindVulkan
----------
.. versionadded:: 3.7
Find Vulkan, which is a low-overhead, cross-platform 3D graphics
and computing API.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
``Vulkan::Vulkan``
The main Vulkan library.
``Vulkan::glslc``
.. versionadded:: 3.19
The GLSLC SPIR-V compiler, if it has been found.
``Vulkan::Headers``
.. versionadded:: 3.21
Provides just Vulkan headers include paths, if found. No library is
included in this target. This can be useful for applications that
load Vulkan library dynamically.
``Vulkan::glslangValidator``
.. versionadded:: 3.21
The glslangValidator tool, if found. It is used to compile GLSL and
HLSL shaders into SPIR-V.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables::
Vulkan_FOUND - "True" if Vulkan was found
Vulkan_INCLUDE_DIRS - include directories for Vulkan
Vulkan_LIBRARIES - link against this library to use Vulkan
The module will also define three cache variables::
Vulkan_INCLUDE_DIR - the Vulkan include directory
Vulkan_LIBRARY - the path to the Vulkan library
Vulkan_GLSLC_EXECUTABLE - the path to the GLSL SPIR-V compiler
Vulkan_GLSLANG_VALIDATOR_EXECUTABLE - the path to the glslangValidator tool
Hints
^^^^^
.. versionadded:: 3.18
The ``VULKAN_SDK`` environment variable optionally specifies the
location of the Vulkan SDK root directory for the given
architecture. It is typically set by sourcing the toplevel
``setup-env.sh`` script of the Vulkan SDK directory into the shell
environment.
#]=======================================================================]
if(WIN32)
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS
"$ENV{VULKAN_SDK}/Include"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(Vulkan_LIBRARY
NAMES vulkan-1
HINTS
"$ENV{VULKAN_SDK}/Lib"
"$ENV{VULKAN_SDK}/Bin"
)
find_program(Vulkan_GLSLC_EXECUTABLE
NAMES glslc
HINTS
"$ENV{VULKAN_SDK}/Bin"
)
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
NAMES glslangValidator
HINTS
"$ENV{VULKAN_SDK}/Bin"
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(Vulkan_LIBRARY
NAMES vulkan-1
HINTS
"$ENV{VULKAN_SDK}/Lib32"
"$ENV{VULKAN_SDK}/Bin32"
)
find_program(Vulkan_GLSLC_EXECUTABLE
NAMES glslc
HINTS
"$ENV{VULKAN_SDK}/Bin32"
)
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
NAMES glslangValidator
HINTS
"$ENV{VULKAN_SDK}/Bin32"
)
endif()
else()
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS "$ENV{VULKAN_SDK}/include")
find_library(Vulkan_LIBRARY
NAMES vulkan
HINTS "$ENV{VULKAN_SDK}/lib")
find_program(Vulkan_GLSLC_EXECUTABLE
NAMES glslc
HINTS "$ENV{VULKAN_SDK}/bin")
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
NAMES glslangValidator
HINTS "$ENV{VULKAN_SDK}/bin")
endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Vulkan
DEFAULT_MSG
Vulkan_LIBRARY Vulkan_INCLUDE_DIR)
mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY Vulkan_GLSLC_EXECUTABLE
Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
set_target_properties(Vulkan::Vulkan PROPERTIES
IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
if(Vulkan_FOUND AND NOT TARGET Vulkan::Headers)
add_library(Vulkan::Headers INTERFACE IMPORTED)
set_target_properties(Vulkan::Headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc)
add_executable(Vulkan::glslc IMPORTED)
set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE AND NOT TARGET Vulkan::glslangValidator)
add_executable(Vulkan::glslangValidator IMPORTED)
set_property(TARGET Vulkan::glslangValidator PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE}")
endif()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion="1.0">
<title>@CPACK_PACKAGE_NAME@</title>
<welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
<readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
<license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>
<options allow-external-scripts="no" customize="allow" rootVolumeOnly="false"></options>
@CPACK_PACKAGEMAKER_CHOICES@
</installer-gui-script>

View file

@ -1,83 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include_guard(GLOBAL)
include(Internal/CheckSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
cmake_policy(PUSH)
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
if(_lang STREQUAL "C")
set(_lang_src "int main(void) { return 0; }")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C"
FAIL_REGEX "-Werror=.* argument .* is not valid for C")
elseif(_lang STREQUAL "CXX")
set(_lang_src "int main() { return 0; }")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+"
FAIL_REGEX "-Werror=.* argument .* is not valid for C\\+\\+")
elseif(_lang STREQUAL "CUDA")
set(_lang_src "__host__ int main() { return 0; }")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU
FAIL_REGEX "argument unused during compilation: .*") # Clang
elseif(_lang STREQUAL "Fortran")
set(_lang_src " program test\n stop\n end program")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran")
elseif(_lang STREQUAL "HIP")
set(_lang_src "__host__ int main() { return 0; }")
set(_lang_fail_regex FAIL_REGEX "argument unused during compilation: .*") # Clang
elseif(_lang STREQUAL "OBJC")
set(_lang_src [=[
#ifndef __OBJC__
# error "Not an Objective-C compiler"
#endif
int main(void) { return 0; }]=])
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C" # GNU
FAIL_REGEX "argument unused during compilation: .*") # Clang
elseif(_lang STREQUAL "OBJCXX")
set(_lang_src [=[
#ifndef __OBJC__
# error "Not an Objective-C++ compiler"
#endif
int main(void) { return 0; }]=])
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+" # GNU
FAIL_REGEX "argument unused during compilation: .*") # Clang
elseif(_lang STREQUAL "ISPC")
set(_lang_src "float func(uniform int32, float a) { return a / 2.25; }")
else()
message (SEND_ERROR "check_compiler_flag: ${_lang}: unknown language.")
return()
endif()
get_property (_supported_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if (NOT _lang IN_LIST _supported_languages)
message (SEND_ERROR "check_compiler_flag: ${_lang}: needs to be enabled before use.")
return()
endif()
set(CMAKE_REQUIRED_DEFINITIONS ${_flag})
# Normalize locale during test compilation.
set(_locale_vars LC_ALL LC_MESSAGES LANG)
foreach(v IN LISTS _locale_vars)
set(_locale_vars_saved_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
check_compiler_flag_common_patterns(_common_patterns)
cmake_check_source_compiles(${_lang}
"${_lang_src}"
${_var}
${_lang_fail_regex}
${_common_patterns}
)
foreach(v IN LISTS _locale_vars)
set(ENV{${v}} ${_locale_vars_saved_${v}})
endforeach()
endfunction ()
cmake_policy(POP)

View file

@ -1,60 +0,0 @@
#!/bin/sh
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This script is internal to CMake and meant only to be
# invoked by CMake-generated build systems on AIX.
usage='usage: ExportImportList -o <out-file> [-l <lib>] [-n] [--] <objects>...'
die() {
echo "$@" 1>&2; exit 1
}
# Process command-line arguments.
out=''
lib=''
no_objects=''
while test "$#" != 0; do
case "$1" in
-l) shift; lib="$1" ;;
-o) shift; out="$1" ;;
-n) no_objects='1' ;;
--) shift; break ;;
-*) die "$usage" ;;
*) break ;;
esac
shift
done
test -n "$out" || die "$usage"
# Build a temporary file that atomically replaces the output later.
out_tmp="$out.tmp$$"
trap 'rm -f "$out_tmp"' EXIT INT TERM
> "$out_tmp"
# Collect symbols exported from all object files.
if test -z "$no_objects"; then
for f in "$@"; do
dump -tov -X 32_64 "$f" |
awk '
BEGIN {
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
}
/^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
print $NF V[$(NF-1)]
}
}
'
done >> "$out_tmp"
fi
# Generate the export/import file.
{
if test -n "$lib"; then
echo "#! $lib"
fi
sort -u "$out_tmp"
} > "$out"

View file

@ -1,29 +0,0 @@
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
# PIE link options are managed in Compiler/<compiler>.cmake file
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
# Does not require -z origin since 10.2-RELEASE
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
# to other libraries to select whether to use the static or shared
# versions of the libraries.
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
endforeach()
include(Platform/UnixPaths)

View file

@ -1,56 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#Setup Green Hills MULTI specific compilation information
if(CMAKE_HOST_UNIX)
set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
else()
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
endif()
mark_as_advanced(GHS_OS_ROOT)
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
mark_as_advanced(GHS_OS_DIR)
set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option")
mark_as_advanced(GHS_OS_DIR_OPTION)
#set GHS_OS_DIR if not set by user
if(NOT GHS_OS_DIR)
if(EXISTS ${GHS_OS_ROOT})
#get all directories in root directory
FILE(GLOB GHS_CANDIDATE_OS_DIRS
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
FILE(GLOB GHS_CANDIDATE_OS_FILES
LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
if(GHS_CANDIDATE_OS_FILES)
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
endif ()
#filter based on platform name
if(GHS_TARGET_PLATFORM MATCHES "integrity")
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
else() #fall-back for standalone
unset(GHS_CANDIDATE_OS_DIRS)
set(GHS_OS_DIR "IGNORE")
endif()
if(GHS_CANDIDATE_OS_DIRS)
list(SORT GHS_CANDIDATE_OS_DIRS)
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
endif()
#update cache with new value
set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
endif()
endif()
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
mark_as_advanced(GHS_CUSTOMIZATION)
set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
mark_as_advanced(GHS_GPJ_MACROS)

View file

@ -1,15 +0,0 @@
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
# PIE link options are managed in Compiler/<compiler>.cmake file
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
include(Platform/UnixPaths)

View file

@ -1,23 +0,0 @@
if(CMAKE_SYSTEM MATCHES "SunOS-4")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
endif()
include(Platform/UnixPaths)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/opt/csw
/opt/openwin
)
# The Sun linker needs to find transitive shared library dependencies
# in the -L path.
set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
# Shared libraries with no builtin soname may not be linked safely by
# specifying the file path.
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)

View file

@ -1,2 +0,0 @@
include(Platform/Windows-Clang)
__windows_compiler_clang(ASM)

View file

@ -1,17 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__WINDOWS_INTEL)
return()
endif()
set(__WINDOWS_INTEL 1)
include(Platform/Windows-MSVC)
macro(__windows_compiler_intel lang)
__windows_compiler_msvc(${lang})
set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
endmacro()

View file

@ -1,3 +0,0 @@
repository='@repository@'
module='@module@'
tag='@tag@'

View file

@ -8,7 +8,7 @@ set(ASM_DIALECT "_MASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c /Fo <OBJECT> <SOURCE>") set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c -Fo <OBJECT> <SOURCE>")
# The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table. # The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "") set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")

View file

@ -35,7 +35,7 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
endif() endif()
if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT) if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT)
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>") set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
endif() endif()
if(CMAKE_ASM_NASM_COMPILER_ID STREQUAL "NASM") if(CMAKE_ASM_NASM_COMPILER_ID STREQUAL "NASM")

View file

@ -5,6 +5,7 @@ set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "@CMAKE_C_COMPILER_VERSION_INTERNAL@") set(CMAKE_C_COMPILER_VERSION_INTERNAL "@CMAKE_C_COMPILER_VERSION_INTERNAL@")
set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@") set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT@")
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@") set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
@ -30,18 +31,9 @@ set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
set(CMAKE_C_COMPILER_LOADED 1) set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@)
set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@) set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@)
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_C_COMPILER_ENV_VAR "CC") set(CMAKE_C_COMPILER_ENV_VAR "CC")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1) set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)

View file

@ -41,23 +41,33 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#if !defined(__STDC__) && !defined(__clang__) #if !defined(__STDC__) && !defined(__clang__)
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) # if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_DIALECT "90" # define C_VERSION "90"
# else # else
# define C_DIALECT # define C_VERSION
# endif # endif
#elif __STDC_VERSION__ > 201710L #elif __STDC_VERSION__ > 201710L
# define C_DIALECT "23" # define C_VERSION "23"
#elif __STDC_VERSION__ >= 201710L #elif __STDC_VERSION__ >= 201710L
# define C_DIALECT "17" # define C_VERSION "17"
#elif __STDC_VERSION__ >= 201000L #elif __STDC_VERSION__ >= 201000L
# define C_DIALECT "11" # define C_VERSION "11"
#elif __STDC_VERSION__ >= 199901L #elif __STDC_VERSION__ >= 199901L
# define C_DIALECT "99" # define C_VERSION "99"
#else #else
# define C_DIALECT "90" # define C_VERSION "90"
#endif #endif
const char* info_language_dialect_default = const char* info_language_standard_default =
"INFO" ":" "dialect_default[" C_DIALECT "]"; "INFO" ":" "standard_default[" C_VERSION "]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -89,7 +99,8 @@ int main(int argc, char* argv[])
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
require += info_cray[argc]; require += info_cray[argc];
#endif #endif
require += info_language_dialect_default[argc]; require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv; (void)argv;
return require; return require;
} }

View file

@ -91,6 +91,14 @@ if(CMAKE_USER_MAKE_RULES_OVERRIDE_C)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}") set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}")
endif() endif()
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
if(NOT DEFINED CMAKE_C_LINK_WHAT_YOU_USE_FLAG)
set(CMAKE_C_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
endif()
if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
endif()
endif()
# for most systems a module is the same as a shared library # for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just # so unless the variable CMAKE_MODULE_EXISTS is set just
@ -196,5 +204,3 @@ if(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
endif() endif()
set(CMAKE_C_INFORMATION_LOADED 1) set(CMAKE_C_INFORMATION_LOADED 1)

View file

@ -6,6 +6,7 @@ set(CMAKE_CUDA_COMPILER_VERSION "@CMAKE_CUDA_COMPILER_VERSION@")
set(CMAKE_CUDA_DEVICE_LINKER "@CMAKE_CUDA_DEVICE_LINKER@") set(CMAKE_CUDA_DEVICE_LINKER "@CMAKE_CUDA_DEVICE_LINKER@")
set(CMAKE_CUDA_FATBINARY "@CMAKE_CUDA_FATBINARY@") set(CMAKE_CUDA_FATBINARY "@CMAKE_CUDA_FATBINARY@")
set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT@")
set(CMAKE_CUDA_COMPILE_FEATURES "@CMAKE_CUDA_COMPILE_FEATURES@") set(CMAKE_CUDA_COMPILE_FEATURES "@CMAKE_CUDA_COMPILE_FEATURES@")
set(CMAKE_CUDA03_COMPILE_FEATURES "@CMAKE_CUDA03_COMPILE_FEATURES@") set(CMAKE_CUDA03_COMPILE_FEATURES "@CMAKE_CUDA03_COMPILE_FEATURES@")
set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@") set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@")
@ -49,8 +50,13 @@ endif()
set(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "@CMAKE_CUDA_COMPILER_TOOLKIT_ROOT@") set(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "@CMAKE_CUDA_COMPILER_TOOLKIT_ROOT@")
set(CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT "@CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT@") set(CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT "@CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT@")
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION "@CMAKE_CUDA_COMPILER_TOOLKIT_VERSION@")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "@CMAKE_CUDA_COMPILER_LIBRARY_ROOT@") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "@CMAKE_CUDA_COMPILER_LIBRARY_ROOT@")
set(CMAKE_CUDA_ARCHITECTURES_ALL "@CMAKE_CUDA_ARCHITECTURES_ALL@")
set(CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR "@CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR@")
set(CMAKE_CUDA_ARCHITECTURES_NATIVE "@CMAKE_CUDA_ARCHITECTURES_NATIVE@")
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@") set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")

View file

@ -0,0 +1,47 @@
#ifndef __CUDACC__
# error "A C or C++ compiler has been selected for CUDA"
#endif
#include <cstdio>
#include <cuda_runtime.h>
#include "CMakeCompilerABI.h"
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
static_cast<void>(argv);
int count = 0;
if (cudaGetDeviceCount(&count) != cudaSuccess || count == 0) {
std::fprintf(stderr, "No CUDA devices found.\n");
return -1;
}
int found = 0;
const char* sep = "";
for (int device = 0; device < count; ++device) {
cudaDeviceProp prop;
if (cudaGetDeviceProperties(&prop, device) == cudaSuccess) {
std::printf("%s%d%d", sep, prop.major, prop.minor);
sep = ";";
found = 1;
}
}
if (!found) {
std::fprintf(stderr, "No CUDA architecture detected from any devices.\n");
// Convince the compiler that the non-zero return value depends
// on the info strings so they are not optimized out.
return require ? -1 : 1;
}
return 0;
}

View file

@ -16,7 +16,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
@CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@ @CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
const char* info_language_dialect_default = "INFO" ":" "dialect_default[" const char* info_language_standard_default = "INFO" ":" "standard_default["
#if __cplusplus > 202002L #if __cplusplus > 202002L
"23" "23"
#elif __cplusplus > 201703L #elif __cplusplus > 201703L
@ -32,6 +32,15 @@ const char* info_language_dialect_default = "INFO" ":" "dialect_default["
#endif #endif
"]"; "]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
#if (defined(__clang__) || defined(__GNUC__)) && \
!defined(__STRICT_ANSI__)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int main(int argc, char* argv[]) int main(int argc, char* argv[])
@ -48,7 +57,8 @@ int main(int argc, char* argv[])
#ifdef SIMULATE_VERSION_MAJOR #ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc]; require += info_simulate_version[argc];
#endif #endif
require += info_language_dialect_default[argc]; require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv; (void)argv;
return require; return require;
} }

View file

@ -100,6 +100,15 @@ if(NOT CMAKE_MODULE_EXISTS)
set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS}) set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS})
endif() endif()
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
if(NOT DEFINED CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG)
set(CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
endif()
if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
endif()
endif()
# add the flags to the cache based # add the flags to the cache based
# on the initial values computed in the platform/*.cmake files # on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time # use _INIT variables so that this only happens the first time
@ -151,22 +160,9 @@ if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
endif() endif()
#Specify how to compile when ptx has been requested if(NOT CMAKE_CUDA_COMPILE_OBJECT)
if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION) set(CMAKE_CUDA_COMPILE_OBJECT
set(CMAKE_CUDA_COMPILE_PTX_COMPILATION "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} <CUDA_COMPILE_MODE> <SOURCE> -o <OBJECT>")
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} ${_CMAKE_CUDA_PTX_FLAG} <SOURCE> -o <OBJECT>")
endif()
#Specify how to compile when separable compilation has been requested
if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} ${_CMAKE_CUDA_DEVICE_CODE} <SOURCE> -o <OBJECT>")
endif()
#Specify how to compile when whole compilation has been requested
if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
endif() endif()
# compile a cu file into an executable # compile a cu file into an executable
@ -202,7 +198,7 @@ endif()
# Used when device linking is handled by CMake. # Used when device linking is handled by CMake.
if(NOT CMAKE_CUDA_DEVICE_LINK_COMPILE) if(NOT CMAKE_CUDA_DEVICE_LINK_COMPILE)
set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>") set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> <LINK_FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>")
endif() endif()
unset(__IMPLICIT_DLINK_FLAGS) unset(__IMPLICIT_DLINK_FLAGS)

View file

@ -5,6 +5,7 @@ set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "@CMAKE_CXX_COMPILER_VERSION_INTERNAL@") set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "@CMAKE_CXX_COMPILER_VERSION_INTERNAL@")
set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@") set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT@")
set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
@ -31,18 +32,9 @@ set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
set(CMAKE_CXX_COMPILER_LOADED 1) set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@)
set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@) set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@)
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)

View file

@ -49,7 +49,7 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
# define CXX_STD __cplusplus # define CXX_STD __cplusplus
#endif #endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default[" const char* info_language_standard_default = "INFO" ":" "standard_default["
#if CXX_STD > 202002L #if CXX_STD > 202002L
"23" "23"
#elif CXX_STD > 201703L #elif CXX_STD > 201703L
@ -65,6 +65,16 @@ const char* info_language_dialect_default = "INFO" ":" "dialect_default["
#endif #endif
"]"; "]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__)) && \
!defined(__STRICT_ANSI__)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
int main(int argc, char* argv[]) int main(int argc, char* argv[])
@ -72,6 +82,7 @@ int main(int argc, char* argv[])
int require = 0; int require = 0;
require += info_compiler[argc]; require += info_compiler[argc];
require += info_platform[argc]; require += info_platform[argc];
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR #ifdef COMPILER_VERSION_MAJOR
require += info_version[argc]; require += info_version[argc];
#endif #endif
@ -87,7 +98,8 @@ int main(int argc, char* argv[])
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
require += info_cray[argc]; require += info_cray[argc];
#endif #endif
require += info_language_dialect_default[argc]; require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv; (void)argv;
return require; return require;
} }

View file

@ -193,6 +193,15 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
endif() endif()
endforeach() endforeach()
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
if(NOT DEFINED CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG)
set(CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
endif()
if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
endif()
endif()
# add the flags to the cache based # add the flags to the cache based
# on the initial values computed in the platform/*.cmake files # on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time # use _INIT variables so that this only happens the first time

View file

@ -32,5 +32,6 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
FAIL_REGEX "Warning: illegal option" # SunStudio 12 FAIL_REGEX "Warning: illegal option" # SunStudio 12
FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu
FAIL_REGEX "An invalid option .* appears on the command line" # Cray FAIL_REGEX "An invalid option .* appears on the command line" # Cray
FAIL_REGEX "WARNING: invalid compiler option" # TI armcl
) )
endmacro () endmacro ()

View file

@ -59,6 +59,7 @@ function(compiler_id_detection outvar lang)
HP HP
Compaq Compaq
zOS zOS
IBMClang
XLClang XLClang
XL XL
VisualAge VisualAge
@ -69,6 +70,7 @@ function(compiler_id_detection outvar lang)
FujitsuClang FujitsuClang
Fujitsu Fujitsu
GHS GHS
Tasking
) )
if ("x${lang}" STREQUAL "xC") if ("x${lang}" STREQUAL "xC")
list(APPEND ordered_compilers list(APPEND ordered_compilers
@ -82,11 +84,9 @@ function(compiler_id_detection outvar lang)
AppleClang AppleClang
ARMClang ARMClang
) )
if(NOT __skip_rocmclang)
list(APPEND ordered_compilers ROCMClang)
endif()
list(APPEND ordered_compilers list(APPEND ordered_compilers
Clang Clang
LCC
GNU GNU
MSVC MSVC
ADSP ADSP

View file

@ -0,0 +1,92 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakeDependentOption
--------------------
Macro to provide an option dependent on other options.
This macro presents an option to the user only if a set of other
conditions are true.
.. command:: cmake_dependent_option
.. code-block:: cmake
cmake_dependent_option(<option> "<help_text>" <value> <depends> <force>)
Makes ``<option>`` available to the user if the
:ref:`semicolon-separated list <CMake Language Lists>` of conditions in
``<depends>`` are all true. Otherwise, a local variable named ``<option>``
is set to ``<force>``.
When ``<option>`` is available, the given ``<help_text>`` and initial
``<value>`` are used. Otherwise, any value set by the user is preserved for
when ``<depends>`` is satisfied in the future.
Note that the ``<option>`` variable only has a value which satisfies the
``<depends>`` condition within the scope of the caller because it is a local
variable.
Example invocation:
.. code-block:: cmake
cmake_dependent_option(USE_FOO "Use Foo" ON "USE_BAR;NOT USE_ZOT" OFF)
If ``USE_BAR`` is true and ``USE_ZOT`` is false, this provides an option called
``USE_FOO`` that defaults to ON. Otherwise, it sets ``USE_FOO`` to OFF and
hides the option from the user. If the status of ``USE_BAR`` or ``USE_ZOT``
ever changes, any value for the ``USE_FOO`` option is saved so that when the
option is re-enabled it retains its old value.
.. versionadded:: 3.22
Full :ref:`Condition Syntax` is now supported. See policy :policy:`CMP0127`.
#]=======================================================================]
macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
cmake_policy(GET CMP0127 _CDO_CMP0127
PARENT_SCOPE # undocumented, do not use outside of CMake
)
if(${option}_ISSET MATCHES "^${option}_ISSET$")
set(${option}_AVAILABLE 1)
if("x${_CDO_CMP0127}x" STREQUAL "xNEWx")
foreach(d ${depends})
cmake_language(EVAL CODE "
if (${d})
else()
set(${option}_AVAILABLE 0)
endif()"
)
endforeach()
else()
foreach(d ${depends})
string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
if(${CMAKE_DEPENDENT_OPTION_DEP})
else()
set(${option}_AVAILABLE 0)
endif()
endforeach()
endif()
if(${option}_AVAILABLE)
option(${option} "${doc}" "${default}")
set(${option} "${${option}}" CACHE BOOL "${doc}" FORCE)
else()
if(${option} MATCHES "^${option}$")
else()
set(${option} "${${option}}" CACHE INTERNAL "${doc}")
endif()
set(${option} ${force})
endif()
else()
set(${option} "${${option}_ISSET}")
endif()
if("x${_CDO_CMP0127}x" STREQUAL "xx" AND "x${depends}x" MATCHES "[^A-Za-z0-9_.; ]")
cmake_policy(GET_WARNING CMP0127 _CDO_CMP0127_WARNING)
message(AUTHOR_WARNING "${_CDO_CMP0127_WARNING}")
endif()
unset(_CDO_CMP0127)
endmacro()

View file

@ -104,7 +104,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC) list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)|(Arm Compiler)")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM) list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v")
@ -125,18 +125,31 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
include(CMakeDetermineCompilerId) include(CMakeDetermineCompilerId)
set(userflags) set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}") CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
set(_variant "")
if("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR") if("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR")
# primary necessary to detect architecture, so the right archiver and linker can be picked # primary necessary to detect architecture, so the right archiver and linker can be picked
# eg. "IAR Assembler V8.10.1.12857/W32 for ARM" or "IAR Assembler V4.11.1.4666 for Renesas RX" # eg. "IAR Assembler V8.10.1.12857/W32 for ARM" or "IAR Assembler V4.11.1.4666 for Renesas RX"
# Cut out identification first, newline handling is a pain # Earlier versions did not provide `--version`, so grep the full output to extract Assembler ID string
string(REGEX MATCH "IAR Assembler[^\r\n]*" _compileid "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT}") string(REGEX MATCH "IAR Assembler[^\r\n]*" _compileid "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT}")
if("${_compileid}" MATCHES "V([0-9]+\\.[0-9]+\\.[0-9]+)") if("${_compileid}" MATCHES "V([0-9]+\\.[0-9]+\\.[0-9]+)")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION ${CMAKE_MATCH_1}) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION ${CMAKE_MATCH_1})
endif() endif()
string(REGEX MATCHALL "([A-Za-z0-9-]+)" _all_compileid_matches "${_compileid}") if("${_compileid}" MATCHES "for.*(MSP430|8051|ARM|AVR|RH850|RISC-?V|RL78|RX|STM8|V850)")
if(_all_compileid_matches) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_MATCH_1})
list(GET _all_compileid_matches "-1" CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
endif() endif()
elseif("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xClang")
# Test whether an MSVC-like command-line option works.
execute_process(COMMAND ${CMAKE_ASM${ASM_DIALECT}_COMPILER} -?
OUTPUT_VARIABLE _clang_output
ERROR_VARIABLE _clang_output
RESULT_VARIABLE _clang_result)
if(_clang_result EQUAL 0)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT "MSVC")
set(CMAKE_ASM${ASM_DIALECT}_SIMULATE_ID MSVC)
else()
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT "GNU")
endif()
set(_variant " with ${CMAKE_ASM${ASM_DIALECT}_COMPILER_FRONTEND_VARIANT}-like command-line")
endif() endif()
_cmake_find_compiler_sysroot(ASM${ASM_DIALECT}) _cmake_find_compiler_sysroot(ASM${ASM_DIALECT})
@ -144,6 +157,8 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT) unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT)
unset(_all_compileid_matches) unset(_all_compileid_matches)
unset(_compileid) unset(_compileid)
unset(_clang_result)
unset(_clang_output)
endif() endif()
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
@ -157,9 +172,10 @@ if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
else() else()
set(_archid "") set(_archid "")
endif() endif()
message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}") message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}${_variant}")
unset(_archid) unset(_archid)
unset(_version) unset(_version)
unset(_variant)
else() else()
message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
endif() endif()

View file

@ -128,11 +128,6 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU") if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCC 1) set(CMAKE_COMPILER_IS_GNUCC 1)
endif() endif()
if(CMAKE_C_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
else() else()
if(NOT DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT) if(NOT DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT)
# Some toolchain files set our internal CMAKE_C_COMPILER_ID_RUN # Some toolchain files set our internal CMAKE_C_COMPILER_ID_RUN
@ -165,7 +160,7 @@ endif ()
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (NOT _CMAKE_TOOLCHAIN_PREFIX) if (NOT _CMAKE_TOOLCHAIN_PREFIX)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC") if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})

View file

@ -3,7 +3,7 @@
if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
message(FATAL_ERROR message(FATAL_ERROR
"C# is currently only supported for Microsoft Visual Studio 2010 and later.") "C# is currently only supported for Microsoft Visual Studio 11 2012 and later.")
endif() endif()
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)

View file

@ -22,7 +22,7 @@ else()
if(NOT $ENV{CUDACXX} STREQUAL "") if(NOT $ENV{CUDACXX} STREQUAL "")
get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT) get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT)
if(CMAKE_CUDA_FLAGS_ENV_INIT) if(CMAKE_CUDA_FLAGS_ENV_INIT)
set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CXX compiler") set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CUDA compiler")
endif() endif()
if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT}) if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT})
message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}") message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}")
@ -78,10 +78,11 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.") message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
endif() endif()
# Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT and CMAKE_CUDA_COMPILER_LIBRARY_ROOT # Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT, CMAKE_CUDA_COMPILER_TOOLKIT_VERSION and
# in CMakeCUDACompiler.cmake, so FindCUDAToolkit can avoid searching on future runs and the toolkit stays the same. # CMAKE_CUDA_COMPILER_LIBRARY_ROOT in CMakeCUDACompiler.cmake so FindCUDAToolkit can avoid searching on future
# runs and the toolkit is the same.
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors # This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
# if we fail to find things we need and we don't need to account for searching the libraries. # if we fail and we don't need to account for searching the libraries.
# For NVCC we can easily deduce the SDK binary directory from the compiler path. # For NVCC we can easily deduce the SDK binary directory from the compiler path.
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
@ -192,17 +193,31 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY) get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY) get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
endif() endif()
if(_CUDA_NVCC_OUT MATCHES "\\#\\$ NVVMIR_LIBRARY_DIR=([^\r\n]*)")
get_filename_component(_CUDA_NVVMIR_LIBRARY_DIR "${CMAKE_MATCH_1}" ABSOLUTE)
#We require the path to end in `/nvvm/libdevice'
if(_CUDA_NVVMIR_LIBRARY_DIR MATCHES "nvvm/libdevice$")
get_filename_component(_CUDA_NVVMIR_LIBRARY_DIR "${_CUDA_NVVMIR_LIBRARY_DIR}/../.." ABSOLUTE)
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR "${_CUDA_NVVMIR_LIBRARY_DIR}")
endif()
unset(_CUDA_NVVMIR_LIBRARY_DIR)
unset(_cuda_nvvmir_dir_name)
endif()
unset(_CUDA_NVCC_OUT) unset(_CUDA_NVCC_OUT)
set(CMAKE_CUDA_DEVICE_LINKER "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/nvlink${CMAKE_EXECUTABLE_SUFFIX}") set(CMAKE_CUDA_DEVICE_LINKER "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/nvlink${CMAKE_EXECUTABLE_SUFFIX}")
set(CMAKE_CUDA_FATBINARY "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/fatbinary${CMAKE_EXECUTABLE_SUFFIX}") set(CMAKE_CUDA_FATBINARY "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/fatbinary${CMAKE_EXECUTABLE_SUFFIX}")
# In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT. # In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
# We first check for a non-scattered installation to prefer it over a scattered installation. # We first check for a non-scattered installation to prefer it over a scattered installation.
# CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library. # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library.
if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice") if(DEFINED CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR)
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR}")
elseif(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice") elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
@ -211,6 +226,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
else() else()
message(FATAL_ERROR "Couldn't find CUDA library root.") message(FATAL_ERROR "Couldn't find CUDA library root.")
endif() endif()
unset(CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR)
# CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files. # CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files.
if(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/nvidia-cuda-toolkit/bin/crt/link.stub") if(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/nvidia-cuda-toolkit/bin/crt/link.stub")
@ -222,17 +238,29 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif() endif()
endif() endif()
# For regular nvcc we the toolkit version is the same as the compiler version and we can parse it from the vendor test output.
# For Clang we need to invoke nvcc to get version output.
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
execute_process(COMMAND ${_CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE CMAKE_CUDA_COMPILER_ID_OUTPUT)
endif()
if(CMAKE_CUDA_COMPILER_ID_OUTPUT MATCHES [=[V([0-9]+\.[0-9]+\.[0-9]+)]=])
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v") set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v")
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
set(nvcc_test_flags "--keep --keep-dir tmp") set(nvcc_test_flags "--keep --keep-dir tmp")
if(CMAKE_CUDA_HOST_COMPILER) if(CMAKE_CUDA_HOST_COMPILER)
string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"") string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
# If the user has specified a host compiler we should fail instead of trying without.
# Succeeding detection without may result in confusing errors later on, see #21076.
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif() endif()
# If we have extracted the vendor as NVIDIA we should require detection to
# work. If we don't, users will get confusing errors later about failure
# to detect a default value for CMAKE_CUDA_ARCHITECTURES
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"") set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"")
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
@ -241,39 +269,35 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif() endif()
endif() endif()
# Append user-specified architectures. # Rest of the code treats an empty value as equivalent to "use the defaults".
if(CMAKE_CUDA_ARCHITECTURES) # Error out early to prevent confusing errors as a result of this.
foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) # Note that this also catches invalid non-numerical values such as "a".
# Strip specifiers as PTX vs binary doesn't matter. if(DEFINED CMAKE_CUDA_ARCHITECTURES)
string(REGEX MATCH "[0-9]+" arch_name "${arch}") if(CMAKE_CUDA_ARCHITECTURES STREQUAL "")
string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}") message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES must be non-empty if set.")
string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}") elseif(CMAKE_CUDA_ARCHITECTURES AND NOT CMAKE_CUDA_ARCHITECTURES MATCHES "^([0-9]+a?(-real|-virtual)?(;[0-9]+a?(-real|-virtual)?|;)*|all|all-major|native)$")
list(APPEND tested_architectures "${arch_name}") message(FATAL_ERROR
endforeach() "CMAKE_CUDA_ARCHITECTURES:\n"
" ${CMAKE_CUDA_ARCHITECTURES}\n"
# If the user has specified architectures we'll want to fail during compiler detection if they don't work. "is not one of the following:\n"
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON) " * a semicolon-separated list of integers, each optionally\n"
" followed by '-real' or '-virtual'\n"
" * a special value: all, all-major, native\n"
)
endif()
endif() endif()
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(NOT CMAKE_CUDA_ARCHITECTURES)
# Clang doesn't automatically select an architecture supported by the SDK. # Clang doesn't automatically select an architecture supported by the SDK.
# Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups). # Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
foreach(arch "20" "30" "52") foreach(arch "52" "30" "20")
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}") list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
endforeach() endforeach()
endif()
# If the user specified CMAKE_CUDA_ARCHITECTURES this will include all the architecture flags.
# Otherwise this won't include any architecture flags and we'll fallback to Clang's defaults.
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags}")
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_test_flags}") list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_test_flags}")
endif() endif()
# We perform compiler identification for a second time to extract implicit linking info and host compiler for NVCC. # We perform compiler identification for a second time to extract implicit linking info and host compiler for NVCC.
# We also use it to verify that CMAKE_CUDA_ARCHITECTURES and additionally on Clang that CUDA toolkit path works.
# The latter could be done during compiler testing in the future to avoid doing this for Clang.
# We need to unset the compiler ID otherwise CMAKE_DETERMINE_COMPILER_ID() doesn't work. # We need to unset the compiler ID otherwise CMAKE_DETERMINE_COMPILER_ID() doesn't work.
set(CMAKE_CUDA_COMPILER_ID) set(CMAKE_CUDA_COMPILER_ID)
set(CMAKE_CUDA_PLATFORM_ID) set(CMAKE_CUDA_PLATFORM_ID)
@ -287,8 +311,13 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER}" DIRECTORY) get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER}" DIRECTORY)
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY) get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
# The compiler comes with the toolkit, so the versions are the same.
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION ${CMAKE_CUDA_COMPILER_VERSION})
endif() endif()
include(${CMAKE_ROOT}/Modules/CUDA/architectures.cmake)
_cmake_find_compiler_sysroot(CUDA) _cmake_find_compiler_sysroot(CUDA)
endif() endif()
@ -322,18 +351,12 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")") "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(NOT CMAKE_CUDA_ARCHITECTURES)
# Find the architecture that we successfully compiled using and set it as the default.
string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
set(detected_architecture "${CMAKE_MATCH_1}")
else()
string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
foreach(cpu ${target_cpus}) foreach(cpu ${target_cpus})
string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}") string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}")
list(APPEND architectures "${CMAKE_MATCH_1}") list(APPEND architectures_detected "${CMAKE_MATCH_1}")
endforeach() endforeach()
endif()
# Find target directory when crosscompiling. # Find target directory when crosscompiling.
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
@ -426,9 +449,10 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
if("${_nvcc_output_line}" MATCHES "^ *nvlink") if("${_nvcc_output_line}" MATCHES "^ *nvlink")
string(APPEND _nvcc_log " ignoring nvlink line\n") string(APPEND _nvcc_log " ignoring nvlink line\n")
elseif(_nvcc_libraries) elseif(_nvcc_libraries)
if("${_nvcc_output_line}" MATCHES "(@\"?tmp/a\\.exe\\.res\"?)") if("${_nvcc_output_line}" MATCHES "(@\"?((tmp/)?a\\.exe\\.res)\"?)")
set(_nvcc_link_res_arg "${CMAKE_MATCH_1}") set(_nvcc_link_res_arg "${CMAKE_MATCH_1}")
set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/tmp/a.exe.res") set(_nvcc_link_res_file "${CMAKE_MATCH_2}")
set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/${_nvcc_link_res_file}")
if(EXISTS "${_nvcc_link_res}") if(EXISTS "${_nvcc_link_res}")
file(READ "${_nvcc_link_res}" _nvcc_link_res_content) file(READ "${_nvcc_link_res}" _nvcc_link_res_content)
string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}") string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}")
@ -479,7 +503,8 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
log log
"${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}") "${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}"
LANGUAGE CUDA)
# Detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by looking at which # Detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by looking at which
# cudart library exists in the implicit link libraries passed to the host linker. # cudart library exists in the implicit link libraries passed to the host linker.
@ -558,46 +583,25 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
"Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n") "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
endif() endif()
# Parse default CUDA architecture.
cmake_policy(GET CMP0104 _CUDA_CMP0104)
if(NOT CMAKE_CUDA_ARCHITECTURES AND _CUDA_CMP0104 STREQUAL "NEW")
string(REGEX MATCH "arch[ =]compute_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
set(detected_architecture "${CMAKE_MATCH_1}")
elseif(CMAKE_CUDA_ARCHITECTURES)
string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
foreach(cpu ${target_cpus}) foreach(cpu ${target_cpus})
string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}") string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}")
list(APPEND architectures "${CMAKE_MATCH_1}") list(APPEND architectures_detected "${CMAKE_MATCH_1}")
endforeach() endforeach()
endif()
endif() endif()
# If the user didn't set the architectures, then set them to a default. # If the user didn't set the architectures, then set them to a default.
# If the user did, then make sure those architectures worked. # If the user did, then make sure those architectures worked.
if(DEFINED detected_architecture AND "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "") if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
set(CMAKE_CUDA_ARCHITECTURES "${detected_architecture}" CACHE STRING "CUDA architectures") cmake_policy(GET CMP0104 _CUDA_CMP0104)
if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" OR _CUDA_CMP0104 STREQUAL "NEW")
set(CMAKE_CUDA_ARCHITECTURES "${architectures_detected}" CACHE STRING "CUDA architectures")
if(NOT CMAKE_CUDA_ARCHITECTURES) if(NOT CMAKE_CUDA_ARCHITECTURES)
message(FATAL_ERROR "Failed to find a working CUDA architecture.") message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
endif() endif()
elseif(architectures)
# Sort since order mustn't matter.
list(SORT architectures)
list(SORT tested_architectures)
# We don't distinguish real/virtual architectures during testing.
# For "70-real;70-virtual" we detect "70" as working and tested_architectures is "70;70".
# Thus we need to remove duplicates before checking if they're equal.
list(REMOVE_DUPLICATES tested_architectures)
if(NOT "${architectures}" STREQUAL "${tested_architectures}")
message(FATAL_ERROR
"The CMAKE_CUDA_ARCHITECTURES:\n"
" ${CMAKE_CUDA_ARCHITECTURES}\n"
"do not all work with this compiler. Try:\n"
" ${architectures}\n"
"instead.")
endif() endif()
endif() endif()
@ -614,5 +618,7 @@ unset(_CUDA_LIBRARY_DIR)
unset(_CUDA_TARGET_DIR) unset(_CUDA_TARGET_DIR)
unset(_CUDA_TARGET_NAME) unset(_CUDA_TARGET_NAME)
unset(architectures_detected)
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX") set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")

View file

@ -125,11 +125,6 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_COMPILER_IS_GNUCXX 1) set(CMAKE_COMPILER_IS_GNUCXX 1)
endif() endif()
if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
else() else()
if(NOT DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT) if(NOT DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
# Some toolchain files set our internal CMAKE_CXX_COMPILER_ID_RUN # Some toolchain files set our internal CMAKE_CXX_COMPILER_ID_RUN
@ -164,7 +159,7 @@ endif ()
if (NOT _CMAKE_TOOLCHAIN_PREFIX) if (NOT _CMAKE_TOOLCHAIN_PREFIX)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC|LCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})

View file

@ -63,6 +63,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX17_COMPILE_FEATURES) set(CMAKE_CXX17_COMPILE_FEATURES)
set(CMAKE_CXX20_COMPILE_FEATURES) set(CMAKE_CXX20_COMPILE_FEATURES)
set(CMAKE_CXX23_COMPILE_FEATURES) set(CMAKE_CXX23_COMPILE_FEATURES)
set(CMAKE_CXX26_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@ -73,6 +74,9 @@ function(cmake_determine_compile_features lang)
return() return()
endif() endif()
if (CMAKE_CXX23_COMPILE_FEATURES AND CMAKE_CXX26_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CXX26_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES})
endif()
if (CMAKE_CXX20_COMPILE_FEATURES AND CMAKE_CXX23_COMPILE_FEATURES) if (CMAKE_CXX20_COMPILE_FEATURES AND CMAKE_CXX23_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES}) list(REMOVE_ITEM CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES})
endif() endif()
@ -97,6 +101,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CXX17_COMPILE_FEATURES} ${CMAKE_CXX17_COMPILE_FEATURES}
${CMAKE_CXX20_COMPILE_FEATURES} ${CMAKE_CXX20_COMPILE_FEATURES}
${CMAKE_CXX23_COMPILE_FEATURES} ${CMAKE_CXX23_COMPILE_FEATURES}
${CMAKE_CXX26_COMPILE_FEATURES}
) )
endif() endif()
@ -107,6 +112,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX26_COMPILE_FEATURES ${CMAKE_CXX26_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done") message(CHECK_PASS "done")
@ -119,6 +125,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA17_COMPILE_FEATURES) set(CMAKE_CUDA17_COMPILE_FEATURES)
set(CMAKE_CUDA20_COMPILE_FEATURES) set(CMAKE_CUDA20_COMPILE_FEATURES)
set(CMAKE_CUDA23_COMPILE_FEATURES) set(CMAKE_CUDA23_COMPILE_FEATURES)
set(CMAKE_CUDA26_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@ -129,6 +136,9 @@ function(cmake_determine_compile_features lang)
return() return()
endif() endif()
if (CMAKE_CUDA23_COMPILE_FEATURES AND CMAKE_CUDA26_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CUDA26_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES})
endif()
if (CMAKE_CUDA20_COMPILE_FEATURES AND CMAKE_CUDA23_COMPILE_FEATURES) if (CMAKE_CUDA20_COMPILE_FEATURES AND CMAKE_CUDA23_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES}) list(REMOVE_ITEM CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES})
endif() endif()
@ -153,6 +163,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CUDA17_COMPILE_FEATURES} ${CMAKE_CUDA17_COMPILE_FEATURES}
${CMAKE_CUDA20_COMPILE_FEATURES} ${CMAKE_CUDA20_COMPILE_FEATURES}
${CMAKE_CUDA23_COMPILE_FEATURES} ${CMAKE_CUDA23_COMPILE_FEATURES}
${CMAKE_CUDA26_COMPILE_FEATURES}
) )
endif() endif()
@ -163,6 +174,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA26_COMPILE_FEATURES ${CMAKE_CUDA26_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done") message(CHECK_PASS "done")
@ -175,6 +187,8 @@ function(cmake_determine_compile_features lang)
set(CMAKE_HIP17_COMPILE_FEATURES) set(CMAKE_HIP17_COMPILE_FEATURES)
set(CMAKE_HIP20_COMPILE_FEATURES) set(CMAKE_HIP20_COMPILE_FEATURES)
set(CMAKE_HIP23_COMPILE_FEATURES) set(CMAKE_HIP23_COMPILE_FEATURES)
set(CMAKE_HIP26_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@ -185,6 +199,9 @@ function(cmake_determine_compile_features lang)
return() return()
endif() endif()
if (CMAKE_HIP23_COMPILE_FEATURES AND CMAKE_HIP26_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_HIP26_COMPILE_FEATURES ${CMAKE_HIP23_COMPILE_FEATURES})
endif()
if (CMAKE_HIP20_COMPILE_FEATURES AND CMAKE_HIP23_COMPILE_FEATURES) if (CMAKE_HIP20_COMPILE_FEATURES AND CMAKE_HIP23_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_HIP23_COMPILE_FEATURES ${CMAKE_HIP20_COMPILE_FEATURES}) list(REMOVE_ITEM CMAKE_HIP23_COMPILE_FEATURES ${CMAKE_HIP20_COMPILE_FEATURES})
endif() endif()
@ -209,6 +226,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_HIP17_COMPILE_FEATURES} ${CMAKE_HIP17_COMPILE_FEATURES}
${CMAKE_HIP20_COMPILE_FEATURES} ${CMAKE_HIP20_COMPILE_FEATURES}
${CMAKE_HIP23_COMPILE_FEATURES} ${CMAKE_HIP23_COMPILE_FEATURES}
${CMAKE_HIP26_COMPILE_FEATURES}
) )
endif() endif()
@ -219,6 +237,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_HIP17_COMPILE_FEATURES ${CMAKE_HIP17_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_HIP17_COMPILE_FEATURES ${CMAKE_HIP17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_HIP20_COMPILE_FEATURES ${CMAKE_HIP20_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_HIP20_COMPILE_FEATURES ${CMAKE_HIP20_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_HIP23_COMPILE_FEATURES ${CMAKE_HIP23_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_HIP23_COMPILE_FEATURES ${CMAKE_HIP23_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_HIP26_COMPILE_FEATURES ${CMAKE_HIP26_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done") message(CHECK_PASS "done")

View file

@ -32,7 +32,7 @@ macro(_cmake_find_compiler lang)
endif() endif()
# Look for directories containing compilers of reference languages. # Look for directories containing compilers of reference languages.
set(_${lang}_COMPILER_HINTS) set(_${lang}_COMPILER_HINTS "${CMAKE_${lang}_COMPILER_HINTS}")
foreach(l ${_languages}) foreach(l ${_languages})
if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}") if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH) get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
@ -53,10 +53,9 @@ macro(_cmake_find_compiler lang)
NO_DEFAULT_PATH NO_DEFAULT_PATH
DOC "${lang} compiler") DOC "${lang} compiler")
endif() endif()
if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja") if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja|MSYS Makefiles|MinGW Makefiles")
# On Windows command-line builds, the Makefile generators each imply # On Windows command-line builds, some generators imply a preferred compiler tool.
# a preferred compiler tool. The Ninja generator does not imply a # These generators do not, so use the compiler that occurs first in PATH.
# compiler tool, so use the compiler that occurs first in PATH.
find_program(CMAKE_${lang}_COMPILER find_program(CMAKE_${lang}_COMPILER
NAMES ${CMAKE_${lang}_COMPILER_LIST} NAMES ${CMAKE_${lang}_COMPILER_LIST}
NAMES_PER_DIR NAMES_PER_DIR
@ -119,9 +118,15 @@ macro(_cmake_find_compiler_path lang)
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
# if CMAKE_${lang}_COMPILER is a list, use the first item as # if CMAKE_${lang}_COMPILER is a list, use the first item as
# CMAKE_${lang}_COMPILER and the rest as CMAKE_${lang}_COMPILER_ARG1 # CMAKE_${lang}_COMPILER and the rest as CMAKE_${lang}_COMPILER_ARG1
# Otherwise, preserve any existing CMAKE_${lang}_COMPILER_ARG1 that might
# have been saved by CMakeDetermine${lang}Compiler in a previous run.
list(LENGTH CMAKE_${lang}_COMPILER _CMAKE_${lang}_COMPILER_LENGTH)
if(_CMAKE_${lang}_COMPILER_LENGTH GREATER 1)
set(CMAKE_${lang}_COMPILER_ARG1 "${CMAKE_${lang}_COMPILER}") set(CMAKE_${lang}_COMPILER_ARG1 "${CMAKE_${lang}_COMPILER}")
list(POP_FRONT CMAKE_${lang}_COMPILER_ARG1 CMAKE_${lang}_COMPILER) list(POP_FRONT CMAKE_${lang}_COMPILER_ARG1 CMAKE_${lang}_COMPILER)
list(JOIN CMAKE_${lang}_COMPILER_ARG1 " " CMAKE_${lang}_COMPILER_ARG1) list(JOIN CMAKE_${lang}_COMPILER_ARG1 " " CMAKE_${lang}_COMPILER_ARG1)
endif()
unset(_CMAKE_${lang}_COMPILER_LENGTH)
# find the compiler in the PATH if necessary # find the compiler in the PATH if necessary
# if compiler (and arguments) comes from cache then synchronize cache with updated CMAKE_<LANG>_COMPILER # if compiler (and arguments) comes from cache then synchronize cache with updated CMAKE_<LANG>_COMPILER
@ -148,7 +153,7 @@ macro(_cmake_find_compiler_path lang)
endmacro() endmacro()
function(_cmake_find_compiler_sysroot lang) function(_cmake_find_compiler_sysroot lang)
if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")
execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -print-sysroot execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -print-sysroot
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE _cmake_sysroot_run_out OUTPUT_VARIABLE _cmake_sysroot_run_out

View file

@ -26,6 +26,14 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG) if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG)
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}") set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}")
endif() endif()
if(lang STREQUAL "CUDA")
if(CMAKE_CUDA_ARCHITECTURES STREQUAL "native")
# We are about to detect the native architectures, so we do
# not yet know them. Use all architectures during detection.
set(CMAKE_CUDA_ARCHITECTURES "all")
endif()
set(CMAKE_CUDA_RUNTIME_LIBRARY "Static")
endif()
if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
# Avoid adding our own platform standard libraries for compilers # Avoid adding our own platform standard libraries for compilers
# from which we might detect implicit link libraries. # from which we might detect implicit link libraries.
@ -47,7 +55,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(ENV{LANG} C) set(ENV{LANG} C)
try_compile(CMAKE_${lang}_ABI_COMPILED try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src} SOURCES ${src}
CMAKE_FLAGS ${CMAKE_FLAGS} CMAKE_FLAGS ${CMAKE_FLAGS}
# Ignore unused flags when we are just determining the ABI. # Ignore unused flags when we are just determining the ABI.
"--no-warn-unused-cli" "--no-warn-unused-cli"
@ -141,7 +149,8 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(CMAKE_${lang}_VERBOSE_FLAG) if(CMAKE_${lang}_VERBOSE_FLAG)
CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
"${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}" "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
COMPUTE_IMPLICIT_OBJECTS implicit_objs) COMPUTE_IMPLICIT_OBJECTS implicit_objs
LANGUAGE ${lang})
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Parsed ${lang} implicit link information from above output:\n${log}\n\n") "Parsed ${lang} implicit link information from above output:\n${log}\n\n")
endif() endif()
@ -153,8 +162,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path") message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
# Build a sample project which reports symbols. # Build a sample project which reports symbols.
try_compile(IFORT_LIB_PATH_COMPILED try_compile(IFORT_LIB_PATH_COMPILED
${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath PROJECT IntelFortranImplicit
${CMAKE_ROOT}/Modules/IntelVSImplicitPath SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
IntelFortranImplicit IntelFortranImplicit
CMAKE_FLAGS CMAKE_FLAGS
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"

View file

@ -150,42 +150,28 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif() endif()
endif() endif()
# When invoked with HIPCC we need to extract the path to the underlying # For LCC Fortran we need to explicitly query the version.
# clang compiler when possible. This fixes the following issues: if(lang STREQUAL "Fortran"
# env variables can change how hipcc behaves AND CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")
# allows us to properly find the binutils bundled with hip
if(CMAKE_${lang}_COMPILER_ID STREQUAL "ROCMClang"
AND CMAKE_${lang}_COMPILER MATCHES ".*hipcc")
get_filename_component(_hipcc_dir "${CMAKE_${lang}_COMPILER}" DIRECTORY)
execute_process( execute_process(
COMMAND "${_hipcc_dir}/hipconfig" COMMAND "${CMAKE_${lang}_COMPILER}"
--hipclangpath --version
OUTPUT_VARIABLE output OUTPUT_VARIABLE output ERROR_VARIABLE output
RESULT_VARIABLE result RESULT_VARIABLE result
TIMEOUT 10
) )
if(result EQUAL 0 AND EXISTS "${output}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
if(lang STREQUAL "C") "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" --version\n"
set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${output}/clang") "${output}\n"
set(CMAKE_${lang}_COMPILER "${output}/clang" PARENT_SCOPE)
else()
set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${output}/clang++")
set(CMAKE_${lang}_COMPILER "${output}/clang++" PARENT_SCOPE)
endif()
endif()
if(lang STREQUAL "HIP")
execute_process(
COMMAND "${_hipcc_dir}/hipconfig"
--rocmpath
OUTPUT_VARIABLE output
RESULT_VARIABLE result
) )
if(result EQUAL 0)
set(_CMAKE_HIP_COMPILER_ROCM_ROOT "${output}" PARENT_SCOPE) if(output MATCHES [[\(GCC\) ([0-9]+\.[0-9]+(\.[0-9]+)?) compatible]])
endif() set(CMAKE_${lang}_SIMULATE_ID "GNU")
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_MATCH_1}")
endif() endif()
endif() endif()
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") if (COMPILER_QNXNTO AND (CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC"))
execute_process( execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}" COMMAND "${CMAKE_${lang}_COMPILER}"
-V -V
@ -302,6 +288,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
set(CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT "${CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
endfunction() endfunction()
@ -354,15 +341,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_cl "$(CLToolExe)") set(id_cl "$(CLToolExe)")
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
set(id_cl clang.exe) set(id_cl clang.exe)
# Executable names have been chosen according documentation
# URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1)
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler") if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler")
set(id_cl dpcpp.exe) set(id_cl dpcpp.exe)
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler ([8-9]\\.|1[0-9]\\.|XE)")
set(id_cl icx.exe)
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler")
set(id_cl icl.exe) set(id_cl icl.exe)
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler")
set(id_cl icx.exe)
endif() endif()
else() else()
set(id_cl cl.exe) set(id_cl cl.exe)
@ -455,6 +440,15 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR) if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR)
set(id_ToolsetVCTargetsDir "<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>") set(id_ToolsetVCTargetsDir "<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>")
endif() endif()
if(CMAKE_VS_TARGET_FRAMEWORK_VERSION)
set(id_TargetFrameworkVersion "<TargetFrameworkVersion>${CMAKE_VS_TARGET_FRAMEWORK_VERSION}</TargetFrameworkVersion>")
endif()
if(CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER)
set(id_TargetFrameworkIdentifier "<TargetFrameworkIdentifier>${CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER}</TargetFrameworkIdentifier>")
endif()
if(CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION)
set(id_TargetFrameworkTargetsVersion "<TargetFrameworkTargetsVersion>${CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION}</TargetFrameworkTargetsVersion>")
endif()
set(id_CustomGlobals "") set(id_CustomGlobals "")
foreach(pair IN LISTS CMAKE_VS_GLOBALS) foreach(pair IN LISTS CMAKE_VS_GLOBALS)
if("${pair}" MATCHES "([^=]+)=(.*)$") if("${pair}" MATCHES "([^=]+)=(.*)$")
@ -501,11 +495,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_VS_PLATFORM_NAME STREQUAL x64) if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
set(cuda_target "<TargetMachinePlatform>64</TargetMachinePlatform>") set(cuda_target "<TargetMachinePlatform>64</TargetMachinePlatform>")
endif() endif()
foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
string(REGEX MATCH "[0-9]+" arch_name "${arch}")
string(APPEND cuda_codegen "compute_${arch_name},sm_${arch_name};")
endforeach()
set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions><CodeGeneration>${cuda_codegen}</CodeGeneration></CudaCompile>")
set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]]) set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]])
if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR) if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR)
# check for legacy cuda custom toolkit folder structure # check for legacy cuda custom toolkit folder structure
@ -573,7 +563,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
else() else()
set(id_toolset "") set(id_toolset "")
endif() endif()
if("${lang}" STREQUAL "Swift") set(id_lang_version "")
if("x${lang}" STREQUAL "xSwift")
if(CMAKE_Swift_LANGUAGE_VERSION) if(CMAKE_Swift_LANGUAGE_VERSION)
set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};") set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};")
elseif(XCODE_VERSION VERSION_GREATER_EQUAL 10.2) elseif(XCODE_VERSION VERSION_GREATER_EQUAL 10.2)
@ -583,8 +574,14 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
else() else()
set(id_lang_version "SWIFT_VERSION = 2.3;") set(id_lang_version "SWIFT_VERSION = 2.3;")
endif() endif()
else() elseif("x${lang}" STREQUAL "xC" OR "x${lang}" STREQUAL "xOBJC")
set(id_lang_version "") if(CMAKE_${lang}_COMPILER_ID_FLAGS MATCHES "(^| )(-std=[^ ]+)( |$)")
set(id_lang_version "OTHER_CFLAGS = \"${CMAKE_MATCH_2}\";")
endif()
elseif("x${lang}" STREQUAL "xCXX" OR "x${lang}" STREQUAL "xOBJCXX")
if(CMAKE_${lang}_COMPILER_ID_FLAGS MATCHES "(^| )(-std=[^ ]+)( |$)")
set(id_lang_version "OTHER_CPLUSPLUSFLAGS = \"${CMAKE_MATCH_2}\";")
endif()
endif() endif()
if(CMAKE_OSX_DEPLOYMENT_TARGET) if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(id_deployment_target set(id_deployment_target
@ -661,12 +658,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
set(id_src "${src}") set(id_src "${src}")
if (GHS_PRIMARY_TARGET)
set(ghs_primary_target "${GHS_PRIMARY_TARGET}") set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
else() if ("${ghs_primary_target}" MATCHES "integrity")
set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
endif()
if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}") set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
set(os_dir "macro GHS_OS=${GHS_OS_DIR}") set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
endif() endif()
@ -724,10 +717,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
# Check the result of compilation. # Check the result of compilation.
if(CMAKE_${lang}_COMPILER_ID_RESULT if(CMAKE_${lang}_COMPILER_ID_RESULT
# Intel Fortran warns and ignores preprocessor lines without /fpp # Intel Fortran warns and ignores preprocessor lines without /fpp
OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line" OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "warning #5117: Bad # preprocessor line"
) )
# Compilation failed. # Compilation failed.
set(MSG string(APPEND _CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG
"Compiling the ${lang} compiler identification source file \"${src}\" failed. "Compiling the ${lang} compiler identification source file \"${src}\" failed.
${COMPILER_DESCRIPTION} ${COMPILER_DESCRIPTION}
The output was: The output was:
@ -735,12 +728,19 @@ ${CMAKE_${lang}_COMPILER_ID_RESULT}
${CMAKE_${lang}_COMPILER_ID_OUTPUT} ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
") ")
# Log the output unless we recognize it as a known-bad case.
if(NOT CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "warning #5117: Bad # preprocessor line")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
endif()
# Some languages may know the correct/desired set of flags and want to fail right away if they don't work. # Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
# This is currently only used by CUDA. # This is currently only used by CUDA.
if(__compiler_id_require_success) if(__compiler_id_require_success)
message(FATAL_ERROR "${MSG}") message(FATAL_ERROR "${_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG}")
else()
# Build up the outputs for compiler detection attempts so that users
# can see all set of flags tried, instead of just last
set(_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG "${_CMAKE_DETERMINE_COMPILER_ID_BUILD_MSG}" PARENT_SCOPE)
endif() endif()
# No output files should be inspected. # No output files should be inspected.
@ -841,15 +841,24 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID) set(ARCHITECTURE_ID)
set(SIMULATE_ID) set(SIMULATE_ID)
set(SIMULATE_VERSION) set(SIMULATE_VERSION)
set(CMAKE_${lang}_COMPILER_ID_STRING_REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE") foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE")
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS
LIMIT_COUNT 38 ${encoding} LIMIT_COUNT 38 ${encoding}
REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]") REGEX "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}")
if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "") if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
break() break()
endif() endif()
endforeach() endforeach()
# Some ADSP processors result in characters being detected as separate strings
if(CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS LENGTH_MAXIMUM 1)
string(REGEX REPLACE ";" "" CMAKE_${lang}_COMPILER_ID_STRING "${CMAKE_${lang}_COMPILER_ID_STRINGS}")
string(REGEX MATCHALL "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}"
CMAKE_${lang}_COMPILER_ID_STRINGS "${CMAKE_${lang}_COMPILER_ID_STRING}")
endif()
# With the IAR Compiler, some strings are found twice, first time as incomplete # With the IAR Compiler, some strings are found twice, first time as incomplete
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies. # list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"") list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"")
@ -915,9 +924,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
if("${info}" MATCHES "INFO:qnxnto\\[\\]") if("${info}" MATCHES "INFO:qnxnto\\[\\]")
set(COMPILER_QNXNTO 1) set(COMPILER_QNXNTO 1)
endif() endif()
if("${info}" MATCHES "INFO:dialect_default\\[([^]\"]*)\\]") if("${info}" MATCHES "INFO:standard_default\\[([^]\"]*)\\]")
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}") set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}")
endif() endif()
if("${info}" MATCHES "INFO:extensions_default\\[([^]\"]*)\\]")
set(CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT "${CMAKE_MATCH_1}")
endif()
endforeach() endforeach()
# Construct compiler version from components if needed. # Construct compiler version from components if needed.
@ -1027,6 +1039,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE) set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE)
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
set(CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT "${CMAKE_${lang}_EXTENSIONS_COMPUTED_DEFAULT}" PARENT_SCOPE)
endfunction() endfunction()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -1114,7 +1127,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
OUTPUT_VARIABLE out OUTPUT_VARIABLE out
ERROR_VARIABLE err ERROR_VARIABLE err
RESULT_VARIABLE res RESULT_VARIABLE res
ENCODING AUTO # cl prints in current code page ENCODING AUTO # cl prints in console output code page
) )
if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n]*:[^:\n]*:[ \t]*)") if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n]*:[^:\n]*:[ \t]*)")
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE)

View file

@ -44,16 +44,14 @@ else()
# finally list compilers to try # finally list compilers to try
if(NOT CMAKE_Fortran_COMPILER_INIT) if(NOT CMAKE_Fortran_COMPILER_INIT)
# Known compilers: # Known compilers:
# f77/f90/f95: generic compiler names
# ftn: Cray fortran compiler wrapper # ftn: Cray fortran compiler wrapper
# g77: GNU Fortran 77 compiler
# gfortran: putative GNU Fortran 95+ compiler (in progress) # gfortran: putative GNU Fortran 95+ compiler (in progress)
# fort77: native F77 compiler under HP-UX (and some older Crays) # frt: Fujitsu Fortran compiler
# frt: Fujitsu F77 compiler
# pathf90/pathf95/pathf2003: PathScale Fortran compiler # pathf90/pathf95/pathf2003: PathScale Fortran compiler
# pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers # pgfortran: Portland Group Fortran compilers
# nvfortran: NVHPC Fotran compiler
# flang: Flang Fortran compiler # flang: Flang Fortran compiler
# xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers # xlf: IBM (AIX) Fortran compiler
# lf95: Lahey-Fujitsu F95 compiler # lf95: Lahey-Fujitsu F95 compiler
# fl32: Microsoft Fortran 77 "PowerStation" compiler # fl32: Microsoft Fortran 77 "PowerStation" compiler
# af77: Apogee F77 compiler for Intergraph hardware running CLIX # af77: Apogee F77 compiler for Intergraph hardware running CLIX
@ -61,38 +59,30 @@ else()
# fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
# ifx: Intel Fortran LLVM-based compiler # ifx: Intel Fortran LLVM-based compiler
# ifort: Intel Classic Fortran compiler # ifort: Intel Classic Fortran compiler
# ifc: Intel Fortran 95 compiler for Linux/x86
# efc: Intel Fortran 95 compiler for IA64
# nagfor: NAG Fortran compiler # nagfor: NAG Fortran compiler
# #
# The order is 95 or newer compilers first, then 90, # GNU is last to be searched,
# then 77 or older compilers, gnu is always last in the group,
# so if you paid for a compiler it is picked by default. # so if you paid for a compiler it is picked by default.
if(CMAKE_HOST_WIN32)
set(CMAKE_Fortran_COMPILER_LIST
ifort ifx pgf95 pgfortran lf95 fort
flang gfortran gfortran-4 g95 f90 pgf90
pgf77 g77 f77 nag
)
else()
set(CMAKE_Fortran_COMPILER_LIST set(CMAKE_Fortran_COMPILER_LIST
ftn ftn
ifort ifc ifx efc pgf95 pgfortran lf95 xlf95 fort ifx ifort nvfortran pgfortran lf95 xlf fort
flang gfortran gfortran-4 g95 f90 pgf90 flang lfortran frt nagfor
frt pgf77 xlf g77 f77 nag gfortran
) )
endif()
# Vendor-specific compiler names. # Vendor-specific compiler names.
set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) set(_Fortran_COMPILER_NAMES_LCC lfortran gfortran)
set(_Fortran_COMPILER_NAMES_GNU gfortran)
set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc ifx) set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc ifx)
set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77)
set(_Fortran_COMPILER_NAMES_Flang flang) set(_Fortran_COMPILER_NAMES_Flang flang)
set(_Fortran_COMPILER_NAMES_LLVMFlang flang)
set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
set(_Fortran_COMPILER_NAMES_XL xlf) set(_Fortran_COMPILER_NAMES_XL xlf)
set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)
set(_Fortran_COMPILER_NAMES_NAG nagfor) set(_Fortran_COMPILER_NAMES_NAG nagfor)
set(_Fortran_COMPILER_NAMES_NVHPC nvfortran)
endif() endif()
_cmake_find_compiler(Fortran) _cmake_find_compiler(Fortran)
@ -235,11 +225,6 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUG77 1) set(CMAKE_COMPILER_IS_GNUG77 1)
endif() endif()
if(CMAKE_Fortran_PLATFORM_ID MATCHES "MinGW")
set(CMAKE_COMPILER_IS_MINGW 1)
elseif(CMAKE_Fortran_PLATFORM_ID MATCHES "Cygwin")
set(CMAKE_COMPILER_IS_CYGWIN 1)
endif()
endif() endif()
if (NOT _CMAKE_TOOLCHAIN_LOCATION) if (NOT _CMAKE_TOOLCHAIN_LOCATION)

View file

@ -0,0 +1,189 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
("${CMAKE_GENERATOR}" MATCHES "Ninja") ) )
message(FATAL_ERROR "HIP language not currently supported by \"${CMAKE_GENERATOR}\" generator")
endif()
if(NOT CMAKE_HIP_COMPILER)
set(CMAKE_HIP_COMPILER_INIT NOTFOUND)
# prefer the environment variable HIPCXX
if(NOT $ENV{HIPCXX} STREQUAL "")
if("$ENV{HIPCXX}" MATCHES "hipcc")
message(FATAL_ERROR
"The HIPCXX environment variable is set to the hipcc wrapper:\n"
" $ENV{HIPCXX}\n"
"This is not supported. Use Clang directly, or let CMake pick a default."
)
endif()
get_filename_component(CMAKE_HIP_COMPILER_INIT $ENV{HIPCXX} PROGRAM PROGRAM_ARGS CMAKE_HIP_FLAGS_ENV_INIT)
if(CMAKE_HIP_FLAGS_ENV_INIT)
set(CMAKE_HIP_COMPILER_ARG1 "${CMAKE_HIP_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CXX compiler")
endif()
if(NOT EXISTS ${CMAKE_HIP_COMPILER_INIT})
message(FATAL_ERROR "Could not find compiler set in environment variable HIPCXX:\n$ENV{HIPCXX}.\n${CMAKE_HIP_COMPILER_INIT}")
endif()
endif()
# finally list compilers to try
if(NOT CMAKE_HIP_COMPILER_INIT)
set(CMAKE_HIP_COMPILER_LIST clang++)
# Look for the Clang coming with ROCm to support HIP.
execute_process(COMMAND hipconfig --hipclangpath
OUTPUT_VARIABLE _CMAKE_HIPCONFIG_CLANGPATH
RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
)
if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
set(CMAKE_HIP_COMPILER_HINTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
endif()
endif()
_cmake_find_compiler(HIP)
elseif(CMAKE_HIP_COMPILER MATCHES "hipcc")
message(FATAL_ERROR
"CMAKE_HIP_COMPILER is set to the hipcc wrapper:\n"
" ${CMAKE_HIP_COMPILER}\n"
"This is not supported. Use Clang directly, or let CMake pick a default."
)
else()
_cmake_find_compiler_path(HIP)
endif()
mark_as_advanced(CMAKE_HIP_COMPILER)
# Build a small source file to identify the compiler.
if(NOT CMAKE_HIP_COMPILER_ID_RUN)
set(CMAKE_HIP_COMPILER_ID_RUN 1)
# Try to identify the compiler.
set(CMAKE_HIP_COMPILER_ID)
set(CMAKE_HIP_PLATFORM_ID)
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
CMAKE_HIP_COMPILER_ID_PLATFORM_CONTENT)
list(APPEND CMAKE_HIP_COMPILER_ID_TEST_FLAGS_FIRST "-v")
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(HIP HIPFLAGS CMakeHIPCompilerId.hip)
_cmake_find_compiler_sysroot(HIP)
endif()
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT AND CMAKE_HIP_COMPILER_ID STREQUAL "Clang")
execute_process(COMMAND "${CMAKE_HIP_COMPILER}" -v -print-targets
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _CMAKE_HIP_COMPILER_RESULT
OUTPUT_VARIABLE _CMAKE_HIP_COMPILER_STDOUT
ERROR_VARIABLE _CMAKE_HIP_COMPILER_STDERR
)
if(_CMAKE_HIP_COMPILER_RESULT EQUAL 0 AND _CMAKE_HIP_COMPILER_STDERR MATCHES "Found HIP installation: *([^,]*)[,\n]")
set(CMAKE_HIP_COMPILER_ROCM_ROOT "${CMAKE_MATCH_1}")
file(TO_CMAKE_PATH "${CMAKE_HIP_COMPILER_ROCM_ROOT}" CMAKE_HIP_COMPILER_ROCM_ROOT)
endif()
endif()
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
execute_process(
COMMAND hipconfig --rocmpath
OUTPUT_VARIABLE _CMAKE_HIPCONFIG_ROCMPATH
RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
)
if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_ROCMPATH}")
set(CMAKE_HIP_COMPILER_ROCM_ROOT "${_CMAKE_HIPCONFIG_ROCMPATH}")
endif()
endif()
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
message(FATAL_ERROR "Failed to find ROCm root directory.")
endif()
if(NOT EXISTS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang/hip-lang-config.cmake")
message(FATAL_ERROR
"The ROCm root directory:\n"
" ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n"
"does not contain the HIP runtime CMake package, expected at:\n"
" ${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang/hip-lang-config.cmake\n"
)
endif()
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_HIP_COMPILER}" PATH)
endif ()
set(_CMAKE_PROCESSING_LANGUAGE "HIP")
include(CMakeFindBinUtils)
include(Compiler/${CMAKE_HIP_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
if(CMAKE_HIP_COMPILER_SYSROOT)
string(CONCAT _SET_CMAKE_HIP_COMPILER_SYSROOT
"set(CMAKE_HIP_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")\n"
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")")
else()
set(_SET_CMAKE_HIP_COMPILER_SYSROOT "")
endif()
if(CMAKE_HIP_COMPILER_ARCHITECTURE_ID)
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID
"set(CMAKE_HIP_COMPILER_ARCHITECTURE_ID ${CMAKE_HIP_COMPILER_ARCHITECTURE_ID})")
else()
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID "")
endif()
if(MSVC_HIP_ARCHITECTURE_ID)
set(SET_MSVC_HIP_ARCHITECTURE_ID
"set(MSVC_HIP_ARCHITECTURE_ID ${MSVC_HIP_ARCHITECTURE_ID})")
endif()
if(NOT DEFINED CMAKE_HIP_ARCHITECTURES)
# Use 'rocm_agent_enumerator' to get the current GPU architecture.
set(_CMAKE_HIP_ARCHITECTURES)
find_program(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR
NAMES rocm_agent_enumerator
HINTS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/bin"
NO_CACHE)
if(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR)
execute_process(COMMAND "${_CMAKE_HIP_ROCM_AGENT_ENUMERATOR}" -t GPU
RESULT_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_RESULT
OUTPUT_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT
ERROR_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_STDERR
)
if(_CMAKE_ROCM_AGENT_ENUMERATOR_RESULT EQUAL 0)
separate_arguments(_hip_archs NATIVE_COMMAND "${_CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT}")
foreach(_hip_arch ${_hip_archs})
if(_hip_arch STREQUAL "gfx000")
continue()
endif()
string(FIND ${_hip_arch} ":" pos)
if(NOT pos STREQUAL "-1")
string(SUBSTRING ${_hip_arch} 0 ${pos} _hip_arch)
endif()
list(APPEND _CMAKE_HIP_ARCHITECTURES "${_hip_arch}")
endforeach()
endif()
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_RESULT)
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT)
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_STDERR)
endif()
unset(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR)
if(_CMAKE_HIP_ARCHITECTURES)
set(CMAKE_HIP_ARCHITECTURES "${_CMAKE_HIP_ARCHITECTURES}" CACHE STRING "HIP architectures")
elseif(CMAKE_HIP_COMPILER_PRODUCED_OUTPUT MATCHES " -target-cpu ([a-z0-9]+) ")
set(CMAKE_HIP_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "HIP architectures")
else()
message(FATAL_ERROR "Failed to find a default HIP architecture.")
endif()
unset(_CMAKE_HIP_ARCHITECTURES)
endif()
# configure variables set in this file for fast reload later on
configure_file(${CMAKE_ROOT}/Modules/CMakeHIPCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPCompiler.cmake
@ONLY
)
set(CMAKE_HIP_COMPILER_ENV_VAR "HIPCXX")

Some files were not shown because too many files have changed in this diff Show more