RNBO + JUCE app build for iOS

Uasmi Nasser's icon

Hi everyone,

I'm currently trying to build a standalone app for iOS, and despite me tweaking the cmakelists file for 2 days, I can't figure out why it doesn't seem to work. As mentioned in cmake api reference on Juce github page, you can build an Xcode project using:

cmake .. -B build-ios -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0

But I don't see iOS as a target build in Xcode. Am I missing declaring something particular in cmake?

Alex Norman's icon

Hi Uasmi,

Which directory are you running your cmake command from?

The ".." in your cmake command assumes that you're in a sub-directory of our example checkout, then the -B means cmake should use the "build-ios" directory for its build scripts and artifacts.

So, if you're in the "build" directory and you've issued that command you detailed, your xcode project should be in "build-ios".

If you're in the top level checkout, remove a "." from your command, that will create "build-ios" and then your xcode project should be in "build-ios".

Could it be that you've also generated a xcode project in "build" and you're opening that instead of "build/build-ios" ?

Anyways, let me detail how I got this setup.

In a fresh checkout of the "rnbo.example.juce" project, I edit the "CMakeLists.txt" file to comment out the Plugin include (I just added a # at the start of the line):

#include(${CMAKE_CURRENT_LIST_DIR}/Plugin.cmake)

After saving that, I use Max to export my generated c++ and the rnbo library into the "export/" directory.

Then, in a terminal, I navigate to the build directory and generate the project file (the "build/" directory should be empty before I do this, also notice that I don't supply the -B option):

cd build/
cmake .. -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=15.0

Here is the output I see from that (my example project checkout is in /Users/xnor/dev/rnbo.templates/) :

-- The C compiler identification is AppleClang 15.0.0.15000100
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Configuring done (89.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/xnor/dev/rnbo.templates/rnbo.example.juce/build

Then I open the resultant Xcode project:

open RNBO_JUCE_EXAMPLE.xcodeproj

If I look at the destinations I can see that I don't have the iOS setup installed:

After I click the "Get" and install the iOS simulators, I can see more destinations, I switch from the "install" scheme to "RNBOApp" and select one of those simulators, then click the run button:

and after that, I have the app running in an iPhone simulator.

Uasmi Nasser's icon

Hi Alex,

Thanks for your answer, and getting back on e-mail! In my test runs I did exactly the steps you mentioned above, however, when I run an Xcode project, I don't see any options available marked as Get as you have for some reason:

I'm on Xcode version 16.4, and Juce 8, as if I use

git submodule update --init --recursive --progress

it doesn't build successfully:

If I add JUCE 8 to the thirdparty/juce it builds fine.

Alex Norman's icon

ahh okay, yeah.. We've seen this issue with new Xcode and our juce submodule.

I don't have Xcode 16 to verify but hopefully this developer documentation helps you: https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components

Uasmi Nasser's icon

Thanks Alex, but I'm not sure that's the case: if I build a sample project for JUCE without RNBO, I can select the simulator for iPhone as the destination for build, and it runs fine. Will try to dig it further to see what's going on. Just to make sure, can you tell me what XCode Juce and cmake version you are running in your example above?

Alex Norman's icon

Oh that is curious, I wonder if our template doesn't setup something that the latest version of xcode needs to generate that ios compatible project?

I'm using Xcode 15.1, and cmake 3.28.1. I've just tried building against JUCE 8.0.8 without issue.

Uasmi Nasser's icon

Good news, I found the issue! There's a Supported Platform menu in build settings, which you need to set to iOS:

Alex Norman's icon

Awesome to hear/see that you got it going! I figure there has to be a cmake arg to specify that