Browse Source

Remove NVCC calls

Roman Shkarin 9 years ago
parent
commit
3c827d9470
1 changed files with 12 additions and 44 deletions
  1. 12 44
      Makefile

+ 12 - 44
Makefile

@@ -18,13 +18,11 @@ LDFLAGS     := -lOpenCL -lm
 
 # Get bits of OS
 ARCH := $(shell getconf LONG_BIT 2> /dev/null)
-
-# Detect NVCC compiler
-CUDA_NVCC_PATH := $(shell which nvcc 2> /dev/null)
-NVCC_NAME := $(notdir $(CUDA_NVCC_PATH))
+ifeq ($(ARCH),32)
+	override ARCH = ''
+endif
 
 # Detect CUDA_PATH compiler
-CUDA_PATH := $(subst /bin/$(NVCC_NAME),,$(CUDA_NVCC_PATH))
 CUDA_FFT := $(shell find $(CUDA_PATH)/ -maxdepth 2 -type f -name "libcufft.so*" 2> /dev/null)
 
 $(info $(CUDA_NVCC_PATH))
@@ -34,32 +32,13 @@ $(info $(CUDA_FFT))
 
 # If true then try to use CUDA, otherwise AMD
 ifneq ($(CUDA_FFT),)
-	ifeq ($(NVCC_NAME),nvcc)
-$(info "WE USE CUDA")
-		CC := nvcc
-		override CPPFLAGS += -DHAVE_CUDA -DHAVE_CUDA_FFT
-
-		override CFLAGS += -I$(CUDA_PATH)/include
-
-		ifeq ($(ARCH),64)
-			override LDFLAGS += -L$(CUDA_PATH)/lib64
-		else
-			override LDFLAGS += -L$(CUDA_PATH)/lib
-		endif
-
-		override LDFLAGS += -lcufft -lcudart
-
-		override LIBS_MSG += " +cuda"
-	endif
+	override CPPFLAGS += -DHAVE_CUDA -DHAVE_CUDA_FFT
+	override CFLAGS += -I$(CUDA_PATH)/include
+	override LDFLAGS += -L$(CUDA_PATH)/lib$(ARCH) -lcufft -lcudart -Wl,-rpath=$(CUDA_PATH)/lib$(ARCH) 
+	override LIBS_MSG += " +cuda"
 else
 	ifneq ($(AMDAPPSDKROOT),)
 		override CFLAGS += -I$(AMDAPPSDKROOT)/include
-
-		#ifeq ($(ARCH),64)
-		#	override LDFLAGS += -L$(AMDAPPSDKROOT)/lib/x86_64
-		#else
-		#	override LDFLAGS += -L$(AMDAPPSDKROOT)/lib/x86
-		#endif
 	else
 $(error "SDKs paths cannot be found. Try setting CUDA_PATH for CUDA SDK or AMDAPPSDKROOT for AMD SDK.")
 	endif
@@ -76,14 +55,14 @@ ifeq ($(AMD_FFT_EXISTS),1)
 else
 	override DEPS += $(DEP_CLFFT)
 	override CFLAGS += -I.deps/clFFT/src/include -DHAVE_AMD_FFT
-	override LDFLAGS += -L.deps/clFFT/src/library -lclFFT
+	override LDFLAGS += -L.deps/clFFT/src/library -lclFFT -Wl,-rpath=.deps/clFFT/src/library
 	override LIBS_MSG += " +amd"
 endif
 
 # Apple FFT library
 override CPPFLAGS += -DHAVE_APPLE_FFT
 override CFLAGS += -I.deps/
-override LDFLAGS += -L.deps/oclfft/src -loclfft
+override LDFLAGS += -L.deps/oclfft/src -loclfft -Wl,-rpath=.deps/oclfft/src
 override LIBS_MSG += " +apple"
 
 # FFTW library
@@ -96,24 +75,13 @@ ifeq ($(FFTW_EXISTS),1)
 	override LIBS_MSG += " +fftw"
 endif
 
-GENCODE_SM20     := -gencode arch=compute_20,code=sm_20
-GENCODE_SM30     := -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\"
-GENCODE_FLAGS    := $(GENCODE_SM10) $(GENCODE_SM20) $(GENCODE_SM30)
-
 ALL_CPPFLAGS     :=
 ALL_CFLAGS       :=
 ALL_LDFLAGS      :=
 
-ifeq ($(CC),nvcc)
-	override ALL_CFLAGS  += $(addprefix -Xcompiler ,$(CFLAGS))
-	override ALL_CFLAGS  += $(GENCODE_FLAGS)
-	override ALL_LDFLAGS += $(addprefix -Xlinker ,$(LDFLAGS))
-else
-	override ALL_CFLAGS  += $(CFLAGS)
-	override ALL_LDFLAGS  += $(LDFLAGS)
-endif
-
-ALL_CPPFLAGS = $(CPPFLAGS)
+override ALL_CFLAGS   += $(CFLAGS)
+override ALL_LDFLAGS  += $(LDFLAGS)
+override ALL_CPPFLAGS += $(CPPFLAGS)
 
 .PHONY: all clean distclean run