diff --git a/scripts/templates/osx/Project.xcconfig b/scripts/templates/osx/Project.xcconfig index dd5e30c5d5e..3097a074fb9 100644 --- a/scripts/templates/osx/Project.xcconfig +++ b/scripts/templates/osx/Project.xcconfig @@ -32,6 +32,7 @@ ICON_FILE = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/$(ICON_NAME) //APPSTORE, uncomment next lines to bundle data folder and code sign //OF_CODESIGN = 1 //OF_BUNDLE_DATA_FOLDER = 1 +//OF_BUNDLE_DYLIBS = 1 // BOOST - UNCOMMENT BELOW TO ENABLE BOOST //HEADER_BOOST = "$(OF_PATH)/libs/boost/include" diff --git a/scripts/templates/osx/emptyExample.xcodeproj/project.pbxproj b/scripts/templates/osx/emptyExample.xcodeproj/project.pbxproj index 204b6501c38..b9a889f75eb 100644 --- a/scripts/templates/osx/emptyExample.xcodeproj/project.pbxproj +++ b/scripts/templates/osx/emptyExample.xcodeproj/project.pbxproj @@ -477,6 +477,20 @@ ], "sourceTree": "" }, + "E935D72329ADADAE00AC8EFD": { + "buildActionMask": "2147483647", + "runOnlyForDeploymentPostprocessing": "0", + "outputPaths": [], + "shellPath": "/bin/zsh", + "alwaysOutOfDate": "1", + "inputFileListPaths": [], + "isa": "PBXShellScriptBuildPhase", + "shellScript": "# make sure shell above is set to /bin/zsh\n#\n# requires `brew install dylibbundler` (v1.0.5 as of 20230121)\n#\n# activate via flag in Project.xcconfig\n#\n# note: dylib subdependencies (dylibs that load dylibs) will be found\n#\t\trecursively and bundled within the .app but might need doctoring \n#\t\tto work in both bundled or freestanding states.\n#\n\nif [ -z \"$OF_BUNDLE_DYLIBS\" ] ; then\n\techo \"Not bundling dylibs\";\nelse\n\techo \"Bundling dylibs\";\n\n\t\tflags=(${(@s: :)OTHER_LDFLAGS})\n\t\tdeclare -A paths\n\t\tsargs=\"\"\n\n\t# use the keys of an associative array to accumulate unique directories enclosing .dylibs based on OTHER_LDFLAGS\n\tfor ITEM in $flags; do\n\t\tif [[ $ITEM == *'.dylib' ]] then\n\t\t\td=$(dirname \"$ITEM\")\n\t\t\tpaths[$d]=$d\n\t\tfi\n\tdone\n\t\t\n\t# construct a list of -s args for dylibbuilder to find the dylibs\n\tfor key val in \"${(@kv)paths}\"; do\n\t\tsargs+=-s\\ $key\\ \n\tdone\n\n\t# do the thing\n\t/opt/homebrew/bin/dylibbundler -cd -b -x \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME\" -d \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/libs\" ${(s[ ])sargs}\n\nfi\n", + "files": [], + "inputPaths": [], + "outputFileListPaths": [], + "name": "Run Script — Bundle dylibs" + }, "E4B69B600A3A1757003C02F2": { "baseConfigurationReference": "E4EB6923138AFD0F00A09F29", "isa": "XCBuildConfiguration", @@ -1754,7 +1768,8 @@ "E4B6FFFD0C3F9AB9008CF71C", "E4C2427710CC5ABF004149E2", "8466F1851C04CA0E00918B1C", - "19D6CF9228F07C000044A7EB" + "19D6CF9228F07C000044A7EB", + "E935D72329ADADAE00AC8EFD" ], "dependencies": [], "name": "emptyExample",