build with libc++ on Yosmite with CUDA 7
authorEvan Shelhamer <shelhamer@imaginarynumber.net>
Fri, 6 Feb 2015 08:51:25 +0000 (00:51 -0800)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Fri, 6 Feb 2015 09:08:39 +0000 (01:08 -0800)
Makefile

index 53c16ea..81c67ef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -231,15 +231,18 @@ endif
 
 # OS X:
 # clang++ instead of g++
-# libstdc++ instead of libc++ for CUDA compatibility on 10.9
+# libstdc++ for NVCC compatibility on OS X >= 10.9 with CUDA < 7.0
 ifeq ($(OSX), 1)
        CXX := /usr/bin/clang++
-       CXXFLAGS += -stdlib=libstdc++
-       LINKFLAGS += -stdlib=libstdc++
+       CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release \d' | grep -o '\d')
+       ifeq ($(shell echo $(CUDA_VERSION) \< 7.0 | bc), 1)
+               CXXFLAGS += -stdlib=libstdc++
+               LINKFLAGS += -stdlib=libstdc++
+       endif
        # clang throws this warning for cuda headers
        WARNINGS += -Wno-unneeded-internal-declaration
        # gtest needs to use its own tuple to not conflict with clang
-       CXXFLAGS += -DGTEST_USE_OWN_TR1_TUPLE=1
+       COMMON_FLAGS += -DGTEST_USE_OWN_TR1_TUPLE=1
        # boost::thread is called boost_thread-mt to mark multithreading on OS X
        LIBRARIES += boost_thread-mt
 endif