Skip to content

Instantly share code, notes, and snippets.

@norman784
Created January 15, 2018 12:37
Show Gist options
  • Save norman784/354a47a006a96f1d53fa1268a2ac7ffd to your computer and use it in GitHub Desktop.
Save norman784/354a47a006a96f1d53fa1268a2ac7ffd to your computer and use it in GitHub Desktop.
Bash script that override Xcode project settings to set the build path relative to the project itself
#!/bin/bash
# TODO: Research how to accomplish this when distributing the library through SPM
# TODO: Check linux OpenGL shader copy files
if [ "$(uname)" == "Darwin" ]; then
swift package generate-xcodeproj
SETTINGS="Enjin.xcodeproj/project.xcworkspace/xcuserdata/$USER.xcuserdatad/WorkspaceSettings.xcsettings"
plutil -replace BuildLocationStyle -string 'CustomLocation' $SETTINGS
plutil -replace CustomBuildLocationType -string 'RelativeToWorkspace' $SETTINGS
plutil -replace CustomBuildProductsPath -string '.build/Products' $SETTINGS
plutil -replace CustomBuildIntermediatesPath -string '.build/Intermediates' $SETTINGS
plutil -replace CustomIndexStorePath -string '.build/Index/DataStore' $SETTINGS
DBUILD_PATH=".build/Products/Debug/Resources"
rm -rf $DBUILD_PATH
mkdir -p $DBUILD_PATH
xcrun -sdk macosx metal Sources/EnjinMacOS/Resources/Shader.metal \
-o $DBUILD_PATH/Shader.air
xcrun -sdk macosx metallib $DBUILD_PATH/Shader.air -o $DBUILD_PATH/Shader.metallib
RBUILD_PATH=".build/Products/Release/Resources"
rm -rf $RBUILD_PATH
mkdir -p $RBUILD_PATH
cp -rf "$DBUILD_PATH/." $RBUILD_PATH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment