diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeBackwardCompatibilityC.cmake | 4 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 13 | ||||
-rw-r--r-- | Modules/FindCUDA/select_compute_arch.cmake | 18 | ||||
-rw-r--r-- | Modules/FindDCMTK.cmake | 1 | ||||
-rw-r--r-- | Modules/FindThreads.cmake | 104 | ||||
-rw-r--r-- | Modules/Qt4ConfigDependentSettings.cmake | 1 | ||||
-rw-r--r-- | Modules/UseSWIG.cmake | 25 |
7 files changed, 85 insertions, 81 deletions
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index 5d86d73..775a513 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -59,9 +59,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL "Use HP pthreads.") - set (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL - "Use sproc libs.") - if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) @@ -72,7 +69,6 @@ mark_as_advanced( CMAKE_HP_PTHREADS CMAKE_THREAD_LIBS CMAKE_USE_PTHREADS -CMAKE_USE_SPROC CMAKE_USE_WIN32_THREADS CMAKE_X_CFLAGS CMAKE_X_LIBS diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 0f5cab4..228eed4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -875,11 +875,7 @@ endif() if(CUDA_USE_STATIC_CUDA_RUNTIME) if(UNIX) - # Check for the dependent libraries. Here we look for pthreads. - if (DEFINED CMAKE_THREAD_PREFER_PTHREAD) - set(_cuda_cmake_thread_prefer_pthread ${CMAKE_THREAD_PREFER_PTHREAD}) - endif() - set(CMAKE_THREAD_PREFER_PTHREAD 1) + # Check for the dependent libraries. # Many of the FindXYZ CMake comes with makes use of try_compile with int main(){return 0;} # as the source file. Unfortunately this causes a warning with -Wstrict-prototypes and @@ -890,13 +886,6 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) find_package(Threads REQUIRED) set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags}) - if (DEFINED _cuda_cmake_thread_prefer_pthread) - set(CMAKE_THREAD_PREFER_PTHREAD ${_cuda_cmake_thread_prefer_pthread}) - unset(_cuda_cmake_thread_prefer_pthread) - else() - unset(CMAKE_THREAD_PREFER_PTHREAD) - endif() - if(NOT APPLE) #On Linux, you must link against librt when using the static cuda runtime. find_library(CUDA_rt_LIBRARY rt) diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake index 1baf051..7ddb709 100644 --- a/Modules/FindCUDA/select_compute_arch.cmake +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -5,9 +5,9 @@ # - "Auto" detects local machine GPU compute arch at runtime. # - "Common" and "All" cover common and entire subsets of architectures # ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX -# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal +# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal Volta Turing # NUM: Any number. Only those pairs are currently accepted by NVCC though: -# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 +# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 7.0 7.2 7.5 # Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable} # Additionally, sets ${out_variable}_readable to the resulting numeric list # Example: @@ -63,12 +63,23 @@ endif () if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Volta") list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.0" "7.0+PTX") + list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.0" "7.0+PTX" "7.2" "7.2+PTX") if(CUDA_VERSION VERSION_LESS "10.0") set(CUDA_LIMIT_GPU_ARCHITECTURE "8.0") endif() endif() +if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") + list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Turing") + list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "7.5" "7.5+PTX") + list(APPEND CUDA_ALL_GPU_ARCHITECTURES "7.5" "7.5+PTX") + + if(CUDA_VERSION VERSION_LESS "11.0") + set(CUDA_LIMIT_GPU_ARCHITECTURE "9.0") + endif() +endif() + ################################################################################################ # A function for automatic detection of GPUs installed (if autodetection is enabled) # Usage: @@ -200,6 +211,9 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable) elseif(${arch_name} STREQUAL "Volta") set(arch_bin 7.0 7.0) set(arch_ptx 7.0) + elseif(${arch_name} STREQUAL "Turing") + set(arch_bin 7.5) + set(arch_ptx 7.5) else() message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS") endif() diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 302c089..111e0ff 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -200,7 +200,6 @@ if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG) # Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to # find the library in all cases. # Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled. - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads) endif() diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 691b1b7..9c96a1b 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -12,7 +12,6 @@ The following variables are set :: CMAKE_THREAD_LIBS_INIT - the thread library - CMAKE_USE_SPROC_INIT - are we using sproc? CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? CMAKE_USE_PTHREADS_INIT - are we using pthreads CMAKE_HP_PTHREADS_INIT - are we using hp pthreads @@ -23,12 +22,6 @@ The following import target is created Threads::Threads -For systems with multiple thread libraries, caller can set - -:: - - CMAKE_THREAD_PREFER_PTHREAD - If the use of the -pthread compiler and linker flag is preferred then the caller can set @@ -55,12 +48,6 @@ else() message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled") endif() -# Do we have sproc? -if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) - include (CheckIncludeFiles) - CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) -endif() - # Internal helper macro. # Do NOT even think about using it outside of this file! macro(_check_threads_lib LIBNAME FUNCNAME VARNAME) @@ -113,58 +100,53 @@ macro(_check_pthreads_flag) endif() endmacro() -if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) - # We have sproc - set(CMAKE_USE_SPROC_INIT 1) +# Do we have pthreads? +if(CMAKE_C_COMPILER_LOADED) + CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) else() - # Do we have pthreads? - if(CMAKE_C_COMPILER_LOADED) - CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H) - else() - CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) - endif() - if(CMAKE_HAVE_PTHREAD_H) - - # - # We have pthread.h - # Let's check for the library now. - # - set(CMAKE_HAVE_THREADS_LIBRARY) - if(NOT THREADS_HAVE_PTHREAD_ARG) - # Check if pthread functions are in normal C library. - # If the pthread functions already exist in C library, we could just use - # them instead of linking to the additional pthread library. We could - # try to check any pthread symbol name, but here is an exception. If we - # use clang asan build, we will find the pthread_create() symbol in the - # libc(libasan). However, it doesn't have the full pthread implementation. - # So, we can't assume that we have the pthread implementation in libc - # using the pthread_create() checking here. Then, we turn to check the - # pthread_kill() symbol instead. - CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) - if(CMAKE_HAVE_LIBC_PTHREAD_KILL) - 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 () - - _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) - _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) - if(CMAKE_SYSTEM_NAME MATCHES "SunOS") - # On sun also check for -lthread - _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) - endif() + CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H) +endif() +if(CMAKE_HAVE_PTHREAD_H) + + # + # We have pthread.h + # Let's check for the library now. + # + set(CMAKE_HAVE_THREADS_LIBRARY) + if(NOT THREADS_HAVE_PTHREAD_ARG) + # Check if pthread functions are in normal C library. + # If the pthread functions already exist in C library, we could just use + # them instead of linking to the additional pthread library. We could + # try to check any pthread symbol name, but here is an exception. If we + # use clang asan build, we will find the pthread_create() symbol in the + # libc(libasan). However, it doesn't have the full pthread implementation. + # So, we can't assume that we have the pthread implementation in libc + # using the pthread_create() checking here. Then, we turn to check the + # pthread_kill() symbol instead. + CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) + if(CMAKE_HAVE_LIBC_PTHREAD_KILL) + 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 () + + _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) + _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) + if(CMAKE_SYSTEM_NAME MATCHES "SunOS") + # On sun also check for -lthread + _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) endif() endif() - - _check_pthreads_flag() endif() + + _check_pthreads_flag() endif() if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD_KILL) diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index 684ec21..4699ecd 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -256,7 +256,6 @@ if(Q_WS_X11) # X11 libraries Qt always depends on set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) - set(CMAKE_THREAD_PREFER_PTHREAD 1) find_package(Threads) if(CMAKE_USE_PTHREADS_INIT) set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index d9a0389..a3d6d9e 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -142,6 +142,11 @@ ensure generated files will receive the required settings. set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname) + .. note:: + + If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>`` + is passed to ``SWIG`` compiler. + Target library properties can be set to apply same configuration to all SWIG input files. @@ -220,12 +225,19 @@ as well as ``SWIG``: #]=======================================================================] cmake_policy(GET CMP0078 target_name_policy) +cmake_policy(GET CMP0086 module_name_policy) + cmake_policy (VERSION 3.12) if (target_name_policy) # respect user choice regarding CMP0078 policy cmake_policy(SET CMP0078 ${target_name_policy}) endif() +if (module_name_policy) + # respect user choice regarding CMP0086 policy + cmake_policy(SET CMP0086 ${module_name_policy}) +endif() unset(target_name_policy) +unset(module_name_policy) set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") @@ -426,6 +438,19 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) list (APPEND swig_special_flags "-c++") endif() + cmake_policy(GET CMP0086 module_name_policy) + if (module_name_policy STREQUAL "NEW") + get_source_file_property(module_name "${infile}" SWIG_MODULE_NAME) + if (module_name) + list (APPEND swig_special_flags "-module" "${module_name}") + endif() + else() + if (NOT module_name_policy) + cmake_policy(GET_WARNING CMP0086 _cmp0086_warning) + message(AUTHOR_WARNING "${_cmp0086_warning}\n") + endif() + endif() + set (swig_extra_flags) if(SWIG_MODULE_${name}_LANGUAGE STREQUAL "CSHARP") if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS)) |