- pick libstdc++ for OS X (regardless of version)
- make gtest rely on its own tuple to not conflict with clang
  (thanks @pluskid!)
- 10.10 has Accelerate while 10.9 has vecLib for BLAS
  (thanks @leonardt and @drdan14)
This commit is contained in:
Evan Shelhamer 2015-01-15 16:28:09 -08:00
Родитель 25e3748929
Коммит ab839f5b2f
2 изменённых файлов: 21 добавлений и 14 удалений

Просмотреть файл

@ -234,12 +234,12 @@ endif
# libstdc++ instead of libc++ for CUDA compatibility on 10.9 # libstdc++ instead of libc++ for CUDA compatibility on 10.9
ifeq ($(OSX), 1) ifeq ($(OSX), 1)
CXX := /usr/bin/clang++ CXX := /usr/bin/clang++
# clang throws this warning for cuda headers
WARNINGS += -Wno-unneeded-internal-declaration
ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
CXXFLAGS += -stdlib=libstdc++ CXXFLAGS += -stdlib=libstdc++
LINKFLAGS += -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
# boost::thread is called boost_thread-mt to mark multithreading on OS X # boost::thread is called boost_thread-mt to mark multithreading on OS X
LIBRARIES += boost_thread-mt LIBRARIES += boost_thread-mt
NVCCFLAGS += -DOSX NVCCFLAGS += -DOSX
@ -304,10 +304,17 @@ else
endif endif
else ifeq ($(OSX), 1) else ifeq ($(OSX), 1)
# OS X packages atlas as the vecLib framework # OS X packages atlas as the vecLib framework
BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
LIBRARIES += cblas LIBRARIES += cblas
# 10.10 has accelerate while 10.9 has veclib
XCODE_CLT_VER := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep -o 'version: 6')
ifneq (,$(findstring version: 6,$(XCODE_CLT_VER)))
BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
LDFLAGS += -framework Accelerate
else
BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
LDFLAGS += -framework vecLib LDFLAGS += -framework vecLib
endif endif
endif
endif endif
INCLUDE_DIRS += $(BLAS_INCLUDE) INCLUDE_DIRS += $(BLAS_INCLUDE)
LIBRARY_DIRS += $(BLAS_LIB) LIBRARY_DIRS += $(BLAS_LIB)

Просмотреть файл

@ -5,7 +5,7 @@ title: Installation
# Installation # Installation
Prior to installing, it is best to read through this guide and take note of the details for your platform. Prior to installing, it is best to read through this guide and take note of the details for your platform.
We have installed Caffe on Ubuntu 14.04, Ubuntu 12.04, OS X 10.9, and OS X 10.8. We have installed Caffe on Ubuntu 14.04, Ubuntu 12.04, OS X 10.10, 10.9, and 10.8.
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Compilation](#compilation) - [Compilation](#compilation)
@ -156,9 +156,9 @@ Building boost from source is needed to link against your local Python (exceptio
**Note** that the HDF5 dependency is provided by Anaconda Python in this case. **Note** that the HDF5 dependency is provided by Anaconda Python in this case.
If you're not using Anaconda, include `hdf5` in the list above. If you're not using Anaconda, include `hdf5` in the list above.
#### 10.9-specific Instructions #### 10.10- and 10.9-specific Instructions
In OS X 10.9, clang++ is the default C++ compiler and uses `libc++` as the standard library. In OS X 10.9+, clang++ is the default C++ compiler and uses `libc++` as the standard library.
However, NVIDIA CUDA (even version 6.0) currently links only with `libstdc++`. However, NVIDIA CUDA (even version 6.0) currently links only with `libstdc++`.
This makes it necessary to change the compilation settings for each of the dependencies. This makes it necessary to change the compilation settings for each of the dependencies.