Skip to content

Commit 8405dfd

Browse files
committed
Fix xcode plugin project generation
1 parent a971ee3 commit 8405dfd

6 files changed

Lines changed: 76 additions & 10 deletions

File tree

PluginGenerator/Source/Project Saving/jucer_ProjectExport_XCode.h

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ class XCodeProjectExporter : public ProjectExporter
268268

269269
else if (type.isDynamicLibrary())
270270
targets.add (new Target (Target::DynamicLibrary, *this));
271+
272+
// Open-Ephys
273+
else if (type.isOpenEphysPlugin())
274+
{
275+
targets.add (new Target (Target::OpenEphysPlugIn, *this));
276+
addOpenEphysPluginSettings();
277+
}
271278

272279
else if (type.isAudioPlugin())
273280
{
@@ -352,7 +359,10 @@ class XCodeProjectExporter : public ProjectExporter
352359
vst3BinaryLocation (config, Ids::xcodeVst3BinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/VST3/"),
353360
auBinaryLocation (config, Ids::xcodeAudioUnitBinaryLocation, nullptr, "$(HOME)/Library/Audio/Plug-Ins/Components/"),
354361
rtasBinaryLocation (config, Ids::xcodeRtasBinaryLocation, nullptr, "/Library/Application Support/Digidesign/Plug-Ins/"),
355-
aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/")
362+
aaxBinaryLocation (config, Ids::xcodeAaxBinaryLocation, nullptr, "/Library/Application Support/Avid/Audio/Plug-Ins/"),
363+
// Open-Ephys
364+
openEphysProjectLocation (config, Ids::xcodeOpenEphysProjectLocation, nullptr, "../../../plugin-gui"),
365+
openEphysBinaryLocation (config, Ids::xcodeOpenEphysBinaryLocation, nullptr, "$(HOME)/Library/Application Support/open-ephys/PlugIns/")
356366
{
357367
}
358368

@@ -363,6 +373,7 @@ class XCodeProjectExporter : public ProjectExporter
363373
customXcodeFlags, cppLanguageStandard, cppStandardLibrary, codeSignIdentity;
364374
CachedValue<bool> fastMathEnabled, linkTimeOptimisationEnabled, stripLocalSymbolsEnabled;
365375
CachedValue<String> vstBinaryLocation, vst3BinaryLocation, auBinaryLocation, rtasBinaryLocation, aaxBinaryLocation;
376+
CachedValue<String> openEphysProjectLocation, openEphysBinaryLocation; // Open-Ephys
366377

367378
//==========================================================================
368379
var getDefaultOptimisationLevel() const override { return var ((int) (isDebug() ? gccO0 : gccO3)); }
@@ -439,6 +450,11 @@ class XCodeProjectExporter : public ProjectExporter
439450

440451
props.add (new ChoicePropertyComponent (cppStandardLibrary.getPropertyAsValue(), "C++ Library", StringArray (cppLibNames), cppLibValues),
441452
"The type of C++ std lib that will be linked.");
453+
454+
// Open-Ephys
455+
if (project.getProjectType().isOpenEphysPlugin())
456+
props.add (new TextWithDefaultPropertyComponent<String> (openEphysProjectLocation, "Plugin GUI Project Location", 1024),
457+
"The location of the Open-Ephys plugin-gui project root directory.");
442458

443459
props.add (new TextWithDefaultPropertyComponent<String> (codeSignIdentity, "Code-signing Identity", 1024),
444460
"The name of a code-signing identity for Xcode to apply.");
@@ -476,6 +492,11 @@ class XCodeProjectExporter : public ProjectExporter
476492
if (project.shouldBuildAAX().getValue())
477493
props.add (new TextWithDefaultPropertyComponent<String> (aaxBinaryLocation, "AAX Binary location", 1024),
478494
"The folder in which the compiled AAX binary should be placed.");
495+
496+
// Open-Ephys
497+
if (project.shouldBuildOpenEphysPlugin().getValue())
498+
props.add (new TextWithDefaultPropertyComponent<String> (openEphysBinaryLocation, "Open Ephys Plugin Binary location", 1024),
499+
"The folder in which the compiled Open Ephys Plugin should be placed.");
479500
}
480501
};
481502

@@ -519,6 +540,7 @@ class XCodeProjectExporter : public ProjectExporter
519540
AudioUnitPlugIn = 14,
520541
AudioUnitv3PlugIn = 15,
521542
StandalonePlugIn = 16,
543+
OpenEphysPlugIn = 17,
522544

