Hi Jules,
I tried your suggestion about using the juce_amalgamated_template (both .h and .cpp) for debug and it works very nicely under VC8 & VC9.
The next thing I stumbled on was the plugin framework, more specifically the wrappers. First, thing the ‘demo’ project seemed to be broken - includes.h was missing.
Anyway, this was rather easy to fix, but out of the fixing process came a request for a tweak to the plugin wrapper code.
Would it be OK for you to use an include redirection for juce.h in the plugin wrappers ?
I don’t know if the following is readable at all, but I hope that you will consider dealing with the issues of moving code around without having to tweak the project or the environment too much. Its so much easier to copy an app and start tweaking away if you dont have to deal with include paths and stuff too much.
Below is my reasoning in the form of a short overview of how I set up my plugin projects.
I see three reasons for having the amalgamated concept:
- Control options from within the project instead of having multiple versions of the Juce lib.
- Ability to wrap up a project easily with a specific version of Juce
- Build speed (in some environments, I guess)
1 and 3 are easily achieved by including the source through the juce_amalgamated_template files.
2 requires that the source files do not reference other files from the juce source tree. This is however the case for the plugin wrappers
I like to keep my projects out of the Juce source tree. In fact I like to be able to move them to different drives and folders without changes to project files or build environment settings.
In my build-environment, I use a single standard include path for all my libs including Juce, so that Juce sits in a subfolder to this.
In order to be able to control whether the amalgamated or the library method of including the framework is used, I have done the following:
Local AppConfig. (without the comments) looks like this:
[code]// Compile in a project-local amalgamated copy of the Juce library
#define JUCE_USE_LOCAL_AMALGAMATED 1
// Compile in sources instead of linking. No effect if JUCE_USE_LOCAL_AMALGAMATED is non-zero
#define JUCE_USE_AS_COMPILED_IN 1[/code]
I include the juce headers through a local juce_IncludHdr.h, which allows me to deal with the DONT_AUTOLINK_TO_JUCE_LIBRARY define.
Local juce_IncludeHdr.h:
[code]#ifndef JUCE_INCLUDEHDR_H
#define JUCE_INCLUDEHDR_H 1
// Include projects local settings
#include “juce_AppConfig.h”
// Select header
#if JUCE_USE_LOCAL_AMALGAMATED
#define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
#include “amalgamated/juce_amalgamated.h”
#elif JUCE_USE_AS_COMPILED_IN
#define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
#include <JUCE/juce.h>
#else
#include <JUCE/juce.h>
#endif
#endif // JUCE_INCLUDEHDR_H[/code]
I have .cpp files that deal with conditionally compiling in Juce and Wrapper code:
juce_LibrarySource.cpp:
#include "juce_AppConfig.h"
#if JUCE_USE_LOCAL_AMALGAMATED
#include "amalgamated/juce_amalgamated.cpp"
#elif JUCE_USE_AS_COMPILED_IN
#include <JUCE/src/juce_amalgamated_template.cpp>
#endif
juce_WrapperSource.cpp:
#include "juce_AppConfig.h"
#include "JucePluginCharacteristics.h"
#if JUCE_USE_LOCAL_AMALGAMATED
#define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
#include "amalgamated/vst/juce_VstWrapper.cpp"
#elif JUCE_USE_AS_COMPILED_IN
#define DONT_AUTOLINK_TO_JUCE_LIBRARY 1
#include <JUCE/extras/audio plugins/wrapper/formats/vst/juce_VstWrapper.cpp>
#else
#include <JUCE/extras/audio plugins/wrapper/formats/vst/juce_VstWrapper.cpp>
#endif
In order to wrap this up into a standalone project (that is, without the need for the Juce source tree) I copied the amalgamated files to an ‘amalgamated’ subdir in my ‘src’ folder.
I then made the following tweaks to the juce wrapper:
a)
Moved the file
- JUCE/extras/audio plugins/wrapper/juce_IncludeCharacteristics.h
to
- JUCE/extras/audio plugins/wrapper/formats/juce_IncludeCharacteristics.h
b)
Added the file
- JUCE/extras/audio plugins/wrapper/juce_IncludeHdr.h
containing
c) Tweaked the plugin wrapper sources (such as juce_vstwrapper.cpp)
so as to include juce.h through the file described in b) and take the characterstics check header from its new location one level further down the tree. That is:
changes to
and
changes to
In this way I am now able to copy the juce_IncludeCharacteristics.h and
any wrapper-format folders I need (only tried with vst on windows) into my ‘amalgamated’ folder and compile them from there, since it will now use my local project version of juce_IncludeHdr.h.
And now I am able to control how to compile the project just by tweaking the defines in juce_AppConfig.h.
Timing wise: For the demo vst plugin on VC9, I got
Amalgamated : 18 seconds
Compile in…: 21 seconds
Linked…: 9 seconds
In case the above is a bit overwhelming, I have zipped a copy of the amalgamated plugin and posted it here:
http://nifomorph.com/repository/pub/juce/juce_amalgamated_demoplugin.zip