Hi all,
I would like to share here some news regarding JUCE and Embedded Linux: I have upstreamed JUCE support for the OpenEmbedded (also Yocto) build system for Embedded Linux! All the JUCE related work is already upstreamed as well.
Introduction
I would like to introduce myself since I am quite new here. My name is Felipe Tonello and I work at ROLI mainly on Audio for Embedded Linux. (check out the Seaboard GRAND for a really cool Embedded Linux device running JUCE!)
Embedded Linux support is all about building. Besides the architecture support that most libraries and system developers have to worry about, application developers care about how to build to a different platform other than the one they are using. This task is quite complicated so I will not discuss it here. And that is why we use build systems - tools developed in order to solve that and many other problems.
Important: This post considers that you are running on any major GNU/Linux distribution and have an OpenEmbedded (or Yocto) setup done.
How to build
There are two ways to cross-compile your application:
- Using a build system (for production)
- Using a SDK (for development)
Build System
Here I provide some of the basics in order to build your application on a build system, considering you already have an openembedded (or yocto) environment setup:
- Add the meta-multimedia layer from meta-openembedded repository to your build configuration.
- Create a recipe for your application containing the following skeleton:
inherit juce
JUCE_JUCERS = "${B}/cool-project.jucer"
SRC_URI = "git://path-to-my-repo.git"
do_compile() {
cd ${B}/LinuxMakefile
CONFIG=Release oe_runmake
}
do_install() {
install -D ${B}/my-binary ${D}${bindir}/my-binary
}
A little explanation
The first line is where the magic happens, inherit juce
will perform all the basic dependency configuration for the build. The bbclass for that can be found here. That class defines two main variables that application recipes should define:
- JUCE_MODULES (optional): What JUCE modules your application depends on? It defaults to what the build system supports. Values should be JUCE modules names separated by spaces.
- JUCE_JUCERS (required): The path of the .jucer your application uses to build. It can be multiple .jucer files separated by spaces.
SRC_URI, do_compile(), do_install() and oe_runmake
(runs make with some arguments) are part of the OpenEmbedded build system. install
is a normal Unix command.
SDK
For SDK builders
In order to add JUCE support to an OpenEmbedded based SDK, add nativesdk-projucer dependency to TOOLCHAIN_HOST_TASK like this: TOOLCHAIN_HOST_TASK += "nativesdk-projucer"
Build your SDK as usual.
For developers
Install the SDK previously built and source the environment file that comes in it.
On the terminal (where you sourced the environment file), you will notice that Projucer will be accessible on the current $PATH
, which means that you can type Pro<TAB><TAB>
and the shell will autocomplete to Projucer
. Then you can just run Projucer --resave my-application.jucer
(or even without --resave, which will open Projucerās window) normally. Just cd
into the directory where the Linux Makefile is and run make
. Your cross compiled binary will be ready in a short time.
It is that simple!
Conclusion
This makes things really easy for Embedded Linux development with JUCE. And yes, some Embedded Linux knowledge is required in order to setup a build system, but that can be the work of someone else.
If you want to know more
Make sure you attend ADC 2016 because, among many other reasons, I will be presenting a talk about Audio Application on Embedded Linux!