1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

CMake: Automatically set archiving-related properties when generating for Xcode

This commit is contained in:
reuk 2021-02-22 17:25:31 +00:00
parent d6376e710f
commit f68ee25b52
2 changed files with 32 additions and 33 deletions

View file

@ -122,41 +122,15 @@ provisioning profiles, which is achieved by passing the `-allowProvisioningUpdat
#### Archiving for iOS
CMake's out-of-the-box archiving behaviour doesn't always work as expected, especially for targets
that depend on static libraries (such as targets added with `juce_add_binary_data`). Xcode may
generate these libraries into a 'DerivedData' directory, but then omit this directory from the
library search paths later in the build.
that depend on custom static libraries. Xcode may generate these libraries into a 'DerivedData'
directory, but then omit this directory from the library search paths later in the build.
If the "Product -> Archive" action isn't working, the following steps may help correct the issue:
If the "Product -> Archive" action isn't working due to missing staticlibs, try setting the
`ARCHIVE_OUTPUT_DIRECTORY` property explicitly:
- On your static library, explicitly set the `ARCHIVE_OUTPUT_DIRECTORY` property.
```
set_target_properties(my_static_lib_target PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "./")
```
- Now, the Archive build should complete without linker errors, but the archived product may still
be hidden in the Organizer window. To fix this issue, set the following properties on the target
representing the actual iOS app. If your target was added with `juce_add_gui_app`, pass the same
target name. Otherwise, if your target was added with `juce_add_plugin` you may need to append
`_Standalone` to the target name, to specify the standalone plugin target.
```
set_target_properties(my_ios_app_target PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)"
XCODE_ATTRIBUTE_SKIP_INSTALL "NO")
```
set_target_properties(my_static_lib_target PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "./")
To archive an AUv3 plugin, `XCODE_ATTRIBUTE_INSTALL_PATH` must point to the PlugIns directory of the
final app bundle but only for the AUv3 target. In code, that might look like this:
set_target_properties(my_plugin_Standalone PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)"
XCODE_ATTRIBUTE_SKIP_INSTALL "NO")
get_target_property(output_name my_plugin_Standalone OUTPUT_NAME)
# On iOS, the AUv3 should go in <bundle_dir>/PlugIns
# On macOS, the AUv3 should go in <bundle_dir>/Contents/PlugIns
set_target_properties(my_plugin_AUv3 PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH "$(LOCAL_APPS_DIR)/${output_name}.app/PlugIns"
XCODE_ATTRIBUTE_SKIP_INSTALL "NO")
Note that the static library produced by `juce_add_binary_data` automatically sets this property.
### Building universal binaries for macOS