diff options
-rw-r--r-- | Help/release/3.19.rst | 2 | ||||
-rw-r--r-- | Modules/CPack.cmake | 44 | ||||
-rw-r--r-- | Modules/Compiler/NVIDIA-CUDA.cmake | 2 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 4 | ||||
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/Android-Clang.cmake | 12 | ||||
-rw-r--r-- | Modules/Platform/Android-Determine.cmake | 12 | ||||
-rw-r--r-- | Modules/Platform/Android-Initialize.cmake | 12 | ||||
-rw-r--r-- | Modules/Platform/Android.cmake | 12 | ||||
-rw-r--r-- | Modules/Platform/Android/Determine-Compiler.cmake | 12 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/CMakePresets.json.in | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-again-ninja-check.cmake (renamed from Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 2 |
17 files changed, 121 insertions, 22 deletions
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index 6e46452..7f6e44c 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -51,6 +51,8 @@ Languages - separable compilation (:prop_tgt:`CUDA_SEPARABLE_COMPILATION`), and - finding scattered toolkit installations when cross-compiling. +* ``CUDA`` language support now works on QNX. + File-Based API -------------- diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 8a0ef30..7529a1f 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -357,7 +357,7 @@ The following variables are for advanced uses of CPack: .. variable:: CPACK_INSTALL_SCRIPTS Extra CMake scripts executed by CPack during its local staging - installation, which is done right before packaging the files. + installation. They are executed before installing the files to be packaged. The scripts are not called by a standalone install (e.g.: ``make install``). For every script, the following variables will be set: :variable:`CMAKE_CURRENT_SOURCE_DIR`, :variable:`CMAKE_CURRENT_BINARY_DIR` @@ -366,6 +366,33 @@ The following variables are for advanced uses of CPack: an alternative variable for historical reasons, but its value is ignored if ``CMAKE_INSTALL_SCRIPTS`` is set and a warning will be issued. + See also :variable:`CPACK_PRE_BUILD_SCRIPTS` and + :variable:`CPACK_POST_BUILD_SCRIPTS` which can be used to specify scripts + to be executed later in the packaging process. + +.. variable:: CPACK_PRE_BUILD_SCRIPTS + + List of CMake scripts to execute after CPack has installed the files to + be packaged into a staging directory and before producing the package(s) + from those files. See also :variable:`CPACK_INSTALL_SCRIPTS` and + :variable:`CPACK_POST_BUILD_SCRIPTS`. + +.. variable:: CPACK_POST_BUILD_SCRIPTS + + List of CMake scripts to execute after CPack has produced the resultant + packages and before copying them back to the build directory. + See also :variable:`CPACK_INSTALL_SCRIPTS`, + :variable:`CPACK_PRE_BUILD_SCRIPTS` and :variable:`CPACK_PACKAGE_FILES`. + +.. variable:: CPACK_PACKAGE_FILES + + List of package files created in the staging directory, with each file + provided as a full absolute path. This variable is populated by CPack + just before invoking the post-build scripts listed in + :variable:`CPACK_POST_BUILD_SCRIPTS`. It is the preferred way for the + post-build scripts to know the set of package files to operate on. + Projects should not try to set this variable themselves. + .. variable:: CPACK_INSTALLED_DIRECTORIES Extra directories to install. @@ -390,21 +417,6 @@ The following variables are for advanced uses of CPack: select the CPack generator(s) to be used when building the ``package`` target or when running :manual:`cpack <cpack(1)>` without the ``-G`` option. -.. variable:: CPACK_PRE_BUILD_SCRIPTS - - List of CMake scripts to execute after CPack has installed the files to - be packed into a staging directory and before producing the result - packages. - -.. variable:: CPACK_POST_BUILD_SCRIPTS - - List of CMake scripts to execute after CPack has produced the result - packages and before copying them back to a build directory. - -.. variable:: CPACK_PACKAGE_FILES - - List of resulting package files passed to the ``CPACK_POST_BUILD_SCRIPTS``. - #]=======================================================================] # Define this var in order to avoid (or warn) concerning multiple inclusion diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 1a724a0..95a51f6 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -64,7 +64,7 @@ set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") -if(UNIX) +if(UNIX AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX")) list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl") endif() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index a93d4fd..f04f571 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -732,6 +732,8 @@ if(CMAKE_CROSSCOMPILING) # Support for aarch64 cross compilation if (ANDROID_ARCH_NAME STREQUAL "arm64") set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux-androideabi") + elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(CUDA_TOOLKIT_TARGET_NAME "aarch64-qnx") else() set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux") endif (ANDROID_ARCH_NAME STREQUAL "arm64") @@ -902,7 +904,7 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) find_package(Threads REQUIRED) set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags}) - if(NOT APPLE) + if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX")) #On Linux, you must link against librt when using the static cuda runtime. find_library(CUDA_rt_LIBRARY rt) if (NOT CUDA_rt_LIBRARY) diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index b4599a3..b3c8569 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -678,6 +678,8 @@ if(CMAKE_CROSSCOMPILING) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") if(ANDROID_ARCH_NAME STREQUAL "arm64") set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi") + elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(CUDAToolkit_TARGET_NAME "aarch64-qnx") else() set(CUDAToolkit_TARGET_NAME "aarch64-linux") endif(ANDROID_ARCH_NAME STREQUAL "arm64") @@ -860,7 +862,7 @@ if(CUDAToolkit_FOUND) target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS}) endif() - if(UNIX AND NOT APPLE) + if(UNIX AND NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX")) # On Linux, you must link against librt when using the static cuda runtime. find_library(CUDAToolkit_rt_LIBRARY rt) mark_as_advanced(CUDAToolkit_rt_LIBRARY) diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake index 160eada..44d48cd 100644 --- a/Modules/Platform/Android-Clang.cmake +++ b/Modules/Platform/Android-Clang.cmake @@ -7,6 +7,12 @@ if(__ANDROID_COMPILER_CLANG) endif() set(__ANDROID_COMPILER_CLANG 1) +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Clang.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. Later we may try to integrate this. @@ -57,3 +63,9 @@ macro(__android_compiler_clang lang) set(_ANDROID_STL_NOSTDLIBXX 1) endif() endmacro() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Clang.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index f7d8d13..3206c83 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -5,6 +5,12 @@ # This module detects platform-wide information about the Android target # in order to store it in "CMakeSystem.cmake". +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Determine.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. @@ -519,3 +525,9 @@ endif() message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'") cmake_policy(POP) + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Determine.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index 5019c28..db75703 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -4,6 +4,12 @@ # When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this # module. +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Initialize.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. @@ -53,3 +59,9 @@ else() "Android: No CMAKE_SYSROOT was selected." ) endif() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Initialize.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index 80d81aa..2a1a7a3 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -1,3 +1,9 @@ +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL) +endif() + include(Platform/Linux) set(ANDROID 1) @@ -96,3 +102,9 @@ if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin") endif() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake index f9c2d89..f8eae62 100644 --- a/Modules/Platform/Android/Determine-Compiler.cmake +++ b/Modules/Platform/Android/Determine-Compiler.cmake @@ -7,6 +7,12 @@ if(__ANDROID_DETERMINE_COMPILER) endif() set(__ANDROID_DETERMINE_COMPILER 1) +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Determine-Compiler.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. Later we may try to integrate this. @@ -83,3 +89,9 @@ set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_S ") endif() endmacro() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Determine-Compiler.cmake OPTIONAL) +endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 779a7f8..2150614 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 20201102) +set(CMake_VERSION_PATCH 20201103) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7a9e493..0274a16 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1005,9 +1005,15 @@ void cmake::SetArgs(const std::vector<std::string>& args) const bool haveSourceDir = !this->GetHomeDirectory().empty(); const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty(); + const bool havePreset = +#ifdef CMAKE_BOOTSTRAP + false; +#else + !presetName.empty(); +#endif if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && - !haveBinaryDir) { + !haveBinaryDir && !havePreset) { this->IssueMessage( MessageType::WARNING, "No source or binary directory provided. Both will be assumed to be " diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index a347120..54e4140 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -170,6 +170,11 @@ "binaryDir": "${sourceDir}/build" }, { + "name": "GoodNoSourceArg", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { "name": "GoodInheritanceParentBase", "hidden": true, "generator": "@RunCMake_GENERATOR@", diff --git a/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake b/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake new file mode 100644 index 0000000..49e7a25 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 2caa66a..1ffda3d 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -179,6 +179,13 @@ unset(RunCMake_TEST_NO_CLEAN) unset(CMakePresets_SOURCE_ARG) unset(RunCMake_TEST_BINARY_DIR) unset(CMakePresets_NO_S_ARG) +set(CMakePresets_NO_SOURCE_ARGS 1) +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/GoodNoSourceArg") +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_presets(GoodNoSourceArg) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) +unset(CMakePresets_NO_SOURCE_ARGS) run_cmake_presets(GoodInheritanceParent) run_cmake_presets(GoodInheritanceChild) run_cmake_presets(GoodInheritanceOverride) diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-again-ninja-check.cmake index 1e4cbe1..1e4cbe1 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-again-ninja-check.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 6699a09..2411114 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -215,7 +215,7 @@ run_ninja(CustomCommandGenerator debug-clean build-Debug.ninja clean) run_cmake_build(CustomCommandGenerator release-clean Release clean) run_cmake_build(CustomCommandGenerator debug-in-release-graph Release generated:Debug) run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TARGET_FILE_generated_Debug}") -run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) +run_ninja(CustomCommandGenerator debug-clean-again build-Debug.ninja clean:Debug) run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") unset(RunCMake_TEST_NO_CLEAN) |