How to generate a release build of a static library for iOS?

Hello,

I’m new to the JUCE framework, and I created my first project, which is a demo static library, that I plan to use in a native iOS app.

So I created a new JUCE project, open it in Xcode, and then I went to Product > Build (in Xcode) to get my static .a library.

But even though I have the Debug and Release targets in Projucer for my project, I only get a iOS/build/Debug/libTest.a file generated (so only for debug, but nothing for release)…

So how can I generate a release build for my static library for iOS?

Thanks.

You can choose between Debug and Release in Xcode’s scheme settings:

1 Like

Thanks for your answer!

That being said, if I do lipo -info libTest.a on the release file, I got the following:

Non-fat file: libTest.a is architecture: arm64

Is it normal that it’s a non-fat file, and that it targets only arm64 architecture?
Also, I don’t have any header file, is it normal?

I think so, yes. Every iOS device since the iPhone 5S has used the arm64 architecture.

Yes, you’ll need to set up the build system of the project that includes the JUCE static library to include all the relevant headers.

Thanks!

Yes, you’ll need to set up the build system of the project that includes the JUCE static library to include all the relevant headers.

Sorry for the beginner question again (I’m quite new to iOS developpment too), but how can I achieve that?

Your build system will have a way of setting the ‘header search paths’ or ‘include paths’. You’ll need to add the JUCE modules folder to the set of include paths. There should also be a “JuceHeader.h” located in the JuceLibraryCode folder of your project. You’ll need to add the JuceLibraryCode directory path to the set of include paths too.

For a staticlib target, I’d also recommend enabling the “Use Global AppConfig” setting in the Projucer, as this will make it easier to ensure that the same preprocessor definitions are used inside the library, and by code including the library.

OK, I’ll try that, thanks!

Sorry but I’m still stuck.

In my iOS project, here is what I did:

  • import my libTest.a library in the root of the project
  • import the JuceLibraryCode directory, also in the root of the project
  • import the JUCE modules directory, also in the root of the project

But it still not working: when I open the JuceHeader.h file in my project, it doesn’t find the #include files (for example: #include <juce_audio_basics/juce_audio_basics.h>)

Also, I found the Header Search Paths item in my project (in Build Settings), but I don’t really know what to put in there…

I really think that a detailed tutorial on how to create a Hello World library and how to import it in an iOS (and also Android) project would be very helpful (well, at least for me :wink: )

Thanks for your help.

This should probably be a relative path from your ‘outer’ project to the location of the header files.