diff options
-rw-r--r-- | CMakeLists.txt | 139 | ||||
-rw-r--r-- | Hacks.cpp | 8 | ||||
-rw-r--r-- | depends/javacheck/CMakeLists.txt | 5 | ||||
-rw-r--r-- | depends/launcher/CMakeLists.txt | 3 | ||||
-rw-r--r-- | generated.qrc.in | 2 | ||||
-rw-r--r-- | logic/JavaChecker.cpp | 16 | ||||
-rw-r--r-- | logic/JavaChecker.h | 2 | ||||
-rw-r--r-- | logic/LegacyInstance.cpp | 6 |
8 files changed, 83 insertions, 98 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 160d09f5..7ab9983d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,7 @@ ELSEIF(MINGW) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall") ENDIF() -################################ INCLUDE LIBRARIES ################################ - -######## 3rd Party Libs ######## +################################ 3rd Party Libs ################################ # Find the required Qt parts find_package(Qt5Core REQUIRED) @@ -75,41 +73,6 @@ query_qmake(QT_HOST_DATA QT_DATA_DIR) set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs) -######## Included Libs ######## - -# Add quazip -add_subdirectory(depends/quazip) -include_directories(depends/quazip) - -# Add the java launcher and checker -add_subdirectory(depends/launcher) -add_subdirectory(depends/javacheck) - -# Add xz decompression -add_subdirectory(depends/xz-embedded) -include_directories(${XZ_INCLUDE_DIR}) - -# Add pack200 decompression -add_subdirectory(depends/pack200) -include_directories(${PACK200_INCLUDE_DIR}) - -######## MultiMC Libs ######## - -# Add the util library. -add_subdirectory(depends/util) -include_directories(${LIBUTIL_INCLUDE_DIR}) - -# Add the settings library. -add_subdirectory(depends/settings) -include_directories(${LIBSETTINGS_INCLUDE_DIR}) - -# Add the group view library. -add_subdirectory(depends/groupview) -include_directories(${LIBGROUPVIEW_INCLUDE_DIR}) - -# Add the updater -add_subdirectory(mmc_updater) - ################################ SET UP BUILD OPTIONS ################################ ######## Check endianness ######## @@ -209,6 +172,72 @@ ADD_DEFINITIONS(-DLIBSETTINGS_STATIC) ADD_DEFINITIONS(-DLIBUTIL_STATIC) ADD_DEFINITIONS(-DLIBGROUPVIEW_STATIC) +######## Packaging/install paths setup ######## + +IF(UNIX AND APPLE) + SET(BINARY_DEST_DIR MultiMC.app/Contents/MacOS) + SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS) + SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources) + SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app") + + SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC") + SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.") + SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.multimc.MultiMC5") + SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") + SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") + SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") + SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns) + SET(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 MultiMC Contributors") +ELSEIF(UNIX) + SET(BINARY_DEST_DIR bin) + SET(PLUGIN_DEST_DIR plugins) + SET(QTCONF_DEST_DIR .) + SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC") +ELSEIF(WIN32) + SET(BINARY_DEST_DIR .) + SET(PLUGIN_DEST_DIR .) + SET(QTCONF_DEST_DIR .) + SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe") +ENDIF() + +# directories to look for dependencies +SET(DIRS "${QT_LIBS_DIR}") + +################################ Included Libs ################################ + +# Add quazip +add_subdirectory(depends/quazip) +include_directories(depends/quazip) + +# Add the java launcher and checker +add_subdirectory(depends/launcher) +add_subdirectory(depends/javacheck) + +# Add xz decompression +add_subdirectory(depends/xz-embedded) +include_directories(${XZ_INCLUDE_DIR}) + +# Add pack200 decompression +add_subdirectory(depends/pack200) +include_directories(${PACK200_INCLUDE_DIR}) + +######## MultiMC Libs ######## + +# Add the util library. +add_subdirectory(depends/util) +include_directories(${LIBUTIL_INCLUDE_DIR}) + +# Add the settings library. +add_subdirectory(depends/settings) +include_directories(${LIBSETTINGS_INCLUDE_DIR}) + +# Add the group view library. +add_subdirectory(depends/groupview) +include_directories(${LIBGROUPVIEW_INCLUDE_DIR}) + +# Add the updater +add_subdirectory(mmc_updater) + ################################ FILES ################################ ######## Sources and headers ######## @@ -516,8 +545,8 @@ IF(MultiMC_CODE_COVERAGE) ENDIF(MultiMC_CODE_COVERAGE) # Tell CMake that MultiMCLauncher.jar is generated. -SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/launcher/MultiMCLauncher.jar GENERATED) -SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/javacheck/JavaCheck.jar GENERATED) +#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/launcher/MultiMCLauncher.jar GENERATED) +#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/depends/javacheck/JavaCheck.jar GENERATED) # Qt 5 stuff QT5_WRAP_UI(MULTIMC_UI ${MULTIMC_UIS}) @@ -529,7 +558,7 @@ QT5_ADD_RESOURCES(GRAPHICS_QRC graphics.qrc) ADD_LIBRARY(MultiMC_common STATIC ${MULTIMC_SOURCES} ${MULTIMC_UI} ${GENERATED_QRC} ${GRAPHICS_QRC}) # Add executable -ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32 main.cpp Hacks.cpp ${MULTIMC_RCS}) +ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32 main.cpp ${MULTIMC_RCS}) # Link TARGET_LINK_LIBRARIES(MultiMC MultiMC_common) @@ -540,34 +569,6 @@ ADD_DEPENDENCIES(MultiMC_common MultiMCLauncher JavaCheck) ################################ INSTALLATION AND PACKAGING ################################ -######## Packaging/install paths setup ######## - -IF(UNIX AND APPLE) - SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS) - SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources) - SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app") - - SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC") - SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.") - SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.multimc.MultiMC5") - SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") - SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") - SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") - SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns) - SET(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013 MultiMC Contributors") -ELSEIF(UNIX) - SET(PLUGIN_DEST_DIR plugins) - SET(QTCONF_DEST_DIR .) - SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC") -ELSEIF(WIN32) - SET(PLUGIN_DEST_DIR .) - SET(QTCONF_DEST_DIR .) - SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe") -ENDIF() - -# directories to look for dependencies -SET(DIRS "${QT_LIBS_DIR}") - ######## Install ######## #### Executable #### diff --git a/Hacks.cpp b/Hacks.cpp deleted file mode 100644 index 3c3d8191..00000000 --- a/Hacks.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "MultiMC.h" - -#ifdef Q_OS_WIN32 -extern "C" -{ -__declspec(dllexport) uint32_t NvOptimusEnablement = 0x00000001; -} -#endif diff --git a/depends/javacheck/CMakeLists.txt b/depends/javacheck/CMakeLists.txt index e72c9552..10b9a716 100644 --- a/depends/javacheck/CMakeLists.txt +++ b/depends/javacheck/CMakeLists.txt @@ -5,10 +5,11 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development) include(UseJava) set(CMAKE_JAVA_JAR_ENTRY_POINT JavaCheck) set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) -#set(CMAKE_JAVA_TARGET_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/../../resources") set(SRC JavaCheck.java ) -add_jar(JavaCheck ${SRC})
\ No newline at end of file +add_jar(JavaCheck ${SRC}) + +INSTALL_JAR(JavaCheck "${BINARY_DEST_DIR}/jars") diff --git a/depends/launcher/CMakeLists.txt b/depends/launcher/CMakeLists.txt index e91d5bd6..729ebb67 100644 --- a/depends/launcher/CMakeLists.txt +++ b/depends/launcher/CMakeLists.txt @@ -5,7 +5,6 @@ find_package(Java 1.6 REQUIRED COMPONENTS Development) include(UseJava) set(CMAKE_JAVA_JAR_ENTRY_POINT MultiMCLauncher) set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) -#set(CMAKE_JAVA_TARGET_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/../../resources") set(SRC MultiMCLauncher.java @@ -19,3 +18,5 @@ set(SRC ) add_jar(MultiMCLauncher ${SRC}) + +INSTALL_JAR(MultiMCLauncher "${BINARY_DEST_DIR}/jars") diff --git a/generated.qrc.in b/generated.qrc.in index 82f4db99..794943eb 100644 --- a/generated.qrc.in +++ b/generated.qrc.in @@ -1,6 +1,8 @@ <RCC> +<!-- <qresource prefix="/java"> <file alias="launcher.jar">@MMC_BIN@/depends/launcher/MultiMCLauncher.jar</file> <file alias="checker.jar">@MMC_BIN@/depends/javacheck/JavaCheck.jar</file> </qresource> +--> </RCC> diff --git a/logic/JavaChecker.cpp b/logic/JavaChecker.cpp index a470bfa2..6ee7b4cf 100644 --- a/logic/JavaChecker.cpp +++ b/logic/JavaChecker.cpp @@ -1,26 +1,20 @@ #include "JavaChecker.h" +#include "MultiMC.h" +#include <pathutils.h> #include <QFile> #include <QProcess> #include <QMap> #include <QTemporaryFile> -#define CHECKER_FILE "JavaChecker.jar" - JavaChecker::JavaChecker(QObject *parent) : QObject(parent) { } void JavaChecker::performCheck() { - checkerJar.setFileTemplate("checker_XXXXXX.jar"); - checkerJar.open(); - QFile inner(":/java/checker.jar"); - inner.open(QIODevice::ReadOnly); - checkerJar.write(inner.readAll()); - inner.close(); - checkerJar.close(); + QString checkerJar = PathCombine(MMC->bin(), "jars", "JavaCheck.jar"); - QStringList args = {"-jar", checkerJar.fileName()}; + QStringList args = {"-jar", checkerJar}; process.reset(new QProcess()); process->setArguments(args); @@ -42,7 +36,6 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status) killTimer.stop(); QProcessPtr _process; _process.swap(process); - checkerJar.remove(); JavaCheckResult result; { @@ -100,7 +93,6 @@ void JavaChecker::error(QProcess::ProcessError err) if(err == QProcess::FailedToStart) { killTimer.stop(); - checkerJar.remove(); JavaCheckResult result; { diff --git a/logic/JavaChecker.h b/logic/JavaChecker.h index 4705381c..e19895f7 100644 --- a/logic/JavaChecker.h +++ b/logic/JavaChecker.h @@ -1,7 +1,6 @@ #pragma once #include <QProcess> #include <QTimer> -#include <QTemporaryFile> #include <memory> class JavaChecker; @@ -35,7 +34,6 @@ signals: private: QProcessPtr process; QTimer killTimer; - QTemporaryFile checkerJar; public slots: void timeout(); diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 0bc0961e..5ab19fc9 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -31,8 +31,6 @@ #include "gui/dialogs/LegacyModEditDialog.h" -#define LAUNCHER_FILE "MultiMCLauncher.jar" - LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings, QObject *parent) : BaseInstance(new LegacyInstancePrivate(), rootDir, settings, parent) @@ -61,7 +59,7 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(MojangAccountPtr account) pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG"); // extract the legacy launcher - QFile(":/java/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE)); + QString launcherJar = PathCombine(MMC->bin(), "jars", "MultiMCLauncher.jar"); // set the process arguments { @@ -104,7 +102,7 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(MojangAccountPtr account) "minecraft.exe.heapdump"); #endif - args << "-jar" << LAUNCHER_FILE; + args << "-jar" << launcherJar; args << account->currentProfile()->name; args << account->sessionId(); args << windowTitle; |