set CUDA library search path for Mac OS X

darknet failed to build on Mac OS X, because the Makefile passed an incorrect
library search path for locating CUDA libraries.
On Mac OS X, CUDA library installation path is /usr/local/cuda/lib by default.
This patch fixed the issue.
This commit is contained in:
Yang Chen 2018-02-12 13:37:52 -08:00
parent 80d9bec20f
commit 74826c56a2

View File

@ -19,6 +19,7 @@ ALIB=libdarknet.a
EXEC=darknet EXEC=darknet
OBJDIR=./obj/ OBJDIR=./obj/
OS=$(shell uname -s)
CC=gcc CC=gcc
NVCC=nvcc NVCC=nvcc
AR=ar AR=ar
@ -48,7 +49,12 @@ endif
ifeq ($(GPU), 1) ifeq ($(GPU), 1)
COMMON+= -DGPU -I/usr/local/cuda/include/ COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU CFLAGS+= -DGPU
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand ifeq ($(OS), Darwin)
LDFLAGS+= -L/usr/local/cuda/lib
else
LDFLAGS+= -L/usr/local/cuda/lib64
endif
LDFLAGS+=-lcuda -lcudart -lcublas -lcurand
endif endif
ifeq ($(CUDNN), 1) ifeq ($(CUDNN), 1)