[Cmake-commits] CMake branch, next, updated. v3.6.1-1666-gc2addd1

Brad King brad.king at kitware.com
Wed Aug 31 11:53:20 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  c2addd198fc7d6b417fa25e28d2d1f127e1e3288 (commit)
       via  900ee0b80077b38b81e5da47cd79c38f044c3a03 (commit)
       via  6442709bae306903084e0bd710b4cea41d0b2500 (commit)
      from  908cfab96a7cb0edbde586e6b31d28f36623577f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2addd198fc7d6b417fa25e28d2d1f127e1e3288
commit c2addd198fc7d6b417fa25e28d2d1f127e1e3288
Merge: 908cfab 900ee0b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Aug 31 11:53:19 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 31 11:53:19 2016 -0400

    Merge topic 'FindCUDA-fixes' into next
    
    900ee0b8 FindCUDA: Allow cuda_compile* macros to be called more than once per directory
    6442709b FindCUDA: Fix for broken cuda_compile* commands.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=900ee0b80077b38b81e5da47cd79c38f044c3a03
commit 900ee0b80077b38b81e5da47cd79c38f044c3a03
Author:     Stephen Sorley <Stephen.Sorley at jhuapl.edu>
AuthorDate: Wed Aug 31 10:11:41 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Aug 31 11:53:01 2016 -0400

    FindCUDA: Allow cuda_compile* macros to be called more than once per directory
    
    Added a counter as a directory property that gets incremented every time one
    of the cuda_compile* macros is called. The value of this counter is then added
    to the phony target name passed to CUDA_WRAP_SRCS. This ensures that every call
    to one of these macros has its own unique intermediate output directory.

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 9545564..aaa1536 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1797,12 +1797,23 @@ endmacro()
 ###############################################################################
 ###############################################################################
 macro(cuda_compile_base cuda_target format generated_files)
+  # Update a counter in this directory, to keep phony target names unique.
+  set(_cuda_target "${cuda_target}")
+  get_property(_counter DIRECTORY PROPERTY _cuda_internal_phony_counter)
+  if(_counter)
+    math(EXPR _counter "${_counter} + 1")
+  else()
+    set(_counter 1)
+  endif()
+  set(_cuda_target "${_cuda_target}_${_counter}")
+  set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter})
 
   # Separate the sources from the options
   CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+
   # Create custom commands and targets for each file.
-  CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
-    OPTIONS ${_options} PHONY)
+  CUDA_WRAP_SRCS( ${_cuda_target} ${format} _generated_files ${_sources}
+                  ${_cmake_options} OPTIONS ${_options} PHONY)
 
   set( ${generated_files} ${_generated_files})
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6442709bae306903084e0bd710b4cea41d0b2500
commit 6442709bae306903084e0bd710b4cea41d0b2500
Author:     Stephen Sorley <Stephen.Sorley at jhuapl.edu>
AuthorDate: Wed Aug 31 09:56:36 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Aug 31 11:52:43 2016 -0400

    FindCUDA: Fix for broken cuda_compile* commands.
    
    The macros CUDA_COMPILE, CUDA_COMPILE_PTX, CUDA_COMPILE_FATBIN, and
    CUDA_COMPILE_CUBIN were broken by commit 7ded655 (FindCUDA: Take NVCC
    include directories from target properties, 2016-08-16).  This bug is
    due to the fact that all of these macros call CUDA_WRAP_SRCS with a
    target name that's not an actual target, causing the new generator
    expressions to fail.
    
    Fix the bug by changing these macros to pass "PHONY" to CUDA_WRAP_SRCS.
    Now, when CUDA_WRAP_SRCS sees "PHONY", it falls back to the old behavior
    of populating the include directories and compile definitions from
    directory properties, instead of using target generator expressions.

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 317a9cd..9545564 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1188,6 +1188,18 @@ endfunction()
 
 macro(CUDA_WRAP_SRCS cuda_target format generated_files)
 
+  # Put optional arguments in list.
+  set(_argn_list "${ARGN}")
+  # If one of the given optional arguments is "PHONY", make a note of it, then
+  # remove it from the list.
+  list(FIND _argn_list "PHONY" _phony_idx)
+  if("${_phony_idx}" GREATER "-1")
+    set(_target_is_phony true)
+    list(REMOVE_AT _argn_list ${_phony_idx})
+  else()
+    set(_target_is_phony false)
+  endif()
+
   # If CMake doesn't support separable compilation, complain
   if(CUDA_SEPARABLE_COMPILATION AND CMAKE_VERSION VERSION_LESS "2.8.10.1")
     message(SEND_ERROR "CUDA_SEPARABLE_COMPILATION isn't supported for CMake versions less than 2.8.10.1")
@@ -1250,13 +1262,24 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
 
   # Initialize our list of includes with the user ones followed by the CUDA system ones.
   set(CUDA_NVCC_INCLUDE_DIRS ${CUDA_NVCC_INCLUDE_DIRS_USER} "${CUDA_INCLUDE_DIRS}")
-  # Append the include directories for this target via generator expression, which is
-  # expanded by the FILE(GENERATE) call below.  This generator expression captures all
-  # include dirs set by the user, whether via directory properties or target properties
-  list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>")
+  if(_target_is_phony)
+    # If the passed in target name isn't a real target (i.e., this is from a call to one of the
+    # cuda_compile_* functions), need to query directory properties to get include directories
+    # and compile definitions.
+    get_directory_property(_dir_include_dirs INCLUDE_DIRECTORIES)
+    get_directory_property(_dir_compile_defs COMPILE_DEFINITIONS)
+
+    list(APPEND CUDA_NVCC_INCLUDE_DIRS "${_dir_include_dirs}")
+    set(CUDA_NVCC_COMPILE_DEFINITIONS "${_dir_compile_defs}")
+  else()
+    # Append the include directories for this target via generator expression, which is
+    # expanded by the FILE(GENERATE) call below.  This generator expression captures all
+    # include dirs set by the user, whether via directory properties or target properties
+    list(APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target},INCLUDE_DIRECTORIES>")
 
-  # Do the same thing with compile definitions
-  set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>")
+    # Do the same thing with compile definitions
+    set(CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target},COMPILE_DEFINITIONS>")
+  endif()
 
 
   # Reset these variables
@@ -1266,7 +1289,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
     set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper})
   endforeach()
 
-  CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN})
+  CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${_argn_list})
   CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options})
 
   # Figure out if we are building a shared library.  BUILD_SHARED_LIBS is
@@ -1356,7 +1379,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
 
   # Iterate over the macro arguments and create custom
   # commands for all the .cu files.
-  foreach(file ${ARGN})
+  foreach(file ${_argn_list})
     # Ignore any file marked as a HEADER_FILE_ONLY
     get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
     # Allow per source file overrides of the format.  Also allows compiling non-.cu files.
@@ -1779,7 +1802,7 @@ macro(cuda_compile_base cuda_target format generated_files)
   CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
   # Create custom commands and targets for each file.
   CUDA_WRAP_SRCS( ${cuda_target} ${format} _generated_files ${_sources} ${_cmake_options}
-    OPTIONS ${_options} )
+    OPTIONS ${_options} PHONY)
 
   set( ${generated_files} ${_generated_files})
 

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindCUDA.cmake |   54 +++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 44 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list