Skip to content

Commit

Permalink
Support for MacOS Universal app (Apple Silicon ARM64/Intel x86_64)
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed Apr 20, 2021
1 parent 8553384 commit 87e6c1e
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 14 deletions.
81 changes: 70 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,92 @@ else
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) $^ -o $@ $(LDFLAGS)
$(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) -c $< $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)

Reframe360Kernel.o: Reframe360Kernel.mm
python metal2string.py Reframe360Kernel.metal Reframe360Kernel.h
$(CXX) -c $< $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS)

OpenCLKernel.o: OpenCLKernel.cpp
$(CXX) $(APPLE86_64_FLAG) -c $< $(CXXFLAGS) -o $@

ofxsCore.o: $(BMDOFXDEVPATH)/Support/Library/ofxsCore.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsImageEffect.o: $(BMDOFXDEVPATH)/Support/Library/ofxsImageEffect.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsInteract.o: $(BMDOFXDEVPATH)/Support/Library/ofxsInteract.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsLog.o: $(BMDOFXDEVPATH)/Support/Library/ofxsLog.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsMultiThread.o: $(BMDOFXDEVPATH)/Support/Library/ofxsMultiThread.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsParams.o: $(BMDOFXDEVPATH)/Support/Library/ofxsParams.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsProperty.o: $(BMDOFXDEVPATH)/Support/Library/ofxsProperty.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(CXX) $(APPLE86_64_FLAG) -c "$<" $(CXXFLAGS)

ofxsPropertyValidation.o: $(BMDOFXDEVPATH)/Support/Library/ofxsPropertyValidation.cpp
$(CXX) -c "$<" $(CXXFLAGS)
$(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.cpp
$(CXX) $(APPLEARM64_FLAG) -c $< $(CXXFLAGS) -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
Expand All @@ -74,7 +120,20 @@ clean:
rm -fr Reframe360.ofx.bundle

ifeq ($(UNAME_SYSTEM), Darwin)
.DEFAULT_GOAL := darwin

.PHONY: darwin
darwin: clean install-universal

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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ New features and bug fixes:

Enjoy!

# Installation on MacOS
# Installation on MacOS (Intel and Apple Silicon)
* Build tested on MacOS 11.2.3 / XCode 12.4
* Install latest XCode from Apple App store
* Install Blackmagic DaVinci Resolve from Blackmagic website (free or studio version)
* clone glm repository https://github.com/bclarksoftware/glm.git
* clone this repository
* and build
````
cd reframe360XL
make install
````
make
````

0 comments on commit 87e6c1e

Please sign in to comment.