523545
SharedCodeTarget = 20, // internal
524546
AggregateTarget = 21,
@@ -686,6 +708,18 @@ class XCodeProjectExporter : public ProjectExporter
686708
xcodeCreatePList = false;
687709
xcodeCopyToProductInstallPathAfterBuild = false;
688710
break;
711+
712+
case OpenEphysPlugIn:
713+
xcodeIsBundle = true;
714+
xcodeIsExecutable = false;
715+
xcodeCreatePList = true;
716+
xcodePackageType = "BNDL";
717+
xcodeBundleSignature = "????";
718+
xcodeFileType = "wrapper.cfbundle";
719+
xcodeBundleExtension = ".bundle";
720+
xcodeProductType = "com.apple.product-type.bundle";
721+
xcodeCopyToProductInstallPathAfterBuild = false;
722+
break;
689723

690724
default:
691725
// unknown target type!
@@ -711,6 +745,7 @@ class XCodeProjectExporter : public ProjectExporter
711745
case RTASPlugIn: return "RTAS";
712746
case SharedCodeTarget: return "Shared Code";
713747
case AggregateTarget: return "All";
748+
case OpenEphysPlugIn: return "OpenEphys Plugin";
714749
default: return "undefined";
715750
}
716751
}
@@ -727,6 +762,9 @@ class XCodeProjectExporter : public ProjectExporter
727762
bool shouldBuildAU() const { return owner.supportsAU() && owner.project.shouldBuildAU().getValue() && (type == SharedCodeTarget || type == AudioUnitPlugIn); }
728763
bool shouldBuildAUv3() const { return owner.supportsAUv3() && owner.project.shouldBuildAUv3().getValue() && (type == SharedCodeTarget || type == AudioUnitv3PlugIn); }
729764
bool shouldBuildStandalone() const { return owner.project.shouldBuildStandalone().getValue() && (type == SharedCodeTarget || type == StandalonePlugIn); }
765+
766+
// Open-Ephys
767+
bool shouldBuildOpenEphys() const { return owner.project.shouldBuildOpenEphysPlugin().getValue() && (type == SharedCodeTarget || type == OpenEphysPlugIn); }
730768

731769
String getID() const
732770
{
@@ -1051,6 +1089,9 @@ class XCodeProjectExporter : public ProjectExporter
10511089
defines.set ("JucePlugin_Build_AAX", (shouldBuildAAX() ? "1" : "0"));
10521090
defines.set ("JucePlugin_Build_Standalone", (shouldBuildStandalone() ? "1" : "0"));
10531091
}
1092+
1093+
if (type == Target::OpenEphysPlugIn)
1094+
defines.set ("JucePlugin_Build_OpenEphys", (shouldBuildOpenEphys() ? "1" : "0"));
10541095

10551096
defines = mergePreprocessorDefs (defines, owner.getAllPreprocessorDefs (config));
10561097

@@ -1085,6 +1126,7 @@ class XCodeProjectExporter : public ProjectExporter
10851126
case RTASPlugIn: return config.rtasBinaryLocation.get();
10861127
case AAXPlugIn: return config.aaxBinaryLocation.get();
10871128
case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks";
1129+
case OpenEphysPlugIn: return config.openEphysBinaryLocation.get(); // Open-Ephys
10881130
default: return String();
10891131
}
10901132
}
@@ -1094,6 +1136,9 @@ class XCodeProjectExporter : public ProjectExporter
10941136
{
10951137
if (xcodeIsBundle)
10961138
flags.add ("-bundle");
1139+
1140+
if (owner.project.getProjectType().isOpenEphysPlugin())
1141+
flags.add ("-undefined dynamic_lookup");
10971142

10981143
const Array<RelativePath>& extraLibs = config.isDebug() ? xcodeExtraLibrariesDebug
10991144
: xcodeExtraLibrariesRelease;
@@ -1920,7 +1965,7 @@ class XCodeProjectExporter : public ProjectExporter
19201965
s.add ("GCC_WARN_MISSING_PARENTHESES = YES");
19211966
s.add ("GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES");
19221967
s.add ("GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES");
1923-
s.add ("WARNING_CFLAGS = -Wreorder");
1968+
s.add (projectType.isOpenEphysPlugin()?"WARNING_CFLAGS = \"-Wreorder -Wno-inconsistent-missing-override\"":"WARNING_CFLAGS = -Wreorder"); // Open-Ephys
19241969
s.add ("GCC_MODEL_TUNING = G5");
19251970

19261971
if (projectType.isStaticLibrary())
@@ -1963,6 +2008,10 @@ class XCodeProjectExporter : public ProjectExporter
19632008
s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\"");
19642009

19652010
s.add ("PRODUCT_NAME = \"" + replacePreprocessorTokens (config, config.getTargetBinaryNameString()) + "\"");
2011+
2012+
if (project.getProjectType().isOpenEphysPlugin());
2013+
s.add ("PLUGIN_GUI_PROJECT_DIR = " + config.openEphysProjectLocation.get().quoted());
2014+
19662015
return s;
19672016
}
19682017

@@ -2754,6 +2803,14 @@ class XCodeProjectExporter : public ProjectExporter
27542803
for (int i = 0; i < numElementsInArray (p); ++i)
27552804
addToExtraSearchPaths (rtasFolder.getChildFile (p[i]));
27562805
}
2806+
2807+
void addOpenEphysPluginSettings()
2808+
{
2809+
extraSearchPaths.add ("$(PLUGIN_GUI_PROJECT_DIR)/JuceLibraryCode");
2810+
extraSearchPaths.add ("$(PLUGIN_GUI_PROJECT_DIR)/JuceLibraryCode/modules");
2811+
extraSearchPaths.add ("$(PLUGIN_GUI_PROJECT_DIR)/Source/Plugins/Headers");
2812+
extraSearchPaths.add ("$(PLUGIN_GUI_PROJECT_DIR)/Source/Plugins/CommonLibs");
2813+
}
27572814

27582815
JUCE_DECLARE_NON_COPYABLE (XCodeProjectExporter)
27592816
};

PluginGenerator/Source/Project Saving/jucer_ProjectSaver.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ class ProjectSaver
8686

8787
checkModuleValidity (modules);
8888

89-
if (errors.size() == 0) writeAppConfigFile (modules, appConfigUserContent);
90-
if (errors.size() == 0) writeBinaryDataFiles();
91-
if (errors.size() == 0) writeAppHeader (modules);
92-
if (errors.size() == 0) writeModuleCppWrappers (modules);
93-
if (errors.size() == 0) writeProjects (modules);
94-
if (errors.size() == 0) writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it)
89+
// Open-Ephys
90+
// if (!project.getProjectType().isOpenEphysPlugin())
91+
// {
92+
const bool oeplugin = project.getProjectType().isOpenEphysPlugin();
93+
if (errors.size() == 0 && !oeplugin) writeAppConfigFile (modules, appConfigUserContent);
94+
if (errors.size() == 0) writeBinaryDataFiles();
95+
if (errors.size() == 0 && !oeplugin) writeAppHeader (modules);
96+
if (errors.size() == 0) writeModuleCppWrappers (modules);
97+
if (errors.size() == 0) writeProjects (modules);
98+
if (errors.size() == 0 && !oeplugin) writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it)
99+
// }
95100

96101
if (errors.size() == 0 && generatedCodeFolder.exists())
97102
writeReadmeFile();

PluginGenerator/Source/Project/jucer_Project.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class Project : public FileBasedDocument,
160160
String getPluginVSTCategoryString();
161161

162162
// <Open Ephys>
163+
Value shouldBuildOpenEphysPlugin() { return getProjectValue ("buildOpenEphys"); }
163164
Value getOpenEphysPluginType() { return getProjectValue ("openEphysPluginType"); }
164165
Value getOpenEphysPluginProcessorType() { return getProjectValue ("openEphysPluginProcessorType"); }
165166
Value getOpenEphysPluginFileSourceSupportedExts() { return getProjectValue ("openEphysFileSourcePluginSupportedExtensions"); }

Source/Processors/PluginManager/PluginIDs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ namespace Ids
4343
DECLARE_OPENEPHYS_ID (DEFAULT_VALUE);
4444
DECLARE_OPENEPHYS_ID (POSSIBLE_VALUES);
4545
}
46+
47+
DECLARE_OPENEPHYS_ID(xcodeOpenEphysProjectLocation);
48+
DECLARE_OPENEPHYS_ID(xcodeOpenEphysBinaryLocation);
4649
}
4750

4851
namespace Plugin

Source/Processors/PluginManager/Templates/openEphys_ProcessorPluginTemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void PROCESSORCLASSNAME::setParameter (int parameterIndex, float newValue)
7777
}
7878

7979

80-
void PROCESSORCLASSNAME::process (AudioSampleBuffer& buffer, MidiBuffer& events)
80+
void PROCESSORCLASSNAME::process (AudioSampleBuffer& buffer)
8181
{
8282
/**
8383
Generic structure for processing buffer data

Source/Processors/PluginManager/Templates/openEphys_ProcessorPluginTemplate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class PROCESSORCLASSNAME : public GenericProcessor
6868
Continuous signals arrive in the "buffer" variable, event data (such as TTLs
6969
and spikes) is contained in the "events" variable.
7070
*/
71-
void process (AudioSampleBuffer& buffer, MidiBuffer& events) override;
71+
void process (AudioSampleBuffer& buffer) override;
7272

7373
/** The method that standard controls on the editor will call.
7474
It is recommended that any variables used by the "process" function

0 commit comments

Comments
 (0)