Credit Rob / Credit Andrew - new render format / bsd need
[goodguy/cinelerra.git] / cinelerra-5.1 / plugin_cuda
1 #cuda compile
2
3 CUDA_PATH ?= /usr/local/cuda
4 TARGET_SIZE := 64 # 32
5 HOST_COMPILER ?= g++
6 NVCC := $(CUDA_PATH)/bin/nvcc -ccbin $(HOST_COMPILER)
7 NVCCFLAGS := -m${TARGET_SIZE} -Xcompiler -fPIC -Xcompiler -fno-omit-frame-pointer -g
8 LDFLAGS = -lcuda -L $(CUDA_PATH)/targets/x86_64-linux/lib -lcudart
9
10 SMS ?= 35 37 50 52 60 61 70 75
11 $(foreach sm,$(SMS),$(eval GENCODE_FLAGS += -gencode arch=compute_$(sm),code=sm_$(sm)))
12 HIGHEST_SM := $(lastword $(sort $(SMS)))
13 GENCODE_FLAGS += -gencode arch=compute_$(HIGHEST_SM),code=compute_$(HIGHEST_SM)
14
15 # samples source access BEWARE!
16 # contains includes which conflict: search /usr/include first
17 CFLAGS += -I/usr/include -I$(CUDA_PATH)/samples
18 CFLAGS += -I$(CUDA_PATH)/samples/common/inc
19 CFLAGS += -I$(CUDA_PATH)/targets/x86_64-linux/include
20 CFLAGS += -Wno-unused-function
21
22 INCLUDES += -I$(TOPDIR)/cinelerra -I$(TOPDIR)/guicast
23 INCLUDES += -I$(CUDA_PATH)/samples
24 INCLUDES += -I$(CUDA_PATH)/samples/common/inc
25 INCLUDES += -I$(CUDA_PATH)/targets/x86_64-linux/include
26
27 CUFLAGS := $(INCLUDES) $(NVCCFLAGS) $(GENCODE_FLAGS)
28 $(shell mkdir -p $(OBJDIR))
29 $(shell echo $(CUFLAGS) > $(OBJDIR)/cu_flags)
30
31 $(OBJDIR)/%.o: %.cu
32         $(NVCC) `cat $(OBJDIR)/cu_flags` $(BFLAGS) -DMSGQUAL=$* -c $< -o $@