lebeg closed pull request #10561: Simplified CUDA language detection in cmake
URL: https://github.com/apache/incubator-mxnet/pull/10561
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ffa4d6549d6..b4a5f288750 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,7 @@
 cmake_minimum_required(VERSION 3.0.2)
 
+message(STATUS "CMake version '${CMAKE_VERSION}' using generator 
'${CMAKE_GENERATOR}'")
+
 project(mxnet C CXX)
 
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/private/local_config.cmake)
@@ -38,28 +40,20 @@ mxnet_option(INSTALL_EXAMPLES     "Install the example 
source files." OFF)
 mxnet_option(USE_SIGNAL_HANDLER   "Print stack traces on segfaults." OFF)
 
 if(USE_CUDA AND NOT USE_OLDCMAKECUDA)
-  message(STATUS "CMake version '${CMAKE_VERSION}' using generator 
'${CMAKE_GENERATOR}'")
-  if(
-      (
-        (${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
-        OR (${CMAKE_GENERATOR} MATCHES "Xcode.*")
-        OR (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
-      ) AND (
-        (${CMAKE_VERSION} VERSION_GREATER "3.9.0") OR (${CMAKE_VERSION} 
VERSION_EQUAL "3.9.0")
-      )
-    )
+  check_language(CUDA)
+  if(CMAKE_CUDA_COMPILER)
     set(FIRST_CUDA TRUE)
     project(mxnet C CXX CUDA)
   else()
+    message(STATUS "No first class CUDA language support in this cmake 
version")
+
     set(FIRST_CUDA FALSE)
     set(USE_OLDCMAKECUDA TRUE)
+
     project(mxnet C CXX)
   endif()
-else()
-  project(mxnet C CXX)
 endif()
 
-
 if(MSVC)
   set(SYSTEM_ARCHITECTURE x86_64)
 else()
@@ -325,7 +319,8 @@ if(USE_OPENMP)
   find_package(OpenMP REQUIRED)
   # This should build on Windows, but there's some problem and I don't have a 
Windows box, so
   # could a Windows user please fix?
-  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt AND 
SYSTEM_ARCHITECTURE STREQUAL "x86_64" AND NOT MSVC)
+  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt
+          AND SYSTEM_ARCHITECTURE STREQUAL "x86_64" AND NOT MSVC)
     # Intel/llvm OpenMP: https://github.com/llvm-mirror/openmp
     set(OPENMP_STANDALONE_BUILD TRUE)
     set(LIBOMP_ENABLE_SHARED TRUE)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to