Build JUCE app in MAC using command line

Hi Everyone,

I have built my JUCE app on MAC several times using the command line. The command I use is

sudo xcodebuild -project Builds/MacOSX/MyApp.xcodeproj -alltargets -parallelizeTargets -configuration Release build CODE_SIGN_IDENTITY='My Developer ID Application' OTHER_CODE_SIGN_FLAGS="--timestamp"

I had to add sudo recently because I also use AAX and for some reason it could not create a folder (installation folder for AAX) in /Library/ Application Supports/Avid/Audio/Plug-Ins

My first question is that if I can only use this command if I have MyApp.xcodeproj file and I can only have that file when I open Xcode from the ProJucer. Is it the right approach? Or there is another better way to do it? I am not fully sure that opening the Xcode with Projucer to create the Builds/MacOSX and the xcodeproj file and after that running the command is the best way.
In this way, I committed the whole Builds folder so I could use Github Actions for automatic builds too.
Am I doing it correctly?
I would really appreciate it if you could also share your experience with me.

Hi,

No, you don’t have to open Xcode (from Projucer or elsewhere) to “have that file”. Projucer writes MyApp.xcodeproj, and all the other files under Builds/MacOSX, when saving the project (see File > Save Project menu in Projucer).

You also don’t have to open Projucer’s UI. Projucer has a command line interface that allows you to save your project (which means writing the files under Builds and JuceLibraryCode).

If you want to do automatic builds, you can either commit the Builds folder (like JUCE does for its examples and extras) or you can re-generate the build files from the .jucer file (this requires downloading or building Projucer first though).

Alternatively, you can use CMake to eliminate the need for Projucer, either using the CMake support that is part of JUCE 6, or by using an external project like FRUT (disclaimer: I’m the author).

I hope this helps!

2 Likes

I have a script here you can copy and modify for your needs: PAPU/build.sh at master · FigBug/PAPU · GitHub

It builds, signs and notarizes on github actions. Also does Windows and Linux.

2 Likes

Thank you @mcmartin
Really appreciate it.
I took the steps written in the FRUT repo.
When I ran the below command

cmake --build . -- -parallelizeTargets OTHER_CODE_SIGN_FLAGS="--timestamp"

I got this error:

warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no run destination to provide an active architecture; building for all applicable architectures (in target 'MyJuceProjects_AAX' from project 'MyJuceProjects')
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no run destination to provide an active architecture; building for all applicable architectures (in target 'MyJuceProjects_AU' from project 'MyJuceProjects')
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no run destination to provide an active architecture; building for all applicable architectures (in target 'MyJuceProjects_StandalonePlugin' from project 'MyJuceProjects')
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no run destination to provide an active architecture; building for all applicable architectures (in target 'MyJuceProjects_Shared_Code' from project 'MyJuceProjects')
** BUILD FAILED **


The following build commands failed:
	CompileC /Users/myuser/developments/my_juce_projects/MyJucePluginProjects/build/MyJuceProjects.build/Debug/MyJuceProjects_Shared_Code.build/Objects-normal/arm64/PluginProcessor.o /Users/myuser/developments/my_juce_projects/MyJucePluginProjects/Source/Audio/PluginProcessor.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler

I tried building and signing the project with Xcode and it was successful without any problem.
Also does this command only build or it also signs too? Because when I used xcodebuild command I could sign it and build it for Release too.

Thank you very much