- 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,15 +234,15 @@ endif
# libstdc++ instead of libc++ for CUDA compatibility on 10.9
ifeq ($(OSX), 1)
CXX := /usr/bin/clang++
CXXFLAGS += -stdlib=libstdc++
LINKFLAGS += -stdlib=libstdc++
# clang throws this warning for cuda headers
WARNINGS += -Wno-unneeded-internal-declaration
ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
CXXFLAGS += -stdlib=libstdc++
LINKFLAGS += -stdlib=libstdc++
endif
# 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
LIBRARIES += boost_thread-mt
NVCCFLAGS += -DOSX
NVCCFLAGS += -DOSX
endif
# Custom compiler
@ -304,9 +304,16 @@ else
endif
else ifeq ($(OSX), 1)
# OS X packages atlas as the vecLib framework
BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
LIBRARIES += cblas
LDFLAGS += -framework vecLib
# 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
endif
endif
endif
INCLUDE_DIRS += $(BLAS_INCLUDE)

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

@ -5,7 +5,7 @@ title: Installation
# Installation
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)
- [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.
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++`.
This makes it necessary to change the compilation settings for each of the dependencies.
@ -226,10 +226,10 @@ Then, whenever you want to update homebrew, switch back to the master branches,
git checkout master
cd /usr/local/Library/Taps/homebrew/homebrew-science
git checkout master
# Update homebrew; hopefully this works without errors!
brew update
# Switch back to the caffe branches with the forumlae that you modified earlier
cd /usr/local
git rebase master caffe
@ -237,8 +237,8 @@ Then, whenever you want to update homebrew, switch back to the master branches,
cd /usr/local/Library/Taps/homebrew/homebrew-science
git rebase master caffe
# Fix any merge conflicts and commit to caffe branch
# Done!
# Done!
At this point, you should be running the latest Homebrew packages and your Caffe-related modifications will remain in place.