diff options
-rw-r--r-- | CMakeLists.txt | 1133 | ||||
-rw-r--r-- | dependencies.cmake.in | 33 | ||||
-rw-r--r-- | depends/classparser/CMakeLists.txt | 6 | ||||
-rw-r--r-- | depends/javacheck/CMakeLists.txt | 4 | ||||
-rw-r--r-- | depends/launcher/CMakeLists.txt | 40 | ||||
-rw-r--r-- | depends/pack200/CMakeLists.txt | 38 | ||||
-rw-r--r-- | depends/quazip/CMakeLists.txt | 33 | ||||
-rw-r--r-- | depends/settings/CMakeLists.txt | 28 | ||||
-rw-r--r-- | depends/util/CMakeLists.txt | 28 | ||||
-rw-r--r-- | depends/xz-embedded/CMakeLists.txt | 20 | ||||
-rw-r--r-- | install_prereqs.cmake.in | 6 | ||||
-rw-r--r-- | mmc_updater/CMakeLists.txt | 12 | ||||
-rw-r--r-- | mmc_updater/src/CMakeLists.txt | 161 | ||||
-rw-r--r-- | mmc_updater/src/tests/CMakeLists.txt | 18 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | translations/CMakeLists.txt | 10 |
16 files changed, 761 insertions, 811 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d804e730..d463ce8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,34 @@ cmake_minimum_required(VERSION 2.8.9) -IF(WIN32) - # In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows - cmake_policy(SET CMP0020 OLD) -ENDIF() +string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BUILD_DIR}" IS_IN_SOURCE_BUILD) +if(IS_IN_SOURCE_BUILD) + message(AUTHOR_WARNING "You are building MultiMC in-source. This is NOT recommended!") +endif() + +if(WIN32) + # In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows + cmake_policy(SET CMP0020 OLD) +endif() project(MultiMC) enable_testing() ######## Set CMake options ######## -SET(CMAKE_AUTOMOC ON) -SET(CMAKE_INCLUDE_CURRENT_DIR ON) -SET(FILES_TO_TRANSLATE ) +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(FILES_TO_TRANSLATE ) ######## Set module path ######## -SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") -SET(MMC_SRC "${PROJECT_SOURCE_DIR}") -SET(MMC_BIN "${PROJECT_BINARY_DIR}") +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") +set(MMC_SRC "${PROJECT_SOURCE_DIR}") +set(MMC_BIN "${PROJECT_BINARY_DIR}") # Output all executables and shared libs in the main build folder, not in subfolders. -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) -IF(UNIX) - SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) -ENDIF() +if(UNIX) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) +endif() set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/jars) @@ -52,12 +57,12 @@ find_package(Qt5Concurrent REQUIRED) find_package(Qt5LinguistTools REQUIRED) include_directories( - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} - ${Qt5Concurrent_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS} - ${Qt5Test_INCLUDE_DIRS} - ) + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5Concurrent_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS} + ${Qt5Test_INCLUDE_DIRS} +) # The Qt5 cmake files don't provide its install paths, so ask qmake. get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) @@ -79,85 +84,84 @@ set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs) ################################ SET UP BUILD OPTIONS ################################ ######## Check endianness ######## -INCLUDE(TestBigEndian) -TEST_BIG_ENDIAN(BIGENDIAN) -IF(${BIGENDIAN}) - ADD_DEFINITIONS(-DMULTIMC_BIG_ENDIAN) -ENDIF(${BIGENDIAN}) +include(TestBigEndian) +test_big_endian(BIGENDIAN) +if(${BIGENDIAN}) + add_definitions(-DMULTIMC_BIG_ENDIAN) +endif(${BIGENDIAN}) ######## Set URLs ######## -SET(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch MultiMC's news RSS feed from.") +set(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch MultiMC's news RSS feed from.") ######## Set version numbers ######## -SET(MultiMC_VERSION_MAJOR 0) -SET(MultiMC_VERSION_MINOR 3) -SET(MultiMC_VERSION_HOTFIX 2) +set(MultiMC_VERSION_MAJOR 0) +set(MultiMC_VERSION_MINOR 3) +set(MultiMC_VERSION_HOTFIX 2) # Build number -SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") +set(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") # Version type -SET(MultiMC_VERSION_TYPE "Custom" CACHE STRING "MultiMC's version type. This should be one of 'Custom', 'Release', 'ReleaseCandidate', or 'Development', depending on what type of version this is.") +set(MultiMC_VERSION_TYPE "Custom" CACHE STRING "MultiMC's version type. This should be one of 'Custom', 'Release', 'ReleaseCandidate', or 'Development', depending on what type of version this is.") # Build platform. -SET(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.") +set(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.") # Version channel -SET(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.") +set(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.") # Channel list URL -SET(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.") +set(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.") # Updater enabled? -SET(MultiMC_UPDATER false CACHE BOOL "Whether or not the update system is enabled. If this is enabled, you must also set MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL in order for it to work properly.") +set(MultiMC_UPDATER false CACHE BOOL "Whether or not the update system is enabled. If this is enabled, you must also set MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL in order for it to work properly.") # Notification URL -SET(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.") +set(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.") -SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}") -IF (MultiMC_VERSION_HOTFIX GREATER 0) - SET(MultiMC_RELEASE_VERSION_NAME "${MultiMC_RELEASE_VERSION_NAME}.${MultiMC_VERSION_HOTFIX}") -ENDIF() +set(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}") +if(MultiMC_VERSION_HOTFIX GREATER 0) + set(MultiMC_RELEASE_VERSION_NAME "${MultiMC_RELEASE_VERSION_NAME}.${MultiMC_VERSION_HOTFIX}") +endif() # Build a version string to display in the configure logs. -IF (MultiMC_VERSION_TYPE STREQUAL "Custom") - MESSAGE(STATUS "Version Type: Custom") - SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") -ELSEIF (MultiMC_VERSION_TYPE STREQUAL "Release") - MESSAGE(STATUS "Version Type: Stable Release") - SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") -ELSEIF (MultiMC_VERSION_TYPE STREQUAL "ReleaseCandidate") - MESSAGE(STATUS "Version Type: Release Candidate") - SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-rc${MultiMC_VERSION_BUILD}") -ELSEIF (MultiMC_VERSION_TYPE STREQUAL "Development") - MESSAGE(STATUS "Version Type: Development") - SET(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-dev${MultiMC_VERSION_BUILD}") -ELSE () - MESSAGE(ERROR "Invalid build type.") -ENDIF () - -MESSAGE(STATUS "MultiMC 5 Version: ${MultiMC_VERSION_STRING}") +if(MultiMC_VERSION_TYPE STREQUAL "Custom") + message(STATUS "Version Type: Custom") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") +elseif(MultiMC_VERSION_TYPE STREQUAL "Release") + message(STATUS "Version Type: Stable Release") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") +elseif(MultiMC_VERSION_TYPE STREQUAL "ReleaseCandidate") + message(STATUS "Version Type: Release Candidate") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-rc${MultiMC_VERSION_BUILD}") +elseif(MultiMC_VERSION_TYPE STREQUAL "Development") + message(STATUS "Version Type: Development") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-dev${MultiMC_VERSION_BUILD}") +else() + message(ERROR "Invalid build type.") +endif() + +message(STATUS "MultiMC 5 Version: ${MultiMC_VERSION_STRING}") # If the update system is enabled, make sure MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL are set. -IF (MultiMC_UPDATER) - IF (MultiMC_VERSION_CHANNEL STREQUAL "") - MESSAGE(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_CHANNEL is not set.\n" - "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") - ENDIF () - IF (MultiMC_CHANLIST_URL STREQUAL "") - MESSAGE(FATAL_ERROR "Update system is enabled, but MultiMC_CHANLIST_URL is not set.\n" - "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") - ENDIF () - IF (MultiMC_VERSION_BUILD LESS 0) - MESSAGE(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_BUILD is not set.\n" - "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") - ENDIF () - - MESSAGE(STATUS "Updater is enabled. Channel list URL: ${MultiMC_CHANLIST_URL}") -ENDIF () +if(MultiMC_UPDATER) + if(MultiMC_VERSION_CHANNEL STREQUAL "") + message(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_CHANNEL is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + if(MultiMC_CHANLIST_URL STREQUAL "") + message(FATAL_ERROR "Update system is enabled, but MultiMC_CHANLIST_URL is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + if(MultiMC_VERSION_BUILD LESS 0) + message(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_BUILD is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + message(STATUS "Updater is enabled. Channel list URL: ${MultiMC_CHANLIST_URL}") +endif() #### Updater-related build config options #### option(MultiMC_UPDATER_DRY_RUN "Enable updater dry-run mode -- for updater development." OFF) @@ -176,31 +180,31 @@ else() endif() #### Custom target to just print the version. -ADD_CUSTOM_TARGET(version echo "Version: ${MultiMC_VERSION_STRING}") +add_custom_target(version echo "Version: ${MultiMC_VERSION_STRING}") #### Check the current Git commit execute_process(COMMAND git rev-parse HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE GIT_COMMIT_CHECK_RESULTVAR - OUTPUT_VARIABLE GIT_COMMIT_CHECK_OUTVAR - OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE GIT_COMMIT_CHECK_RESULTVAR + OUTPUT_VARIABLE GIT_COMMIT_CHECK_OUTVAR + OUTPUT_STRIP_TRAILING_WHITESPACE ) IF(GIT_COMMIT_CHECK_RESULTVAR EQUAL 0) - SET(MultiMC_GIT_COMMIT "${GIT_COMMIT_CHECK_OUTVAR}") - MESSAGE(STATUS "Git commit: ${MultiMC_GIT_COMMIT}") + SET(MultiMC_GIT_COMMIT "${GIT_COMMIT_CHECK_OUTVAR}") + MESSAGE(STATUS "Git commit: ${MultiMC_GIT_COMMIT}") ELSE() - SET(MultiMC_GIT_COMMIT "Unknown") - MESSAGE(STATUS "Failed to check Git commit. ${GIT_COMMIT_CHECK_RESULTVAR}") + SET(MultiMC_GIT_COMMIT "Unknown") + MESSAGE(STATUS "Failed to check Git commit. ${GIT_COMMIT_CHECK_RESULTVAR}") ENDIF() OPTION(MultiMC_CODE_COVERAGE "Compiles for code coverage" OFF) IF(MultiMC_CODE_COVERAGE) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 --coverage") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O0 --coverage") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0 --coverage") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 --coverage") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -O0 --coverage") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0 --coverage") ENDIF(MultiMC_CODE_COVERAGE) ######## Configure header ######## @@ -208,39 +212,39 @@ configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR} ######## 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() +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}") +set(DIRS "${QT_LIBS_DIR}") ################################ Included Libs ################################ # Add quazip -ADD_DEFINITIONS(-DQUAZIP_STATIC) +add_definitions(-DQUAZIP_STATIC) add_subdirectory(depends/quazip) include_directories(depends/quazip) @@ -259,12 +263,12 @@ include_directories(${PACK200_INCLUDE_DIR}) ######## MultiMC Libs ######## # Add the util library. -ADD_DEFINITIONS(-DLIBUTIL_STATIC) +add_definitions(-DLIBUTIL_STATIC) add_subdirectory(depends/util) include_directories(${LIBUTIL_INCLUDE_DIR}) # Add the settings library. -ADD_DEFINITIONS(-DLIBSETTINGS_STATIC) +add_definitions(-DLIBSETTINGS_STATIC) add_subdirectory(depends/settings) include_directories(${LIBSETTINGS_INCLUDE_DIR}) @@ -274,520 +278,517 @@ add_subdirectory(mmc_updater) ################################ FILES ################################ ######## Sources and headers ######## -SET(MULTIMC_SOURCES -# Application base -MultiMC.h -MultiMC.cpp -MMCError.h -BuildConfig.h -${PROJECT_BINARY_DIR}/BuildConfig.cpp - -# Logging -logger/QsDebugOutput.cpp -logger/QsDebugOutput.h -logger/QsLog.cpp -logger/QsLog.h -logger/QsLogDest.cpp -logger/QsLogDest.h - -# GUI - windows -gui/MainWindow.h -gui/MainWindow.cpp -gui/ConsoleWindow.h -gui/ConsoleWindow.cpp - -# GUI - dialogs -gui/dialogs/SettingsDialog.h -gui/dialogs/SettingsDialog.cpp -gui/dialogs/CopyInstanceDialog.h -gui/dialogs/CopyInstanceDialog.cpp -gui/dialogs/NewInstanceDialog.cpp -gui/dialogs/ProgressDialog.h -gui/dialogs/ProgressDialog.cpp -gui/dialogs/AboutDialog.h -gui/dialogs/AboutDialog.cpp -gui/dialogs/VersionSelectDialog.h -gui/dialogs/VersionSelectDialog.cpp -gui/dialogs/LwjglSelectDialog.h -gui/dialogs/LwjglSelectDialog.cpp -gui/dialogs/InstanceSettings.h -gui/dialogs/InstanceSettings.cpp -gui/dialogs/IconPickerDialog.h -gui/dialogs/IconPickerDialog.cpp -gui/dialogs/LegacyModEditDialog.h -gui/dialogs/LegacyModEditDialog.cpp -gui/dialogs/OneSixModEditDialog.h -gui/dialogs/OneSixModEditDialog.cpp -gui/dialogs/ModEditDialogCommon.h -gui/dialogs/ModEditDialogCommon.cpp -gui/dialogs/EditNotesDialog.h -gui/dialogs/EditNotesDialog.cpp -gui/dialogs/CustomMessageBox.h -gui/dialogs/CustomMessageBox.cpp -gui/dialogs/EditAccountDialog.h -gui/dialogs/EditAccountDialog.cpp -gui/dialogs/AccountListDialog.h -gui/dialogs/AccountListDialog.cpp -gui/dialogs/AccountSelectDialog.h -gui/dialogs/AccountSelectDialog.cpp -gui/dialogs/UpdateDialog.h -gui/dialogs/UpdateDialog.cpp -gui/dialogs/ScreenshotDialog.h -gui/dialogs/ScreenshotDialog.cpp -gui/dialogs/NotificationDialog.h -gui/dialogs/NotificationDialog.cpp - -# GUI - widgets -gui/widgets/Common.h -gui/widgets/Common.cpp -gui/widgets/ModListView.h -gui/widgets/ModListView.cpp -gui/widgets/VersionListView.h -gui/widgets/VersionListView.cpp -gui/widgets/LabeledToolButton.h -gui/widgets/LabeledToolButton.cpp -gui/widgets/MCModInfoFrame.h -gui/widgets/MCModInfoFrame.cpp - -# GUI - instance group view -gui/groupview/Group.cpp -gui/groupview/Group.h -gui/groupview/GroupedProxyModel.cpp -gui/groupview/GroupedProxyModel.h -gui/groupview/GroupView.cpp -gui/groupview/GroupView.h -gui/groupview/InstanceDelegate.cpp -gui/groupview/InstanceDelegate.h - -# Base classes and infrastructure -logic/BaseVersion.h -logic/MinecraftVersion.h -logic/InstanceFactory.h -logic/InstanceFactory.cpp -logic/BaseInstance.h -logic/BaseInstance.cpp -logic/BaseInstance_p.h - -logic/MinecraftProcess.h -logic/MinecraftProcess.cpp -logic/Mod.h -logic/Mod.cpp -logic/ModList.h -logic/ModList.cpp - -# Basic instance launcher for starting from terminal -logic/InstanceLauncher.h -logic/InstanceLauncher.cpp - -# JSON parsing helpers -logic/MMCJson.h -logic/MMCJson.cpp - -# network stuffs -logic/net/NetAction.h -logic/net/MD5EtagDownload.h -logic/net/MD5EtagDownload.cpp -logic/net/ByteArrayDownload.h -logic/net/ByteArrayDownload.cpp -logic/net/CacheDownload.h -logic/net/CacheDownload.cpp -logic/net/ForgeMirrors.h -logic/net/ForgeMirrors.cpp -logic/net/ForgeXzDownload.h -logic/net/ForgeXzDownload.cpp -logic/net/NetJob.h -logic/net/NetJob.cpp -logic/net/HttpMetaCache.h -logic/net/HttpMetaCache.cpp -logic/net/PasteUpload.h -logic/net/PasteUpload.cpp -logic/net/URLConstants.h -logic/net/URLConstants.cpp - -# Yggdrasil login stuff -logic/auth/AuthSession.h -logic/auth/AuthSession.cpp -logic/auth/MojangAccountList.h -logic/auth/MojangAccountList.cpp -logic/auth/MojangAccount.h -logic/auth/MojangAccount.cpp -logic/auth/YggdrasilTask.h -logic/auth/YggdrasilTask.cpp -logic/auth/flows/AuthenticateTask.h -logic/auth/flows/AuthenticateTask.cpp -logic/auth/flows/RefreshTask.cpp -logic/auth/flows/RefreshTask.cpp -logic/auth/flows/ValidateTask.h -logic/auth/flows/ValidateTask.cpp - -# Update system -logic/updater/UpdateChecker.h -logic/updater/UpdateChecker.cpp -logic/updater/DownloadUpdateTask.h -logic/updater/DownloadUpdateTask.cpp -logic/updater/NotificationChecker.h -logic/updater/NotificationChecker.cpp - -# News System -logic/news/NewsChecker.h -logic/news/NewsChecker.cpp -logic/news/NewsEntry.h -logic/news/NewsEntry.cpp - -# Status system -logic/status/StatusChecker.h -logic/status/StatusChecker.cpp - -# legacy instances -logic/LegacyInstance.h -logic/LegacyInstance.cpp -logic/LegacyInstance_p.h -logic/LegacyUpdate.h -logic/LegacyUpdate.cpp - -logic/LegacyForge.h -logic/LegacyForge.cpp - -# OneSix instances -logic/OneSixUpdate.h -logic/OneSixUpdate.cpp -logic/OneSixInstance.h -logic/OneSixInstance.cpp -logic/OneSixInstance_p.h - -# OneSix version json infrastructure -logic/OneSixVersionBuilder.h -logic/OneSixVersionBuilder.cpp -logic/VersionFile.h -logic/VersionFile.cpp -logic/VersionFinal.h -logic/VersionFinal.cpp -logic/OneSixLibrary.h -logic/OneSixLibrary.cpp -logic/OneSixRule.h -logic/OneSixRule.cpp -logic/OpSys.h -logic/OpSys.cpp - -# Mod installers -logic/BaseInstaller.h -logic/BaseInstaller.cpp -logic/ForgeInstaller.h -logic/ForgeInstaller.cpp -logic/LiteLoaderInstaller.h -logic/LiteLoaderInstaller.cpp - -# Nostalgia -logic/NostalgiaInstance.h -logic/NostalgiaInstance.cpp - -# FTB -logic/OneSixFTBInstance.h -logic/OneSixFTBInstance.cpp -logic/LegacyFTBInstance.h -logic/LegacyFTBInstance.cpp - -# Lists -logic/lists/InstanceList.h -logic/lists/InstanceList.cpp -logic/lists/BaseVersionList.h -logic/lists/BaseVersionList.cpp -logic/lists/MinecraftVersionList.h -logic/lists/MinecraftVersionList.cpp -logic/lists/LwjglVersionList.h -logic/lists/LwjglVersionList.cpp -logic/lists/ForgeVersionList.h -logic/lists/ForgeVersionList.cpp -logic/lists/JavaVersionList.h -logic/lists/JavaVersionList.cpp -logic/lists/LiteLoaderVersionList.h -logic/lists/LiteLoaderVersionList.cpp - -# the screenshots feature -logic/screenshots/Screenshot.h -logic/screenshots/Screenshot.cpp -logic/screenshots/ScreenshotList.h -logic/screenshots/ScreenshotList.cpp -logic/screenshots/ImgurUpload.h -logic/screenshots/ImgurUpload.cpp -logic/screenshots/ImgurAlbumCreation.h -logic/screenshots/ImgurAlbumCreation.cpp - -# Icons -logic/icons/MMCIcon.h -logic/icons/MMCIcon.cpp -logic/icons/IconList.h -logic/icons/IconList.cpp - - -# misc model/view -logic/EnabledItemFilter.h -logic/EnabledItemFilter.cpp - -# Tasks -logic/tasks/ProgressProvider.h -logic/tasks/Task.h -logic/tasks/Task.cpp -logic/tasks/ThreadTask.h -logic/tasks/ThreadTask.cpp -logic/tasks/SequentialTask.h -logic/tasks/SequentialTask.cpp - -# Utilities -logic/JavaChecker.h -logic/JavaChecker.cpp -logic/JavaUtils.h -logic/JavaUtils.cpp -logic/NagUtils.h -logic/NagUtils.cpp -logic/SkinUtils.h -logic/SkinUtils.cpp -logic/JavaCheckerJob.h -logic/JavaCheckerJob.cpp - -# Assets -logic/assets/AssetsMigrateTask.h -logic/assets/AssetsMigrateTask.cpp -logic/assets/AssetsUtils.h -logic/assets/AssetsUtils.cpp - -# Tools -logic/tools/BaseExternalTool.h -logic/tools/BaseExternalTool.cpp -logic/tools/MCEditTool.h -logic/tools/MCEditTool.cpp -logic/tools/BaseProfiler.h -logic/tools/BaseProfiler.cpp -logic/tools/JProfiler.h -logic/tools/JProfiler.cpp -logic/tools/JVisualVM.h -logic/tools/JVisualVM.cpp +set(MULTIMC_SOURCES + # Application base + MultiMC.h + MultiMC.cpp + MMCError.h + BuildConfig.h + ${PROJECT_BINARY_DIR}/BuildConfig.cpp + + # Logging + logger/QsDebugOutput.cpp + logger/QsDebugOutput.h + logger/QsLog.cpp + logger/QsLog.h + logger/QsLogDest.cpp + logger/QsLogDest.h + + # GUI - windows + gui/MainWindow.h + gui/MainWindow.cpp + gui/ConsoleWindow.h + gui/ConsoleWindow.cpp + + # GUI - dialogs + gui/dialogs/SettingsDialog.h + gui/dialogs/SettingsDialog.cpp + gui/dialogs/CopyInstanceDialog.h + gui/dialogs/CopyInstanceDialog.cpp + gui/dialogs/NewInstanceDialog.cpp + gui/dialogs/ProgressDialog.h + gui/dialogs/ProgressDialog.cpp + gui/dialogs/AboutDialog.h + gui/dialogs/AboutDialog.cpp + gui/dialogs/VersionSelectDialog.h + gui/dialogs/VersionSelectDialog.cpp + gui/dialogs/LwjglSelectDialog.h + gui/dialogs/LwjglSelectDialog.cpp + gui/dialogs/InstanceSettings.h + gui/dialogs/InstanceSettings.cpp + gui/dialogs/IconPickerDialog.h + gui/dialogs/IconPickerDialog.cpp + gui/dialogs/LegacyModEditDialog.h + gui/dialogs/LegacyModEditDialog.cpp + gui/dialogs/OneSixModEditDialog.h + gui/dialogs/OneSixModEditDialog.cpp + gui/dialogs/ModEditDialogCommon.h + gui/dialogs/ModEditDialogCommon.cpp + gui/dialogs/EditNotesDialog.h + gui/dialogs/EditNotesDialog.cpp + gui/dialogs/CustomMessageBox.h + gui/dialogs/CustomMessageBox.cpp + gui/dialogs/EditAccountDialog.h + gui/dialogs/EditAccountDialog.cpp + gui/dialogs/AccountListDialog.h + gui/dialogs/AccountListDialog.cpp + gui/dialogs/AccountSelectDialog.h + gui/dialogs/AccountSelectDialog.cpp + gui/dialogs/UpdateDialog.h + gui/dialogs/UpdateDialog.cpp + gui/dialogs/ScreenshotDialog.h + gui/dialogs/ScreenshotDialog.cpp + gui/dialogs/NotificationDialog.h + gui/dialogs/NotificationDialog.cpp + + # GUI - widgets + gui/widgets/Common.h + gui/widgets/Common.cpp + gui/widgets/ModListView.h + gui/widgets/ModListView.cpp + gui/widgets/VersionListView.h + gui/widgets/VersionListView.cpp + gui/widgets/LabeledToolButton.h + gui/widgets/LabeledToolButton.cpp + gui/widgets/MCModInfoFrame.h + gui/widgets/MCModInfoFrame.cpp + + # GUI - instance group view + gui/groupview/Group.cpp + gui/groupview/Group.h + gui/groupview/GroupedProxyModel.cpp + gui/groupview/GroupedProxyModel.h + gui/groupview/GroupView.cpp + gui/groupview/GroupView.h + gui/groupview/InstanceDelegate.cpp + gui/groupview/InstanceDelegate.h + + # Base classes and infrastructure + logic/BaseVersion.h + logic/MinecraftVersion.h + logic/InstanceFactory.h + logic/InstanceFactory.cpp + logic/BaseInstance.h + logic/BaseInstance.cpp + logic/BaseInstance_p.h + + logic/MinecraftProcess.h + logic/MinecraftProcess.cpp + logic/Mod.h + logic/Mod.cpp + logic/ModList.h + logic/ModList.cpp + + # Basic instance launcher for starting from terminal + logic/InstanceLauncher.h + logic/InstanceLauncher.cpp + + # JSON parsing helpers + logic/MMCJson.h + logic/MMCJson.cpp + + # network stuffs + logic/net/NetAction.h + logic/net/MD5EtagDownload.h + logic/net/MD5EtagDownload.cpp + logic/net/ByteArrayDownload.h + logic/net/ByteArrayDownload.cpp + logic/net/CacheDownload.h + logic/net/CacheDownload.cpp + logic/net/ForgeMirrors.h + logic/net/ForgeMirrors.cpp + logic/net/ForgeXzDownload.h + logic/net/ForgeXzDownload.cpp + logic/net/NetJob.h + logic/net/NetJob.cpp + logic/net/HttpMetaCache.h + logic/net/HttpMetaCache.cpp + logic/net/PasteUpload.h + logic/net/PasteUpload.cpp + logic/net/URLConstants.h + logic/net/URLConstants.cpp + + # Yggdrasil login stuff + logic/auth/AuthSession.h + logic/auth/AuthSession.cpp + logic/auth/MojangAccountList.h + logic/auth/MojangAccountList.cpp + logic/auth/MojangAccount.h + logic/auth/MojangAccount.cpp + logic/auth/YggdrasilTask.h + logic/auth/YggdrasilTask.cpp + logic/auth/flows/AuthenticateTask.h + logic/auth/flows/AuthenticateTask.cpp + logic/auth/flows/RefreshTask.cpp + logic/auth/flows/RefreshTask.cpp + logic/auth/flows/ValidateTask.h + logic/auth/flows/ValidateTask.cpp + + # Update system + logic/updater/UpdateChecker.h + logic/updater/UpdateChecker.cpp + logic/updater/DownloadUpdateTask.h + logic/updater/DownloadUpdateTask.cpp + logic/updater/NotificationChecker.h + logic/updater/NotificationChecker.cpp + + # News System + logic/news/NewsChecker.h + logic/news/NewsChecker.cpp + logic/news/NewsEntry.h + logic/news/NewsEntry.cpp + + # Status system + logic/status/StatusChecker.h + logic/status/StatusChecker.cpp + + # legacy instances + logic/LegacyInstance.h + logic/LegacyInstance.cpp + logic/LegacyInstance_p.h + logic/LegacyUpdate.h + logic/LegacyUpdate.cpp + + logic/LegacyForge.h + logic/LegacyForge.cpp + + # OneSix instances + logic/OneSixUpdate.h + logic/OneSixUpdate.cpp + logic/OneSixInstance.h + logic/OneSixInstance.cpp + logic/OneSixInstance_p.h + + # OneSix version json infrastructure + logic/OneSixVersionBuilder.h + logic/OneSixVersionBuilder.cpp + logic/VersionFile.h + logic/VersionFile.cpp + logic/VersionFinal.h + logic/VersionFinal.cpp + logic/OneSixLibrary.h + logic/OneSixLibrary.cpp + logic/OneSixRule.h + logic/OneSixRule.cpp + logic/OpSys.h + logic/OpSys.cpp + + # Mod installers + logic/BaseInstaller.h + logic/BaseInstaller.cpp + logic/ForgeInstaller.h + logic/ForgeInstaller.cpp + logic/LiteLoaderInstaller.h + logic/LiteLoaderInstaller.cpp + + # Nostalgia + logic/NostalgiaInstance.h + logic/NostalgiaInstance.cpp + + # FTB + logic/OneSixFTBInstance.h + logic/OneSixFTBInstance.cpp + logic/LegacyFTBInstance.h + logic/LegacyFTBInstance.cpp + + # Lists + logic/lists/InstanceList.h + logic/lists/InstanceList.cpp + logic/lists/BaseVersionList.h + logic/lists/BaseVersionList.cpp + logic/lists/MinecraftVersionList.h + logic/lists/MinecraftVersionList.cpp + logic/lists/LwjglVersionList.h + logic/lists/LwjglVersionList.cpp + logic/lists/ForgeVersionList.h + logic/lists/ForgeVersionList.cpp + logic/lists/JavaVersionList.h + logic/lists/JavaVersionList.cpp + logic/lists/LiteLoaderVersionList.h + logic/lists/LiteLoaderVersionList.cpp + + # the screenshots feature + logic/screenshots/Screenshot.h + logic/screenshots/Screenshot.cpp + logic/screenshots/ScreenshotList.h + logic/screenshots/ScreenshotList.cpp + logic/screenshots/ImgurUpload.h + logic/screenshots/ImgurUpload.cpp + logic/screenshots/ImgurAlbumCreation.h + logic/screenshots/ImgurAlbumCreation.cpp + + # Icons + logic/icons/MMCIcon.h + logic/icons/MMCIcon.cpp + logic/icons/IconList.h + logic/icons/IconList.cpp + + # misc model/view + logic/EnabledItemFilter.h + logic/EnabledItemFilter.cpp + + # Tasks + logic/tasks/ProgressProvider.h + logic/tasks/Task.h + logic/tasks/Task.cpp + logic/tasks/ThreadTask.h + logic/tasks/ThreadTask.cpp + logic/tasks/SequentialTask.h + logic/tasks/SequentialTask.cpp + + # Utilities + logic/JavaChecker.h + logic/JavaChecker.cpp + logic/JavaUtils.h + logic/JavaUtils.cpp + logic/NagUtils.h + logic/NagUtils.cpp + logic/SkinUtils.h + logic/SkinUtils.cpp + logic/JavaCheckerJob.h + logic/JavaCheckerJob.cpp + + # Assets + logic/assets/AssetsMigrateTask.h + logic/assets/AssetsMigrateTask.cpp + logic/assets/AssetsUtils.h + logic/assets/AssetsUtils.cpp + + # Tools + logic/tools/BaseExternalTool.h + logic/tools/BaseExternalTool.cpp + logic/tools/MCEditTool.h + logic/tools/MCEditTool.cpp + logic/tools/BaseProfiler.h + logic/tools/BaseProfiler.cpp + logic/tools/JProfiler.h + logic/tools/JProfiler.cpp + logic/tools/JVisualVM.h + logic/tools/JVisualVM.cpp ) ######## UIs ######## -SET(MULTIMC_UIS - -# Windows -gui/MainWindow.ui -gui/ConsoleWindow.ui - -# Dialogs -gui/dialogs/SettingsDialog.ui -gui/dialogs/CopyInstanceDialog.ui -gui/dialogs/NewInstanceDialog.ui -gui/dialogs/AboutDialog.ui -gui/dialogs/VersionSelectDialog.ui -gui/dialogs/LwjglSelectDialog.ui -gui/dialogs/InstanceSettings.ui -gui/dialogs/ProgressDialog.ui -gui/dialogs/IconPickerDialog.ui -gui/dialogs/LegacyModEditDialog.ui -gui/dialogs/OneSixModEditDialog.ui -gui/dialogs/EditNotesDialog.ui -gui/dialogs/AccountListDialog.ui -gui/dialogs/AccountSelectDialog.ui -gui/dialogs/EditAccountDialog.ui -gui/dialogs/UpdateDialog.ui -gui/dialogs/ScreenshotDialog.ui -gui/dialogs/NotificationDialog.ui - -# Widgets/other -gui/widgets/MCModInfoFrame.ui +set(MULTIMC_UIS + # Windows + gui/MainWindow.ui + gui/ConsoleWindow.ui + + # Dialogs + gui/dialogs/SettingsDialog.ui + gui/dialogs/CopyInstanceDialog.ui + gui/dialogs/NewInstanceDialog.ui + gui/dialogs/AboutDialog.ui + gui/dialogs/VersionSelectDialog.ui + gui/dialogs/LwjglSelectDialog.ui + gui/dialogs/InstanceSettings.ui + gui/dialogs/ProgressDialog.ui + gui/dialogs/IconPickerDialog.ui + gui/dialogs/LegacyModEditDialog.ui + gui/dialogs/OneSixModEditDialog.ui + gui/dialogs/EditNotesDialog.ui + gui/dialogs/AccountListDialog.ui + gui/dialogs/AccountSelectDialog.ui + gui/dialogs/EditAccountDialog.ui + gui/dialogs/UpdateDialog.ui + gui/dialogs/ScreenshotDialog.ui + gui/dialogs/NotificationDialog.ui + + # Widgets/other + gui/widgets/MCModInfoFrame.ui ) set(FILES_TO_TRANSLATE) foreach(file ${MULTIMC_SOURCES}) get_filename_component(absfile "${file}" ABSOLUTE) - list(APPEND FILES_TO_TRANSLATE "${absfile}") + list(APPEND FILES_TO_TRANSLATE "${absfile}") endforeach() foreach(file ${MULTIMC_UIS}) get_filename_component(absfile "${file}" ABSOLUTE) - list(APPEND FILES_TO_TRANSLATE "${absfile}") + list(APPEND FILES_TO_TRANSLATE "${absfile}") endforeach() -SET(MULTIMC_QRCS -resources/backgrounds/backgrounds.qrc -resources/multimc/multimc.qrc -resources/instances/instances.qrc +set(MULTIMC_QRCS + resources/backgrounds/backgrounds.qrc + resources/multimc/multimc.qrc + resources/instances/instances.qrc ) ######## Windows resource files ######## -IF(WIN32) -SET(MULTIMC_RCS resources/multimc.rc) -ENDIF() +if(WIN32) + set(MULTIMC_RCS resources/multimc.rc) +endif() ####### X11 Stuff ####### -IF(UNIX AND NOT APPLE) - SET(MultiMC_QT_ADDITIONAL_MODULES ${MultiMC_QT_ADDITIONAL_MODULES} X11Extras) - SET(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} xcb) - LIST(APPEND MULTIMC_SOURCES gui/Platform_X11.cpp) -ELSE() - LIST(APPEND MULTIMC_SOURCES gui/Platform_Other.cpp) -ENDIF() +if(UNIX AND NOT APPLE) + set(MultiMC_QT_ADDITIONAL_MODULES ${MultiMC_QT_ADDITIONAL_MODULES} X11Extras) + set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} xcb) + list(APPEND MULTIMC_SOURCES gui/Platform_X11.cpp) +else() + list(APPEND MULTIMC_SOURCES gui/Platform_Other.cpp) +endif() ################################ COMPILE ################################ # Link additional libraries -IF(WIN32) - SET(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain) -ENDIF(WIN32) +if(WIN32) + set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain) +endif(WIN32) # 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) # Qt 5 stuff -QT5_WRAP_UI(MULTIMC_UI ${MULTIMC_UIS}) -QT5_ADD_RESOURCES(MULTIMC_RESOURCES ${MULTIMC_QRCS}) +qt5_wrap_ui(MULTIMC_UI ${MULTIMC_UIS}) +qt5_add_resources(MULTIMC_RESOURCES ${MULTIMC_QRCS}) # Add common library -ADD_LIBRARY(MultiMC_common STATIC ${MULTIMC_SOURCES} ${MULTIMC_UI} ${MULTIMC_RESOURCES}) +add_library(MultiMC_common STATIC ${MULTIMC_SOURCES} ${MULTIMC_UI} ${MULTIMC_RESOURCES}) # Add executable -ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32 main.cpp ${MULTIMC_RCS}) +add_executable(MultiMC MACOSX_BUNDLE WIN32 main.cpp ${MULTIMC_RCS}) # Link -TARGET_LINK_LIBRARIES(MultiMC MultiMC_common) -TARGET_LINK_LIBRARIES(MultiMC_common xz-embedded unpack200 quazip libUtil libSettings ${MultiMC_LINK_ADDITIONAL_LIBS}) -QT5_USE_MODULES(MultiMC Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) -QT5_USE_MODULES(MultiMC_common Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) +target_link_libraries(MultiMC MultiMC_common) +target_link_libraries(MultiMC_common xz-embedded unpack200 quazip libUtil libSettings ${MultiMC_LINK_ADDITIONAL_LIBS}) +qt5_use_modules(MultiMC Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) +qt5_use_modules(MultiMC_common Core Widgets Network Xml Concurrent ${MultiMC_QT_ADDITIONAL_MODULES}) ################################ INSTALLATION AND PACKAGING ################################ ######## Install ######## #### Executable #### -IF(APPLE AND UNIX) ## OSX - INSTALL(TARGETS MultiMC - BUNDLE DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime - ) - -ELSEIF(UNIX) ## LINUX and similar - INSTALL(TARGETS MultiMC - BUNDLE DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION bin COMPONENT Runtime - ) - INSTALL(PROGRAMS package/linux/MultiMC DESTINATION .) - -ELSEIF(WIN32) ## WINDOWS - INSTALL(TARGETS MultiMC - BUNDLE DESTINATION . COMPONENT Runtime - LIBRARY DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION . COMPONENT Runtime - ) -ENDIF() +if(APPLE AND UNIX) ## OSX + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime + ) + +elseif(UNIX) ## LINUX and similar + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION bin COMPONENT Runtime + ) + install(PROGRAMS package/linux/MultiMC DESTINATION .) + +elseif(WIN32) ## WINDOWS + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + LIBRARY DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION . COMPONENT Runtime + ) +endif() #### Dist package logic #### -if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") -# Image formats -INSTALL( - DIRECTORY "${QT_PLUGINS_DIR}/imageformats" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "tga|svg|tiff|mng" EXCLUDE -) - -# Platform plugins -INSTALL( - DIRECTORY "${QT_PLUGINS_DIR}/platforms" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "minimal|linuxfb|offscreen" EXCLUDE -) +if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + # Image formats + install( + DIRECTORY "${QT_PLUGINS_DIR}/imageformats" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "tga|svg|tiff|mng" EXCLUDE + ) + + # Platform plugins + install( + DIRECTORY "${QT_PLUGINS_DIR}/platforms" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "minimal|linuxfb|offscreen" EXCLUDE + ) else() -# Image formats -INSTALL( - DIRECTORY "${QT_PLUGINS_DIR}/imageformats" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "tga|svg|tiff|mng" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE -) - -# Platform plugins -INSTALL( - DIRECTORY "${QT_PLUGINS_DIR}/platforms" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "minimal|linuxfb|offscreen" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE -) -IF(APPLE) - # Accessible plugin to make buttons look decent on osx - INSTALL( - DIRECTORY "${QT_PLUGINS_DIR}/accessible" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "quick" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE - ) -ENDIF() - + # Image formats + install( + DIRECTORY "${QT_PLUGINS_DIR}/imageformats" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "tga|svg|tiff|mng" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." EXCLUDE + ) + + # Platform plugins + install( + DIRECTORY "${QT_PLUGINS_DIR}/platforms" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "minimal|linuxfb|offscreen" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." EXCLUDE + ) + if(APPLE) + # Accessible plugin to make buttons look decent on osx + install( + DIRECTORY "${QT_PLUGINS_DIR}/accessible" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "quick" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." EXCLUDE + ) + endif() endif() # qtconf -INSTALL( - CODE " -FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\") +install( + CODE " +file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\") " - COMPONENT Runtime + COMPONENT Runtime ) # ICNS file for OS X -IF(APPLE) - INSTALL(FILES resources/MultiMC.icns DESTINATION MultiMC.app/Contents/Resources) -ENDIF() +if(APPLE) + install(FILES resources/MultiMC.icns DESTINATION MultiMC.app/Contents/Resources) +endif() -CONFIGURE_FILE( - "${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" - @ONLY) -INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" COMPONENT Runtime) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" + @ONLY) +install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" COMPONENT Runtime) ######## Package ######## # Package with CPack -IF(UNIX) - if(APPLE) - SET(CPACK_GENERATOR "ZIP") - else() - SET(CPACK_GENERATOR "TGZ") - endif() -ELSEIF(WIN32) - SET(CPACK_GENERATOR "ZIP") -ENDIF() -SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) - -SET(CPACK_PACKAGE_NAME "MultiMC 5") -SET(CPACK_PACKAGE_VENDOR "") -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MultiMC - Minecraft launcher and management tool.") -SET(CPACK_PACKAGE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") -SET(CPACK_PACKAGE_VERSION_MAJOR ${MultiMC_VERSION_MAJOR}) -SET(CPACK_PACKAGE_VERSION_MINOR ${MultiMC_VERSION_MINOR}) -SET(CPACK_PACKAGE_VERSION_PATCH ${MultiMC_VERSION_REV}) - -IF(CPACK_GENERATOR STREQUAL "NSIS") -SET(CPACK_PACKAGE_FILE_NAME "Setup-MultiMC") -ELSE() -SET(CPACK_PACKAGE_FILE_NAME "MultiMC") -ENDIF() +if(UNIX) + if(APPLE) + set(CPACK_GENERATOR "ZIP") + else() + set(CPACK_GENERATOR "TGZ") + endif() +elseif(WIN32) + set(CPACK_GENERATOR "ZIP") +endif() +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + +set(CPACK_PACKAGE_NAME "MultiMC 5") +set(CPACK_PACKAGE_VENDOR "") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MultiMC - Minecraft launcher and management tool.") +set(CPACK_PACKAGE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") +set(CPACK_PACKAGE_VERSION_MAJOR ${MultiMC_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${MultiMC_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${MultiMC_VERSION_REV}) + +if(CPACK_GENERATOR STREQUAL "NSIS") + set(CPACK_PACKAGE_FILE_NAME "Setup-MultiMC") +else() + set(CPACK_PACKAGE_FILE_NAME "MultiMC") +endif() -IF(WIN32) -SET(CPACK_PACKAGE_INSTALL_DIRECTORY "MultiMC 5") -ENDIF() +if(WIN32) + set(CPACK_PACKAGE_INSTALL_DIRECTORY "MultiMC 5") +endif() -INCLUDE(CPack) +include(CPack) include_directories(${PROJECT_BINARY_DIR}/include) diff --git a/dependencies.cmake.in b/dependencies.cmake.in deleted file mode 100644 index 9d4d1f63..00000000 --- a/dependencies.cmake.in +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -message(STATUS "Running install script...") - -SET(Qt5_DIR @Qt5_DIR@) - -IF(WIN32) -SET(LIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) -ELSE() -SET(LIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib) -ENDIF() - -INCLUDE(GetPrerequisites) -GET_PREREQUISITES(@BINARY_LOCATION@ MULTIMC_PREREQS 1 1 "" "") - -message(STATUS "Prerequisites: ${MULTIMC_PREREQS}") - -FOREACH(PREREQ ${MULTIMC_PREREQS}) - GET_FILENAME_COMPONENT(PREREQ_NAME "${PREREQ}" NAME) - GET_FILENAME_COMPONENT(PREREQ_ACTUAL "${PREREQ}" REALPATH) - IF(WIN32) - SET(PREREQ_ACTUAL "${Qt5_DIR}/bin/${PREREQ}") - ENDIF() - - message(STATUS "Adding install prerequisite: ${PREREQ_NAME}") - - FILE(INSTALL - DESTINATION "${LIB_INSTALL_PREFIX}" - TYPE PROGRAM - RENAME "${PREREQ_NAME}" - FILES "${PREREQ_ACTUAL}" - ) -ENDFOREACH() diff --git a/depends/classparser/CMakeLists.txt b/depends/classparser/CMakeLists.txt index 5a48e002..abae3ef5 100644 --- a/depends/classparser/CMakeLists.txt +++ b/depends/classparser/CMakeLists.txt @@ -8,7 +8,7 @@ find_package(Qt5Core REQUIRED) # Include Qt headers. include_directories(${Qt5Base_INCLUDE_DIRS}) -SET(CLASSPARSER_HEADERS +set(CLASSPARSER_HEADERS include/classparser_config.h # Public headers @@ -23,13 +23,13 @@ src/javaendian.h src/membuffer.h ) -SET(CLASSPARSER_SOURCES +set(CLASSPARSER_SOURCES src/javautils.cpp src/annotations.cpp ) # Set the include dir path. -SET(LIBGROUPVIEW_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) +set(LIBGROUPVIEW_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) # Include self. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/depends/javacheck/CMakeLists.txt b/depends/javacheck/CMakeLists.txt index 10b9a716..8396aabb 100644 --- a/depends/javacheck/CMakeLists.txt +++ b/depends/javacheck/CMakeLists.txt @@ -7,9 +7,9 @@ set(CMAKE_JAVA_JAR_ENTRY_POINT JavaCheck) set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) set(SRC - JavaCheck.java + JavaCheck.java ) add_jar(JavaCheck ${SRC}) -INSTALL_JAR(JavaCheck "${BINARY_DEST_DIR}/jars") +install_jar(JavaCheck "${BINARY_DEST_DIR}/jars") diff --git a/depends/launcher/CMakeLists.txt b/depends/launcher/CMakeLists.txt index 6af5f738..9db3aaeb 100644 --- a/depends/launcher/CMakeLists.txt +++ b/depends/launcher/CMakeLists.txt @@ -7,29 +7,29 @@ set(CMAKE_JAVA_JAR_ENTRY_POINT org.multimc.EntryPoint) set(CMAKE_JAVA_COMPILE_FLAGS -target 1.6 -source 1.6 -Xlint:deprecation -Xlint:unchecked) set(SRC - # OSX things - org/simplericity/macify/eawt/Application.java - org/simplericity/macify/eawt/ApplicationAdapter.java - org/simplericity/macify/eawt/ApplicationEvent.java - org/simplericity/macify/eawt/ApplicationListener.java - org/simplericity/macify/eawt/DefaultApplication.java + # OSX things + org/simplericity/macify/eawt/Application.java + org/simplericity/macify/eawt/ApplicationAdapter.java + org/simplericity/macify/eawt/ApplicationEvent.java + org/simplericity/macify/eawt/ApplicationListener.java + org/simplericity/macify/eawt/DefaultApplication.java - # legacy applet wrapper thing. - # The launcher has to be there for silly FML/Forge relauncher. - net/minecraft/Launcher.java - org/multimc/legacy/LegacyLauncher.java - org/multimc/legacy/LegacyFrame.java + # legacy applet wrapper thing. + # The launcher has to be there for silly FML/Forge relauncher. + net/minecraft/Launcher.java + org/multimc/legacy/LegacyLauncher.java + org/multimc/legacy/LegacyFrame.java - # onesix launcher - org/multimc/onesix/OneSixLauncher.java + # onesix launcher + org/multimc/onesix/OneSixLauncher.java - # generic launcher - org/multimc/EntryPoint.java - org/multimc/Launcher.java - org/multimc/ParseException.java - org/multimc/Utils.java - org/multimc/IconLoader.java + # generic launcher + org/multimc/EntryPoint.java + org/multimc/Launcher.java + org/multimc/ParseException.java + org/multimc/Utils.java + org/multimc/IconLoader.java ) add_jar(NewLaunch ${SRC}) -INSTALL_JAR(NewLaunch "${BINARY_DEST_DIR}/jars") +install_jar(NewLaunch "${BINARY_DEST_DIR}/jars") diff --git a/depends/pack200/CMakeLists.txt b/depends/pack200/CMakeLists.txt index 386c8bb8..f1b699b2 100644 --- a/depends/pack200/CMakeLists.txt +++ b/depends/pack200/CMakeLists.txt @@ -1,26 +1,26 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +cmake_minimum_required(VERSION 2.6) -IF(WIN32) +if(WIN32) # In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows cmake_policy(SET CMP0020 OLD) -ENDIF() +endif() project(unpack200) # Find ZLIB for quazip # Use system zlib on unix and Qt ZLIB on Windows -IF(UNIX) +if(UNIX) find_package(ZLIB REQUIRED) -ELSE(UNIX) - get_filename_component (ZLIB_FOUND_DIR "${Qt5Core_DIR}/../../../include/QtZlib" ABSOLUTE) - SET(ZLIB_INCLUDE_DIRS ${ZLIB_FOUND_DIR} CACHE PATH "Path to ZLIB headers of Qt") - SET(ZLIB_LIBRARIES "") - IF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") - MESSAGE("Please specify a valid zlib include dir") - ENDIF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") -ENDIF(UNIX) - -SET(PACK200_SRC +else(UNIX) + get_filename_component(ZLIB_FOUND_DIR "${Qt5Core_DIR}/../../../include/QtZlib" ABSOLUTE) + set(ZLIB_INCLUDE_DIRS ${ZLIB_FOUND_DIR} CACHE PATH "Path to ZLIB headers of Qt") + set(ZLIB_LIBRARIES "") + if(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") + message("Please specify a valid zlib include dir") + endif(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") +endif(UNIX) + +set(PACK200_SRC include/unpack200.h src/bands.cpp src/bands.h @@ -41,19 +41,19 @@ src/zip.h set(CMAKE_POSITION_INDEPENDENT_CODE ON) -SET(PACK200_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) +set(PACK200_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) include_directories( include ${ZLIB_INCLUDE_DIRS} ) add_library(unpack200 STATIC ${PACK200_SRC}) -IF(UNIX) +if(UNIX) target_link_libraries(unpack200 ${ZLIB_LIBRARIES}) -ELSE() +else() # zlib is part of Qt on windows. use it. - QT5_USE_MODULES(unpack200 Core) -ENDIF() + qt5_use_modules(unpack200 Core) +endif() add_executable(anti200 anti200.cpp) target_link_libraries(anti200 unpack200) diff --git a/depends/quazip/CMakeLists.txt b/depends/quazip/CMakeLists.txt index 76da0a59..b5787307 100644 --- a/depends/quazip/CMakeLists.txt +++ b/depends/quazip/CMakeLists.txt @@ -2,16 +2,16 @@ project(quazip) # Find ZLIB for quazip # Use system zlib on unix and Qt ZLIB on Windows -IF(UNIX) +if(UNIX) find_package(ZLIB REQUIRED) -ELSE(UNIX) - get_filename_component (ZLIB_FOUND_DIR "${Qt5Core_DIR}/../../../include/QtZlib" ABSOLUTE) - SET(ZLIB_INCLUDE_DIRS ${ZLIB_FOUND_DIR} CACHE PATH "Path to ZLIB headers of Qt") - SET(ZLIB_LIBRARIES "") - IF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") - MESSAGE("Please specify a valid zlib include dir") - ENDIF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") -ENDIF(UNIX) +else(UNIX) + get_filename_component(ZLIB_FOUND_DIR "${Qt5Core_DIR}/../../../include/QtZlib" ABSOLUTE) + set(ZLIB_INCLUDE_DIRS ${ZLIB_FOUND_DIR} CACHE PATH "Path to ZLIB headers of Qt") + set(ZLIB_LIBRARIES "") + if(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") + message("Please specify a valid zlib include dir") + endif(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") +endif(UNIX) # set all include directories for in and out of source builds include_directories( @@ -20,23 +20,12 @@ include_directories( ${ZLIB_INCLUDE_DIRS} ) -# include with QT_USE selected library parts -# INCLUDE(${QT_USE_FILE}) - file(GLOB SRCS "*.c" "*.cpp") file(GLOB PUBLIC_HEADERS "*.h") # Static link! -ADD_DEFINITIONS(-DQUAZIP_STATIC) - -#qt5_wrap_cpp(MOC_SRCS ${PUBLIC_HEADERS}) -#set(SRCS ${SRCS} ${MOC_SRCS}) - -#set(CMAKE_POSITION_INDEPENDENT_CODE ON) +add_definitions(-DQUAZIP_STATIC) add_library(quazip STATIC ${SRCS}) -QT5_USE_MODULES(quazip Core) +qt5_use_modules(quazip Core) target_link_libraries(quazip ${ZLIB_LIBRARIES}) - -#install(FILES ${PUBLIC_HEADERS} DESTINATION include/quazip) -#install(TARGETS quazip LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION}) diff --git a/depends/settings/CMakeLists.txt b/depends/settings/CMakeLists.txt index da853a73..868b31e6 100644 --- a/depends/settings/CMakeLists.txt +++ b/depends/settings/CMakeLists.txt @@ -7,28 +7,28 @@ find_package(Qt5Core REQUIRED) include_directories(${Qt5Base_INCLUDE_DIRS}) -SET(LIBSETTINGS_SOURCES -libsettings_config.h +set(LIBSETTINGS_SOURCES + libsettings_config.h -inifile.h -inifile.cpp + inifile.h + inifile.cpp -settingsobject.h -settingsobject.cpp -inisettingsobject.h -inisettingsobject.cpp + settingsobject.h + settingsobject.cpp + inisettingsobject.h + inisettingsobject.cpp -setting.h -setting.cpp -overridesetting.h -overridesetting.cpp + setting.h + setting.cpp + overridesetting.h + overridesetting.cpp ) # Set the include dir path. -SET(LIBSETTINGS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE) +set(LIBSETTINGS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE) # Static link! -ADD_DEFINITIONS(-DLIBSETTINGS_STATIC) +add_definitions(-DLIBSETTINGS_STATIC) add_definitions(-DLIBSETTINGS_LIBRARY) diff --git a/depends/util/CMakeLists.txt b/depends/util/CMakeLists.txt index 7f6573bd..969c4a78 100644 --- a/depends/util/CMakeLists.txt +++ b/depends/util/CMakeLists.txt @@ -20,31 +20,30 @@ find_package(Qt5Core REQUIRED) # Include Qt headers. include_directories(${Qt5Base_INCLUDE_DIRS}) -# include_directories(${Qt5Network_INCLUDE_DIRS}) -SET(LIBUTIL_SOURCES -include/libutil_config.h +set(LIBUTIL_SOURCES + include/libutil_config.h -include/pathutils.h -src/pathutils.cpp + include/pathutils.h + src/pathutils.cpp -include/osutils.h + include/osutils.h -include/userutils.h -src/userutils.cpp + include/userutils.h + src/userutils.cpp -include/cmdutils.h -src/cmdutils.cpp + include/cmdutils.h + src/cmdutils.cpp -include/modutils.h -src/modutils.cpp + include/modutils.h + src/modutils.cpp ) # Set the include dir path. -SET(LIBUTIL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) +set(LIBUTIL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) # Static link! -ADD_DEFINITIONS(-DLIBUTIL_STATIC) +add_definitions(-DLIBUTIL_STATIC) add_definitions(-DLIBUTIL_LIBRARY) @@ -59,6 +58,5 @@ IF(MultiMC_CODE_COVERAGE) ENDIF(MultiMC_CODE_COVERAGE) add_library(libUtil STATIC ${LIBUTIL_SOURCES}) -# qt5_use_modules(libUtil Core Network) qt5_use_modules(libUtil Core) target_link_libraries(libUtil) diff --git a/depends/xz-embedded/CMakeLists.txt b/depends/xz-embedded/CMakeLists.txt index d4987f76..b308efa4 100644 --- a/depends/xz-embedded/CMakeLists.txt +++ b/depends/xz-embedded/CMakeLists.txt @@ -8,21 +8,21 @@ option(XZ_BUILD_MINIDEC "Build a tiny utility that decompresses xz streams" OFF) set(CMAKE_C_FLAGS "-std=c99") include_directories(include) -SET(XZ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) +set(XZ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE) # See include/xz.h for manual feature configuration # tweak this list and xz.h to fit your needs set(XZ_SOURCES -include/xz.h -src/xz_config.h -src/xz_crc32.c -src/xz_crc64.c -src/xz_dec_lzma2.c -src/xz_dec_stream.c -src/xz_lzma2.h -src/xz_private.h -src/xz_stream.h + include/xz.h + src/xz_config.h + src/xz_crc32.c + src/xz_crc64.c + src/xz_dec_lzma2.c + src/xz_dec_stream.c + src/xz_lzma2.h + src/xz_private.h + src/xz_stream.h # src/xz_dec_bcj.c ) # TODO: look into what would be needed for plain old lzma diff --git a/install_prereqs.cmake.in b/install_prereqs.cmake.in index 3ae8302d..4ed7876b 100644 --- a/install_prereqs.cmake.in +++ b/install_prereqs.cmake.in @@ -1,4 +1,4 @@ -FILE(GLOB_RECURSE QTPLUGINS "${CMAKE_INSTALL_PREFIX}/@PLUGIN_DEST_DIR@/*@CMAKE_SHARED_LIBRARY_SUFFIX@") +file(GLOB_RECURSE QTPLUGINS "${CMAKE_INSTALL_PREFIX}/@PLUGIN_DEST_DIR@/*@CMAKE_SHARED_LIBRARY_SUFFIX@") function(gp_resolved_file_type_override resolved_file type_var) if(resolved_file MATCHES "^/usr/lib/libQt") message("resolving ${resolved_file} as other") @@ -6,12 +6,12 @@ function(gp_resolved_file_type_override resolved_file type_var) elseif(resolved_file MATCHES "^/usr/lib(.+)?/libxcb") message("resolving ${resolved_file} as other") set(${type_var} other PARENT_SCOPE) - endif() + endif() endfunction() set(gp_tool "@CMAKE_GP_TOOL@") set(gp_cmd_paths ${gp_cmd_paths} - "@CMAKE_GP_CMD_PATHS@" + "@CMAKE_GP_CMD_PATHS@" ) include(BundleUtilities) diff --git a/mmc_updater/CMakeLists.txt b/mmc_updater/CMakeLists.txt index 971ac153..84bc63a5 100644 --- a/mmc_updater/CMakeLists.txt +++ b/mmc_updater/CMakeLists.txt @@ -6,18 +6,18 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") include_directories(depends) -if (WIN32) - include_directories(depends/win32cpp) +if(WIN32) + include_directories(depends/win32cpp) # static all the things. The updater must have no dependencies, or it will fail. - if (MINGW) + if(MINGW) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++ -static") #set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s") #set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s") endif() - if(MSVC) + if(MSVC) # - Link the updater binary statically with the Visual C++ runtime # so that the executable can function standalone. # - Enable PDB generation for release builds @@ -27,14 +27,14 @@ if (WIN32) set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG") set(CMAKE_C_FLAGS_RELEASE "/MT /Zi /O2 /Ob2 /D NDEBUG") remove_definitions(-DUNICODE -D_UNICODE) - endif() + endif() else() # optimize for reduced code size set(CMAKE_CXX_FLAGS_RELEASE "-Os") set(CMAKE_C_FLAGS_RELEASE "-Os") endif() -if (APPLE) +if(APPLE) # Build the updater as a dual 32/64bit binary. If only one architecture # is required, removing the other architecture will reduce the size # of the updater binary diff --git a/mmc_updater/src/CMakeLists.txt b/mmc_updater/src/CMakeLists.txt index d1a32755..d27fbe00 100644 --- a/mmc_updater/src/CMakeLists.txt +++ b/mmc_updater/src/CMakeLists.txt @@ -4,79 +4,76 @@ add_subdirectory(tests) find_package(Threads REQUIRED) include(GenerateCppResourceFile) -set (UPDATER_SOURCES - AppInfo.cpp - AppInfo.h - DirIterator.cpp - DirIterator.h - FileUtils.cpp - FileUtils.h - Log.cpp - Log.h - ProcessUtils.cpp - ProcessUtils.h - StandardDirs.cpp - StandardDirs.h - UpdateDialog.cpp - UpdateInstaller.cpp - UpdateInstaller.h - UpdateScript.cpp - UpdateScript.h - UpdaterOptions.cpp - UpdaterOptions.h +set(UPDATER_SOURCES + AppInfo.cpp + AppInfo.h + DirIterator.cpp + DirIterator.h + FileUtils.cpp + FileUtils.h + Log.cpp + Log.h + ProcessUtils.cpp + ProcessUtils.h + StandardDirs.cpp + StandardDirs.h + UpdateDialog.cpp + UpdateInstaller.cpp + UpdateInstaller.h + UpdateScript.cpp + UpdateScript.h + UpdaterOptions.cpp + UpdaterOptions.h ) add_definitions(-DTIXML_USE_STL) -if (WIN32) +if(WIN32) set(UPDATER_SOURCES ${UPDATER_SOURCES} UpdateDialogWin32.cpp UpdateDialogWin32.h) endif() -if (UNIX) +if(UNIX) set(UPDATER_SOURCES ${UPDATER_SOURCES} UpdateDialogAscii.cpp UpdateDialogAscii.h) add_definitions(-Wall -Wconversion) -if (APPLE) - set(MAC_DOCK_ICON_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/mac_dock_icon.cpp) - set(MAC_INFO_PLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/mac_info_plist.cpp) - generate_cpp_resource_file(resource_macdockicon ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac.icns ${MAC_DOCK_ICON_CPP_FILE}) - generate_cpp_resource_file(resource_macplist ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist ${MAC_INFO_PLIST_FILE}) - set(UPDATER_SOURCES ${UPDATER_SOURCES} - MacBundle.h - MacBundle.cpp - StandardDirs.mm - StlSymbolsLeopard.cpp - UpdateDialogCocoa.mm - UpdateDialogCocoa.h - mac_dock_icon.cpp - mac_info_plist.cpp - ) -else() # linuxes and other similar systems - find_package(GTK2 REQUIRED gtk) - include_directories(${GTK2_INCLUDE_DIRS}) - add_library(updatergtk SHARED UpdateDialogGtk.cpp UpdateDialogGtk.h) - target_link_libraries(updatergtk ${GTK2_LIBRARIES}) - - # embed the GTK helper library into the updater binary. - # At runtime it will be extracted and loaded if the - # GTK libraries are available - get_property(GTK_UPDATER_LIB TARGET updatergtk PROPERTY LOCATION) - set(GTK_BIN_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/libupdatergtk.cpp) - generate_cpp_resource_file(resource_updatergtk ${GTK_UPDATER_LIB} ${GTK_BIN_CPP_FILE}) - add_dependencies(resource_updatergtk updatergtk) - - set(UPDATER_SOURCES ${UPDATER_SOURCES} UpdateDialogGtkFactory.cpp UpdateDialogGtkFactory.h ${GTK_BIN_CPP_FILE}) -endif() + if(APPLE) + set(MAC_DOCK_ICON_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/mac_dock_icon.cpp) + set(MAC_INFO_PLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/mac_info_plist.cpp) + generate_cpp_resource_file(resource_macdockicon ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac.icns ${MAC_DOCK_ICON_CPP_FILE}) + generate_cpp_resource_file(resource_macplist ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist ${MAC_INFO_PLIST_FILE}) + set(UPDATER_SOURCES ${UPDATER_SOURCES} + MacBundle.h + MacBundle.cpp + StandardDirs.mm + StlSymbolsLeopard.cpp + UpdateDialogCocoa.mm + UpdateDialogCocoa.h + mac_dock_icon.cpp + mac_info_plist.cpp + ) + else() # linuxes and other similar systems + find_package(GTK2 REQUIRED gtk) + include_directories(${GTK2_INCLUDE_DIRS}) + add_library(updatergtk SHARED UpdateDialogGtk.cpp UpdateDialogGtk.h) + target_link_libraries(updatergtk ${GTK2_LIBRARIES}) + + # embed the GTK helper library into the updater binary. + # At runtime it will be extracted and loaded if the + # GTK libraries are available + get_property(GTK_UPDATER_LIB TARGET updatergtk PROPERTY LOCATION) + set(GTK_BIN_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/libupdatergtk.cpp) + generate_cpp_resource_file(resource_updatergtk ${GTK_UPDATER_LIB} ${GTK_BIN_CPP_FILE}) + add_dependencies(resource_updatergtk updatergtk) + + set(UPDATER_SOURCES ${UPDATER_SOURCES} UpdateDialogGtkFactory.cpp UpdateDialogGtkFactory.h ${GTK_BIN_CPP_FILE}) + endif() endif() add_library(updatershared STATIC ${UPDATER_SOURCES}) -target_link_libraries(updatershared - anyoption - tinyxml -) +target_link_libraries(updatershared anyoption tinyxml) -if (UNIX) - if (APPLE) +if(UNIX) + if(APPLE) find_library(COCOA_LIBRARY Cocoa) find_library(SECURITY_LIBRARY Security) target_link_libraries(updatershared ${SECURITY_LIBRARY} ${COCOA_LIBRARY}) @@ -86,36 +83,34 @@ if (UNIX) target_link_libraries(updatershared pthread dl) endif() -if (WIN32) +if(WIN32) set(EXE_FLAGS WIN32 resources/updater.rc) endif() add_executable(updater ${EXE_FLAGS} main.cpp) -target_link_libraries(updater - updatershared -) +target_link_libraries(updater updatershared) #### Updater Executable #### -IF(WIN32) -INSTALL(TARGETS updater - BUNDLE DESTINATION . COMPONENT Runtime - LIBRARY DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION . COMPONENT Runtime -) -ENDIF() -IF(UNIX) -IF(APPLE) -INSTALL(TARGETS updater - BUNDLE DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime -) -ELSE() -INSTALL(TARGETS updater - BUNDLE DESTINATION . COMPONENT Runtime - RUNTIME DESTINATION bin COMPONENT Runtime -) -ENDIF() -ENDIF() +if(WIN32) + install(TARGETS updater + BUNDLE DESTINATION . COMPONENT Runtime + LIBRARY DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION . COMPONENT Runtime + ) +endif() +if(UNIX) + if(APPLE) + install(TARGETS updater + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime + ) + else() + install(TARGETS updater + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION bin COMPONENT Runtime + ) + endif() +endif() diff --git a/mmc_updater/src/tests/CMakeLists.txt b/mmc_updater/src/tests/CMakeLists.txt index 08501a98..5a96d7c9 100644 --- a/mmc_updater/src/tests/CMakeLists.txt +++ b/mmc_updater/src/tests/CMakeLists.txt @@ -1,8 +1,8 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") -if (APPLE) - set(HELPER_SHARED_SOURCES ../StlSymbolsLeopard.cpp) +if(APPLE) + set(HELPER_SHARED_SOURCES ../StlSymbolsLeopard.cpp) endif() # # Create helper binaries for unit tests @@ -17,14 +17,14 @@ endif() # Install data files required by unit tests set(TEST_FILES - file_list.xml + file_list.xml ) foreach(TEST_FILE ${TEST_FILES}) - execute_process( - COMMAND - "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" - ) + execute_process( + COMMAND + "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" + ) endforeach() # Add unit test binaries @@ -32,13 +32,13 @@ macro(ADD_UPDATER_TEST CLASS) set(TEST_TARGET updater_${CLASS}) unset(srcs) list(APPEND srcs ${CLASS}.cpp) - if (WIN32) + if(WIN32) list(APPEND srcs ${CMAKE_CURRENT_SOURCE_DIR}/test.rc) endif() add_executable(${TEST_TARGET} ${srcs}) target_link_libraries(${TEST_TARGET} updatershared) add_test(NAME ${TEST_TARGET} COMMAND ${TEST_TARGET}) - if (APPLE) + if(APPLE) set_target_properties(${TEST_TARGET} PROPERTIES LINK_FLAGS "-framework Security -framework Cocoa") endif() endmacro() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2236e8fc..abd3523a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,7 +8,7 @@ macro(add_unit_test name) unset(srcs) foreach(arg ${testname} ${ARGN}) list(APPEND srcs ${CMAKE_CURRENT_SOURCE_DIR}/${arg}) - if (WIN32) + if(WIN32) list(APPEND srcs ${CMAKE_CURRENT_SOURCE_DIR}/test.rc) endif() endforeach() diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index 142d44dd..d28a997d 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -9,8 +9,8 @@ qt5_add_translation(TRANSLATION_QM ${TRANSLATION_FILES}) add_custom_target(translations_update DEPENDS ${TRANSLATION_MESSAGES}) add_custom_target(translations DEPENDS ${TRANSLATION_QM}) -IF(APPLE AND UNIX) ## OSX - install(FILES ${TRANSLATION_QM} DESTINATION MultiMC.app/Contents/MacOS/translations) -ELSE() - install(FILES ${TRANSLATION_QM} DESTINATION translations) -ENDIF() +if(APPLE AND UNIX) ## OSX + install(FILES ${TRANSLATION_QM} DESTINATION MultiMC.app/Contents/MacOS/translations) +else() + install(FILES ${TRANSLATION_QM} DESTINATION translations) +endif() |