4 Commits

Author SHA1 Message Date
27cd6a339d wxwidgets source build 2025-06-28 20:25:24 +02:00
ef4de7fa43 macos bundle 2025-06-28 17:45:52 +02:00
fee594b56e default bundle path DHFS_BUNDLE_PATH 2025-06-28 17:13:14 +02:00
f3ba0d810a check if DHFS_BUNDLE_PATH is set 2025-06-26 18:03:06 +02:00
5 changed files with 51 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.10)
project(launcher)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
@@ -28,6 +30,8 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_link_options(-O3)
endif ()
include(wxWidgets)
add_subdirectory(utils)
add_subdirectory(backend)
add_subdirectory(gui)

View File

@@ -1,8 +1,3 @@
find_package(wxWidgets REQUIRED COMPONENTS base)
if (wxWidgets_USE_FILE) # not defined in CONFIG mode
include(${wxWidgets_USE_FILE})
endif ()
add_library(backend
src/DhfsInstance.cpp
include_public/DhfsInstance.hpp

View File

@@ -0,0 +1,26 @@
# if linux
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(wxWidgets_IN_TREE_BUILD "Build wxWidgets in-tree" OFF)
else ()
option(wxWidgets_IN_TREE_BUILD "Build wxWidgets in-tree" ON)
endif ()
if (wxWidgets_IN_TREE_BUILD)
message(STATUS "Building wxWidgets in-tree")
include(FetchContent)
set(wxBUILD_SHARED OFF)
FetchContent_Declare(wx
GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
GIT_TAG v3.2.8.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(wx)
set(wxWidgets_LIBRARIES wx::core wx::base wx::webview wx::net)
else ()
message(STATUS "Using system wxWidgets")
find_package(wxWidgets REQUIRED COMPONENTS net core base webview)
if (wxWidgets_USE_FILE) # not defined in CONFIG mode
include(${wxWidgets_USE_FILE})
endif ()
endif ()

View File

@@ -1,9 +1,3 @@
find_package(wxWidgets REQUIRED COMPONENTS net core base webview)
if (wxWidgets_USE_FILE) # not defined in CONFIG mode
include(${wxWidgets_USE_FILE})
endif ()
add_executable(launcher
src/LauncherApp.cpp
src/GLauncherApp.cpp
@@ -13,4 +7,10 @@ add_executable(launcher
)
target_link_libraries(launcher ${wxWidgets_LIBRARIES})
target_link_libraries(launcher backend utils)
target_link_libraries(launcher backend utils)
set_target_properties(launcher PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_GUI_IDENTIFIER "com.usatiuk.dhfs.launcher"
MACOSX_BUNDLE_BUNDLE_NAME "DHFS Launcher"
)

View File

@@ -2,12 +2,24 @@
#include <iostream>
#include <wx/fileconf.h>
#include <wx/stdpaths.h>
#include <filesystem>
#include "Exception.h"
wxDEFINE_EVENT(NEW_LINE_OUTPUT_EVENT, wxCommandEvent);
wxDEFINE_EVENT(DHFS_STATE_CHANGE_EVENT, wxCommandEvent);
std::string getBundlePath() {
if (wxGetenv("DHFS_BUNDLE_PATH") == NULL)
return std::filesystem::path(wxStandardPaths::Get().GetExecutablePath().ToStdString())
#ifndef __APPLE__
.parent_path()
#endif
.parent_path().string();
return wxGetenv("DHFS_BUNDLE_PATH");
}
LauncherAppMainFrame::LauncherAppMainFrame(wxWindow* parent)
: MainFrame(parent) {
m_javaHomeDirPicker->SetPath(wxFileConfig::Get()->Read(kJavaHomeSettingsKey));
@@ -79,9 +91,8 @@ void LauncherAppMainFrame::OnStartStopButtonClick(wxCommandEvent& event) {
options.xmx = "512m";
options.mount_path = wxFileConfig::Get()->Read(kMountPointSettingsKey);
options.data_path = wxFileConfig::Get()->Read(kDataDirSettingsKey);
std::string bundlePath = wxGetenv("DHFS_BUNDLE_PATH");
options.jar_path = bundlePath + "/app/Server/quarkus-run.jar";
options.webui_path = bundlePath + "/app/Webui";
options.jar_path = getBundlePath() + "/app/Server/quarkus-run.jar";
options.webui_path = getBundlePath() + "/app/Webui";
_dhfsInstance.start(options);
break;