CMake iOS AUv3 unknown application extension

In the meanwhile i can start the standalone in the simulator, but i get following error when i try to load it on a device or if i try to archive:

error: unknown application extension '.appex: expected '.app' or '.ipa'

I see in XCode that the AUv3 project isn’t defined as an extension. The build settings look ok at a first sight but XCode shows the properties of an app in the General panel.

Still trying to migrate a running projucer iOS project to CMake. Is there something i’m missing?

The problem only happens when i compile against “Any iOS Device”. It works when i compile for a simulator. Any help welcome.

This seems wrong to me. In FRUT, the AUv3 target is definitely not an application, but a loadable module.

You can apply this patch to change the type of the AUv3 target:

--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -1401,7 +1401,7 @@ function(_juce_link_plugin_wrapper shared_code_target kind)

     if(CMAKE_SYSTEM_NAME STREQUAL "Android")
         add_library(${target_name} SHARED)
-    elseif((kind STREQUAL "Standalone") OR (kind STREQUAL "AUv3"))
+    elseif(kind STREQUAL "Standalone")
         add_executable(${target_name} WIN32 MACOSX_BUNDLE)
     else()
         add_library(${target_name} MODULE)

I unfortunately don’t know whether that will fix your issue, since I don’t own any iOS device.

This fixes the issue :slight_smile:

Hope those changes make it into the JUCE branch.

@reuk the patch above fixed the issue.

I remember it being difficult to get this “working” initially, and it seems I didn’t completely succeed.

If I generate an AUv3 project via the Projucer and open it in Xcode, I can see that the ‘Mach-O Type’ for the target is “Executable” rather than “Bundle”. If I create a MODULE target I can set XCODE_ATTRIBUTE_MACH_O_TYPE to emulate this behaviour, but then CMake will still (incorrectly?) add -bundle to the linkline for the target, causing the build to fail (bitcode_bundle and bundle can’t both be enabled simultaneously).

I just tried adding the target as an executable target, but setting XCODE_PRODUCT_TYPE com.apple.product-type.app-extension. This seems to generate a working project which builds for both the simulator and for devices. The “General” tab for the AUv3 no longer looks like an exe target. I’m then able to install the app on an iPhone, and I can see+use the app extension in GarageBand.

I’ll push this change, as it seems a bit cleaner than my previous approach. Open to any suggestions for alternative approaches though!

1 Like

to make Auv3 works (using juce cmake but not the add plugin part), I had to

 set_target_properties(${TARGET_EXT_NAME} PROPERTIES
    BUNDLE YES
    BUNDLE_EXTENSION appex
    XCODE_ATTRIBUTE_WRAPPER_EXTENSION appex
    XCODE_PRODUCT_TYPE com.apple.product-type.app-extension
    XCODE_ATTRIBUTE_APPLICATION_EXTENSION_API_ONLY NO
)

and copy into SA bundle

add_custom_command(TARGET {TARGET_SA_NAME} POST_BUILD COMMAND {CMAKE_COMMAND} ARGS -E copy_directory “<TARGET_FILE_DIR:{TARGET_SA_NAME}>/…/{TARGET_EXT_NAME}.appex" "<TARGET_FILE_DIR:{TARGET_SA_NAME}>/PlugIns/{TARGET_EXT_NAME}.appex” MAIN_DEPENDENCY “${TARGET_EXT_NAME}”)

That’s exactly what was reported in https://github.com/McMartin/FRUT/issues/653, but I didn’t really understand :sweat_smile:

This indeed seems to be the right combo to me.

JUCEUtils.cmake actually attempted to set XCODE_PRODUCT_TYPE, but was setting XCODE_ATTRIBUTE_PRODUCT_TYPE instead :smile:

So the right fix should be:

--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -1310,7 +1310,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
         set_target_properties(${target_name} PROPERTIES
             BUNDLE_EXTENSION appex
             XCODE_ATTRIBUTE_WRAPPER_EXTENSION appex
-            XCODE_ATTRIBUTE_PRODUCT_TYPE "com.apple.product-type.app-extension"
+            XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension"
             XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES)
     elseif(kind STREQUAL "AAX")
         set_target_properties(${target_name} PROPERTIES

(without my previous patch)

Thanks for the fixes. All works now with the latest develop branch. I was able to download the app to the device without any issues :slight_smile:

1 Like