diff options
Diffstat (limited to 'Modules')
46 files changed, 778 insertions, 116 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index e9cfed6..dea721e 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -160,22 +160,9 @@ if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH) set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") endif() -#Specify how to compile when ptx has been requested -if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION) - set(CMAKE_CUDA_COMPILE_PTX_COMPILATION - "<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>") +if(NOT CMAKE_CUDA_COMPILE_OBJECT) + set(CMAKE_CUDA_COMPILE_OBJECT + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} <CUDA_COMPILE_MODE> <SOURCE> -o <OBJECT>") endif() # compile a cu file into an executable @@ -211,7 +198,7 @@ endif() # Used when device linking is handled by CMake. 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() unset(__IMPLICIT_DLINK_FLAGS) diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index e6b3ee3..044326c 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -84,6 +84,7 @@ function(compiler_id_detection outvar lang) ) list(APPEND ordered_compilers Clang + LCC GNU MSVC ADSP diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 15eab0f..f5298df 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -160,7 +160,7 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" 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) if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index d06315e..8479831 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -258,13 +258,22 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) # Append user-specified architectures. if(CMAKE_CUDA_ARCHITECTURES) - foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) - # Strip specifiers as PTX vs binary doesn't matter. - string(REGEX MATCH "[0-9]+" arch_name "${arch}") - string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}") - string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}") - list(APPEND tested_architectures "${arch_name}") - endforeach() + if("x${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "xall") + string(APPEND nvcc_test_flags " -arch=all") + set(architectures_mode all) + elseif("x${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "xall-major") + string(APPEND nvcc_test_flags " -arch=all-major") + set(architectures_mode all-major) + else() + set(architectures_mode explicit) + foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + # Strip specifiers as PTX vs binary doesn't matter. + string(REGEX MATCH "[0-9]+" arch_name "${arch}") + string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}") + string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}") + list(APPEND tested_architectures "${arch_name}") + endforeach() + endif() # If the user has specified architectures we'll want to fail during compiler detection if they don't work. set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON) @@ -597,7 +606,18 @@ if(DEFINED detected_architecture AND "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "") if(NOT CMAKE_CUDA_ARCHITECTURES) message(FATAL_ERROR "Failed to find a working CUDA architecture.") endif() -elseif(architectures) +elseif(architectures AND (architectures_mode STREQUAL "xall" OR + architectures_mode STREQUAL "xall-major")) + if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + message(FATAL_ERROR + "The CMAKE_CUDA_ARCHITECTURES:\n" + " ${CMAKE_CUDA_ARCHITECTURES}\n" + "is not supported with the ${CMAKE_CUDA_COMPILER_ID} compiler. Try:\n" + " ${architectures}\n" + "instead.") + endif() + +elseif(architectures AND architectures_mode STREQUAL "xexplicit") # Sort since order mustn't matter. list(SORT architectures) list(SORT tested_architectures) @@ -630,5 +650,7 @@ unset(_CUDA_LIBRARY_DIR) unset(_CUDA_TARGET_DIR) unset(_CUDA_TARGET_NAME) +unset(architectures_mode) + set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX") set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 72dc8d3..fd3d028 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -159,7 +159,7 @@ endif () 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) if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index c967ab7..aec86d9 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -148,7 +148,7 @@ macro(_cmake_find_compiler_path lang) endmacro() 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 OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _cmake_sysroot_run_out diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index c62cb7d..b7119a8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -150,7 +150,28 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() endif() - if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") + # For LCC Fortran we need to explicitly query the version. + if(lang STREQUAL "Fortran" + AND CMAKE_${lang}_COMPILER_ID STREQUAL "LCC") + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + --version + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" --version\n" + "${output}\n" + ) + + if(output MATCHES [[\(GCC\) ([0-9]+\.[0-9]+(\.[0-9]+)?) compatible]]) + set(CMAKE_${lang}_SIMULATE_ID "GNU") + set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_MATCH_1}") + endif() + endif() + + if (COMPILER_QNXNTO AND (CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")) execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" -V @@ -641,12 +662,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) set(id_src "${src}") - if (GHS_PRIMARY_TARGET) - set(ghs_primary_target "${GHS_PRIMARY_TARGET}") - else() - set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt") - endif() - if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity") + set(ghs_primary_target "${GHS_PRIMARY_TARGET}") + if ("${ghs_primary_target}" MATCHES "integrity") set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}") set(os_dir "macro GHS_OS=${GHS_OS_DIR}") endif() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 6a8984b..33b8bf4 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -78,12 +78,13 @@ else() set(CMAKE_Fortran_COMPILER_LIST ftn ifort ifc ifx efc pgf95 pgfortran lf95 xlf95 fort - flang gfortran gfortran-4 g95 f90 pgf90 + flang lfortran gfortran gfortran-4 g95 f90 pgf90 frt pgf77 xlf g77 f77 nag ) endif() # Vendor-specific compiler names. + set(_Fortran_COMPILER_NAMES_LCC lfortran gfortran) set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc ifx) set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index f90301b..5d7d430 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -88,7 +88,7 @@ set(ENV{LANG} C) # Now check for C, works for gcc and Intel compiler at least if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) - if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES "Intel" OR CMAKE_C_COMPILER_ID MATCHES Clang) + if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES "LCC" OR CMAKE_C_COMPILER_ID MATCHES "Intel" OR CMAKE_C_COMPILER_ID MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines) set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") @@ -99,7 +99,7 @@ endif () # And now the same for C++ if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS) - if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang) + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "LCC" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines) set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories") set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index d0e0e46..969c841 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -95,6 +95,13 @@ # endif #elif defined(__ABSOFT__) PRINT *, 'INFO:compiler[Absoft]' +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) + PRINT *, 'INFO:compiler[LCC]' +# define COMPILER_VERSION_MAJOR DEC(1) +# define COMPILER_VERSION_MINOR DEC(__LCC__ - 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif #elif defined(__GNUC__) PRINT *, 'INFO:compiler[GNU]' # define COMPILER_VERSION_MAJOR DEC(__GNUC__) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index a61f71b..6bdefde 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -58,6 +58,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj endif() separate_arguments(args NATIVE_COMMAND "${line}") list(GET args 0 cmd) + if("${cmd}" MATCHES "->") + # LCC has '-> ' in-front of the linker + list(GET args 1 cmd) + endif() else() #check to see if the link line is comma-separated instead of space separated string(REGEX REPLACE "," " " line "${line}") diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 373a707..50a9525 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -262,7 +262,7 @@ installers. The most commonly-used variables are: create Start Menu shortcuts. For example, setting this to the list ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the installed executable ``ccmake``. Not all CPack generators use it (at least - NSIS, WIX and OSXX11 do). + NSIS, and WIX do). .. variable:: CPACK_STRIP_FILES @@ -658,13 +658,11 @@ if(NOT CPACK_GENERATOR) if(APPLE) option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) - option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages (deprecated)" OFF) option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages (deprecated)" OFF) option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF) mark_as_advanced( CPACK_BINARY_BUNDLE CPACK_BINARY_DRAGNDROP - CPACK_BINARY_OSXX11 CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_PRODUCTBUILD ) @@ -717,7 +715,6 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NUGET NuGet) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 48ee3c4..a7139af 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -67,14 +67,29 @@ cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) if(CMAKE_C_COMPILER_LOADED) + __CHECK_SYMBOL_EXISTS_FILTER_FLAGS(C) __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + __CHECK_SYMBOL_EXISTS_RESTORE_FLAGS(C) elseif(CMAKE_CXX_COMPILER_LOADED) + __CHECK_SYMBOL_EXISTS_FILTER_FLAGS(CXX) __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) + __CHECK_SYMBOL_EXISTS_RESTORE_FLAGS(CXX) else() message(FATAL_ERROR "CHECK_SYMBOL_EXISTS needs either C or CXX language enabled") endif() endmacro() +macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG) + set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}") + string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") + string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") +endmacro() + +macro(__CHECK_SYMBOL_EXISTS_RESTORE_FLAGS LANG) + set(CMAKE_${LANG}_FLAGS "${__CMAKE_${LANG}_FLAGS_SAVED}") + unset(__CMAKE_${LANG}_FLAGS_SAVED) +endmacro() + macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE) if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake index 0223081..219897e 100644 --- a/Modules/Compiler/Clang-CUDA.cmake +++ b/Modules/Compiler/Clang-CUDA.cmake @@ -18,8 +18,13 @@ __compiler_clang_cxx_standards(CUDA) set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE TRUE) set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cuda") +set(_CMAKE_CUDA_WHOLE_FLAG "-c") +set(_CMAKE_CUDA_RDC_FLAG "-fgpu-rdc") set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S") -set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c") + +# Device linking is just regular linking so these are the same. +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG ${CMAKE_CUDA_LINKER_WRAPPER_FLAG}) +set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ${CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP}) # RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default. set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") diff --git a/Modules/Compiler/LCC-C-DetermineCompiler.cmake b/Modules/Compiler/LCC-C-DetermineCompiler.cmake new file mode 100644 index 0000000..2ce92fe --- /dev/null +++ b/Modules/Compiler/LCC-C-DetermineCompiler.cmake @@ -0,0 +1,19 @@ + +set(_compiler_id_pp_test "defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(1) +# if defined(__LCC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__LCC__- 100) +# endif +# if defined(__LCC_MINOR__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define @PREFIX@SIMULATE_ID \"GNU\" +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) +# endif +# endif") diff --git a/Modules/Compiler/LCC-C-FeatureTests.cmake b/Modules/Compiler/LCC-C-FeatureTests.cmake new file mode 100644 index 0000000..0ab5265 --- /dev/null +++ b/Modules/Compiler/LCC-C-FeatureTests.cmake @@ -0,0 +1,17 @@ + +set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304") + +# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it +# to 201000L. As the former is strictly greater than the latter, test only +# for the latter. If in the future CMake learns about a C feature which was +# introduced with GNU 4.7, that should test for the correct version, similar +# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests. +set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L") +set(_cmake_feature_test_c_static_assert "${GNU46_C11}") +# Since 3.4 at least: +set(GNU34_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") +set(_cmake_feature_test_c_restrict "${GNU34_C99}") +set(_cmake_feature_test_c_variadic_macros "${GNU34_C99}") + +set(GNU_C90 "${_cmake_oldestSupported}") +set(_cmake_feature_test_c_function_prototypes "${GNU_C90}") diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake new file mode 100644 index 0000000..3dd6e68 --- /dev/null +++ b/Modules/Compiler/LCC-C.cmake @@ -0,0 +1,29 @@ +include(Compiler/LCC) +__compiler_lcc(C) + + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + +set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") +set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") +set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") +set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") +set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") +set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") +set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") +set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") +set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") +set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + +__compiler_check_default_language_standard(C 1.23 90 1.20 11 1.26 17) diff --git a/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake b/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..2ce92fe --- /dev/null +++ b/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake @@ -0,0 +1,19 @@ + +set(_compiler_id_pp_test "defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(1) +# if defined(__LCC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__LCC__- 100) +# endif +# if defined(__LCC_MINOR__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define @PREFIX@SIMULATE_ID \"GNU\" +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define @PREFIX@SIMULATE_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) +# endif +# endif") diff --git a/Modules/Compiler/LCC-CXX-FeatureTests.cmake b/Modules/Compiler/LCC-CXX-FeatureTests.cmake new file mode 100644 index 0000000..45c5470 --- /dev/null +++ b/Modules/Compiler/LCC-CXX-FeatureTests.cmake @@ -0,0 +1,109 @@ + +# Reference: http://gcc.gnu.org/projects/cxx0x.html +# http://gcc.gnu.org/projects/cxx1y.html + +set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") + +set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L") +set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}") +set(_cmake_feature_test_cxx_relaxed_constexpr "${GNU50_CXX14}") +set(_cmake_feature_test_cxx_aggregate_default_initializers "${GNU50_CXX14}") + +# GNU 4.9 in c++14 mode sets __cplusplus to 201300L, so don't test for the +# correct value of it below. +# https://patchwork.ozlabs.org/patch/382470/ +set(GNU49_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L") +set(_cmake_feature_test_cxx_contextual_conversions "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_attribute_deprecated "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_decltype_auto "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_digit_separators "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_generic_lambdas "${GNU49_CXX14}") +# GNU 4.3 supports binary literals as an extension, but may warn about +# use of extensions prior to GNU 4.9 +# http://stackoverflow.com/questions/16334024/difference-between-gcc-binary-literals-and-c14-ones +set(_cmake_feature_test_cxx_binary_literals "${GNU49_CXX14}") +# The features below are documented as available in GNU 4.8 (by implementing an +# earlier draft of the standard paper), but that version of the compiler +# does not set __cplusplus to a value greater than 201103L until GNU 4.9: +# http://gcc.gnu.org/onlinedocs/gcc-4.8.2/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros +# http://gcc.gnu.org/onlinedocs/gcc-4.9.0/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros +# So, CMake only reports availability for it with GNU 4.9 or later. +set(_cmake_feature_test_cxx_return_type_deduction "${GNU49_CXX14}") +set(_cmake_feature_test_cxx_lambda_init_captures "${GNU49_CXX14}") + +# Introduced in GCC 4.8.1 +set(GNU481_CXX11 "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${GNU481_CXX11}") +set(_cmake_feature_test_cxx_reference_qualified_functions "${GNU481_CXX11}") +set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}") +# The alignof feature works with GNU 4.7 and -std=c++11, but it is documented +# as available with GNU 4.8, so treat that as true. +set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}") +set(_cmake_feature_test_cxx_attributes "${GNU48_CXX11}") +set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}") +set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}") +set(GNU47_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_final "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_override "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}") +# NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor +# release following that (March 2012), and the first minor release to +# support -std=c++11. Prior to that, support for C++11 features is technically +# experiemental and possibly incomplete (see for example the note below about +# cxx_variadic_template_template_parameters) +# GNU does not define __cplusplus correctly before version 4.7. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773 +# __GXX_EXPERIMENTAL_CXX0X__ is defined in prior versions, but may not be +# defined in the future. +set(GNU_CXX0X_DEFINED "(__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))") +set(GNU46_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_defaulted_move_initializers "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_enum_forward_declarations "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_noexcept "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}") +set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}") +set(GNU45_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}") +set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}") +set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}") +set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}") +set(GNU44_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_inline_namespaces "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_sizeof_member "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_uniform_initialization "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") +# TODO: If features are ever recorded for GNU 4.3, there should possibly +# be a new feature added like cxx_variadic_template_template_parameters, +# which is implemented by GNU 4.4, but not 4.3. cxx_variadic_templates is +# actually implemented by GNU 4.3, but variadic template template parameters +# 'completes' it, so that is the version we record as having the variadic +# templates capability in CMake. See +# http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf +# TODO: Should be supported by GNU 4.3 +set(GNU43_CXX11 "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_long_long_type "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") +# TODO: Should be supported since GNU 3.4? +set(_cmake_feature_test_cxx_extern_templates "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +# TODO: Should be supported forever? +set(_cmake_feature_test_cxx_func_identifier "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_variadic_macros "${_cmake_oldestSupported} && ${GNU_CXX0X_DEFINED}") +set(_cmake_feature_test_cxx_template_template_parameters "${_cmake_oldestSupported} && __cplusplus") diff --git a/Modules/Compiler/LCC-CXX.cmake b/Modules/Compiler/LCC-CXX.cmake new file mode 100644 index 0000000..b3bdd3c --- /dev/null +++ b/Modules/Compiler/LCC-CXX.cmake @@ -0,0 +1,31 @@ +include(Compiler/LCC) +__compiler_lcc(CXX) + + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") + +set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") +set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") +set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") +set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") +set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") +set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") +set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") +set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a") +set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a") + +__compiler_check_default_language_standard(CXX 1.19 98 1.20 11 1.21 14 1.24 17 1.26 20) diff --git a/Modules/Compiler/LCC-FindBinUtils.cmake b/Modules/Compiler/LCC-FindBinUtils.cmake new file mode 100644 index 0000000..4dcdd53 --- /dev/null +++ b/Modules/Compiler/LCC-FindBinUtils.cmake @@ -0,0 +1,37 @@ +if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "") + message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") +endif() + +# Ubuntu 16.04: +# * /usr/bin/gcc-ar-5 +# * /usr/bin/gcc-ranlib-5 +string(REGEX MATCH "^([0-9]+)" __version_x + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}") + +string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}") + +# Try to find tools in the same directory as GCC itself +get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY) + +# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html +find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}" + HINTS ${__gcc_hints} + NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH + DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" +) +mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) + +# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html +find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}" + HINTS ${__gcc_hints} + NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH + DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" +) +mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB) diff --git a/Modules/Compiler/LCC-Fortran.cmake b/Modules/Compiler/LCC-Fortran.cmake new file mode 100644 index 0000000..8091b29 --- /dev/null +++ b/Modules/Compiler/LCC-Fortran.cmake @@ -0,0 +1,26 @@ +include(Compiler/LCC) +__compiler_lcc(Fortran) + +set(CMAKE_Fortran_SUBMODULE_SEP "@") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + +set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>") + +set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form") +set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") + +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp") +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp") + +set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed") + +# No -DNDEBUG for Fortran. +string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os") +string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3") + +# No -isystem for Fortran because it will not find .mod files. +unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran) + +# Fortran-specific feature flags. +set(CMAKE_Fortran_MODDIR_FLAG -J) diff --git a/Modules/Compiler/LCC.cmake b/Modules/Compiler/LCC.cmake new file mode 100644 index 0000000..8353ab6 --- /dev/null +++ b/Modules/Compiler/LCC.cmake @@ -0,0 +1,95 @@ +# 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(__COMPILER_LCC) + return() +endif() +set(__COMPILER_LCC 1) + +include(Compiler/CMakeCommonCompilerMacros) + +set(__pch_header_C "c-header") +set(__pch_header_CXX "c++-header") +set(__pch_header_OBJC "objective-c-header") +set(__pch_header_OBJCXX "objective-c++-header") + +macro(__compiler_lcc lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-v") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set (_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER NO) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + # Support of PIE at link stage depends on various elements : platform, compiler, linker + # so to activate it, module CheckPIESupported must be used. + set (_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER YES) + set(CMAKE_${lang}_LINK_OPTIONS_PIE ${CMAKE_${lang}_COMPILE_OPTIONS_PIE} "-pie") + set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "-no-pie") + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=") + + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + + # Older versions of gcc (< 4.5) contain a bug causing them to report a missing + # header file as a warning if depfiles are enabled, causing check_header_file + # tests to always succeed. Work around this by disabling dependency tracking + # in try_compile mode. + get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) + if(CMAKE_${lang}_COMPILER_ID STREQUAL "LCC" AND _IN_TC AND NOT CMAKE_FORCE_DEPFILES) + else() + # distcc does not transform -o to -MT when invoking the preprocessor + # internally, as it ought to. Work around this bug by setting -MT here + # even though it isn't strictly necessary. + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") + endif() + + # Initial configuration flags. + string(APPEND CMAKE_${lang}_FLAGS_INIT " ") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) + set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) + set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) + set(__lto_flags -flto) + list(APPEND __lto_flags -fno-fat-lto-objects) + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO ${__lto_flags}) + + set(CMAKE_${lang}_ARCHIVE_CREATE_IPO + "\"${CMAKE_${lang}_COMPILER_AR}\" cr <TARGET> <LINK_FLAGS> <OBJECTS>" + ) + + set(CMAKE_${lang}_ARCHIVE_APPEND_IPO + "\"${CMAKE_${lang}_COMPILER_AR}\" r <TARGET> <LINK_FLAGS> <OBJECTS>" + ) + + set(CMAKE_${lang}_ARCHIVE_FINISH_IPO + "\"${CMAKE_${lang}_COMPILER_RANLIB}\" <TARGET>" + ) + + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") + if(CMAKE_${lang}_COMPILER_ARG1) + separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) + unset(_COMPILER_ARGS) + endif() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + + if(NOT "x${lang}" STREQUAL "xFortran") + set(CMAKE_PCH_EXTENSION .gch) + if (NOT CMAKE_GENERATOR MATCHES "Xcode") + set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + endif() + set(CMAKE_${lang}_COMPILE_OPTIONS_INVALID_PCH -Winvalid-pch) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -x ${__pch_header_${lang}} -include <PCH_HEADER>) + endif() +endmacro() diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index c2fe42d..2f12b43 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -5,8 +5,9 @@ set(CMAKE_CUDA_VERBOSE_FLAG "-v") set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v") set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu") +set(_CMAKE_CUDA_WHOLE_FLAG "-c") +set(_CMAKE_CUDA_RDC_FLAG "-rdc=true") set(_CMAKE_CUDA_PTX_FLAG "-ptx") -set(_CMAKE_CUDA_DEVICE_CODE "-dc") if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # The -forward-unknown-to-host-compiler flag was only diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index e5b1e5d..afa36f7 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -21,6 +21,7 @@ LabelsForSubprojects: @CTEST_LABELS_FOR_SUBPROJECTS@ # Submission information SubmitURL: @SUBMIT_URL@ +SubmitInactivityTimeout: @CTEST_SUBMIT_INACTIVITY_TIMEOUT@ # Dashboard start time NightlyStartTime: @NIGHTLY_START_TIME@ diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 308138f..e3bf8f9 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -437,7 +437,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") set(BLAS_mkl_END_GROUP "") endif() # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it) - if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) + if(CMAKE_Fortran_COMPILER_LOADED AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LCC") AND NOT APPLE) set(BLAS_mkl_INTFACE "gf") set(BLAS_mkl_THREADING "gnu") set(BLAS_mkl_OMP "gomp") @@ -756,10 +756,10 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}") if(BLA_STATIC) if (CMAKE_C_COMPILER_LOADED) - find_package(OpenMP COMPONENTS C) + find_package(OpenMP QUIET COMPONENTS C) list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") elseif(CMAKE_CXX_COMPILER_LOADED) - find_package(OpenMP COMPONENTS CXX) + find_package(OpenMP QUIET COMPONENTS CXX) list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}") endif() endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0ad342f..25e646a 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -917,14 +917,14 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) if(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0) # From GCC 5 and clang 4, versioning changes and minor becomes patch. # For those compilers, patch is exclude from compiler tag in Boost 1.69+ library naming. - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4) + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4) OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC") set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3) set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") endif() endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC") if(Boost_VERSION_STRING VERSION_LESS 1.34) set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 else() diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index d22a676..de5f376 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -933,6 +933,23 @@ if(CUDAToolkit_FOUND) _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse) _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos) + + if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2) + # cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2, + # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack + _CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib + _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_lapack_static) + endif() + + if(CUDAToolkit_VERSION VERSION_GREATER 11.2.1) + # cusolver depends on libcusolver_metis and cublasLt + # https://docs.nvidia.com/cuda/archive/11.2.2/cusolver/index.html#link-dependency + _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublasLt) + + _CUDAToolkit_find_and_add_import_lib(cusolver_metis_static ALT metis_static) # implementation detail static lib + _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cusolver_metis_static cublasLt_static) + endif() + # nvGRAPH depends on cuRAND, and cuSOLVER. _CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver) _CUDAToolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 8e22f79..60bb401 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -22,6 +22,14 @@ Imported targets ``GTest::gtest_main`` The Google Test ``gtest_main`` library, if found +.. versionadded:: 3.23 + +``GTest::gmock`` + The Google Mock ``gmock`` library, if found; adds Thread::Thread + automatically +``GTest::gmock_main`` + The Google Mock ``gmock_main`` library, if found + .. deprecated:: 3.20 For backwards compatibility, this module defines additionally the following deprecated :prop_tgt:`IMPORTED` targets (available since 3.5): @@ -32,7 +40,6 @@ Imported targets ``GTest::Main`` The Google Test ``gtest_main`` library, if found - Result variables ^^^^^^^^^^^^^^^^ @@ -245,15 +252,29 @@ if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") __gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd) __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main) __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind) + __gtest_find_library(GMOCK_LIBRARY gmock-md gmock) + __gtest_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd) + __gtest_find_library(GMOCK_MAIN_LIBRARY gmock_main-md gmock_main) + __gtest_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_main-mdd gmock_maind) else() __gtest_find_library(GTEST_LIBRARY gtest) __gtest_find_library(GTEST_LIBRARY_DEBUG gtestd) __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main) __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) + __gtest_find_library(GMOCK_LIBRARY gmock) + __gtest_find_library(GMOCK_LIBRARY_DEBUG gmockd) + __gtest_find_library(GMOCK_MAIN_LIBRARY gmock_main) + __gtest_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind) endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) +if(GMOCK_LIBRARY AND GMOCK_MAIN_LIBRARY) + set(GMock_FOUND True) +else() + set(GMock_FOUND False) +endif() + if(GTest_FOUND) set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) __gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) @@ -292,3 +313,36 @@ if(GTest_FOUND) __gtest_define_backwards_compatible_library_targets() endif() + +if(GMock_FOUND) + if(NOT TARGET GTest::gmock) + __gtest_determine_library_type(GMOCK_LIBRARY) + add_library(GTest::gmock ${GMOCK_LIBRARY_TYPE} IMPORTED) + set(_gmock_link_libraries "GTest::gtest") + if(TARGET Threads::Threads) + list(APPEND _gmock_link_libraries Threads::Threads) + endif() + set_target_properties(GTest::gmock PROPERTIES + INTERFACE_LINK_LIBRARIES "${_gmock_link_libraries}") + if(GMOCK_LIBRARY_TYPE STREQUAL "SHARED") + set_target_properties(GTest::gmock PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "GMOCK_LINKED_AS_SHARED_LIBRARY=1") + endif() + if(GTEST_INCLUDE_DIRS) + set_target_properties(GTest::gmock PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}") + endif() + __gtest_import_library(GTest::gmock GMOCK_LIBRARY "") + __gtest_import_library(GTest::gmock GMOCK_LIBRARY "RELEASE") + __gtest_import_library(GTest::gmock GMOCK_LIBRARY "DEBUG") + endif() + if(NOT TARGET GTest::gmock_main) + __gtest_determine_library_type(GMOCK_MAIN_LIBRARY) + add_library(GTest::gmock_main ${GMOCK_MAIN_LIBRARY_TYPE} IMPORTED) + set_target_properties(GTest::gmock_main PROPERTIES + INTERFACE_LINK_LIBRARIES "GTest::gmock") + __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "") + __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "RELEASE") + __gtest_import_library(GTest::gmock_main GMOCK_MAIN_LIBRARY "DEBUG") + endif() +endif() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 6cadadb..6e07da5 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -319,8 +319,6 @@ function(_HDF5_test_regular_compiler_Fortran success is_parallel) file(WRITE ${test_file} "program hdf5_hello\n" " use hdf5\n" - " use h5lt\n" - " use h5ds\n" " integer error\n" " call h5open_f(error)\n" " call h5close_f(error)\n" @@ -881,7 +879,7 @@ if( NOT HDF5_FOUND ) # Add library-based search paths for Fortran modules. if (NOT _hdf5_main_library STREQUAL "") # gfortran module directory - if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LCC") get_filename_component(_hdf5_library_dir "${_hdf5_main_library}" DIRECTORY) list(APPEND _hdf5_inc_extra_paths "${_hdf5_library_dir}") unset(_hdf5_library_dir) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 929a809..ecfb7f9 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -102,6 +102,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG) unset(OpenMP_FLAG_CANDIDATES) set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_LCC "-fopenmp") set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp" "-Xclang -fopenmp") set(OMP_FLAG_AppleClang "-Xclang -fopenmp") set(OMP_FLAG_HP "+Oopenmp") diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 8474e05..85e386a 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -435,7 +435,7 @@ else() ${_OPENSSL_LIBDIR} ${_OPENSSL_LIBRARY_DIRS} PATH_SUFFIXES - lib + lib lib64 ) find_library(OPENSSL_CRYPTO_LIBRARY @@ -447,7 +447,7 @@ else() ${_OPENSSL_LIBDIR} ${_OPENSSL_LIBRARY_DIRS} PATH_SUFFIXES - lib + lib lib64 ) mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) @@ -650,7 +650,7 @@ if(OPENSSL_FOUND) _OpenSSL_target_add_dependencies(OpenSSL::SSL) endif() - if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8") + if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8") if(MSVC) if(EXISTS "${OPENSSL_INCLUDE_DIR}") set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR}) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index e4d6cf3..4198374 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -164,18 +164,21 @@ if(CMAKE_HAVE_PTHREAD_H) elseif(CMAKE_CXX_COMPILER_LOADED) CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD) endif() - if(CMAKE_HAVE_LIBC_PTHREAD) + + # Check for -pthread first if enabled. This is the recommended + # way, but not backwards compatible as one must also pass -pthread + # as compiler flag then. + if(THREADS_PREFER_PTHREAD_FLAG) + _check_pthreads_flag() + endif() + + if(Threads_FOUND) + # do nothing, we are done + elseif(CMAKE_HAVE_LIBC_PTHREAD) set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) else() - # Check for -pthread first if enabled. This is the recommended - # way, but not backwards compatible as one must also pass -pthread - # as compiler flag then. - if (THREADS_PREFER_PTHREAD_FLAG) - _check_pthreads_flag() - endif () - if(CMAKE_SYSTEM MATCHES "GHS-MULTI") _check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) endif() diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 4f48e13..527ca8b 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -39,18 +39,29 @@ This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found: 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 +This module defines the following variables: + +``Vulkan_FOUND`` + set to true if Vulkan was found +``Vulkan_INCLUDE_DIRS`` + include directories for Vulkan +``Vulkan_LIBRARIES`` + link against this library to use Vulkan +``Vulkan_VERSION`` + .. versionadded:: 3.23 + + value from ``vulkan/vulkan_core.h`` + +The module will also defines these 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 ^^^^^ @@ -125,10 +136,33 @@ endif() set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR}) +# detect version e.g 1.2.189 +set(Vulkan_VERSION "") +if(Vulkan_INCLUDE_DIR) + set(VULKAN_CORE_H ${Vulkan_INCLUDE_DIR}/vulkan/vulkan_core.h) + if(EXISTS ${VULKAN_CORE_H}) + file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ") + string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}") + file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ") + string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}") + list(LENGTH VulkanHeaderVersion2 _len) + # versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2' + if(_len EQUAL 3) + list(REMOVE_AT VulkanHeaderVersion2 0) + endif() + list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion}) + list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION) + endif() +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Vulkan - DEFAULT_MSG - Vulkan_LIBRARY Vulkan_INCLUDE_DIR) + REQUIRED_VARS + Vulkan_LIBRARY + Vulkan_INCLUDE_DIR + VERSION_VAR + Vulkan_VERSION +) mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY Vulkan_GLSLC_EXECUTABLE Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 01bd637..4e7f87b 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -52,8 +52,10 @@ where ``<dir>`` is one of: .. versionadded:: 3.9 run-time variable data (``LOCALSTATEDIR/run``) ``LIBDIR`` - object code libraries (``lib`` or ``lib64`` - or ``lib/<multiarch-tuple>`` on Debian) + object code libraries (``lib`` or ``lib64``) + + On Debian, this may be ``lib/<multiarch-tuple>`` when + :variable:`CMAKE_INSTALL_PREFIX` is ``/``, ``/usr``, or ``/usr/local``. ``INCLUDEDIR`` C header files (``include``) ``OLDINCLUDEDIR`` @@ -271,7 +273,9 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set if(__system_type_for_install STREQUAL "debian") if(CMAKE_LIBRARY_ARCHITECTURE) - if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/" + OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$" + OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$") set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") endif() if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX @@ -328,7 +332,7 @@ else() "Info documentation (DATAROOTDIR/info)") endif() -if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$") +if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(FreeBSD)$") _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "man" "Man documentation (man)") else() diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.in Binary files differdeleted file mode 100644 index c715860..0000000 --- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in +++ /dev/null diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in Binary files differdeleted file mode 100644 index 5f5f17a..0000000 --- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in +++ /dev/null diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index c115f00..958a6db 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -332,6 +332,14 @@ function(cpack_deb_prepare_package_vars) RESULT_VARIABLE SHLIBDEPS_RESULT ERROR_VARIABLE SHLIBDEPS_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) + + # E2K OSL 6.0.1 and prior has broken dpkg-shlibdeps. CPack will deal with that (mocking SHLIBDEPS_OUTPUT), but inform user of this. + if("${SHLIBDEPS_ERROR}" MATCHES "unknown gcc system type e2k.*, falling back to default") + message(WARNING "CPackDeb: broken dpkg-shlibdeps on E2K detected, will fall back to minimal dependencies.\n" + "You should expect that dependencies list in the package will be incomplete.") + set(SHLIBDEPS_OUTPUT "shlibs:Depends=libc6, lcc-libs") + endif() + if(CPACK_DEBIAN_PACKAGE_DEBUG) # dpkg-shlibdeps will throw some warnings if some input files are not binary message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake index 349d906..96f0162 100644 --- a/Modules/Platform/GHS-MULTI-Determine.cmake +++ b/Modules/Platform/GHS-MULTI-Determine.cmake @@ -1,26 +1,77 @@ # 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 +# Setup variables used for Green Hills MULTI generator +# -- Allow users to override these values. + +if(CMAKE_GENERATOR MATCHES "Green Hills MULTI") + + # Set the project primaryTarget value + # If not set then primaryTarget will be determined by the generator + if((NOT DEFINED GHS_PRIMARY_TARGET) OR (DEFINED CACHE{GHS_PRIMARY_TARGET})) + set(GHS_PRIMARY_TARGET "IGNORE" CACHE STRING "GHS MULTI primaryTarget") + mark_as_advanced(GHS_PRIMARY_TARGET) + endif() + + # Setup MULTI toolset selection variables + if((NOT DEFINED GHS_TOOLSET_ROOT) OR (DEFINED CACHE{GHS_TOOLSET_ROOT})) + if(CMAKE_HOST_UNIX) + set(_ts_root "/usr/ghs") + else() + set(_ts_root "C:/ghs") + endif() + set(GHS_TOOLSET_ROOT "${_ts_root}" CACHE PATH "GHS platform toolset root directory") + mark_as_advanced(GHS_TOOLSET_ROOT) + unset(_ts_root) + endif() + + # Setup MULTI project variables + if((NOT DEFINED GHS_CUSTOMIZATION) OR (DEFINED CACHE{GHS_CUSTOMIZATION})) + set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") + mark_as_advanced(GHS_CUSTOMIZATION) + endif() + + if((NOT DEFINED GHS_GPJ_MACROS) OR (DEFINED CACHE{GHS_GPJ_MACROS})) + set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") + mark_as_advanced(GHS_GPJ_MACROS) + endif() -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) +# If project primaryTarget not set then set target platform name. +# -- May be used by the generator when determining the primaryTarget. +if(NOT GHS_PRIMARY_TARGET) + if((NOT DEFINED GHS_TARGET_PLATFORM) OR (DEFINED CACHE{GHS_TARGET_PLATFORM})) + set(GHS_TARGET_PLATFORM "integrity" CACHE STRING "GHS MULTI target platform") + mark_as_advanced(GHS_TARGET_PLATFORM) + endif() +endif() -set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option") -mark_as_advanced(GHS_OS_DIR_OPTION) +# Settings for OS selection +if((NOT DEFINED GHS_OS_ROOT) OR (DEFINED CACHE{GHS_OS_ROOT})) + if(CMAKE_HOST_UNIX) + set(_os_root "/usr/ghs") + else() + set(_os_root "C:/ghs") + endif() + set(GHS_OS_ROOT "${_os_root}" CACHE PATH "GHS platform OS search root directory") + unset(_os_root) + mark_as_advanced(GHS_OS_ROOT) +endif() -#set GHS_OS_DIR if not set by user -if(NOT GHS_OS_DIR) +# Search for GHS_OS_DIR if not set by user and is known to be required +if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity") + # Needed - Use a value that will make it apparent RTOS selection failed + set(_ghs_os_dir "GHS_OS_DIR-NOT-SPECIFIED") +else() + # Not needed for this target + set(_ghs_os_dir "IGNORE") +endif() + +if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR) if(EXISTS ${GHS_OS_ROOT}) - #get all directories in root directory + # 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 @@ -29,28 +80,50 @@ if(NOT GHS_OS_DIR) list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES}) endif () - #filter based on platform name - if(GHS_TARGET_PLATFORM MATCHES "integrity") + # Filter based on platform name + if(GHS_PRIMARY_TARGET MATCHES "integrity" OR 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() + # Select latest? of matching candidates 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}) + 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") +#Used for targets requiring RTOS +if((NOT DEFINED GHS_OS_DIR) OR (DEFINED CACHE{GHS_OS_DIR})) + set(GHS_OS_DIR "${_ghs_os_dir}" CACHE PATH "GHS platform OS directory") + mark_as_advanced(GHS_OS_DIR) +endif() +unset(_ghs_os_dir) + +if((NOT DEFINED GHS_OS_DIR_OPTION) OR (DEFINED CACHE{GHS_OS_DIR_OPTION})) + set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option") + mark_as_advanced(GHS_OS_DIR_OPTION) +endif() + +# Select GHS_BSP_NAME if not set by user and is known to be required +if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity") + set(_ghs_bsp_name "GHS_BSP_NAME-NOT-SPECIFIED") +else() + set(_ghs_bsp_name "IGNORE") +endif() -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) +if(_ghs_bsp_name AND NOT DEFINED GHS_BSP_NAME) + # First try taking architecture from `-A` option + if(CMAKE_GENERATOR_PLATFORM) + set(_ghs_bsp_name "sim${CMAKE_GENERATOR_PLATFORM}") + else() + set(_ghs_bsp_name "simarm") + endif() +endif() + +if((NOT DEFINED GHS_BSP_NAME) OR (DEFINED CACHE{GHS_BSP_NAME})) + set(GHS_BSP_NAME "${_ghs_bsp_name}" CACHE STRING "BSP name") + mark_as_advanced(GHS_BSP_NAME) +endif() +unset(_ghs_bsp_name) diff --git a/Modules/Platform/Generic-ELF.cmake b/Modules/Platform/Generic-ELF.cmake new file mode 100644 index 0000000..943cb6b --- /dev/null +++ b/Modules/Platform/Generic-ELF.cmake @@ -0,0 +1,7 @@ +# This is a platform definition file for platforms without +# an operating system using the ELF executable format. +# It is used when CMAKE_SYSTEM_NAME is set to "Generic-ELF" + +include(Platform/Generic) + +set(CMAKE_EXECUTABLE_SUFFIX .elf) diff --git a/Modules/Platform/Linux-LCC-C.cmake b/Modules/Platform/Linux-LCC-C.cmake new file mode 100644 index 0000000..b204c55 --- /dev/null +++ b/Modules/Platform/Linux-LCC-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-LCC) +__linux_compiler_lcc(C) diff --git a/Modules/Platform/Linux-LCC-CXX.cmake b/Modules/Platform/Linux-LCC-CXX.cmake new file mode 100644 index 0000000..cf2fa35 --- /dev/null +++ b/Modules/Platform/Linux-LCC-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-LCC) +__linux_compiler_lcc(CXX) diff --git a/Modules/Platform/Linux-LCC-Fortran.cmake b/Modules/Platform/Linux-LCC-Fortran.cmake new file mode 100644 index 0000000..d3a4cf4 --- /dev/null +++ b/Modules/Platform/Linux-LCC-Fortran.cmake @@ -0,0 +1,3 @@ +include(Platform/Linux-LCC) +__linux_compiler_lcc(Fortran) +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-llfortran") diff --git a/Modules/Platform/Linux-LCC.cmake b/Modules/Platform/Linux-LCC.cmake new file mode 100644 index 0000000..a375461 --- /dev/null +++ b/Modules/Platform/Linux-LCC.cmake @@ -0,0 +1,15 @@ +# 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(__LINUX_COMPILER_LCC) + return() +endif() +set(__LINUX_COMPILER_LCC 1) + +macro(__linux_compiler_lcc lang) + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") +endmacro() diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 1c32018..c4d6fd8 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -56,7 +56,12 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) - set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto") + if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9) + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin") + else() + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto") + endif() + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>") diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index b83932e..6c1699b 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -1,11 +1,7 @@ include(Platform/Windows-MSVC) -set(CMAKE_CUDA_COMPILE_PTX_COMPILATION - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -ptx <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") -set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") -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> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") +set(CMAKE_CUDA_COMPILE_OBJECT + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} <CUDA_COMPILE_MODE> <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") set(__IMPLICIT_LINKS) foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) |