-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Drew Crawford edited this page Jul 26, 2020
·
4 revisions
- Add a dependency on blitcurve. File->Swift Packages->Add Package Dependencies...
- In your target settings, add blitcurve to your "Frameworks, Libraries, and Embedded Content".
Blitcurve is cross-compiled: there's a C version and a metal shader version, so you can use it from inside metal shaders. To add the metal shader version, you need to perform some additional steps.
-
First, you need to add a build setting. Scroll down to the "Metal Compiler - Build Options" heading and set
MTL_HEADER_SEARCH_PATHS
to be${HEADER_SEARCH_PATHS}
. -
Now you need to add some custom build settings. You can do this by opening the project settings, and then choosing Edit -> Add Build Setting -> Add User Defined Setting.
- Set
BLITCURVE_DIR
to the path to blitcurve on disk. This is typically${BUILD_ROOT}/../../SourcePackages/Checkouts/blitcurve
if your dependency is managed by Xcode. - Set
MTLLINKER_FLAGS
to-L ${BUILT_PRODUCTS_DIR} -l blitcurve-metal
.
- Set
-
Create a "run script" phase for your target.
- The phase should be before the "Compile Sources" phase in your target settings. You may need to drag it earlier in the list.
- The phase should have the following contents:
if [ -z ${BLITCURVE_DIR+x} ]; then echo "error: set BLITCURVE_DIR" exit 1 fi ( . "${BLITCURVE_DIR}/makemetal.sh" )
- The "Input file lists" should contain one entry,
${BLITCURVE_DIR}/inputfiles.txt
. This improves incremental compile speeds. - The "Output file lists" should contain one entry,
${BLITCURVE_DIR}/outputfiles.txt
This improves incremental compile speeds.