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  20d39160baf3301acdfac3f844b2c23cb1a2dd9b (commit)
       via  1c60231ca546597ef8b80e7340c8991b06387cbf (commit)
       via  8d75d8dc72a0ac4502991891782a2c84df1f61c3 (commit)
      from  47f4a0c1ed5243f2d8482a952a0a687ab9307bd0 (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=20d39160baf3301acdfac3f844b2c23cb1a2dd9b
commit 20d39160baf3301acdfac3f844b2c23cb1a2dd9b
Merge: 47f4a0c 1c60231
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Feb 14 11:06:43 2017 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Feb 14 11:06:43 2017 -0500

    Merge topic 'cuda-with-c' into next
    
    1c60231c CUDA: Link to standard system libraries when linking as CUDA
    8d75d8dc Tests: Add case for CUDA with C but not C++


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c60231ca546597ef8b80e7340c8991b06387cbf
commit 1c60231ca546597ef8b80e7340c8991b06387cbf
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Feb 14 10:34:10 2017 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Feb 14 10:34:15 2017 -0500

    CUDA: Link to standard system libraries when linking as CUDA
    
    On Windows with MSVC-like host compilers we must honor the standard
    libraries chosen by the `Platform/Windows-MSVC` module.  Otherwise C
    code linked into the CUDA binary that expects to have these libraries
    available may not link.

diff --git a/Modules/CMakeCUDAInformation.cmake 
b/Modules/CMakeCUDAInformation.cmake
index 13b1789..1c48159 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -93,6 +93,12 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
 
 endif()
 
+if(CMAKE_CUDA_STANDARD_LIBRARIES_INIT)
+  set(CMAKE_CUDA_STANDARD_LIBRARIES "${CMAKE_CUDA_STANDARD_LIBRARIES_INIT}"
+    CACHE STRING "Libraries linked by default with all CUDA applications.")
+  mark_as_advanced(CMAKE_CUDA_STANDARD_LIBRARIES)
+endif()
+
 include(CMakeCommonLanguageInclude)
 
 # now define the following rules:
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake 
b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 809ee06..eda41e0 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -40,3 +40,5 @@ string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " 
-Xcompiler=-MDd,-Zi,-RTC1")
 string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=-MD")
 string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=-MD")
 string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=-MD")
+
+set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
diff --git a/Tests/Cuda/WithC/main.c b/Tests/Cuda/WithC/main.c
index f9101a7..cb5fddc 100644
--- a/Tests/Cuda/WithC/main.c
+++ b/Tests/Cuda/WithC/main.c
@@ -1,6 +1,14 @@
 extern int use_cuda(void);
 
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
 int main()
 {
+#ifdef _WIN32
+  /* Use an API that requires CMake's "standard" C libraries.  */
+  GetOpenFileName(NULL);
+#endif
   return use_cuda();
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d75d8dc72a0ac4502991891782a2c84df1f61c3
commit 8d75d8dc72a0ac4502991891782a2c84df1f61c3
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Feb 14 10:32:44 2017 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Feb 14 10:34:06 2017 -0500

    Tests: Add case for CUDA with C but not C++
    
    An executable using CUDA and C should link as CUDA.

diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 42b00e1..de48501 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -4,3 +4,4 @@ ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures 
CudaConsumeCompileFeatures)
 ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
 ADD_TEST_MACRO(Cuda.ToolkitInclude CudaToolkitInclude)
 ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
+ADD_TEST_MACRO(Cuda.WithC CudaWithC)
diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt
new file mode 100644
index 0000000..7596804
--- /dev/null
+++ b/Tests/Cuda/WithC/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.7)
+project(CudaComplex CUDA C)
+
+set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+
+add_executable(CudaWithC main.c cuda.cu)
+
+if(APPLE)
+  # We need to add the default path to the driver (libcuda.dylib) as an rpath, 
so that
+  # the static cuda runtime can find it at runtime.
+  target_link_libraries(CudaWithC PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
+endif()
diff --git a/Tests/Cuda/WithC/cuda.cu b/Tests/Cuda/WithC/cuda.cu
new file mode 100644
index 0000000..06bd7b9
--- /dev/null
+++ b/Tests/Cuda/WithC/cuda.cu
@@ -0,0 +1,16 @@
+#include <cuda.h>
+
+#include <iostream>
+
+extern "C" int use_cuda(void)
+{
+  int nDevices = 0;
+  cudaError_t err = cudaGetDeviceCount(&nDevices);
+  if (err != cudaSuccess) {
+    std::cerr << "Failed to retrieve the number of CUDA enabled devices"
+              << std::endl;
+    return 1;
+  }
+  std::cout << "Found " << nDevices << " CUDA enabled devices" << std::endl;
+  return 0;
+}
diff --git a/Tests/Cuda/WithC/main.c b/Tests/Cuda/WithC/main.c
new file mode 100644
index 0000000..f9101a7
--- /dev/null
+++ b/Tests/Cuda/WithC/main.c
@@ -0,0 +1,6 @@
+extern int use_cuda(void);
+
+int main()
+{
+  return use_cuda();
+}

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

Summary of changes:
 Modules/CMakeCUDAInformation.cmake         |    6 ++++++
 Modules/Platform/Windows-NVIDIA-CUDA.cmake |    2 ++
 Tests/Cuda/CMakeLists.txt                  |    1 +
 Tests/Cuda/WithC/CMakeLists.txt            |   12 ++++++++++++
 Tests/Cuda/WithC/cuda.cu                   |   16 ++++++++++++++++
 Tests/Cuda/WithC/main.c                    |   14 ++++++++++++++
 6 files changed, 51 insertions(+)
 create mode 100644 Tests/Cuda/WithC/CMakeLists.txt
 create mode 100644 Tests/Cuda/WithC/cuda.cu
 create mode 100644 Tests/Cuda/WithC/main.c


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to