Skip to content

Commit 91a861a

Browse files
committed
Fixes for custom plugin build
1 parent b2b3433 commit 91a861a

File tree

7 files changed

+42
-32
lines changed

7 files changed

+42
-32
lines changed

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "iOS")
9191
list(APPEND HARDENED_RUNTIME_OPTIONS com.apple.developer.networking.multicast)
9292
endif()
9393

94-
95-
if(BUILD_CUSTOM_PLUGIN)
96-
project(${CUSTOM_PLUGIN_NAME} VERSION ${CUSTOM_PLUGIN_VERSION} LANGUAGES C CXX)
97-
else()
98-
project(plugdata VERSION 0.9.2 LANGUAGES C CXX)
94+
95+
if(BUILD_CUSTOM_PLUGIN)
96+
project(${CUSTOM_PLUGIN_NAME} VERSION ${CUSTOM_PLUGIN_VERSION} LANGUAGES C CXX)
97+
else()
98+
project(plugdata VERSION 0.9.2 LANGUAGES C CXX)
99+
endif()
100+
99101
include(CheckIPOSupported)
100102
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
101103

@@ -433,7 +435,7 @@ endif()
433435
list(APPEND PLUGDATA_COMPILE_DEFINITIONS JUCE_MODAL_LOOPS_PERMITTED=1)
434436

435437
if(BUILD_CUSTOM_PLUGIN)
436-
list(APPEND PLUGDATA_COMPILE_DEFINITIONS PROJECT_NAME=${CUSTOM_PLUGIN_NAME} PROJECT_VERSION=${CUSTOM_PLUGIN_VERSION} COMPANY_NAME=${CUSTOM_PLUGIN_COMPANY} CUSTOM_PLUGIN=1)
438+
list(APPEND PLUGDATA_COMPILE_DEFINITIONS PROJECT_NAME=${CUSTOM_PLUGIN_NAME} PATCH_NAME=${CUSTOM_PLUGIN_PATCH} PROJECT_VERSION=${CUSTOM_PLUGIN_VERSION} COMPANY_NAME=${CUSTOM_PLUGIN_COMPANY} CUSTOM_PLUGIN=1)
437439
set(STANDALONE_NAME ${CUSTOM_PLUGIN_NAME})
438440
if(CUSTOM_PLUGIN_IS_FX)
439441
set(INSTRUMENT_NAME "${CUSTOM_PLUGIN_NAME}-instrument")
@@ -518,7 +520,7 @@ source_group("Source\\Standalone" FILES ${plugdata_standalone_sources})
518520

519521
if(NOT ${BUILD_CUSTOM_PLUGIN})
520522
set(DOCUMENT_EXTENSIONS "pd plugdata")
521-
else()
523+
endif()
522524

523525
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "iOS")
524526
set(AU_EFFECT_TYPE kAudioUnitType_MusicEffect)

Resources/Scripts/package_custom_resources.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,11 @@ def generate_binary_data(output_dir, file_list):
297297
removeDir("Extra/else/audio")
298298

