[Cmake-commits] CMake branch, next, updated. v2.8.9-199-ge8c18d5

James Bigler jamesbigler at gmail.com
Mon Aug 20 17:43:45 EDT 2012


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  e8c18d5af921a39fa6e1cacf42f4f95fc7bb11a2 (commit)
       via  db207e4065f4d1ecec9432cd4cc948f706bc973c (commit)
      from  34f9f40a21ff7c78a06ba54ec628261ae82d5894 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8c18d5af921a39fa6e1cacf42f4f95fc7bb11a2
commit e8c18d5af921a39fa6e1cacf42f4f95fc7bb11a2
Merge: 34f9f40 db207e4
Author:     James Bigler <jamesbigler at gmail.com>
AuthorDate: Mon Aug 20 17:43:41 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Aug 20 17:43:41 2012 -0400

    Merge topic 'topics/FindCUDA/Add-CUDA_HOST_COMPILER' into next
    
    db207e4 FindCUDA: Added CUDA_HOST_COMPILER variable.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db207e4065f4d1ecec9432cd4cc948f706bc973c
commit db207e4065f4d1ecec9432cd4cc948f706bc973c
Author:     James Bigler <jamesbigler at gmail.com>
AuthorDate: Mon Aug 20 15:14:37 2012 -0600
Commit:     James Bigler <jamesbigler at gmail.com>
CommitDate: Mon Aug 20 15:14:37 2012 -0600

    FindCUDA: Added CUDA_HOST_COMPILER variable.
    
    Added a new CUDA variable for specifying the CUDA_HOST_COMPILER.  This will allow users to
    be able to specify which host compiler to use for invoking NVCC with.  By default it will
    use the compiler used for host compilation.  This is convenient for when you want to
    specify a different compiler than the default compiler.  You end up using the same
    compiler for both the NVCC compilation and the host compilation instead of using the
    default compiler in the path for NVCC.

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 9f8d575..ed009c1 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -68,6 +68,13 @@
 #  CUDA_HOST_COMPILATION_CPP (Default ON)
 #  -- Set to OFF for C compilation of host code.
 #
+#  CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
+#  -- Set the host compiler to be used by nvcc.  Ignored if -ccbin or
+#     --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
+#     CUDA_NVCC_FLAGS_<CONFIG> variables.  For Visual Studio targets
+#     $(VCInstallDir)/bin is a special value that expands out to the path when
+#     the command is run from withing VS.
+#
 #  CUDA_NVCC_FLAGS
 #  CUDA_NVCC_FLAGS_<CONFIG>
 #  -- Additional NVCC command line arguments.  NOTE: multiple arguments must be
@@ -390,6 +397,12 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
 # Extra user settable flags
 set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
 
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+  set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
+else()
+  set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+endif()
+
 # Propagate the host flags to the host compiler via -Xcompiler
 option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
 
@@ -938,12 +951,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
   endif()
 
   # This needs to be passed in at this stage, because VS needs to fill out the
-  # value of VCInstallDir from within VS.
+  # value of VCInstallDir from within VS.  Note that CCBIN is only used if
+  # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches
+  # $(VCInstallDir)/bin.
   if(CMAKE_GENERATOR MATCHES "Visual Studio")
-    if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-      # Add nvcc flag for 64b Windows
-      set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
-    endif()
+    set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
   endif()
 
   # Figure out which configure we will use and pass that in as an argument to
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index b31011c..381246d 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,6 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path
 set(CUDA_make2cmake "@CUDA_make2cmake@") # path
 set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
 set(build_cubin @build_cubin@) # bool
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool
 # We won't actually use these variables for now, but we need to set this, in
 # order to force this file to be run again if it changes.
 set(generated_file_path "@generated_file_path@") # path
@@ -102,8 +103,15 @@ endif()
 # Add the build specific configuration flags
 list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
 
-if(DEFINED CCBIN)
-  set(CCBIN -ccbin "${CCBIN}")
+# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
+list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
+list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+  if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
+    set(CCBIN -ccbin "${CCBIN}")
+  else()
+    set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
+  endif()
 endif()
 
 # cuda_execute_process - Executes a command with optional command echo and status message.

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

Summary of changes:
 Modules/FindCUDA.cmake          |   22 +++++++++++++++++-----
 Modules/FindCUDA/run_nvcc.cmake |   12 ++++++++++--
 2 files changed, 27 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list