Skip to content

Commit 36bf744

Browse files
authored
Merge pull request #187 from kmichaelfox/fix/projectGenerator
Fix project generator for Visual Studio and Xcode
2 parents a971ee3 + 3d29036 commit 36bf744

13 files changed

Lines changed: 1720 additions & 1544 deletions

PluginGenerator/JuceLibraryCode/BinaryData.cpp

Lines changed: 1513 additions & 1513 deletions
Large diffs are not rendered by default.

PluginGenerator/JuceLibraryCode/BinaryData.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ namespace BinaryData
1616
const int OE_GUI_MoonShard_hSize = 2656;
1717

1818
extern const char* openEphys_DataThreadPluginTemplate_cpp;
19-
const int openEphys_DataThreadPluginTemplate_cppSize = 1561;
19+
const int openEphys_DataThreadPluginTemplate_cppSize = 1627;
2020

2121
extern const char* openEphys_DataThreadPluginTemplate_h;
22-
const int openEphys_DataThreadPluginTemplate_hSize = 1817;
22+
const int openEphys_DataThreadPluginTemplate_hSize = 1881;
2323

2424
extern const char* openEphys_FileSourcePluginTemplate_cpp;
25-
const int openEphys_FileSourcePluginTemplate_cppSize = 1487;
25+
const int openEphys_FileSourcePluginTemplate_cppSize = 1560;
2626

2727
extern const char* openEphys_FileSourcePluginTemplate_h;
28-
const int openEphys_FileSourcePluginTemplate_hSize = 1450;
28+
const int openEphys_FileSourcePluginTemplate_hSize = 1501;
2929

3030
extern const char* openEphys_OpenEphysLibTemplate_cpp;
31-
const int openEphys_OpenEphysLibTemplate_cppSize = 4255;
31+
const int openEphys_OpenEphysLibTemplate_cppSize = 4366;
3232

3333
extern const char* openEphys_PluginMakefile_example;
34-
const int openEphys_PluginMakefile_exampleSize = 923;
34+
const int openEphys_PluginMakefile_exampleSize = 968;
3535

3636
extern const char* openEphys_ProcessorContentComponentTemplate_cpp;
3737
const int openEphys_ProcessorContentComponentTemplate_cppSize = 2993;
@@ -40,34 +40,34 @@ namespace BinaryData
4040
const int openEphys_ProcessorContentComponentTemplate_hSize = 2348;
4141

4242
extern const char* openEphys_ProcessorEditorPluginTemplate_cpp;
43-
const int openEphys_ProcessorEditorPluginTemplate_cppSize = 4043;
43+
const int openEphys_ProcessorEditorPluginTemplate_cppSize = 4153;
4444

4545
extern const char* openEphys_ProcessorEditorPluginTemplate_h;
46-
const int openEphys_ProcessorEditorPluginTemplate_hSize = 3454;
46+
const int openEphys_ProcessorEditorPluginTemplate_hSize = 3550;
4747

4848
extern const char* openEphys_ProcessorPluginTemplate_cpp;
49-
const int openEphys_ProcessorPluginTemplate_cppSize = 6425;
49+
const int openEphys_ProcessorPluginTemplate_cppSize = 6598;
5050

5151
extern const char* openEphys_ProcessorPluginTemplate_h;
52-
const int openEphys_ProcessorPluginTemplate_hSize = 3746;
52+
const int openEphys_ProcessorPluginTemplate_hSize = 3832;
5353

5454
extern const char* openEphys_ProcessorVisualizerCanvasTemplate_cpp;
55-
const int openEphys_ProcessorVisualizerCanvasTemplate_cppSize = 1972;
55+
const int openEphys_ProcessorVisualizerCanvasTemplate_cppSize = 2057;
5656

5757
extern const char* openEphys_ProcessorVisualizerCanvasTemplate_h;
58-
const int openEphys_ProcessorVisualizerCanvasTemplate_hSize = 2797;
58+
const int openEphys_ProcessorVisualizerCanvasTemplate_hSize = 2881;
5959

6060
extern const char* openEphys_ProcessorVisualizerEditorPluginTemplate_cpp;
61-
const int openEphys_ProcessorVisualizerEditorPluginTemplate_cppSize = 4286;
61+
const int openEphys_ProcessorVisualizerEditorPluginTemplate_cppSize = 4406;
6262

6363
extern const char* openEphys_ProcessorVisualizerEditorPluginTemplate_h;
64-
const int openEphys_ProcessorVisualizerEditorPluginTemplate_hSize = 3306;
64+
const int openEphys_ProcessorVisualizerEditorPluginTemplate_hSize = 3403;
6565