299299
copyDir(project_root + "/Libraries/pd-else/Source/Audio/sfz~/sfz", "Extra/else/sfz")
300-
convert_merda.process(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/")
301-
globCopy(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/*.pd", "./Extra/else")
300+
301+
convert_merda.process(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/", output_dir + "/Merda_temp")
302+
globCopy(output_dir + "/Merda_temp/*", "./Extra/else")
302303
copyDir(project_root + "/Libraries/pd-else/Abstractions/Merda/Modules/brane-presets", "./Extra/else/brane-presets")
304+
removeDir(output_dir + "/Merda_temp")
303305
removeDir("./Extra/else/sf") # soundfont is too large to ship
304306
for file_path in glob.glob("./Extra/else/*-help.pd"):
305307
os.remove(file_path)
@@ -315,13 +317,8 @@ def generate_binary_data(output_dir, file_list):
315317

316318
makeArchive("Filesystem", "./", "./plugdata_version")
317319

318-
with zipfile.ZipFile(output_dir + "/InterUnicode.ttf.zip", 'w', compression=zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
319-
zipf.write(project_root + "/Resources/Fonts/InterRegular.ttf", arcname="InterUnicode.ttf")
320-
321320
removeDir(output_dir + "/plugdata_version")
322321

323-
splitFile(output_dir + "/InterUnicode.ttf.zip", output_dir + "/InterUnicode_%i", 3)
324-
325322
splitFile("./Filesystem", output_dir + "/Filesystem_%i", 8)
326323
removeFile("./Filesystem")
327324

@@ -336,6 +333,5 @@ def generate_binary_data(output_dir, file_list):
336333
project_root + "/Resources/Icons/plugdata_large_logo.png",
337334
project_root + "/Resources/Icons/plugdata_logo.png",
338335
"Documentation.bin",
339-
"InterUnicode_*",
340336
"Filesystem_*"
341337
}))

Source/PluginEditor.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ PluginEditor::PluginEditor(PluginProcessor& p)
317317
}
318318
setSize(pd->lastUIWidth, pd->lastUIHeight);
319319
#else
320-
setSize(pd->lastUIWidth, pd->lastUIHeight);#endif
320+
setSize(pd->lastUIWidth, pd->lastUIHeight);
321+
#endif
321322
sidebar->toFront(false);
322323

323324
// Make sure existing console messages are processed
@@ -862,6 +863,9 @@ void PluginEditor::fileDragMove(StringArray const& files, int const x, int const
862863

863864
void PluginEditor::installPackage(File const& file)
864865
{
866+
#ifdef CUSTOM_PLUGIN
867+
return;
868+
#endif
865869
auto install = [this, file]{
866870
auto zip = ZipFile(file);
867871
auto patchesDir = ProjectInfo::appDataDir.getChildFile("Patches");
@@ -917,6 +921,9 @@ void PluginEditor::installPackage(File const& file)
917921

918922
void PluginEditor::filesDropped(StringArray const& files, int const x, int const y)
919923
{
924+
#ifdef CUSTOM_PLUGIN
925+
return;
926+
#endif
920927
// First check for .pd files
921928
bool openedPdFiles = false;
922929
for (auto& path : files) {
@@ -948,12 +955,18 @@ void PluginEditor::filesDropped(StringArray const& files, int const x, int const
948955
}
949956
void PluginEditor::fileDragEnter(StringArray const&, int, int)
950957
{
951-
// isDraggingFile = true;
958+
#ifdef CUSTOM_PLUGIN
959+
return;
960+
#endif
961+
isDraggingFile = true;
952962
repaint();
953963
}
954964

955965
void PluginEditor::fileDragExit(StringArray const&)
956966
{
967+
#ifdef CUSTOM_PLUGIN
968+
return;
969+
#endif
957970
isDraggingFile = false;
958971
repaint();
959972
}

Source/PluginMode.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ class PluginMode final : public Component
210210
addChildComponent(consolePanel);
211211

212212
revealPatchButton.onClick = [](){
213-
auto projectFolder = ProjectInfo::versionDataDir.getChildFile(JUCE_STRINGIFY(PROJECT_NAME));
214-
auto pdFiles = projectFolder.findChildFiles(File::findFiles, false, "*.pd");
215-
if(pdFiles.size())
216-
{
217-
pdFiles[0].revealToUser();
218-
}
213+
auto patchFile = ProjectInfo::versionDataDir.getChildFile(JUCE_STRINGIFY(PROJECT_NAME)).getChildFile(JUCE_STRINGIFY(PATCH_NAME));
214+
patchFile.revealToUser();
219215
};
220216
}
221217

Source/PluginProcessor.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,10 @@ PluginProcessor::PluginProcessor()
196196

197197
sendMessagesFromQueue();
198198
startDSP();
199-
200199

201200
#ifdef CUSTOM_PLUGIN
202-
auto projectFolder = ProjectInfo::versionDataDir.getChildFile(JUCE_STRINGIFY(PROJECT_NAME));
203-
auto pdFiles = projectFolder.findChildFiles(File::findFiles, false, "*.pd");
204-
if(pdFiles.size())
205-
{
206-
loadPatch(URL(pdFiles[0]));
207-
}
201+
auto patchFile = ProjectInfo::versionDataDir.getChildFile(JUCE_STRINGIFY(PROJECT_NAME)).getChildFile(JUCE_STRINGIFY(PATCH_NAME));
202+
loadPatch(URL(patchFile));
208203
#endif
209204
}
210205

@@ -493,7 +488,8 @@ bool PluginProcessor::initialiseFilesystem()
493488
createLinkWithRetry(homeDir.getChildFile("Abstractions"), versionDataDir.getChildFile("Abstractions"));
494489
createLinkWithRetry(homeDir.getChildFile("Documentation"), versionDataDir.getChildFile("Documentation"));
495490
createLinkWithRetry(homeDir.getChildFile("Extra"), versionDataDir.getChildFile("Extra"));
496-
// TODO: version transition code, remove this later#ifndef CUSTOM_PLUGIN
491+
// TODO: version transition code, remove this later
492+
#ifndef CUSTOM_PLUGIN
497493
auto oldlocation = File::getSpecialLocation(File::SpecialLocationType::userDocumentsDirectory).getChildFile("plugdata");
498494
auto backupLocation = File::getSpecialLocation(File::SpecialLocationType::userDocumentsDirectory).getChildFile("plugdata.old");
499495
if (oldlocation.isDirectory() && !backupLocation.isDirectory()) {

Source/Standalone/PlugDataApp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class PlugDataApp final : public JUCEApplication {
8787

8888
void fileOpened(String const& commandLine) const
8989
{
90+
#ifdef CUSTOM_PLUGIN
91+
return;
92+
#endif
9093
auto const tokens = StringArray::fromTokens(commandLine, true);
9194
auto const file = File(tokens[0].unquoted());
9295
if (file.existsAsFile()) {
@@ -118,7 +121,10 @@ class PlugDataApp final : public JUCEApplication {
118121
mainWindow = new PlugDataWindow(pluginHolder->processor->createEditorIfNeeded());
119122

120123
mainWindow->setVisible(true);
124+
125+
#ifndef CUSTOM_PLUGIN
121126
parseSystemArguments(arguments);
127+
#endif
122128

123129
#if JUCE_LINUX || JUCE_BSD
124130
mainWindow->getPeer()->setIcon(logo);

Source/Utility/Config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ struct ProjectInfo {
3636
static bool isMidiEffect() noexcept;
3737
static bool canUseSemiTransparentWindows();
3838
#ifdef CUSTOM_PLUGIN
39-
static inline File const appDataDir = File::getSpecialLocation(File::SpecialLocationType::userApplicationDataDirectory ).getChildFile(JUCE_STRINGIFY(PROJECT_NAME));
39+
static inline File const appDataDir = File::getSpecialLocation(File::SpecialLocationType::userApplicationDataDirectory ).getChildFile(JUCE_STRINGIFY(COMPANY_NAME)).getChildFile(JUCE_STRINGIFY(PROJECT_NAME));
40+
4041
static inline File const versionDataDir = appDataDir.getChildFile("Versions").getChildFile(JUCE_STRINGIFY(PROJECT_VERSION));
4142
#else
4243
#if JUCE_WINDOWS

0 commit comments

Comments
 (0)