Skip to content

Commit

Permalink
Drop JuceHeader.h, include JUCE modules directly (surge-synthesizer#4816
Browse files Browse the repository at this point in the history
)

JuceHeader.h is a generated header that includes all enabled JUCE
modules. This was bloating the preprocessed sources of many Surge TUs by
hundreds of KBytes each (on Linux), slowing down the build somewhat.

Also, JuceHeader.h is generated at build time, impairing IDE navigation
and completion until halfway through an initial build.

This change includes only the required JUCE modules directly, which
is supported in CMake projects as per the documentation.
  • Loading branch information
mvf authored Aug 10, 2021
1 parent 78be91c commit b0bb41c
Show file tree
Hide file tree
Showing 51 changed files with 191 additions and 169 deletions.
24 changes: 1 addition & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ target_include_directories(surge-shared
${SURGE_COMMON_INCLUDES}
${OS_INCLUDE_DIRECTORIES}
)
target_compile_definitions(surge-shared PRIVATE ${OS_COMPILE_DEFINITIONS} )
target_compile_definitions(surge-shared PUBLIC ${OS_COMPILE_DEFINITIONS} )

if( BUILD_HEADLESS )
add_executable(surge-headless
Expand Down Expand Up @@ -585,7 +585,6 @@ if( BUILD_HEADLESS )
target_compile_definitions(surge-headless
PRIVATE
${OS_COMPILE_DEFINITIONS}
TARGET_HEADLESS=1
$<IF:$<CONFIG:DEBUG>,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1
)

Expand Down Expand Up @@ -745,8 +744,6 @@ if( BUILD_SURGE_EFFECTS_BANK )
FORMATS ${SURGE_JUCE_FORMATS}
)

juce_generate_juce_header( surge-fx )