6666
extern const char* openEphys_RecordEnginePluginTemplate_cpp;
67-
const int openEphys_RecordEnginePluginTemplate_cppSize = 2169;
67+
const int openEphys_RecordEnginePluginTemplate_cppSize = 2270;
6868

6969
extern const char* openEphys_RecordEnginePluginTemplate_h;
70-
const int openEphys_RecordEnginePluginTemplate_hSize = 2052;
70+
const int openEphys_RecordEnginePluginTemplate_hSize = 2113;
7171

7272
extern const char* jucer_AnimatedComponentTemplate_cpp;
7373
const int jucer_AnimatedComponentTemplate_cppSize = 1949;

PluginGenerator/Source/Project Saving/jucer_ProjectExport_MSVC.h

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@
2424

2525
class MSVCProjectExporterBase : public ProjectExporter
2626
{
27+
// Open-Ephys
28+
protected:
29+
CachedValue<String> openEphysProjectLocation;
30+
2731
public:
2832
MSVCProjectExporterBase (Project& p, const ValueTree& t, const char* const folderName)
29-
: ProjectExporter (p, t)
33+
: ProjectExporter (p, t),
34+
openEphysProjectLocation(settings, Ids::msvcOpenEphysProjectLocation, nullptr, "../../../plugin-gui")
3035
{
36+
msvcFolderName = folderName; // Open-Ephys
37+
msvcFolderName += "\\";
38+
3139
if (getTargetLocationString().isEmpty())
3240
getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName;
3341

@@ -84,8 +92,12 @@ class MSVCProjectExporterBase : public ProjectExporter
8492
#endif
8593
}
8694

87-
void createExporterProperties (PropertyListBuilder&) override
95+
void createExporterProperties (PropertyListBuilder& props) override
8896
{
97+
// Open-Ephys
98+
if (isOpenEphysPlugin())
99+
props.add(new TextPropertyComponent(openEphysProjectLocation.getPropertyAsValue(), "Plugin GUI Project Location", 1024, false),
100+
"The location of the Open-Ephys plugin-gui project root directory.");
89101
}
90102

91103
enum OptimisationLevel
@@ -122,6 +134,11 @@ class MSVCProjectExporterBase : public ProjectExporter
122134
msvcExtraPreprocessorDefs.set ("_LIB", "");
123135
msvcIsDLL = true;
124136
}
137+
else if (type.isOpenEphysPlugin())
138+
{
139+
msvcTargetSuffix = ".dll";
140+
addOpenEphysPluginSettings();
141+
}
125142
else if (type.isAudioPlugin())
126143
{
127144
msvcTargetSuffix = ".dll";
@@ -152,6 +169,77 @@ class MSVCProjectExporterBase : public ProjectExporter
152169
: CppTokeniserFunctions::addEscapeChars (rebasedPath).quoted();
153170
}
154171

172+
// Open-Ephys
173+
virtual void createDefaultConfigs() override
174+
{
175+
for (int i = 0; i < 4; ++i)
176+
{
177+
addNewConfiguration(nullptr);
178+
BuildConfiguration::Ptr config(getConfiguration(i));
179+
180+
const bool debugConfig = i % 2 == 0;
181+
const bool is64Bit = i >= 2;
182+
183+
String name = debugConfig ? "Debug" : "Release";
184+
if (is64Bit) name += "64";
185+
config->getNameValue() = name;
186+
config->isDebugValue() = debugConfig;
187+
config->getOptimisationLevel() = config->getDefaultOptimisationLevel();
188+
config->getTargetBinaryName() = project.getProjectFilenameRoot();
189+
if (is64Bit) config->getValue(Ids::winArchitecture).setValue("x64");
190+
}
191+
}
192+
193+
// Open-Ephys
194+
void addOpenEphysPluginSettings()
195+
{
196+
msvcExtraPreprocessorDefs.set("_LIB", "");
197+
msvcExtraPreprocessorDefs.set("OEPLUGIN", "");
198+
msvcIsDLL = true;
199+
msvcIsOpenEphysPlugin = true;
200+
201+
202+
203+
String pluginGuiDir = "$(GuiDir)";
204+
extraSearchPaths.add(pluginGuiDir + "JuceLibraryCode\\");
205+
extraSearchPaths.add(pluginGuiDir + "JuceLibraryCode\\modules\\");
206+
extraSearchPaths.add(pluginGuiDir + "Source\\Plugins\\Headers");
207+
extraSearchPaths.add(pluginGuiDir + "Source\\Plugins\\CommonHeaders");
208+
209+
// create the 64 bit configurations
210+
String buildDir = pluginGuiDir + "Builds\\" + msvcFolderName + "\\";
211+
/*int numConfigs = getNumConfigurations();
212+
for (int i = numConfigs; i < numConfigs+2; ++i)
213+
{
214+
addNewConfiguration(nullptr);
215+
BuildConfiguration::Ptr config(getConfiguration(i));
216+
217+
const bool debugConfig = i % 2 == 0;
218+
const bool is64Bit = i >= 2;
219+
220+
config->getNameValue() = debugConfig ? "Debug64" : "Release64";
221+
config->isDebugValue() = debugConfig;
222+
config->getOptimisationLevel() = config->getDefaultOptimisationLevel();
223+
config->getTargetBinaryName() = project.getProjectFilenameRoot();
224+
config->getValue(Ids::winArchitecture).setValue("x64");
225+
}*/
226+
227+
for (ProjectExporter::ConfigIterator config(*this); config.next();)
228+
{
229+
if (config->getValue (Ids::useRuntimeLibDLL).getValue().isVoid())
230+
config->getValue (Ids::useRuntimeLibDLL) = true;
231+
232+
String libraryPath = config->getLibrarySearchPathString();
233+
bool is64Bit = config->getValue(Ids::winArchitecture).getValue() == "x64";
234+
String configuration = config->isDebug() ? "Debug" : "Release";
235+
if (is64Bit) configuration += "64";
236+
String configurationPath = (is64Bit ? "x64\\" : "") + configuration + "\\bin\\";
237+
config->getLibrarySearchPathValue().setValue("$(GuiDir)Builds\\" + msvcFolderName + configurationPath + ";" + libraryPath);
238+
}
239+
240+
getExternalLibraries().setValue("open-ephys.lib " + getExternalLibrariesString());
241+
}
242+
155243
void addVSTPluginSettings (bool isVST3)
156244
{
157245
RelativePath modulePath (rebaseFromProjectFolderToBuildTarget (RelativePath (getPathForModuleString ("juce_audio_plugin_client"),
@@ -256,11 +344,13 @@ class MSVCProjectExporterBase : public ProjectExporter
256344
//==============================================================================
257345
String projectGUID;
258346
mutable File rcFile, iconFile;
347+
String msvcFolderName;
259348

260349
File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); }
261350
File getSLNFile() const { return getProjectFile (".sln"); }
262351

263352
bool isLibraryDLL() const { return msvcIsDLL || projectType.isDynamicLibrary(); }
353+
bool isOpenEphysPlugin() const { return msvcIsOpenEphysPlugin || projectType.isOpenEphysPlugin(); }
264354

265355
static String prependIfNotAbsolute (const String& file, const char* prefix)
266356
{
@@ -347,6 +437,9 @@ class MSVCProjectExporterBase : public ProjectExporter
347437
String getCharacterSet() const { return config [Ids::characterSet].toString(); }
348438
Value getCharacterSetValue() { return getValue (Ids::characterSet); }
349439

440+
String getOpenEphysProjectDir() const { return config[Ids::msvcOpenEphysProjectLocation].toString(); }
441+
Value getOpenEphysProjectDirValue() { return getValue(Ids::msvcOpenEphysProjectLocation); }
442+
350443
String getOutputFilename (const String& suffix, bool forceSuffix) const
351444
{
352445
const String target (File::createLegalFileName (getTargetBinaryNameString().trim()));
@@ -473,6 +566,9 @@ class MSVCProjectExporterBase : public ProjectExporter
473566
StringArray getHeaderSearchPaths (const BuildConfiguration& config) const
474567
{
475568
StringArray searchPaths (extraSearchPaths);
569+
570+
if (isLibraryDLL())
571+
476572
searchPaths.addArray (config.getHeaderSearchPaths());
477573
return getCleanedStringArray (searchPaths);
478574
}
@@ -755,6 +851,10 @@ class MSVCProjectExporterBase : public ProjectExporter
755851
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder),
756852
Ids::rtasPath,
757853
TargetOS::windows)));
854+
855+
/*openEphysPath.referTo (Value (new DependencyPathValueSource (getSetting(Ids::msvcOpenEphysProjectLocation),
856+
Ids::msvcOpenEphysProjectLocation,
857+
TargetOS::windows)));*/
758858
}
759859

760860
static bool shouldUseStdCall (const RelativePath& path)
@@ -1396,6 +1496,10 @@ class MSVCProjectExporterVC2010 : public MSVCProjectExporterBase
13961496
{
13971497
XmlElement* e = projectXml.createNewChildElement ("PropertyGroup");
13981498
e->setAttribute ("Label", "UserMacros");
1499+
XmlElement* p = e->createNewChildElement("GuiDir");
1500+
String pathname = File::getCurrentWorkingDirectory().getChildFile(String(openEphysProjectLocation)).getFullPathName();
1501+
if (pathname.getLastCharacters(1) != "\\") pathname.append("\\", 1);
1502+
p->addTextElement(pathname);
13991503
}
14001504

14011505
{

0 commit comments

Comments
 (0)