|
24 | 24 |
|
25 | 25 | class MSVCProjectExporterBase : public ProjectExporter |
26 | 26 | { |
| 27 | + // Open-Ephys |
| 28 | +protected: |
| 29 | + CachedValue<String> openEphysProjectLocation; |
| 30 | + |
27 | 31 | public: |
28 | 32 | 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") |
30 | 35 | { |
| 36 | + msvcFolderName = folderName; // Open-Ephys |
| 37 | + msvcFolderName += "\\"; |
| 38 | + |
31 | 39 | if (getTargetLocationString().isEmpty()) |
32 | 40 | getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName; |
33 | 41 |
|
@@ -84,8 +92,12 @@ class MSVCProjectExporterBase : public ProjectExporter |
84 | 92 | #endif |
85 | 93 | } |
86 | 94 |
|
87 | | - void createExporterProperties (PropertyListBuilder&) override |
| 95 | + void createExporterProperties (PropertyListBuilder& props) override |
88 | 96 | { |
| 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."); |
89 | 101 | } |
90 | 102 |
|
91 | 103 | enum OptimisationLevel |
@@ -122,6 +134,11 @@ class MSVCProjectExporterBase : public ProjectExporter |
122 | 134 | msvcExtraPreprocessorDefs.set ("_LIB", ""); |
123 | 135 | msvcIsDLL = true; |
124 | 136 | } |
| 137 | + else if (type.isOpenEphysPlugin()) |
| 138 | + { |
| 139 | + msvcTargetSuffix = ".dll"; |
| 140 | + addOpenEphysPluginSettings(); |
| 141 | + } |
125 | 142 | else if (type.isAudioPlugin()) |
126 | 143 | { |
127 | 144 | msvcTargetSuffix = ".dll"; |
@@ -152,6 +169,77 @@ class MSVCProjectExporterBase : public ProjectExporter |
152 | 169 | : CppTokeniserFunctions::addEscapeChars (rebasedPath).quoted(); |
153 | 170 | } |
154 | 171 |
|
| 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 | + |
155 | 243 | void addVSTPluginSettings (bool isVST3) |
156 | 244 | { |
157 | 245 | RelativePath modulePath (rebaseFromProjectFolderToBuildTarget (RelativePath (getPathForModuleString ("juce_audio_plugin_client"), |
@@ -256,11 +344,13 @@ class MSVCProjectExporterBase : public ProjectExporter |
256 | 344 | //============================================================================== |
257 | 345 | String projectGUID; |
258 | 346 | mutable File rcFile, iconFile; |
| 347 | + String msvcFolderName; |
259 | 348 |
|
260 | 349 | File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } |
261 | 350 | File getSLNFile() const { return getProjectFile (".sln"); } |
262 | 351 |
|
263 | 352 | bool isLibraryDLL() const { return msvcIsDLL || projectType.isDynamicLibrary(); } |
| 353 | + bool isOpenEphysPlugin() const { return msvcIsOpenEphysPlugin || projectType.isOpenEphysPlugin(); } |
264 | 354 |
|
265 | 355 | static String prependIfNotAbsolute (const String& file, const char* prefix) |
266 | 356 | { |
@@ -347,6 +437,9 @@ class MSVCProjectExporterBase : public ProjectExporter |
347 | 437 | String getCharacterSet() const { return config [Ids::characterSet].toString(); } |
348 | 438 | Value getCharacterSetValue() { return getValue (Ids::characterSet); } |
349 | 439 |
|
| 440 | + String getOpenEphysProjectDir() const { return config[Ids::msvcOpenEphysProjectLocation].toString(); } |
| 441 | + Value getOpenEphysProjectDirValue() { return getValue(Ids::msvcOpenEphysProjectLocation); } |
| 442 | + |
350 | 443 | String getOutputFilename (const String& suffix, bool forceSuffix) const |
351 | 444 | { |
352 | 445 | const String target (File::createLegalFileName (getTargetBinaryNameString().trim())); |
@@ -473,6 +566,9 @@ class MSVCProjectExporterBase : public ProjectExporter |
473 | 566 | StringArray getHeaderSearchPaths (const BuildConfiguration& config) const |
474 | 567 | { |
475 | 568 | StringArray searchPaths (extraSearchPaths); |
| 569 | + |
| 570 | + if (isLibraryDLL()) |
| 571 | + |
476 | 572 | searchPaths.addArray (config.getHeaderSearchPaths()); |
477 | 573 | return getCleanedStringArray (searchPaths); |
478 | 574 | } |
@@ -755,6 +851,10 @@ class MSVCProjectExporterBase : public ProjectExporter |
755 | 851 | rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), |
756 | 852 | Ids::rtasPath, |
757 | 853 | TargetOS::windows))); |
| 854 | + |
| 855 | + /*openEphysPath.referTo (Value (new DependencyPathValueSource (getSetting(Ids::msvcOpenEphysProjectLocation), |
| 856 | + Ids::msvcOpenEphysProjectLocation, |
| 857 | + TargetOS::windows)));*/ |
758 | 858 | } |
759 | 859 |
|
760 | 860 | static bool shouldUseStdCall (const RelativePath& path) |
@@ -1396,6 +1496,10 @@ class MSVCProjectExporterVC2010 : public MSVCProjectExporterBase |
1396 | 1496 | { |
1397 | 1497 | XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); |
1398 | 1498 | 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); |
1399 | 1503 | } |
1400 | 1504 |
|
1401 | 1505 | { |
|
0 commit comments