Adding Juce to existing projects

Hi, are there any guidelines anywhere for adding Juce to an existing project, i.e. not using Intro/Projucer?

 

thx

I don't know about any guidelines.

And I haven't done this for years. But some things I do remeber that might help:

It depends on what you want to do.
If you don't need any JUCE GUI stuff, it might work to just add the classes (and their dependencies) you want to use.
If not and you run your own event loop, call

initialiseJuce_GUI();

otherwise, use the START_JUCE_APPLICATION macro when initialising your application.

An old project where I contributed an "audio engine" using JUCE to an Objective-C codebase:
https://github.com/klangfreund/Choreographer/tree/master/Audio%20Engine
The AudioEngine.mm is the main interface between.

Hi, it may not help entirely, but I haven't found any guideline for integrating the libraries into a project.
All you need to do is to add the appconfig, juceheader.h and juceheader.cpp to your project and you are set!

Hey old topic, but couldn’t really get this working.

Is this still the way to go? Could anyone confirm how to do this with Juce 6?

Thanks in advance!

Depending on what you’re trying to do, the new CMake support in JUCE 6 is likely to be the lowest-friction and best-supported approach to use JUCE without the Projucer.

To get started, you might find the example projects in examples/CMake and the API reference in docs/CMake API.md helpful.

2 Likes

Did anyone ever manage this without Projucer and without CMake?

I’m just trying to get juce_core added to an existing project.

Thx

Yes, I am doing that with a pre-existing major QT application.

The way I do this is to create a juce_config.h containing my settings and then I add the cpp of the modules to the project using a little stub, like the ones created by projucer (works in Visual Studio in the IDE and on Mac adding it to the .pro files of QtCreator).

here’s the content of my juce_config.h

#pragma once

#define JUCE_PLUGINHOST_VST    0
#define JUCE_PLUGINHOST_VST3   1
#define JUCE_PLUGINHOST_AU     0
#define JUCE_PLUGINHOST_LADSPA 0

#define JUCE_WEB_BROWSER 0

#define JUCE_MODULE_AVAILABLE_juce_audio_basics     1
#define JUCE_MODULE_AVAILABLE_juce_audio_devices    1
#define JUCE_MODULE_AVAILABLE_juce_audio_formats    1
#define JUCE_MODULE_AVAILABLE_juce_audio_processors 1
#define JUCE_MODULE_AVAILABLE_juce_core             1
#define JUCE_MODULE_AVAILABLE_juce_data_structures  1
#define JUCE_MODULE_AVAILABLE_juce_dsp              1
#define JUCE_MODULE_AVAILABLE_juce_events           1
#define JUCE_MODULE_AVAILABLE_juce_graphics         1
#define JUCE_MODULE_AVAILABLE_juce_gui_basics       1
#define JUCE_MODULE_AVAILABLE_juce_gui_extras       1

// these silences some warnings in juce when not using their toolchain
#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 1
#define JUCE_STANDALONE_APPLICATION          0

Then for every module:
juce_audio_basics_stub.cpp

#include "stdafx.h"

#include "juce_config.h"
#include "../JUCE/modules/juce_audio_basics/juce_audio_basics.cpp"

That’s it

2 Likes

thx. I hacked something together similar, but your way is more elegant so thx.

Unfortunately I hit another block of the fact that JUCE requires ARC to be off and the code I’m trying to bring JUCE into requires it to be on, and not sure that’s going to be easy to solve.

Thanks