summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/policy/CMP0105.rst5
-rw-r--r--Help/prop_tgt/COMPILE_OPTIONS.rst2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/FindCUDAToolkit.cmake106
-rw-r--r--Modules/FindJNI.cmake7
-rw-r--r--Tests/Cuda/Toolkit/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake3
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake3
-rw-r--r--Tests/RunCMake/showIncludes.c8
11 files changed, 118 insertions, 34 deletions
diff --git a/Help/policy/CMP0105.rst b/Help/policy/CMP0105.rst
index 097a59a..aadc8d6 100644
--- a/Help/policy/CMP0105.rst
+++ b/Help/policy/CMP0105.rst
@@ -8,12 +8,13 @@ properties are now used for the device link step.
In CMake 3.17 and below, link options are not used by the device link step.
-The ``OLD`` behavior for this policy is to ignore the link options.
+The ``OLD`` behavior for this policy is to ignore the link options during the
+device link step.
The ``NEW`` behavior of this policy is to use the link options during the
device link step.
-This policy was introduced in CMake version 3.17. Use the
+This policy was introduced in CMake version 3.18. Use the
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
Unlike many policies, CMake version |release| does *not* warn
when this policy is not set and simply uses ``OLD`` behavior.
diff --git a/Help/prop_tgt/COMPILE_OPTIONS.rst b/Help/prop_tgt/COMPILE_OPTIONS.rst
index 0fd6aac..2b93db1 100644
--- a/Help/prop_tgt/COMPILE_OPTIONS.rst
+++ b/Help/prop_tgt/COMPILE_OPTIONS.rst
@@ -6,7 +6,7 @@ List of options to pass to the compiler.
This property holds a :ref:`semicolon-separated list <CMake Language Lists>`
of options specified so far for its target. Use the
:command:`target_compile_options` command to append more options.
-The options will be added after after flags in the
+The options will be added after flags in the
:variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
variables, but before those propagated from dependencies by the
:prop_tgt:`INTERFACE_COMPILE_OPTIONS` property.
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index f79e8b8..2250d63 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -1144,7 +1144,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
ENCODING AUTO # cl prints in console output code page
)
string(REPLACE "\n" "\n " msg " ${out}")
- if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./)")
+ if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./|/)")
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE)
string(APPEND msg "\nFound prefix \"${CMAKE_MATCH_2}\"")
else()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index c3b6bc3..724fdf1 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -29,8 +29,8 @@ The CUDA Toolkit search behavior uses the following order:
precedence.
The directory specified here must be such that the executable ``nvcc`` or
- the appropriate ``version.txt`` file can be found underneath the specified
- directory.
+ the appropriate ``version.txt`` or ``version.json`` file can be found
+ underneath the specified directory.
3. If the CUDA_PATH environment variable is defined, it will be searched
for ``nvcc``.
@@ -478,7 +478,7 @@ Result variables
``CUDAToolkit_VERSION``
The exact version of the CUDA Toolkit found (as reported by
- ``nvcc --version`` or ``version.txt``).
+ ``nvcc --version``, ``version.txt``, or ``version.json``).
``CUDAToolkit_VERSION_MAJOR``
The major version of the CUDA Toolkit.
@@ -505,7 +505,7 @@ Result variables
.. versionadded:: 3.18
The path to the CUDA Toolkit directory containing the nvvm directory and
- version.txt.
+ either version.txt or version.json.
``CUDAToolkit_TARGET_DIR``
The path to the CUDA Toolkit directory including the target architecture
@@ -590,7 +590,7 @@ else()
if(NOT CUDAToolkit_NVCC_EXECUTABLE)
find_file(CUDAToolkit_SENTINEL_FILE
- NAMES version.txt
+ NAMES version.txt version.json
PATHS ${arg_SEARCH_PATHS}
NO_DEFAULT_PATH
)
@@ -631,14 +631,43 @@ else()
function(_CUDAToolkit_find_version_file result_variable)
# We first check for a non-scattered installation to prefer it over a scattered installation.
- if(CUDAToolkit_ROOT AND EXISTS "${CUDAToolkit_ROOT}/version.txt")
- set(${result_variable} "${CUDAToolkit_ROOT}/version.txt" PARENT_SCOPE)
- elseif(CUDAToolkit_ROOT_DIR AND EXISTS "${CUDAToolkit_ROOT_DIR}/version.txt")
- set(${result_variable} "${CUDAToolkit_ROOT_DIR}/version.txt" PARENT_SCOPE)
- elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt")
- set(${result_variable} "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt" PARENT_SCOPE)
- elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt")
- set(${result_variable} "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt" PARENT_SCOPE)
+ set(version_files version.txt version.json)
+ foreach(vf IN LISTS version_files)
+ if(CUDAToolkit_ROOT AND EXISTS "${CUDAToolkit_ROOT}/${vf}")
+ set(${result_variable} "${CUDAToolkit_ROOT}/${vf}" PARENT_SCOPE)
+ break()
+ elseif(CUDAToolkit_ROOT_DIR AND EXISTS "${CUDAToolkit_ROOT_DIR}/${vf}")
+ set(${result_variable} "${CUDAToolkit_ROOT_DIR}/${vf}" PARENT_SCOPE)
+ break()
+ elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/${vf}")
+ set(${result_variable} "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/${vf}" PARENT_SCOPE)
+ break()
+ elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/${vf}")
+ set(${result_variable} "${CMAKE_SYSROOT}/usr/lib/cuda/${vf}" PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ endfunction()
+
+ function(_CUDAToolkit_parse_version_file version_file)
+ if(version_file)
+ file(READ "${version_file}" file_conents)
+ cmake_path(GET version_file EXTENSION LAST_ONLY version_ext)
+ if(version_ext STREQUAL ".json")
+ string(JSON cuda_version_info GET "${file_conents}" "cuda" "version")
+ set(cuda_version_match_regex [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=])
+ elseif(version_ext STREQUAL ".txt")
+ set(cuda_version_info "${file_conents}")
+ set(cuda_version_match_regex [=[CUDA Version ([0-9]+)\.([0-9]+)\.([0-9]+)]=])
+ endif()
+
+ if(cuda_version_info MATCHES "${cuda_version_match_regex}")
+ set(CUDAToolkit_VERSION_MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE)
+ set(CUDAToolkit_VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
+ set(CUDAToolkit_VERSION_PATCH "${CMAKE_MATCH_3}" PARENT_SCOPE)
+ set(CUDAToolkit_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" PARENT_SCOPE)
+ message(STATUS "_CUDAToolkit_parse_version_file")
+ endif()
endif()
endfunction()
@@ -785,15 +814,7 @@ else()
unset(NVCC_OUT)
else()
_CUDAToolkit_find_version_file(version_file)
- if(version_file)
- file(READ "${version_file}" VERSION_INFO)
- if(VERSION_INFO MATCHES [=[CUDA Version ([0-9]+)\.([0-9]+)\.([0-9]+)]=])
- set(CUDAToolkit_VERSION_MAJOR "${CMAKE_MATCH_1}")
- set(CUDAToolkit_VERSION_MINOR "${CMAKE_MATCH_2}")
- set(CUDAToolkit_VERSION_PATCH "${CMAKE_MATCH_3}")
- set(CUDAToolkit_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
- endif()
- endif()
+ _CUDAToolkit_parse_version_file("${version_file}")
endif()
endif()
@@ -931,6 +952,19 @@ if(CUDAToolkit_FOUND)
file(REAL_PATH "${CUDAToolkit_LIBRARY_DIR}/../" _cmake_search_dir)
list(APPEND CUDAToolkit_LIBRARY_SEARCH_DIRS "${_cmake_search_dir}")
endif()
+
+ # If no `CUDAToolkit_LIBRARY_ROOT` exists set it based on CUDAToolkit_LIBRARY_DIR
+ if(NOT DEFINED CUDAToolkit_LIBRARY_ROOT)
+ foreach(CUDAToolkit_search_loc IN LISTS CUDAToolkit_LIBRARY_DIR CUDAToolkit_BIN_DIR)
+ get_filename_component(CUDAToolkit_possible_lib_root "${CUDAToolkit_search_loc}" DIRECTORY ABSOLUTE)
+ if(EXISTS "${CUDAToolkit_possible_lib_root}/nvvm/")
+ set(CUDAToolkit_LIBRARY_ROOT "${CUDAToolkit_possible_lib_root}")
+ break()
+ endif()
+ endforeach()
+ unset(CUDAToolkit_search_loc)
+ unset(CUDAToolkit_possible_lib_root)
+ endif()
endif()
@@ -1022,12 +1056,24 @@ if(CUDAToolkit_FOUND)
endif()
endif()
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.0.0)
+ _CUDAToolkit_find_and_add_import_lib(nvJitLink)
+ _CUDAToolkit_find_and_add_import_lib(nvJitLink_static DEPS cudart_static_deps)
+ endif()
+
_CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library
- foreach (cuda_lib cublasLt cufft curand cusparse nppc nvjpeg)
+ foreach (cuda_lib cublasLt cufft nvjpeg)
+ _CUDAToolkit_find_and_add_import_lib(${cuda_lib})
+ _CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS cudart_static_deps culibos)
+ endforeach()
+ foreach (cuda_lib curand nppc)
_CUDAToolkit_find_and_add_import_lib(${cuda_lib})
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
endforeach()
+ _CUDAToolkit_find_and_add_import_lib(cusparse DEPS nvJitLink)
+ _CUDAToolkit_find_and_add_import_lib(cusparse_static DEPS nvJitLink_static culibos)
+
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.0.0)
# cublas depends on cublasLt
# https://docs.nvidia.com/cuda/archive/11.0/cublas/index.html#static-library
@@ -1109,21 +1155,21 @@ if(CUDAToolkit_FOUND)
if(NOT TARGET CUDA::nvptxcompiler_static)
_CUDAToolkit_find_and_add_import_lib(nvptxcompiler_static DEPS cuda_driver)
if(TARGET CUDA::nvptxcompiler_static)
- target_link_libraries(CUDA::nvptxcompiler_static INTERFACE Threads::Threads)
+ target_link_libraries(CUDA::nvptxcompiler_static INTERFACE CUDA::cudart_static_deps)
endif()
endif()
endif()
- if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.0.0)
- _CUDAToolkit_find_and_add_import_lib(nvJitLink DEPS cuda_driver)
- _CUDAToolkit_find_and_add_import_lib(nvJitLink_static DEPS cuda_driver)
- endif()
-
_CUDAToolkit_find_and_add_import_lib(nvrtc_builtins DEPS cuda_driver)
_CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0)
_CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver)
- _CUDAToolkit_find_and_add_import_lib(nvrtc_static DEPS nvrtc_builtins_static nvptxcompiler_static nvJitLink_static)
+ if(NOT TARGET CUDA::nvrtc_static)
+ _CUDAToolkit_find_and_add_import_lib(nvrtc_static DEPS nvrtc_builtins_static nvptxcompiler_static nvJitLink_static)
+ if(TARGET CUDA::nvrtc_static AND WIN32 AND NOT (BORLAND OR MINGW OR CYGWIN))
+ target_link_libraries(CUDA::nvrtc_static INTERFACE Ws2_32.lib)
+ endif()
+ endif()
endif()
_CUDAToolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 64163b0..27f9b0e 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -290,6 +290,13 @@ set(_JNI_JAVA_DIRECTORIES_BASE
# Arch Linux specific paths for default JVM
/usr/lib/jvm/default
# Ubuntu specific paths for default JVM
+ /usr/lib/jvm/java-21-openjdk-{libarch} # Ubuntu 23.04
+ /usr/lib/jvm/java-20-openjdk-{libarch} # Ubuntu 22.10
+ /usr/lib/jvm/java-19-openjdk-{libarch} # Ubuntu 22.04 LTS
+ /usr/lib/jvm/java-18-openjdk-{libarch} # Ubuntu 22.04 LTS
+ /usr/lib/jvm/java-17-openjdk-{libarch} # Ubuntu 18.04 LTS
+ /usr/lib/jvm/java-16-openjdk-{libarch} # Ubuntu 20.04 LTS
+ /usr/lib/jvm/java-13-openjdk-{libarch} # Ubuntu 20.04 LTS
/usr/lib/jvm/java-11-openjdk-{libarch} # Ubuntu 18.04 LTS
/usr/lib/jvm/java-8-openjdk-{libarch} # Ubuntu 15.10
/usr/lib/jvm/java-7-openjdk-{libarch} # Ubuntu 15.10
diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt
index b67aa32..8432b71 100644
--- a/Tests/Cuda/Toolkit/CMakeLists.txt
+++ b/Tests/Cuda/Toolkit/CMakeLists.txt
@@ -16,8 +16,22 @@ message(STATUS "CUDAToolkit_VERSION_PATCH: ${CUDAToolkit_VERSION_PATCH}")
message(STATUS "CUDAToolkit_BIN_DIR: ${CUDAToolkit_BIN_DIR}")
message(STATUS "CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}")
message(STATUS "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}")
+message(STATUS "CUDAToolkit_LIBRARY_ROOT: ${CUDAToolkit_LIBRARY_ROOT}")
message(STATUS "CUDAToolkit_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}")
+set(should_exist
+ CUDAToolkit_BIN_DIR
+ CUDAToolkit_INCLUDE_DIRS
+ CUDAToolkit_LIBRARY_DIR
+ CUDAToolkit_LIBRARY_ROOT
+ )
+foreach (cuda_loc_var IN LISTS should_exist)
+ if(NOT EXISTS "${${cuda_loc_var}}")
+ message(FATAL_ERROR "${cuda_loc_var} variable is expected to be set to valid path")
+ endif()
+endforeach()
+
+
set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1)
list(APPEND cuda_libs cublasLt)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 520d9c7..a52c64e 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -51,6 +51,7 @@ if(WIN32)
run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-437-Italian -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
+ run_cmake_script(ShowIncludes-437-WineMSVC -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-54936-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-65001-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-65001-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake
new file mode 100644
index 0000000..d4017ab
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake
@@ -0,0 +1,3 @@
+# 'msvc-wine -showIncludes' prefix.
+set(expect "Note: including file: ")
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt
new file mode 100644
index 0000000..bda7eab
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt
@@ -0,0 +1 @@
+-- showIncludes='Note: including file: '
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake
new file mode 100644
index 0000000..59d3bf6
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake
@@ -0,0 +1,3 @@
+set(CODEPAGE 437)
+set(VSLANG "msvc-wine") # Special case for test, not a real VS value.
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c
index 5afe04a..7d467cf 100644
--- a/Tests/RunCMake/showIncludes.c
+++ b/Tests/RunCMake/showIncludes.c
@@ -36,6 +36,14 @@ int main()
}
}
+ // msvc-wine (special case for test, not a real VS value).
+ if (strcmp(vslang, "msvc-wine") == 0) {
+ if (cp == 437 || cp == 65001) {
+ printf("Note: including file: /c/foo.h\n");
+ return 0;
+ }
+ }
+
// German.
if (strcmp(vslang, "1031") == 0) {
if (cp == 437 || cp == 65001) {