forked from LRP-sgravel/reframe360XL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
178 lines (137 loc) · 6.85 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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/OpenFX
OPENCLPATH = /usr
CXXFLAGS += -I${OPENCLPATH}/include -fPIC -Dlinux -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 = Reframe360CudaKernel.o
OPENCL_OBJ = Reframe360CLKernel.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 = Reframe360CLKernel.o
METAL_ARM_OBJ = Reframe360Kernel-arm.o
OPENCL_ARM_OBJ = Reframe360CLKernel-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) KernelDebugHelper.o 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)
Reframe360CudaKernel.o: Reframe360CudaKernel.cu
${NVCC} -c $< $(NVCCFLAGS)
Reframe360.o: Reframe360.cpp
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)
Reframe360Kernel.o: Reframe360Kernel.mm
python3 metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)
Reframe360CLKernel.o: Reframe360CLKernel.h Reframe360CLKernel.cpp
$(CXX) $(APPLE86_64_FLAG) -c Reframe360CLKernel.cpp $(CXXFLAGS) -o Reframe360CLKernel.o
KernelDebugHelper.o: KernelDebugHelper.cpp
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS) -o $@
Reframe360CLKernel.h: Reframe360CLKernel.cl
python3 ./HardcodeKernel.py Reframe360CLKernel Reframe360CLKernel.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) KernelDebugHelper-arm.o 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
python3 metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
$(CXX) $(APPLEARM64_FLAG) -c $< $(CXXFLAGS) -o $@
KernelDebugHelper-arm.o: KernelDebugHelper.cpp
$(CXX) $(APPLEARM64_FLAG) -c "$<" $(CXXFLAGS) -o $@
Reframe360CLKernel-arm.o: Reframe360CLKernel.h Reframe360CLKernel.cpp
$(CXX) $(APPLEARM64_FLAG) -c Reframe360CLKernel.cpp $(CXXFLAGS) -o Reframe360CLKernel-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
python3 metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
%.metallib: %.metal
xcrun -sdk macosx metal -c $< -o $@
mkdir -p $(BUNDLE_DIR)
cp $@ $(BUNDLE_DIR)
clean:
rm -f *.o *.ofx *.metallib Reframe360Kernel.h Reframe360CLKernel.h
dist-clean: clean
rm -fr Reframe360.ofx.bundle Reframe360-universal.ofx Reframe360.ofx Reframe360-arm.ofx
zip: bundle
zip -r Reframe360.ofx.bundle.zip Reframe360.ofx.bundle
ifdef DEV_IDENTITY
codesign --force --options runtime -s "$(DEV_IDENTITY)" --deep --strict Reframe360.ofx.bundle.zip -vvv
endif
ifeq ($(UNAME_SYSTEM), Darwin)
.DEFAULT_GOAL := darwin
.PHONY: darwin
darwin: clean zip install
bundle: Reframe360.ofx Reframe360-arm.ofx
ifdef DEV_IDENTITY
codesign --force --options runtime -s "$(DEV_IDENTITY)" --deep --strict Reframe360.ofx -vvv
codesign --force --options runtime -s "$(DEV_IDENTITY)" --deep --strict Reframe360-arm.ofx -vvv
endif
mkdir -p $(BUNDLE_DIR)
lipo -create -output Reframe360-universal.ofx Reframe360.ofx Reframe360-arm.ofx
mkdir -p $(BUNDLE_DIR)
cp Reframe360-universal.ofx $(BUNDLE_DIR)/Reframe360.ofx
ifdef DEV_IDENTITY
codesign -f -s "$(DEV_IDENTITY)" Reframe360.ofx.bundle/Contents/MacOS/Reframe360.ofx
endif
root-install:
cp Reframe360-universal.ofx $(BUNDLE_DIR)/Reframe360.ofx
sudo rm -rf /Library/OFX/Plugins/Reframe360.ofx.bundle
sudo mkdir -p /Library/OFX/Plugins/
sudo cp -a Reframe360.ofx.bundle /Library/OFX/Plugins/
sudo xattr -r -d com.apple.quarantine /Library/OFX/Plugins/Reframe360.ofx.bundle
install: bundle Reframe360.ofx Reframe360-arm.ofx
cp Reframe360-universal.ofx $(BUNDLE_DIR)/Reframe360.ofx
rm -rf /Library/OFX/Plugins/Reframe360.ofx.bundle
cp -a Reframe360.ofx.bundle /Library/OFX/Plugins/
else
bundle: Reframe360.ofx
mkdir -p $(BUNDLE_DIR)
cp Reframe360.ofx $(BUNDLE_DIR)/Reframe360.ofx
install: bundle Reframe360.ofx
rm -rf /usr/OFX/Plugins/Reframe360.ofx.bundle
mkdir -p /usr/OFX/Plugins/
cp -a Reframe360.ofx.bundle /usr/OFX/Plugins/
endif