Skip to content

Commit

Permalink
- added new export dialog for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Hart committed Jan 22, 2025
1 parent 0e71789 commit 0a39f3d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion hi_backend/backend/BackendApplicationCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,7 @@ void BackendCommandTarget::Actions::compileNetworksToDll(BackendRootWindow* bpe)
return;
}

#if JUCE_WINDOWS
#if JUCE_WINDOWS || JUCE_MAC
auto s = new multipage::library::NetworkCompiler(bpe);
s->setModalBaseWindowComponent(bpe);
#else
Expand Down
15 changes: 10 additions & 5 deletions hi_backend/backend/CompileExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ CompileExporter::ErrorCodes CompileExporter::compileSolution(BuildOption buildOp
{
BatchFileCreator::createBatchFile(this, buildOption, types, manager != nullptr);

File batchFile = BatchFileCreator::getBatchFile(this);
File batchFile = BatchFileCreator::getBatchFile(this, manager);

#if JUCE_WINDOWS

Expand All @@ -1178,8 +1178,7 @@ CompileExporter::ErrorCodes CompileExporter::compileSolution(BuildOption buildOp

String permissionCommand = "chmod +x \"" + batchFile.getFullPathName() + "\"";
system(permissionCommand.getCharPointer());

String command = "open \"" + batchFile.getFullPathName() + "\"";
String command = manager != nullptr ? ("sh " + batchFile.getFullPathName()) : ("open " + batchFile.getFullPathName().quoted());

#endif

Expand Down Expand Up @@ -2613,6 +2612,12 @@ void CompileExporter::BatchFileCreator::createBatchFile(CompileExporter* exporte

const String projucerPath = exporter->hisePath.getChildFile("tools/Projucer/Projucer.app/Contents/MacOS/Projucer").getFullPathName();

if(hasChildProcessManager)
{
ADD_LINE("#!/bin/bash");
ADD_LINE("PATH=\"/usr/local/bin:$PATH\"");
}

ADD_LINE("chmod +x \"" << projucerPath << "\"");

ADD_LINE("cd \"`dirname \"$0\"`\"");
Expand Down Expand Up @@ -2664,14 +2669,14 @@ void CompileExporter::BatchFileCreator::createBatchFile(CompileExporter* exporte

#undef ADD_LINE

File CompileExporter::BatchFileCreator::getBatchFile(CompileExporter* exporter)
File CompileExporter::BatchFileCreator::getBatchFile(CompileExporter* exporter, ChildProcessManager* manager)
{
#if JUCE_WINDOWS
return exporter->getBuildFolder().getChildFile("batchCompile.bat");
#elif JUCE_LINUX
return exporter->getBuildFolder().getChildFile("batchCompileLinux.sh");
#else
return exporter->getBuildFolder().getChildFile("batchCompileOSX");
return exporter->getBuildFolder().getChildFile("batchCompileOSX").withFileExtension(manager != nullptr ? ".sh" : "");
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion hi_backend/backend/CompileExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class CompileExporter: public BaseExporter
struct BatchFileCreator
{
static void createBatchFile(CompileExporter* exporter, BuildOption buildOption, TargetTypes types, bool hasChildProcessManager=false);
static File getBatchFile(CompileExporter* exporter);
static File getBatchFile(CompileExporter* exporter, ChildProcessManager* m=nullptr);
};

protected:
Expand Down
36 changes: 26 additions & 10 deletions hi_backend/backend/dialog_library/dialog_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ class NewProjectCreator: public ImporterBase,
};

struct NetworkCompiler: public EncodedDialogBase,
public ChildProcessManager
public ChildProcessManager,
public AsyncUpdater
{
NetworkCompiler(BackendRootWindow* bpe_);

Expand All @@ -304,18 +305,33 @@ struct NetworkCompiler: public EncodedDialogBase,
}
}

void handleAsyncUpdate() override
{
auto m = readState("CompileOutput").toString();

{
SimpleReadWriteLock::ScopedReadLock sl(logLock);
m << "\n" << currentMessage;
currentMessage = {};
}

writeState("CompileOutput", m);

if(auto md = dialog->findPageBaseForID("CompileOutput"))
{
md->postInit();
}
}

void logMessage(const String& message) override
{
auto m = readState("CompileOutput").toString();
m << "\n" << message;
writeState("CompileOutput", m);

if(auto md = dialog->findPageBaseForID("CompileOutput"))
{
MessageManagerLock mm;
md->postInit();
}
SimpleReadWriteLock::ScopedWriteLock sl(logLock);
currentMessage << message;
triggerAsyncUpdate();
}

SimpleReadWriteLock logLock;
String currentMessage;

var onInit(const var::NativeFunctionArgs& args);
var compileTask(const var::NativeFunctionArgs& args);
Expand Down
4 changes: 2 additions & 2 deletions hi_backend/snex_workbench/WorkbenchProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void DspNetworkCompileExporter::writeDebugFileAndShowSolution()

auto hasThirdPartyFiles = includedThirdPartyFiles.isEmpty();

if (hasThirdPartyFiles && PresetHandler::showYesNoWindow("Quit HISE", "Do you want to quit HISE and show VS solution for debugging the DLL? \n> Double click on the solution file, then run the VS debugger and it will open HISE with the ability to set VS breakpoints in your C++ nodes"))
if (hasThirdPartyFiles && managerToUse == nullptr && PresetHandler::showYesNoWindow("Quit HISE", "Do you want to quit HISE and show VS solution for debugging the DLL? \n> Double click on the solution file, then run the VS debugger and it will open HISE with the ability to set VS breakpoints in your C++ nodes"))
{
solutionFile.revealToUser();
JUCEApplication::quit();
Expand All @@ -234,7 +234,7 @@ void DspNetworkCompileExporter::writeDebugFileAndShowSolution()
solutionFolder = solutionFolder.getChildFile("MacOSX");
auto solutionFile = solutionFolder.getChildFile(projectName).withFileExtension("xcodeproj");

if (PresetHandler::showYesNoWindow("Show XCode Project", "Do you want to show the Xcode Project file? \n> Double click on the file to open XCode, then choose `Debug->Attach to Process->HISE Debug` in order to run your C++ node in the Xcode Debugger"))
if (managerToUse == nullptr && PresetHandler::showYesNoWindow("Show XCode Project", "Do you want to show the Xcode Project file? \n> Double click on the file to open XCode, then choose `Debug->Attach to Process->HISE Debug` in order to run your C++ node in the Xcode Debugger"))
{
solutionFile.revealToUser();
}
Expand Down

0 comments on commit 0a39f3d

Please sign in to comment.