forked from stefsietz/reframe360resolve
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
145 lines (109 loc) · 5.46 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
UNAME_SYSTEM := $(shell uname -s)
GLMPATH = ../glm
CUDAPATH ?= /usr/local/cuda
NVCC = ${CUDAPATH}/bin/nvcc
CXXFLAGS += -std=c++11 -fvisibility=hidden -I$(OFXPATH)/include -I$(BMDOFXDEVPATH)/Support/include -I$(BMDOFXDEVPATH)/OpenFX-1.4/include -I$(GLMPATH)
ifeq ($(UNAME_SYSTEM), Linux)
BMDOFXDEVPATH = /opt/resolve/Developer
OPENCLPATH = /opt/AMDAPP
CXXFLAGS += -I${OPENCLPATH}/include -fPIC -D__OPENCL__
NVCCFLAGS = --compiler-options="-fPIC"
LDFLAGS = -shared -fvisibility=hidden -L${CUDAPATH}/lib64 -lcuda -lcudart
BUNDLE_DIR = Reframe360.ofx.bundle/Contents/Linux-x86-64/
CUDA_OBJ = CudaKernel.o
OPENCL_OBJ = OpenCLKernel.o
else
BMDOFXDEVPATH = /Library/Application\ Support/Blackmagic\ Design/DaVinci\ Resolve/Developer/OpenFX
LDFLAGS = -bundle -fvisibility=hidden -F/Library/Frameworks -framework OpenCL -framework Metal -framework AppKit
BUNDLE_DIR = Reframe360.ofx.bundle/Contents/MacOS/
METAL_OBJ = Reframe360Kernel.o
OPENCL_OBJ = OpenCLKernel.o
METAL_ARM_OBJ = Reframe360Kernel-arm.o
OPENCL_ARM_OBJ = OpenCLKernel-arm.o
APPLE86_64_FLAG = -target x86_64-apple-macos10.12
APPLEARM64_FLAG = -target arm64-apple-macos11
endif
Reframe360.ofx: Reframe360.o $(OPENCL_OBJ) $(CUDA_OBJ) $(METAL_OBJ) ofxsCore.o ofxsImageEffect.o ofxsInteract.o ofxsLog.o ofxsMultiThread.o ofxsParams.o ofxsProperty.o ofxsPropertyValidation.o
$(CXX) $(APPLE86_64_FLAG) $^ -o $@ $(LDFLAGS)
mkdir -p $(BUNDLE_DIR)
cp Reframe360.ofx $(BUNDLE_DIR)
CudaKernel.o: CudaKernel.cu
${NVCC} -c $< $(NVCCFLAGS)
Reframe360.o: Reframe360.cpp
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)
Reframe360Kernel.o: Reframe360Kernel.mm
python metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)
OpenCLKernel.o: OpenCLKernel.h OpenCLKernel.cpp
$(CXX) $(APPLE86_64_FLAG) -c OpenCLKernel.cpp $(CXXFLAGS) -o OpenCLKernel.o
OpenCLKernel.h: Reframe360Kernel.cl
python ./HardcodeKernel.py OpenCLKernel Reframe360Kernel.cl
ofxsCore.o: $(BMDOFXDEVPATH)/Support/Library/ofxsCore.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsImageEffect.o: $(BMDOFXDEVPATH)/Support/Library/ofxsImageEffect.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsInteract.o: $(BMDOFXDEVPATH)/Support/Library/ofxsInteract.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsLog.o: $(BMDOFXDEVPATH)/Support/Library/ofxsLog.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsMultiThread.o: $(BMDOFXDEVPATH)/Support/Library/ofxsMultiThread.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsParams.o: $(BMDOFXDEVPATH)/Support/Library/ofxsParams.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsProperty.o: $(BMDOFXDEVPATH)/Support/Library/ofxsProperty.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
ofxsPropertyValidation.o: $(BMDOFXDEVPATH)/Support/Library/ofxsPropertyValidation.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)
Reframe360-arm.ofx: Reframe360-arm.o $(OPENCL_ARM_OBJ) $(METAL_ARM_OBJ) ofxsCore-arm.o ofxsImageEffect-arm.o ofxsInteract-arm.o ofxsLog-arm.o ofxsMultiThread-arm.o ofxsParams-arm.o ofxsProperty-arm.o ofxsPropertyValidation-arm.o
$(CXX) $(APPLEARM64_FLAG) $^ -o $@ $(LDFLAGS)
mkdir -p $(BUNDLE_DIR)
cp Reframe360.ofx $(BUNDLE_DIR)
Reframe360-arm.o: Reframe360.cpp
$(CXX) $(APPLEARM64_FLAG) -c $< $(CXXFLAGS) -o $@
Reframe360Kernel-arm.o: Reframe360Kernel.mm
python metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
$(CXX) $(APPLEARM64_FLAG) -c $< $(CXXFLAGS) -o $@
OpenCLKernel-arm.o: OpenCLKernel.h OpenCLKernel.cpp
$(CXX) $(APPLEARM64_FLAG) -c OpenCLKernel.cpp $(CXXFLAGS) -o OpenCLKernel-arm.o
ofxsCore-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsCore.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsImageEffect-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsImageEffect.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsInteract-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsInteract.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsLog-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsLog.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsMultiThread-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsMultiThread.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsParams-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsParams.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsProperty-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsProperty.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
ofxsPropertyValidation-arm.o: $(BMDOFXDEVPATH)/Support/Library/ofxsPropertyValidation.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
Reframe360Kernel.h: Reframe360Kernel.metal
python metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
%.metallib: %.metal
xcrun -sdk macosx metal -c $< -o $@
mkdir -p $(BUNDLE_DIR)
cp $@ $(BUNDLE_DIR)
macos-bin: install-universal
zip -r Reframe360XL_Mac.zip Reframe360.ofx.bundle
clean:
rm -f *.o *.ofx *.zip *.metallib Reframe360Kernel.h OpenCLKernel.h
rm -fdr Reframe360.ofx.bundle
ifeq ($(UNAME_SYSTEM), Darwin)
.DEFAULT_GOAL := darwin
.PHONY: darwin
darwin: clean install-universal macos-bin
install: Reframe360.ofx
rm -rf /Library/OFX/Plugins/Reframe360.ofx.bundle
cp -a Reframe360.ofx.bundle /Library/OFX/Plugins/
install-universal: Reframe360.ofx Reframe360-arm.ofx
lipo -create -output Reframe360-universal.ofx Reframe360.ofx Reframe360-arm.ofx
rm -rf $(BUNDLE_DIR)
mkdir -p $(BUNDLE_DIR)
cp Reframe360-universal.ofx $(BUNDLE_DIR)/Reframe360.ofx
rm -rf /Library/OFX/Plugins/Reframe360.ofx.bundle
cp -a Reframe360.ofx.bundle /Library/OFX/Plugins/
endif