diff options
33 files changed, 274 insertions, 79 deletions
diff --git a/.gitlab/ci/configure_macos_common.cmake b/.gitlab/ci/configure_macos_common.cmake index 4bd3c7d..37cd51c 100644 --- a/.gitlab/ci/configure_macos_common.cmake +++ b/.gitlab/ci/configure_macos_common.cmake @@ -11,3 +11,8 @@ set(CMake_TEST_Java 0 CACHE FILEPATH "") set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF CACHE BOOL "") set(BUILD_QtDialog ON CACHE BOOL "") + +# The "XCTest" test uses an explicit deployment target chosen +# when CMake itself is configured. Use a version that is not +# newer than the macOS version running on any CI host. +set(CMake_TEST_XCTest_DEPLOYMENT_TARGET "10.15" CACHE STRING "") diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index c3733ab..6137ea9 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -27,6 +27,8 @@ ;; cmake-command-help Written by James Bigler ;; +(require 'rst) + (defcustom cmake-mode-cmake-executable "cmake" "*The name of the cmake executable. @@ -264,10 +266,29 @@ optional argument topic will be appended to the argument list." ) ;;;###autoload +(defun cmake-command-run-help (type &optional topic buffer) + "`cmake-command-run' but rendered in `rst-mode'." + (interactive "s") + (let* ((bufname (if buffer buffer (concat "*CMake" type (if topic "-") topic "*"))) + (buffer (if (get-buffer bufname) (get-buffer bufname) (generate-new-buffer bufname))) + (command (concat cmake-mode-cmake-executable " " type " " topic)) + ;; Turn of resizing of mini-windows for shell-command. + (resize-mini-windows nil) + ) + (shell-command command buffer) + (save-selected-window + (select-window (display-buffer buffer 'not-this-window)) + (rst-mode) + (read-only-mode 1) + (view-mode 1)) + ) + ) + +;;;###autoload (defun cmake-help-list-commands () "Prints out a list of the cmake commands." (interactive) - (cmake-command-run "--help-command-list") + (cmake-command-run-help "--help-command-list") ) (defvar cmake-commands '() "List of available topics for --help-command.") @@ -293,7 +314,7 @@ and store the result as a list in LISTVAR." (if (not (symbol-value listvar)) (let ((temp-buffer-name "*CMake Temporary*")) (save-window-excursion - (cmake-command-run (concat "--help-" listname "-list") nil temp-buffer-name) + (cmake-command-run-help (concat "--help-" listname "-list") nil temp-buffer-name) (with-current-buffer temp-buffer-name ; FIXME: Ignore first line if it is "cmake version ..." from CMake < 3.0. (set listvar (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t))))) @@ -327,25 +348,25 @@ and store the result as a list in LISTVAR." (defun cmake-help-command () "Prints out the help message for the command the cursor is on." (interactive) - (cmake-command-run "--help-command" (cmake-help-type "command") "*CMake Help*")) + (cmake-command-run-help "--help-command" (cmake-help-type "command") "*CMake Help*")) ;;;###autoload (defun cmake-help-module () "Prints out the help message for the module the cursor is on." (interactive) - (cmake-command-run "--help-module" (cmake-help-type "module") "*CMake Help*")) + (cmake-command-run-help "--help-module" (cmake-help-type "module") "*CMake Help*")) ;;;###autoload (defun cmake-help-variable () "Prints out the help message for the variable the cursor is on." (interactive) - (cmake-command-run "--help-variable" (cmake-help-type "variable") "*CMake Help*")) + (cmake-command-run-help "--help-variable" (cmake-help-type "variable") "*CMake Help*")) ;;;###autoload (defun cmake-help-property () "Prints out the help message for the property the cursor is on." (interactive) - (cmake-command-run "--help-property" (cmake-help-type "property") "*CMake Help*")) + (cmake-command-run-help "--help-property" (cmake-help-type "property") "*CMake Help*")) ;;;###autoload (defun cmake-help () @@ -368,13 +389,13 @@ and store the result as a list in LISTVAR." (if (string= input "") (error "No argument given") (if (member input command-list) - (cmake-command-run "--help-command" input "*CMake Help*") + (cmake-command-run-help "--help-command" input "*CMake Help*") (if (member input variable-list) - (cmake-command-run "--help-variable" input "*CMake Help*") + (cmake-command-run-help "--help-variable" input "*CMake Help*") (if (member input module-list) - (cmake-command-run "--help-module" input "*CMake Help*") + (cmake-command-run-help "--help-module" input "*CMake Help*") (if (member input property-list) - (cmake-command-run "--help-property" input "*CMake Help*") + (cmake-command-run-help "--help-property" input "*CMake Help*") (error "Not a know help topic.") ; this really should not happen )))))) ) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index ff9d1bf..482b14e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -648,6 +648,9 @@ which is just the string ``tgt``. expression is evaluated on. ``$<TARGET_FILE_NAME:tgt>`` The ``tgt`` filename. + + Note that ``tgt`` is not added as a dependency of the target this + expression is evaluated on (see policy :policy:`CMP0112`). ``$<TARGET_FILE_DIR:tgt>`` Directory of the ``tgt`` binary file. diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 88cddf6..0267ca3 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -386,7 +386,8 @@ Configure use of an Android NDK with the following variables: :variable:`CMAKE_ANDROID_ARCH_ABI` Set to the Android ABI (architecture). If not specified, this - variable will default to ``armeabi``. + variable will default to the first supported ABI in the list of + ``armeabi``, ``armeabi-v7a`` and ``arm64-v8a``. The :variable:`CMAKE_ANDROID_ARCH` variable will be computed from ``CMAKE_ANDROID_ARCH_ABI`` automatically. Also see the :variable:`CMAKE_ANDROID_ARM_MODE` and @@ -394,7 +395,6 @@ Configure use of an Android NDK with the following variables: :variable:`CMAKE_ANDROID_NDK` Set to the absolute path to the Android NDK root directory. - A ``${CMAKE_ANDROID_NDK}/platforms`` directory must exist. If not specified, a default for this variable will be chosen as specified :ref:`above <Cross Compiling for Android>`. diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst index 78a9055..313a51e 100644 --- a/Help/policy/CMP0112.rst +++ b/Help/policy/CMP0112.rst @@ -8,6 +8,7 @@ Target file component generator expressions do not add target dependencies. The following target-based generator expressions that query for directory or file name components no longer add a dependency on the evaluated target. + - ``TARGET_FILE_NAME`` - ``TARGET_FILE_DIR`` - ``TARGET_LINKER_FILE_BASE_NAME`` - ``TARGET_LINKER_FILE_NAME`` diff --git a/Help/release/dev/android-ndk.rst b/Help/release/dev/android-ndk.rst new file mode 100644 index 0000000..ee4ea5b --- /dev/null +++ b/Help/release/dev/android-ndk.rst @@ -0,0 +1,12 @@ +android-ndk +----------- + +* CMake's support for :ref:`Cross Compiling for Android` + is now merged with the Android NDK's toolchain file. + They now have similar behavior, though some variable names differ. + User-facing changes include: + + - ``find_*`` functions will search NDK ABI / API specific paths by default. + + - The default :variable:`CMAKE_BUILD_TYPE` for Android is + now ``RelWithDebInfo``. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index 99ff015..8eb4fb6 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -25,8 +25,6 @@ include: HP = Hewlett-Packard Compiler (hp.com) IAR = IAR Systems (iar.com) Intel = Intel Compiler (intel.com) - IntelDPCPP = Intel DPCPP Compiler (intel.com) - IntelClang = Intel Clang Compiler (intel.com) MSVC = Microsoft Visual Studio (microsoft.com) NVIDIA = NVIDIA CUDA Compiler (nvidia.com) OpenWatcom = Open Watcom (openwatcom.org) diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 26fb381..a0f0dfa 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -78,8 +78,6 @@ function(compiler_id_detection outvar lang) ARMCC AppleClang ARMClang - IntelDPCPP - IntelClang Clang GNU MSVC diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index b296ba7..8cf161f 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -279,6 +279,16 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) + # Executable names have choosen 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") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler") + set(id_cl dpcpp.exe) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021") + set(id_cl icx.exe) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler") + set(id_cl icl.exe) + endif() else() set(id_cl cl.exe) endif() @@ -313,9 +323,6 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>") else() set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") - set(id_cl icl.exe) - endif() if(CMAKE_VS_PLATFORM_TOOLSET_VERSION) set(id_sep "\\") if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20") diff --git a/Modules/Compiler/Intel-ISPC.cmake b/Modules/Compiler/Intel-ISPC.cmake index e4d5c97..be64cf7 100644 --- a/Modules/Compiler/Intel-ISPC.cmake +++ b/Modules/Compiler/Intel-ISPC.cmake @@ -20,8 +20,6 @@ string(APPEND CMAKE_ISPC_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") set(CMAKE_ISPC_COMPILE_OPTIONS_PIE --pic) set(CMAKE_ISPC_COMPILE_OPTIONS_PIC --pic) -set(CMAKE_INCLUDE_SYSTEM_FLAG_ISPC -isystem=) - set(CMAKE_ISPC_RESPONSE_FILE_FLAG "@") set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_INCLUDES 1) set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_LIBRARIES 1) diff --git a/Modules/Compiler/IntelClang-DetermineCompiler.cmake b/Modules/Compiler/IntelClang-DetermineCompiler.cmake deleted file mode 100644 index 3544be3..0000000 --- a/Modules/Compiler/IntelClang-DetermineCompiler.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -set(_compiler_id_pp_test "defined(__clang__) && defined(__INTEL_CLANG_COMPILER)") - -include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") - -string(APPEND _compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_CLANG_COMPILER)") diff --git a/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake b/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake deleted file mode 100644 index 7bbb21c..0000000 --- a/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -set(_compiler_id_pp_test "defined(__clang__) && defined(__INTEL_DPCPP_COMPILER__)") - -include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") - -string(APPEND _compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_DPCPP_COMPILER__)") diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 93c0a11..01d0236 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -53,6 +53,8 @@ The following variables may be set to influence this module's behavior: * ``Arm_mp`` * ``Arm_ilp64`` * ``Arm_ilp64_mp`` + * ``EML`` + * ``EML_mt`` * ``Generic`` .. versionadded:: 3.6 @@ -74,6 +76,9 @@ The following variables may be set to influence this module's behavior: .. versionadded:: 3.19 ``FlexiBLAS`` support. + .. versionadded:: 3.20 + Elbrus Math Library support (``EML``, ``EML_mt``). + ``BLA_F95`` if ``ON`` tries to find the BLAS95 interfaces @@ -983,6 +988,31 @@ if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") endif() endif() +# Elbrus Math Library? +if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All") + + set(BLAS_EML_LIB "eml") + + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + set(BLAS_EML_LIB "${BLAS_EML_LIB}_mt") + endif() + + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${BLAS_EML_LIB}" + "" + "" + "" + ) + endif() + +endif() + # Generic BLAS library? if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 4f769ba..d5af5da 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -43,6 +43,8 @@ The following variables may be set to influence this module's behavior: * ``Arm_mp`` * ``Arm_ilp64`` * ``Arm_ilp64_mp`` + * ``EML`` + * ``EML_mt`` * ``Generic`` .. versionadded:: 3.6 @@ -64,6 +66,9 @@ The following variables may be set to influence this module's behavior: .. versionadded:: 3.19 ``FlexiBLAS`` support. + .. versionadded:: 3.20 + Elbrus Math Library support (``EML``, ``EML_mt``). + ``BLA_F95`` if ``ON`` tries to find the BLAS95/LAPACK95 interfaces @@ -515,6 +520,30 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) ) endif() + # Elbrus Math Library? + if(NOT LAPACK_LIBRARIES + AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")) + + set(LAPACK_EML_LIB "eml") + + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + set(LAPACK_EML_LIB "${LAPACK_EML_LIB}_mt") + endif() + + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "${LAPACK_EML_LIB}" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + # Generic LAPACK library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Generic" diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 0e76468..0c775f7 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -456,7 +456,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) list (REMOVE_DUPLICATES _values) elseif (NAME STREQUAL "SOABI") # clean-up: remove prefix character and suffix - string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}") + if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$") + set(_values "") + else() + string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}") + endif() endif() endif() endif() @@ -508,7 +512,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME) endforeach() if (_values) # clean-up: remove prefix character and suffix - string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}") + if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$") + set(_values "") + else() + string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}") + endif() endif() endif() else() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index abaf75e..99f1229 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 20201208) +set(CMake_VERSION_PATCH 20201210) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 12f8e44..b444edd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5086,9 +5086,14 @@ void cmGeneratorTarget::GetTargetObjectNames( objects.push_back(map_it->second); } + // We need to compute the relative path from the root of + // of the object directory to handle subdirectory paths + std::string rootObjectDir = this->GetObjectDirectory(config); + rootObjectDir = cmSystemTools::CollapseFullPath(rootObjectDir); auto ispcObjects = this->GetGeneratedISPCObjects(config); for (std::string const& output : ispcObjects) { - objects.push_back(cmSystemTools::GetFilenameName(output)); + auto relativePathFromObjectDir = output.substr(rootObjectDir.size()); + objects.push_back(relativePathFromObjectDir); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 17d1790..70aa052 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1649,6 +1649,14 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) } } + // Allow empty source file list for iOS Sticker packs + if (const char* productType = GetTargetProductType(gtgt)) { + if (strcmp(productType, + "com.apple.product-type.app-extension.messages-sticker-pack") == + 0) + return; + } + // Add an empty source file to the target that compiles with the // linker language. This should convince Xcode to choose the proper // language. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d9b7926..c9dfdea 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,6 +3,7 @@ #include "cmLocalGenerator.h" #include <algorithm> +#include <array> #include <cassert> #include <cstdio> #include <cstdlib> @@ -2431,9 +2432,10 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target) this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); for (std::string const& config : configsList) { - std::string perConfigDir = target->GetObjectDirectory(config); + std::string rootObjectDir = target->GetObjectDirectory(config); + std::string headerDir = rootObjectDir; if (cmProp prop = target->GetProperty("ISPC_HEADER_DIRECTORY")) { - perConfigDir = cmSystemTools::CollapseFullPath( + headerDir = cmSystemTools::CollapseFullPath( cmStrCat(this->GetBinaryDirectory(), '/', *prop)); } @@ -2450,11 +2452,11 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target) std::string ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(objectName); - auto headerPath = cmStrCat(perConfigDir, '/', ispcSource, ".h"); + auto headerPath = cmStrCat(headerDir, '/', ispcSource, ".h"); target->AddISPCGeneratedHeader(headerPath, config); if (extra_objects) { std::vector<std::string> objs = detail::ComputeISPCExtraObjects( - objectName, perConfigDir, ispcSuffixes); + objectName, rootObjectDir, ispcSuffixes); target->AddISPCGeneratedObject(std::move(objs), config); } } @@ -2474,8 +2476,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) target->GetSourceFiles(sources, config); const std::string configUpper = cmSystemTools::UpperCase(config); + static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC", + "OBJCXX" } }; - for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) { + for (const std::string& lang : langs) { auto langSources = std::count_if( sources.begin(), sources.end(), [lang](cmSourceFile* sf) { return lang == sf->GetLanguage() && @@ -4098,15 +4102,23 @@ std::vector<std::string> ComputeISPCExtraObjects( std::string const& objectName, std::string const& buildDirectory, std::vector<std::string> const& ispcSuffixes) { + auto normalizedDir = cmSystemTools::CollapseFullPath(buildDirectory); std::vector<std::string> computedObjects; computedObjects.reserve(ispcSuffixes.size()); auto extension = cmSystemTools::GetFilenameLastExtension(objectName); - auto objNameNoExt = - cmSystemTools::GetFilenameWithoutLastExtension(objectName); + + // We can't use cmSystemTools::GetFilenameWithoutLastExtension as it + // drops any directories in objectName + auto objNameNoExt = objectName; + std::string::size_type dot_pos = objectName.rfind('.'); + if (dot_pos != std::string::npos) { + objNameNoExt.resize(dot_pos); + } + for (const auto& ispcTarget : ispcSuffixes) { computedObjects.emplace_back( - cmStrCat(buildDirectory, "/", objNameNoExt, "_", ispcTarget, extension)); + cmStrCat(normalizedDir, "/", objNameNoExt, "_", ispcTarget, extension)); } return computedObjects; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6edbf82..838cf4c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1357,15 +1357,16 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::string ispcSource = cmSystemTools::GetFilenameWithoutLastExtension(objectName); - std::string ispcDirectory = objectFileDir; + std::string ispcHeaderDirectory = + this->GeneratorTarget->GetObjectDirectory(config); if (cmProp prop = this->GeneratorTarget->GetProperty("ISPC_HEADER_DIRECTORY")) { - ispcDirectory = *prop; + ispcHeaderDirectory = + cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', *prop); } - ispcDirectory = - cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', ispcDirectory); - std::string ispcHeader = cmStrCat(ispcDirectory, '/', ispcSource, ".h"); + std::string ispcHeader = + cmStrCat(ispcHeaderDirectory, '/', ispcSource, ".h"); ispcHeader = this->ConvertToNinjaPath(ispcHeader); // Make sure ninja knows what command generates the header @@ -1377,8 +1378,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( auto ispcSuffixes = detail::ComputeISPCObjectSuffixes(this->GeneratorTarget); if (ispcSuffixes.size() > 1) { + std::string rootObjectDir = + this->GeneratorTarget->GetObjectDirectory(config); auto ispcSideEfffectObjects = detail::ComputeISPCExtraObjects( - objectName, ispcDirectory, ispcSuffixes); + objectName, rootObjectDir, ispcSuffixes); for (auto sideEffect : ispcSideEfffectObjects) { sideEffect = this->ConvertToNinjaPath(sideEffect); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index f27b788..67834f1 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -29,6 +29,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmGlobalNinjaGenerator.h" #include "cmLinkItem.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" @@ -1237,11 +1238,23 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() const std::string outputFile = cmStrCat(this->Dir.Build, "/", timestampFileName); this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps"); - auto relativeBinaryDir = cmSystemTools::RelativePath( - this->LocalGen->GetBinaryDirectory(), - this->LocalGen->GetCurrentBinaryDirectory()); - if (!relativeBinaryDir.empty()) { - relativeBinaryDir = cmStrCat(relativeBinaryDir, "/"); + std::string relativeBinaryDir; + if (dynamic_cast<cmGlobalNinjaGenerator*>(this->GlobalGen)) { + switch (this->LocalGen->GetPolicyStatus(cmPolicies::CMP0116)) { + case cmPolicies::OLD: + case cmPolicies::WARN: + relativeBinaryDir = cmSystemTools::RelativePath( + this->LocalGen->GetBinaryDirectory(), + this->LocalGen->GetCurrentBinaryDirectory()); + if (!relativeBinaryDir.empty()) { + relativeBinaryDir = cmStrCat(relativeBinaryDir, "/"); + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + break; + } } this->AutogenTarget.DepFileRuleName = cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/", diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx index e1f8753..163d7e0 100644 --- a/Source/cmTransformDepfile.cxx +++ b/Source/cmTransformDepfile.cxx @@ -47,7 +47,8 @@ void WriteGccDepfile(cmsys::ofstream& fout, const cmGccDepfileContent& content) } fout << ':'; for (auto const& path : dep.paths) { - fout << " \\\n " << path; + fout << " \\\n "; + WriteFilenameGcc(fout, path); } fout << '\n'; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e0be694..14095dd 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -299,18 +299,7 @@ if(BUILD_TESTING) set(CTEST_TEST_OSX_ARCH 0) set(CMake_TEST_XCODE_VERSION 0) if(APPLE) - execute_process( - COMMAND sw_vers -productVersion - OUTPUT_VARIABLE OSX_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(OSX_VERSION VERSION_LESS 10.4) - message(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4") - message(STATUS "OSX_VERSION='${OSX_VERSION}'") - set(CTEST_TEST_CPACK OFF) - else() - set(CTEST_TEST_OSX_ARCH 1) - endif() + set(CTEST_TEST_OSX_ARCH 1) if(XCODE_VERSION) set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}") else() @@ -1832,11 +1821,22 @@ if(BUILD_TESTING) ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 - AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") - set(XCTest_CTEST_OPTIONS --build-config $<CONFIGURATION>) - set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1} -DCMAKE_OSX_SYSROOT=macosx) - ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V) + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5) + if(NOT CMake_TEST_XCTest_DEPLOYMENT_TARGET) + execute_process( + COMMAND sw_vers -productVersion + OUTPUT_VARIABLE OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(CMake_TEST_XCTest_DEPLOYMENT_TARGET "${CMAKE_MATCH_1}") + endif() + endif() + if(CMake_TEST_XCTest_DEPLOYMENT_TARGET) + set(XCTest_CTEST_OPTIONS --build-config $<CONFIGURATION>) + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMake_TEST_XCTest_DEPLOYMENT_TARGET} -DCMAKE_OSX_SYSROOT=macosx) + ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V) + endif() endif() add_test(linkorder1 ${CMAKE_CTEST_COMMAND} diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt index c13271a..2c3651d 100644 --- a/Tests/ISPC/CMakeLists.txt +++ b/Tests/ISPC/CMakeLists.txt @@ -13,4 +13,5 @@ add_ispc_test_macro(ISPC.ObjectGenex ISPCObjectGenex) add_ispc_test_macro(ISPC.ObjectLibrary ISPCObjectLibrary) add_ispc_test_macro(ISPC.ResponseAndDefine ISPCResponseAndDefine) add_ispc_test_macro(ISPC.StaticLibrary ISPCStaticLibrary) +add_ispc_test_macro(ISPC.SystemIncludes ISPCSystemIncludes) add_ispc_test_macro(ISPC.TryCompile ISPCTryCompile) diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt index 4767d7e..a4c81a9 100644 --- a/Tests/ISPC/ObjectLibrary/CMakeLists.txt +++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt @@ -8,7 +8,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4) endif() -add_library(ispc_objects OBJECT simple.ispc extra.ispc) +add_library(ispc_objects OBJECT simple.ispc subdir/extra.ispc) set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") diff --git a/Tests/ISPC/ObjectLibrary/extra.ispc b/Tests/ISPC/ObjectLibrary/subdir/extra.ispc index 5a4a442..5a4a442 100644 --- a/Tests/ISPC/ObjectLibrary/extra.ispc +++ b/Tests/ISPC/ObjectLibrary/subdir/extra.ispc diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt new file mode 100644 index 0000000..95959b2 --- /dev/null +++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.18) +project(ispc_spaces_in_path ISPC CXX) + + +add_executable(ISPCSystemIncludes main.cxx simple.ispc) +set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_include_directories(ISPCSystemIncludes SYSTEM PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") + +target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") +endif() diff --git a/Tests/ISPC/SystemIncludes/main.cxx b/Tests/ISPC/SystemIncludes/main.cxx new file mode 100644 index 0000000..4f1c9be --- /dev/null +++ b/Tests/ISPC/SystemIncludes/main.cxx @@ -0,0 +1,15 @@ +#include <stdio.h> + +#include "simple.ispc.h" + +int main() +{ + float vin[16], vout[16]; + for (int i = 0; i < 16; ++i) + vin[i] = i; + + ispc::simple(vin, vout, 16); + + for (int i = 0; i < 16; ++i) + printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]); +} diff --git a/Tests/ISPC/SystemIncludes/simple.ispc b/Tests/ISPC/SystemIncludes/simple.ispc new file mode 100644 index 0000000..d539bbe --- /dev/null +++ b/Tests/ISPC/SystemIncludes/simple.ispc @@ -0,0 +1,9 @@ + +export void simple(uniform float vin[], uniform float vout[], + uniform int count) { + foreach (index = 0 ... count) { + float v = vin[index]; + v = sqrt(v); + vout[index] = v; + } +} diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake index d69a119..d314ff3 100644 --- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake +++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake @@ -7,3 +7,6 @@ set(CMAKE_AUTOMOC ON) add_library(simple_lib SHARED simple_lib.cpp) add_executable(app_with_qt app.cpp app_qt.cpp) target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core) + +add_subdirectory(QtSubDir1) +add_subdirectory(QtSubDir2) diff --git a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt new file mode 100644 index 0000000..64016b6 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0116 OLD) + +add_executable(sub_exe_1 ../app.cpp) +target_link_libraries(sub_exe_1 PRIVATE Qt5::Core) diff --git a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt new file mode 100644 index 0000000..3176426 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0116 NEW) + +add_executable(sub_exe_2 ../app.cpp) +target_link_libraries(sub_exe_2 PRIVATE Qt5::Core) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index e6f86a1..b91ab00 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -338,8 +338,17 @@ function(run_Qt5AutoMocDeps) # Build and assert that AUTOMOC was not run for app_with_qt. run_ninja("${RunCMake_TEST_BINARY_DIR}") if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt") - message(FATAL_ERROR - "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}") + endif() + # Assert that the subdir executables were not rebuilt. + if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_1") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'sub_exe_1' target:\nstdout:\n${ninja_stdout}") + endif() + if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_2") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'sub_exe_2' target:\nstdout:\n${ninja_stdout}") endif() endif() endfunction() |