Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirasawaSama committed Dec 10, 2023
1 parent dd84569 commit 525f91e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ARA_SDK
Submodule ARA_SDK updated 2 files
+1 −1 ARA_Examples
+1 −1 ARA_Library
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ endif()
if (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinSizeRel)
add_definitions(-DNDEBUG)

if (NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -ftree-vectorize")
if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -ftree-vectorize")
endif()
endif()

Expand Down
21 changes: 17 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
namespace juce { extern void initialiseNSApplication(); }
#endif

class simple_msgbox : private juce::ModalComponentManager::Callback {
public:
void modalStateFinished(int) override { juce::MessageManager::getInstance()->stopDispatchLoop(); }
static void show(const juce::String& text) {
juce::initialiseJuce_GUI();
juce::NativeMessageBox::showMessageBoxAsync(juce::MessageBoxIconType::WarningIcon, "EIMHost", text, nullptr, new simple_msgbox);
juce::MessageManager::getInstance()->runDispatchLoop();
juce::shutdownJuce_GUI();
}
};

int main(int argc, char* argv[]) {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
Expand Down Expand Up @@ -123,9 +134,10 @@ int main(int argc, char* argv[]) {
#else
auto javaFile = "java";
#endif
juce::File file(juce::String("./jre/bin/") + javaFile);
auto currentExec = juce::File::getSpecialLocation(juce::File::SpecialLocationType::currentExecutableFile);
auto file = currentExec.getSiblingFile("jre/bin").getChildFile(javaFile);
if (file.exists()) {
juce::File vmoptions("./.vmoptions");
auto vmoptions = currentExec.getSiblingFile(".vmoptions");
juce::StringArray arr;
if (vmoptions.exists()) vmoptions.readLines(arr);
arr.insert(0, file.getFullPathName());
Expand All @@ -134,8 +146,9 @@ int main(int argc, char* argv[]) {
juce::ChildProcess process;
process.start(arr);
} else {
std::cout << "Cannot find java!\n";
fflush(stdout);
std::cerr << "Cannot find java!\n";
fflush(stderr);
simple_msgbox::show("Java Runtime Environment not found.\nPlease install Java Runtime Environment 21 or higher.");
}
}
return 0;
Expand Down

0 comments on commit 525f91e

Please sign in to comment.