file(GLOB SURGE_FX_BANK_RESOURCES_GLOB
resources/surge_effects_bank/*.svg
resources/surge_effects_bank/icons/*.svg
Expand Down Expand Up @@ -780,9 +777,6 @@ if( BUILD_SURGE_EFFECTS_BANK )

JUCE_WASAPI=1
JUCE_DIRECTSOUND=1

TARGET_HEADLESS=1

)

if (JUCE_ASIO_SUPPORT)
Expand Down Expand Up @@ -891,8 +885,6 @@ if( BUILD_SURGE_XT )
FORMATS ${SURGE_JUCE_FORMATS}
)

juce_generate_juce_header( surge-xt )

file(GLOB SURGE_SYNTH_JUCE_RESOURCES_GLOB
resources/classic-skin-svgs/*.svg
resources/fonts/Lato*ttf
Expand Down Expand Up @@ -954,10 +946,6 @@ if( BUILD_SURGE_XT )
SURGE_JUCE_HOST_CONTEXT=${SURGE_JUCE_HOST_CONTEXT_DEFINE}
SURGE_JUCE_VST3_EXTENSIONS=${SURGE_JUCE_VST3_EXTENSIONS}

TARGET_JUCE_SYNTH=1
TARGET_HEADLESS=1
TARGET_JUCE_UI=1

$<IF:$<CONFIG:DEBUG>,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1
)

Expand Down Expand Up @@ -1038,15 +1026,6 @@ if( BUILD_SURGE_XT )
)
endif()

target_compile_definitions(surge-xt PUBLIC ${OS_COMPILE_DEFINITIONS} DONT_SET_USING_JUCE_NAMESPACE=1)

target_compile_definitions(surge-xt_Standalone PUBLIC
TARGET_JUCE_SYNTH=1
TARGET_HEADLESS=1
TARGET_JUCE_UI=1)

# add_dependencies(surge-juce-pipeline-targets surge-xt_Standalone)

get_target_property( SURGE_XT_OUTPUT_DIR surge-xt RUNTIME_OUTPUT_DIRECTORY )

# Really just a little convnience for BP on lin and win
Expand Down Expand Up @@ -1282,7 +1261,6 @@ if( ${BUILD_SURGE_PYTHON_BINDINGS} )
target_compile_definitions(surgepy
PRIVATE
${OS_COMPILE_DEFINITIONS}
TARGET_HEADLESS=1
$<IF:$<CONFIG:DEBUG>,BUILD_IS_DEBUG,BUILD_IS_RELEASE>=1
)

Expand Down
2 changes: 1 addition & 1 deletion src/common/dsp/effects/chowdsp/bbd_utils/BBDCompander.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <JuceHeader.h>
#include "juce_core/juce_core.h"

/**
* Signal averager used for BBD companding.
Expand Down
5 changes: 3 additions & 2 deletions src/gui/AccessibleHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
#ifndef SURGE_XT_ACCESSIBLEHELPERS_H
#define SURGE_XT_ACCESSIBLEHELPERS_H

#include <JuceHeader.h>
#if SURGE_JUCE_ACCESSIBLE
#include "Parameter.h"
#include "SurgeGUIEditor.h"

#if SURGE_JUCE_ACCESSIBLE
#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
namespace Widgets
Expand Down
3 changes: 2 additions & 1 deletion src/gui/RuntimeFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
*/

#include "RuntimeFont.h"
#include <JuceHeader.h>
#include "BinaryData.h"

#include <iostream>

namespace Surge
Expand Down
2 changes: 1 addition & 1 deletion src/gui/RuntimeFont.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <JuceHeader.h>
#include "juce_graphics/juce_graphics.h"

namespace Surge
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/SkinSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "DebugHelpers.h"
#include "globals.h"

#include <JuceHeader.h>
#include "juce_graphics/juce_graphics.h"

#include "SkinModel.h"
#include "SkinColors.h"
Expand Down
2 changes: 2 additions & 0 deletions src/gui/SurgeGUICallbackInterfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef SURGE_XT_SURGEGUICALLBACKINTERFACES_H
#define SURGE_XT_SURGEGUICALLBACKINTERFACES_H

#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
namespace GUI
Expand Down
4 changes: 2 additions & 2 deletions src/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include "globals.h"

#include <JuceHeader.h>

#include "SurgeGUICallbackInterfaces.h"

#include "SurgeStorage.h"
Expand All @@ -33,6 +31,8 @@
#include "overlays/OverlayWrapper.h" // This needs to be concrete for inline functions for now
#include "widgets/ModulatableControlInterface.h"

#include "juce_gui_basics/juce_gui_basics.h"

#include <vector>
#include <thread>
#include <atomic>
Expand Down
3 changes: 2 additions & 1 deletion src/gui/SurgeGUIUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include "SurgeGUIUtils.h"

#include "juce_core/juce_core.h"

#include <cctype>
#include <JuceHeader.h>

namespace Surge
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/SurgeImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
** open source in September 2018.
*/

#include <JuceHeader.h>
#include "SurgeImage.h"
#include "BinaryData.h"

SurgeImage::SurgeImage(int rid)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/SurgeImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* A utility wrapper around loading and drawables and stuff
*/

#include <JuceHeader.h>
#include "juce_gui_basics/juce_gui_basics.h"

#include <vector>
#include <map>
Expand Down
3 changes: 2 additions & 1 deletion src/gui/SurgeImageStore.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once

#include "resource.h"
#include <JuceHeader.h>
#include <string>
#include <map>
#include <atomic>
#include <algorithm>
#include <cctype>
#include <vector>

class SurgeImage;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/SurgeJUCEHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef SURGE_XT_JUCEHELPERS_H
#define SURGE_XT_JUCEHELPERS_H

#include <JuceHeader.h>
#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/SurgeJUCELookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef SURGE_XT_SURGEJUCELOOKANDFEEL_H
#define SURGE_XT_SURGEJUCELOOKANDFEEL_H

#include <JuceHeader.h>
#include "juce_gui_basics/juce_gui_basics.h"

class SurgeJUCELookAndFeel : public juce::LookAndFeel_V4
{
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/AboutScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef SURGE_XT_ABOUTSCREEN_H
#define SURGE_XT_ABOUTSCREEN_H

#include <JuceHeader.h>
#include "SkinSupport.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;
class SurgeStorage;

Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/LuaEditors.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
#ifndef SURGE_XT_LUAEDITORS_H
#define SURGE_XT_LUAEDITORS_H

#include <JuceHeader.h>
#include "SurgeStorage.h"
#include "SkinSupport.h"

#include "juce_gui_extra/juce_gui_extra.h"

class SurgeGUIEditor;

namespace Surge
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/MSEGEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
*/

#pragma once
#include <JuceHeader.h>
#include "SurgeStorage.h"
#include "SkinSupport.h"
#include "RefreshableOverlay.h"

#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
namespace Overlays
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/MiniEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef SURGE_XT_MINIEDIT_H
#define SURGE_XT_MINIEDIT_H

#include <JuceHeader.h>
#include "SkinSupport.h"

#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
namespace Overlays
Expand Down
2 changes: 1 addition & 1 deletion src/gui/overlays/ModulationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef SURGE_XT_MODULATIONEDITOR_H
#define SURGE_XT_MODULATIONEDITOR_H

#include <JuceHeader.h>
#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;
class SurgeSynthesizer;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/OverlayWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef SURGE_XT_OVERLAYWRAPPER_H
#define SURGE_XT_OVERLAYWRAPPER_H

#include <JuceHeader.h>
#include "SkinSupport.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;
class SurgeImage;

Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/PatchDBViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef SURGE_PATCHDBVIEWER_H
#define SURGE_PATCHDBVIEWER_H

#include <JuceHeader.h>
#include "SurgeStorage.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;

namespace Surge
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/PatchStoreDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef SURGE_XT_PATCHSTOREDIALOG_H
#define SURGE_XT_PATCHSTOREDIALOG_H

#include <JuceHeader.h>
#include "SkinSupport.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;

namespace Surge
Expand Down
3 changes: 2 additions & 1 deletion src/gui/overlays/TypeinParamEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
#ifndef SURGE_XT_TYPEINPARAMEDITOR_H
#define SURGE_XT_TYPEINPARAMEDITOR_H

#include <JuceHeader.h>
#include "Parameter.h"
#include "SurgeStorage.h"
#include "ModulationSource.h"
#include "SkinSupport.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;

namespace Surge
Expand Down
6 changes: 4 additions & 2 deletions src/gui/widgets/EffectChooser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
#ifndef SURGE_XT_EFFECTCHOOSER_H
#define SURGE_XT_EFFECTCHOOSER_H

#include <JuceHeader.h>
#include <array>
#include "SurgeStorage.h"
#include "SkinSupport.h"
#include "WidgetBaseMixin.h"
#include "SurgeJUCEHelpers.h"

#include "juce_gui_basics/juce_gui_basics.h"

#include <array>

namespace Surge
{
namespace Widgets
Expand Down
4 changes: 3 additions & 1 deletion src/gui/widgets/EffectLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
#ifndef SURGE_XT_EFFECTLABEL_H
#define SURGE_XT_EFFECTLABEL_H

#include <JuceHeader.h>
#include "SkinSupport.h"
#include "RuntimeFont.h"

#include "juce_gui_basics/juce_gui_basics.h"

#include <string>

namespace Surge
Expand Down
3 changes: 2 additions & 1 deletion src/gui/widgets/LFOAndStepDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
#ifndef SURGE_XT_LFOANDSTEPDISPLAY_H
#define SURGE_XT_LFOANDSTEPDISPLAY_H

#include <JuceHeader.h>
#include "WidgetBaseMixin.h"
#include "SurgeStorage.h"

#include "juce_gui_basics/juce_gui_basics.h"

namespace Surge
{
namespace Widgets
Expand Down
3 changes: 2 additions & 1 deletion src/gui/widgets/MainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
#ifndef SURGE_XT_MAINFRAME_H
#define SURGE_XT_MAINFRAME_H

#include <JuceHeader.h>
#include "SurgeImage.h"
#include "Parameter.h"

#include "juce_gui_basics/juce_gui_basics.h"

class SurgeGUIEditor;

namespace Surge
Expand Down
Loading

0 comments on commit b0bb41c

Please sign in to comment.