Commit 8d0d1d13 authored by Christopher Bruns's avatar Christopher Bruns
Browse files

Downgraded recent cmake changes to ghastly compliance with cmake 2.4, for the...

Downgraded recent cmake changes to ghastly compliance with cmake 2.4, for the benefit of the simtk dart server.
parent 61092422
...@@ -328,14 +328,18 @@ IF(CUDA_FOUND) ...@@ -328,14 +328,18 @@ IF(CUDA_FOUND)
# Unfortunately the variables CUDA_NVCC_FLAGS_RELEASE and CUDA_NVCC_FLAGS_DEBUG # Unfortunately the variables CUDA_NVCC_FLAGS_RELEASE and CUDA_NVCC_FLAGS_DEBUG
# appear to be unused, at least in CMake 2.6 # appear to be unused, at least in CMake 2.6
# Release /MD linkage # Release /MD linkage
IF(NOT (CUDA_NVCC_FLAGS MATCHES "-Xcompiler")) SET(HAS_NVCC_FLAG FALSE)
IF(CUDA_NVCC_FLAGS MATCHES "-Xcompiler")
SET(HAS_NVCC_FLAG TRUE)
ENDIF(CUDA_NVCC_FLAGS MATCHES "-Xcompiler")
IF(NOT HAS_NVCC_FLAG)
set(new_flags "-Xcompiler \"/MD\"") set(new_flags "-Xcompiler \"/MD\"")
if(CUDA_NVCC_FLAGS) if(CUDA_NVCC_FLAGS)
set(new_flags "${CUDA_NVCC_FLAGS};${new_flags}") set(new_flags "${CUDA_NVCC_FLAGS};${new_flags}")
endif(CUDA_NVCC_FLAGS) endif(CUDA_NVCC_FLAGS)
SET(CUDA_NVCC_FLAGS "${new_flags}" SET(CUDA_NVCC_FLAGS "${new_flags}"
CACHE STRING "Semicolon delimit multiple arguments" FORCE) CACHE STRING "Semicolon delimit multiple arguments" FORCE)
ENDIF(NOT (CUDA_NVCC_FLAGS MATCHES "-Xcompiler")) ENDIF(NOT HAS_NVCC_FLAG)
ENDIF(MSVC) ENDIF(MSVC)
ELSE(CUDA_FOUND) ELSE(CUDA_FOUND)
SET(OPENMM_BUILD_CUDA_LIB OFF CACHE BOOL "Build OpenMMCuda library for Nvidia GPUs") SET(OPENMM_BUILD_CUDA_LIB OFF CACHE BOOL "Build OpenMMCuda library for Nvidia GPUs")
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Only run tests if this machine has a cuda-capable GPU # Only run tests if this machine has a cuda-capable GPU
# So run a little test program at configuration time to sniff for GPUs # So run a little test program at configuration time to sniff for GPUs
find_package(CUDA) # find_package(CUDA) # find_package has already run and causes trouble w/ cmake 2.4
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/tests/has_cuda_gpu.c ${CMAKE_CURRENT_SOURCE_DIR}/tests/has_cuda_gpu.c
...@@ -29,11 +29,18 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR ...@@ -29,11 +29,18 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
# message("${RUN_OUTPUT_VAR}") # Display number of GPUs found # message("${RUN_OUTPUT_VAR}") # Display number of GPUs found
# COMPILE_RESULT_VAR is TRUE when compile succeeds # COMPILE_RESULT_VAR is TRUE when compile succeeds
# RUN_RESULT_VAR is zero when a GPU is found # RUN_RESULT_VAR is zero when a GPU is found
if(COMPILE_RESULT_VAR AND NOT RUN_RESULT_VAR) set(CUDA_HAVE_GPU_MAYBE TRUE)
if(NOT COMPILE_RESULT_VAR)
set(CUDA_HAVE_GPU_MAYBE FALSE)
endif(NOT COMPILE_RESULT_VAR)
if(RUN_RESULT_VAR)
set(CUDA_HAVE_GPU_MAYBE FALSE)
endif(RUN_RESULT_VAR)
if(CUDA_HAVE_GPU_MAYBE)
set(CUDA_HAVE_GPU TRUE CACHE BOOL "Whether CUDA-capable GPU is present") set(CUDA_HAVE_GPU TRUE CACHE BOOL "Whether CUDA-capable GPU is present")
else() else(CUDA_HAVE_GPU_MAYBE)
set(CUDA_HAVE_GPU FALSE CACHE BOOL "Whether CUDA-capable GPU is present") set(CUDA_HAVE_GPU FALSE CACHE BOOL "Whether CUDA-capable GPU is present")
endif() endif(CUDA_HAVE_GPU_MAYBE)
if(CUDA_HAVE_GPU) if(CUDA_HAVE_GPU)
SUBDIRS (tests) SUBDIRS (tests)
endif(CUDA_HAVE_GPU) endif(CUDA_HAVE_GPU)
......
...@@ -38,9 +38,16 @@ ENDIF(LOG) ...@@ -38,9 +38,16 @@ ENDIF(LOG)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Only run tests when cuda-enabled GPU is found # Only run tests when cuda-enabled GPU is found
IF( (NOT DEFINED CUDA_HAVE_GPU) OR (CUDA_HAVE_GPU) ) SET(DO_TESTS FALSE)
IF(NOT DEFINED CUDA_HAVE_GPU)
SET(DO_TESTS TRUE)
ENDIF(NOT DEFINED CUDA_HAVE_GPU)
IF(CUDA_HAVE_GPU)
SET(DO_TESTS TRUE)
ENDIF(CUDA_HAVE_GPU)
IF(DO_TESTS)
SUBDIRS (tests) SUBDIRS (tests)
ENDIF( (NOT DEFINED CUDA_HAVE_GPU) OR (CUDA_HAVE_GPU) ) ENDIF(DO_TESTS)
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
# this CMakeLists file rather than letting CMake visit them as SUBDIRS. # this CMakeLists file rather than letting CMake visit them as SUBDIRS.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment