Skip to content
24 changes: 13 additions & 11 deletions Source/Heavy/CppExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,37 @@ class CppExporter final : public ExporterBase {
projectCopyrightValue = tree.getProperty("projectCopyrightValue");
}

bool performExport(String pdPatch, String const outdir, String name, String const copyright, StringArray searchPaths) override
bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override
{
exportingView->showState(ExportingProgressView::Exporting);

StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
#if JUCE_WINDOWS
auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/');
#else
auto const heavyPath = heavyExecutable.getFullPathName();
#endif
StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() };

name = name.replaceCharacter('-', '_');
args.add("-n" + name);

if (copyright.isNotEmpty()) {
args.add("--copyright");
args.add("\"" + copyright + "\"");
args.add(copyright.quoted());
}

args.add("-v");

String paths = "-p";
args.add("-p");
for (auto& path : searchPaths) {
paths += " " + path;
args.add(path);
}

args.add(paths);

if (shouldQuit)
return true;

auto compileString = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + compileString + "\n");
start(compileString);
auto const command = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + command + "\n");
Toolchain::startShellScript(command, this);

waitForProcessToFinish(-1);
exportingView->flushConsole();
Expand Down
28 changes: 15 additions & 13 deletions Source/Heavy/DPFExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,22 @@ class DPFExporter final : public ExporterBase {
}
}

bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override
bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override
{
exportingView->showState(ExportingProgressView::Exporting);

StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
#if JUCE_WINDOWS
auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/');
#else
auto const heavyPath = heavyExecutable.getFullPathName();
#endif
StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() };

name = name.replaceCharacter('-', '_');
args.add("-n" + name);

if (copyright.isNotEmpty()) {
args.add("--copyright");
args.add("\"" + copyright + "\"");
args.add(copyright.quoted());
}

auto makerName = getValue<String>(makerNameValue);
Expand Down Expand Up @@ -211,19 +215,17 @@ class DPFExporter final : public ExporterBase {
args.add("-v");
args.add("-gdpf");

String paths = "-p";
args.add("-p");
for (auto& path : searchPaths) {
paths += " " + path;
args.add(path);
}

args.add(paths);

if (shouldQuit)
return true;

auto compileString = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + compileString + "\n");
start(compileString);
auto const command = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + command + "\n");
Toolchain::startShellScript(command, this);

waitForProcessToFinish(-1);
exportingView->flushConsole();
Expand Down Expand Up @@ -268,8 +270,8 @@ class DPFExporter final : public ExporterBase {
auto path = "export PATH=\"$PATH:" + Toolchain::dir.getChildFile("bin").getFullPathName().replaceCharacter('\\', '/') + "\"\n";
auto cc = "CC=" + Toolchain::dir.getChildFile("bin").getChildFile("gcc.exe").getFullPathName().replaceCharacter('\\', '/') + " ";
auto cxx = "CXX=" + Toolchain::dir.getChildFile("bin").getChildFile("g++.exe").getFullPathName().replaceCharacter('\\', '/') + " ";

Toolchain::startShellScript(path + cc + cxx + make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " + makefile.getFullPathName().replaceCharacter('\\', '/'), this);
auto shell = " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted();
Toolchain::startShellScript(path + cc + cxx + make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " + makefile.getFullPathName().replaceCharacter('\\', '/') + shell, this);

#else // Linux or BSD
auto prepareEnvironmentScript = Toolchain::dir.getChildFile("scripts").getChildFile("anywhere-setup.sh").getFullPathName() + "\n";
Expand Down
33 changes: 18 additions & 15 deletions Source/Heavy/DaisyExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class DaisyExporter final : public ExporterBase {
return getExitCode();
}

bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override
bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override
{
auto target = getValue<int>(targetBoardValue) - 1;
bool compile = getValue<int>(exportTypeValue) - 1;
Expand All @@ -248,15 +248,19 @@ class DaisyExporter final : public ExporterBase {
auto rate = getValue<int>(samplerateValue) - 1;
auto size = getValue<int>(patchSizeValue);
auto appType = getValue<int>(appTypeValue);

#if JUCE_WINDOWS
auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/');
#else
auto const heavyPath = heavyExecutable.getFullPathName();
#endif
StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() };

StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };

name = name.replaceCharacter('-', '_');
args.add("-n" + name);

if (copyright.isNotEmpty()) {
args.add("--copyright");
args.add("\"" + copyright + "\"");
args.add(copyright.quoted());
}

// set board definition
Expand Down Expand Up @@ -331,21 +335,19 @@ class DaisyExporter final : public ExporterBase {

metaJson->setProperty("daisy", metaDaisy);
auto metaJsonFile = createMetaJson(metaJson);
args.add("-m" + metaJsonFile.getFullPathName());
args.add("-m" + metaJsonFile.getFullPathName().quoted());

args.add("-v");
args.add("-gdaisy");

String paths = "-p";
args.add("-p");
for (auto& path : searchPaths) {
paths += " " + path;
args.add(path);
}

args.add(paths);

auto compileString = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + compileString + "\n");
start(compileString);
auto const command = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + command + "\n");
Toolchain::startShellScript(command, this);
waitForProcessToFinish(-1);
exportingView->flushConsole();

Expand Down Expand Up @@ -385,15 +387,16 @@ class DaisyExporter final : public ExporterBase {
#if JUCE_WINDOWS
auto buildScript = make.getFullPathName().replaceCharacter('\\', '/')
+ " -j4 -f "
+ sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/')
+ sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/').quoted()
+ " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted()
+ " GCC_PATH="
+ gccPath.replaceCharacter('\\', '/')
+ " PROJECT_NAME=" + name;

Toolchain::startShellScript(buildScript, this);
#else
String buildScript = make.getFullPathName()
+ " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName()
+ " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName().quoted()
+ " GCC_PATH=" + gccPath
+ " PROJECT_NAME=" + name;

Expand Down
30 changes: 19 additions & 11 deletions Source/Heavy/ExporterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ struct ExporterBase : public Component

void startExport(File const& outDir)
{
#if JUCE_WINDOWS
auto const patchPath = patchFile.getFullPathName().replaceCharacter('\\', '/');
auto const& outPath = outDir.getFullPathName().replaceCharacter('\\', '/');
#else
auto patchPath = patchFile.getFullPathName();
auto const& outPath = outDir.getFullPathName();
#endif

auto projectTitle = projectNameValue.toString();
auto projectCopyright = projectCopyrightValue.toString();

Expand All @@ -138,33 +144,35 @@ struct ExporterBase : public Component
else
projectTitle = "Untitled";
}
projectTitle = projectTitle.replaceCharacter('-', '_');

// Add original file location to search paths
auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName() };

auto searchPaths = StringArray {};
if (realPatchFile.existsAsFile() && !realPatchFile.isRoot()) // Make sure file actually exists
{
#if JUCE_WINDOWS
searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().replaceCharacter('\\', '/').quoted());
#else
searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().quoted());
#endif
}
editor->pd->setThis();

// Get pd's search paths
char* paths[1024];
int numItems;
pd::Interface::getSearchPaths(paths, &numItems);

if (realPatchFile.existsAsFile()) {
searchPaths.add(realPatchFile.getParentDirectory().getFullPathName());
}

for (int i = 0; i < numItems; i++) {
searchPaths.add(paths[i]);
searchPaths.add(String(paths[i]).quoted());
}

// Make sure we don't add the file location twice
searchPaths.removeDuplicates(false);

addJob([this, patchPath, outPath, projectTitle, projectCopyright, searchPaths]() mutable {
exportingView->monitorProcessOutput(this);

exportingView->showState(ExportingProgressView::Exporting);

auto const result = performExport(patchPath, outPath, projectTitle, projectCopyright, searchPaths);

if (shouldQuit)
Expand Down Expand Up @@ -223,5 +231,5 @@ struct ExporterBase : public Component
}

private:
virtual bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) = 0;
virtual bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) = 0;
};
26 changes: 14 additions & 12 deletions Source/Heavy/OWLExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,37 +86,38 @@ class OWLExporter : public ExporterBase {
storeSlotProperty->setEnabled(exportType == 4);
}

bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override
bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override
{
auto target = getValue<int>(targetBoardValue);
bool compile = getValue<int>(exportTypeValue) - 1;
bool load = getValue<int>(exportTypeValue) == 3;
bool store = getValue<int>(exportTypeValue) == 4;
int slot = getValue<int>(storeSlotValue);

StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
#if JUCE_WINDOWS
auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/');
#else
auto const heavyPath = heavyExecutable.getFullPathName();
#endif
StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() };

name = name.replaceCharacter('-', '_');
args.add("-n" + name);

if (copyright.isNotEmpty()) {
args.add("--copyright");
args.add("\"" + copyright + "\"");
args.add(copyright.quoted());
}

args.add("-v");
args.add("-gOWL");

String paths = "-p";
args.add("-p");
for (auto& path : searchPaths) {
paths += " " + path;
args.add(path);
}

args.add(paths);

auto compileString = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + compileString + "\n");
start(compileString);
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
start(args);

waitForProcessToFinish(-1);
exportingView->flushConsole();
Expand Down Expand Up @@ -164,7 +165,8 @@ class OWLExporter : public ExporterBase {
+ " BUILD=../"
+ " PATCHNAME=" + name
+ " PATCHCLASS=HeavyPatch"
+ " PATCHFILE=HeavyOWL_" + name + ".hpp";
+ " PATCHFILE=HeavyOWL_" + name + ".hpp"
+ " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted();
#else
buildScript += make.getFullPathName()
+ " -j4"
Expand Down
27 changes: 15 additions & 12 deletions Source/Heavy/PdExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,38 @@ class PdExporter final : public ExporterBase {
}
}

bool performExport(String pdPatch, String const outdir, String name, String const copyright, StringArray searchPaths) override
bool performExport(String const& pdPatch, String const& outdir, String const &name, String const& copyright, StringArray const& searchPaths) override
{
exportingView->showState(ExportingProgressView::Exporting);

StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
#if JUCE_WINDOWS
auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/');
#else
auto const heavyPath = heavyExecutable.getFullPathName();
#endif
StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() };

name = name.replaceCharacter('-', '_');
args.add("-n" + name);

if (copyright.isNotEmpty()) {
args.add("--copyright");
args.add("\"" + copyright + "\"");
args.add(copyright.quoted());
}

args.add("-v");
args.add("-gpdext");

String paths = "-p";
args.add("-p");
for (auto& path : searchPaths) {
paths += " " + path;
args.add(path);
}

args.add(paths);

if (shouldQuit)
return true;

auto compileString = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + compileString + "\n");
start(compileString);
auto const command = args.joinIntoString(" ");
exportingView->logToConsole("Command: " + command + "\n");
Toolchain::startShellScript(command, this);

waitForProcessToFinish(-1);
exportingView->flushConsole();
Expand Down Expand Up @@ -130,8 +132,9 @@ class PdExporter final : public ExporterBase {
auto cc = "CC=" + Toolchain::dir.getChildFile("bin").getChildFile("gcc.exe").getFullPathName().replaceCharacter('\\', '/') + " ";
auto cxx = "CXX=" + Toolchain::dir.getChildFile("bin").getChildFile("g++.exe").getFullPathName().replaceCharacter('\\', '/') + " ";
auto pdbindir = "PDBINDIR=\"" + pdDll.getFullPathName().replaceCharacter('\\', '/') + "\" ";
auto shell = " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted();

Toolchain::startShellScript(path + cc + cxx + pdbindir + make.getFullPathName().replaceCharacter('\\', '/') + " -j4", this);
Toolchain::startShellScript(path + cc + cxx + pdbindir + make.getFullPathName().replaceCharacter('\\', '/') + " -j4" + shell, this);

#else // Linux or BSD
auto prepareEnvironmentScript = Toolchain::dir.getChildFile("scripts").getChildFile("anywhere-setup.sh").getFullPathName() + "\n";
Expand Down
6 changes: 3 additions & 3 deletions Source/Heavy/Toolchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ class ToolchainInstaller final : public Component
int statusCode = 0;

#if JUCE_WINDOWS
String downloadSize = "1.2 GB";
String downloadSize = "1.13 GB";
#elif JUCE_MAC
String downloadSize = "457 MB";
String downloadSize = "460 MB";
#else
String downloadSize = "1.1 GB";
String downloadSize = "799 MB";
#endif

class ToolchainInstallerButton final : public Component {
Expand Down
Loading
Loading