Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ flatbuild

# Snap
*.snap

# Rust
launcher/hematite/target
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15) # minimum version required by QuaZip
cmake_minimum_required(VERSION 3.15) # minimum version required by QuaZip & Corrosion

project(Launcher)

Expand Down Expand Up @@ -332,13 +332,17 @@ endif()

if(Launcher_QT_VERSION_MAJOR EQUAL 5)
include(ECMQueryQt)
# ecm_query_qt(QT_BINS_DIR QT_INSTALL_BINS)
ecm_query_qt(QT_PLUGINS_DIR QT_INSTALL_PLUGINS)
ecm_query_qt(QT_LIBS_DIR QT_INSTALL_LIBS)
ecm_query_qt(QT_LIBEXECS_DIR QT_INSTALL_LIBEXECS)
# ecm_query_qt(QT_QML_DIR QT_INSTALL_QML)
else()
# set(QT_BINS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_BINS})
set(QT_PLUGINS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_PLUGINS})
set(QT_LIBS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBS})
set(QT_LIBEXECS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBEXECS})
# set(QT_QML_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_QML})
endif()

# NOTE: Qt 6 already sets this by default
Expand Down Expand Up @@ -384,6 +388,7 @@ if(UNIX AND APPLE)
set(PLUGIN_DEST_DIR "${Launcher_Name}.app/Contents/MacOS")
set(FRAMEWORK_DEST_DIR "${Launcher_Name}.app/Contents/Frameworks")
set(RESOURCES_DEST_DIR "${Launcher_Name}.app/Contents/Resources")
# set(QML_DEST_DIR "${RESOURCES_DEST_DIR}/qml")
set(JARS_DEST_DIR "${Launcher_Name}.app/Contents/MacOS/jars")

# Apps to bundle
Expand Down Expand Up @@ -442,7 +447,8 @@ elseif(UNIX)
set(PLUGIN_DEST_DIR "plugins")
set(BUNDLE_DEST_DIR ".")
set(RESOURCES_DEST_DIR ".")

# set(QML_DEST_DIR "qml")

# Apps to bundle
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${Launcher_APP_BINARY_NAME}")

Expand All @@ -463,6 +469,7 @@ elseif(WIN32)
set(LIBRARY_DEST_DIR ".")
set(PLUGIN_DEST_DIR ".")
set(RESOURCES_DEST_DIR ".")
# set(QML_DEST_DIR "qml")
set(JARS_DEST_DIR "jars")

# Apps to bundle
Expand Down
6 changes: 5 additions & 1 deletion launcher/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
#include "WindowsConsole.h"
#endif

#include "hematite_static/src/log.cxx.h"

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

Expand Down Expand Up @@ -502,6 +504,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
QLoggingCategory::setFilterRules(rules_str);
}

prism::hematite::log::setup_rust_tracing_qdebug();

qDebug() << "<> Log initialized.";
}

Expand Down Expand Up @@ -1938,4 +1942,4 @@ bool Application::checkQSavePath(QString path)
}
}
return false;
}
}
48 changes: 41 additions & 7 deletions launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set(CORE_SOURCES
MTPixmapCache.h
)
if (UNIX AND NOT CYGWIN AND NOT APPLE)
set(CORE_SOURCES
set(CORE_SOURCES
${CORE_SOURCES}

# MangoHud
Expand Down Expand Up @@ -1140,7 +1140,7 @@ SET(LAUNCHER_SOURCES
)

if (NOT Apple)
set(LAUNCHER_SOURCES
set(LAUNCHER_SOURCES
${LAUNCHER_SOURCES}

ui/dialogs/UpdateAvailableDialog.h
Expand Down Expand Up @@ -1310,11 +1310,11 @@ if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks/")

if(Launcher_ENABLE_UPDATER)
file(DOWNLOAD ${MACOSX_SPARKLE_DOWNLOAD_URL} ${CMAKE_BINARY_DIR}/Sparkle.tar.xz EXPECTED_HASH SHA256=${MACOSX_SPARKLE_SHA256})
file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/Sparkle.tar.xz DESTINATION ${CMAKE_BINARY_DIR}/frameworks/Sparkle)
file(DOWNLOAD ${MACOSX_SPARKLE_DOWNLOAD_URL} ${CMAKE_BINARY_DIR}/Sparkle.tar.xz EXPECTED_HASH SHA256=${MACOSX_SPARKLE_SHA256})
file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/Sparkle.tar.xz DESTINATION ${CMAKE_BINARY_DIR}/frameworks/Sparkle)

find_library(SPARKLE_FRAMEWORK Sparkle "${CMAKE_BINARY_DIR}/frameworks/Sparkle")
add_compile_definitions(SPARKLE_ENABLED)
find_library(SPARKLE_FRAMEWORK Sparkle "${CMAKE_BINARY_DIR}/frameworks/Sparkle")
add_compile_definitions(SPARKLE_ENABLED)
endif()

target_link_libraries(Launcher_logic
Expand All @@ -1324,7 +1324,7 @@ if(APPLE)
"-framework ApplicationServices"
)
if(Launcher_ENABLE_UPDATER)
target_link_libraries(Launcher_logic ${SPARKLE_FRAMEWORK})
target_link_libraries(Launcher_logic ${SPARKLE_FRAMEWORK})
endif()
endif()

Expand All @@ -1345,6 +1345,8 @@ if(DEFINED Launcher_APP_BINARY_DEFS)
target_compile_definitions(Launcher_logic PRIVATE ${Launcher_APP_BINARY_DEFS})
endif()

add_subdirectory(hematite)

install(TARGETS ${Launcher_Name}
BUNDLE DESTINATION "." COMPONENT Runtime
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
Expand Down Expand Up @@ -1544,6 +1546,38 @@ if(INSTALL_BUNDLE STREQUAL "full")
PATTERN "*qcertonlybackend*" EXCLUDE
)
endif()
# # QML plugins
# install(
# DIRECTORY "${QT_QML_DIR}/QtQml"
# CONFIGURATIONS Debug RelWithDebInfo ""
# DESTINATION ${QML_DEST_DIR}
# COMPONENT Runtime
# )
# install(
# DIRECTORY "${QT_QML_DIR}/QtQml"
# CONFIGURATIONS Release MinSizeRel
# DESTINATION ${QML_DEST_DIR}
# COMPONENT Runtime
# REGEX "d\\." EXCLUDE
# REGEX "_debug\\." EXCLUDE
# REGEX "\\.dSYM" EXCLUDE
# )
# # QtQuick plugins
# install(
# DIRECTORY "${QT_QML_DIR}/QtQuick"
# CONFIGURATIONS Debug RelWithDebInfo ""
# DESTINATION ${QML_DEST_DIR}
# COMPONENT Runtime
# )
# install(
# DIRECTORY "${QT_QML_DIR}/QtQuick"
# CONFIGURATIONS Release MinSizeRel
# DESTINATION ${QML_DEST_DIR}
# COMPONENT Runtime
# REGEX "d\\." EXCLUDE
# REGEX "_debug\\." EXCLUDE
# REGEX "\\.dSYM" EXCLUDE
# )
# Wayland support
if(EXISTS "${QT_PLUGINS_DIR}/wayland-graphics-integration-client")
install(
Expand Down
2 changes: 2 additions & 0 deletions launcher/hematite/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
49 changes: 49 additions & 0 deletions launcher/hematite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
#
# SPDX-License-Identifier: GPL-3.0-only
#
# Prism Launcher - Minecraft Launcher
# Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

# Rust always links against non-debug Windows runtime on *-msvc targets
# Note it is best to set this on the command line to ensure all targets are consistent
# https://github.com/corrosion-rs/corrosion/blob/master/doc/src/common_issues.md #linking-debug-cc-libraries-into-rust-fails-on-windows-msvc-targets
# https://github.com/rust-lang/rust/issues/39016
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
endif()

find_package(CxxQt QUIET)
if(NOT CxxQt_FOUND)
include(FetchContent)
FetchContent_Declare(
CxxQt
GIT_REPOSITORY https://github.com/kdab/cxx-qt-cmake.git
GIT_TAG v0.7.0
)

FetchContent_MakeAvailable(CxxQt)
endif()

cxx_qt_import_crate(
MANIFEST_PATH "./Cargo.toml"
CRATES hematite_static
QT_MODULES Qt::Core
)
target_link_libraries(hematite_static INTERFACE Qt::Core)


target_link_libraries(Launcher_logic hematite_static)
Loading
Loading