diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 129 |
1 files changed, 65 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cb618f3b..be0eced8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,9 @@ include_directories(${LIBSETTINGS_INCLUDE_DIR}) add_subdirectory(depends/groupview) include_directories(${LIBGROUPVIEW_INCLUDE_DIR}) +# Add the updater +add_subdirectory(mmc_updater) + ################################ SET UP BUILD OPTIONS ################################ ######## Check endianness ######## @@ -115,24 +118,54 @@ SET(MultiMC_VERSION_MINOR 0) SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") # Build type -SET(MultiMC_VERSION_BUILD_TYPE "custombuild" CACHE STRING "Build type. Usually corresponds to the buildbot build name. Empty string for no build type.") +SET(MultiMC_VERSION_BUILD_TYPE "custombuild" CACHE STRING "Build type. If this is set, it is appended to the end of the version string with a dash (<version string>-<build type>. It is not used for anything other than indicating in the version string what type of build this is (eg 'lin64').") -SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}") +# Version channel +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.") + +# 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.") + +# Build a version string to display in the configure logs. +SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}") IF (MultiMC_VERSION_BUILD GREATER -1) SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}.${MultiMC_VERSION_BUILD}") ENDIF () - +IF (NOT MultiMC_VERSION_CHANNEL STREQUAL "") + SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_CHANNEL}") +ENDIF () IF (NOT MultiMC_VERSION_BUILD_TYPE STREQUAL "") SET(MultiMC_VERSION_STRING "${MultiMC_VERSION_STRING}-${MultiMC_VERSION_BUILD_TYPE}") ENDIF () MESSAGE(STATUS "MultiMC 5 version ${MultiMC_VERSION_STRING}") -# Custom target to just print the version. +# 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 () + +#### Custom target to just print the version. ADD_CUSTOM_TARGET(version echo "Version: ${MultiMC_VERSION_STRING}") -# Check the current Git commit +#### Check the current Git commit execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE GIT_COMMIT_CHECK_RESULTVAR @@ -140,7 +173,6 @@ execute_process(COMMAND git rev-parse HEAD OUTPUT_STRIP_TRAILING_WHITESPACE ) -# If Git executed successfully IF(GIT_COMMIT_CHECK_RESULTVAR EQUAL 0) SET(MultiMC_GIT_COMMIT "${GIT_COMMIT_CHECK_OUTVAR}") MESSAGE(STATUS "Git commit: ${MultiMC_GIT_COMMIT}") @@ -149,41 +181,8 @@ ELSE() MESSAGE(STATUS "Failed to check Git commit. ${GIT_COMMIT_CHECK_RESULTVAR}") ENDIF() - -######## Set Jenkins info ######## -# Jenkins build tag -IF(DEFINED MultiMC_BUILD_TAG) - MESSAGE(STATUS "Build tag: ${MultiMC_BUILD_TAG}") -ELSE() - MESSAGE(STATUS "No build tag specified.") - SET(MultiMC_BUILD_TAG custom) -ENDIF() - -# Architecture detection -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(MultiMC_ARCH "x64" CACHE STRING "Architecture we're building for.") -ELSE() - SET(MultiMC_ARCH "x86" CACHE STRING "Architecture we're building for.") -ENDIF() -MESSAGE(STATUS "Architecture is ${MultiMC_ARCH}") - -# Jenkins job name -IF(WIN32) - SET(MultiMC_JOB_NAME "MultiMC5Windows" CACHE STRING "Jenkins job name.") -ELSEIF(UNIX AND APPLE) - SET(MultiMC_JOB_NAME "MultiMC5OSX" CACHE STRING "Jenkins job name.") -ELSE() - SET(MultiMC_JOB_NAME "MultiMC5Linux" CACHE STRING "Jenkins job name.") -ENDIF() - -# Jenkins URL -SET(MultiMC_JOB_URL "http://ci.forkk.net/job/${MultiMC_JOB_NAME}/arch=${MultiMC_ARCH}${MultiMC_Extra_Label}/" - CACHE STRING "URL of the jenkins job to pull updates from.") -MESSAGE(STATUS "Job URL: ${MultiMC_JOB_URL}") - ######## Configure header ######## -configure_file("${PROJECT_SOURCE_DIR}/config.h.in" - "${PROJECT_BINARY_DIR}/include/config.h") +configure_file("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/include/config.h") ######## Other Stuff ######## @@ -251,6 +250,8 @@ 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 - widgets gui/widgets/InstanceDelegate.h @@ -284,8 +285,8 @@ logic/InstanceLauncher.cpp # network stuffs logic/net/NetAction.h -logic/net/FileDownload.h -logic/net/FileDownload.cpp +logic/net/MD5EtagDownload.h +logic/net/MD5EtagDownload.cpp logic/net/ByteArrayDownload.h logic/net/ByteArrayDownload.cpp logic/net/CacheDownload.h @@ -300,8 +301,13 @@ logic/net/HttpMetaCache.h logic/net/HttpMetaCache.cpp logic/net/S3ListBucket.h logic/net/S3ListBucket.cpp +logic/net/PasteUpload.h +logic/net/PasteUpload.cpp +logic/net/URLConstants.h # Yggdrasil login stuff +logic/auth/MojangAccountList.h +logic/auth/MojangAccountList.cpp logic/auth/MojangAccount.h logic/auth/MojangAccount.cpp logic/auth/YggdrasilTask.h @@ -312,8 +318,12 @@ logic/auth/flows/RefreshTask.cpp logic/auth/flows/RefreshTask.cpp logic/auth/flows/ValidateTask.h logic/auth/flows/ValidateTask.cpp -logic/auth/flows/InvalidateTask.h -logic/auth/flows/InvalidateTask.cpp + +# Update system +logic/updater/UpdateChecker.h +logic/updater/UpdateChecker.cpp +logic/updater/DownloadUpdateTask.h +logic/updater/DownloadUpdateTask.cpp # legacy instances logic/LegacyInstance.h @@ -325,8 +335,6 @@ logic/LegacyForge.h logic/LegacyForge.cpp # 1.6 instances -logic/OneSixAssets.h -logic/OneSixAssets.cpp logic/OneSixInstance.h logic/OneSixInstance.cpp logic/OneSixInstance_p.h @@ -362,8 +370,6 @@ logic/lists/ForgeVersionList.h logic/lists/ForgeVersionList.cpp logic/lists/JavaVersionList.h logic/lists/JavaVersionList.cpp -logic/lists/MojangAccountList.h -logic/lists/MojangAccountList.cpp # misc model/view logic/EnabledItemFilter.h @@ -383,7 +389,12 @@ logic/NagUtils.h logic/NagUtils.cpp logic/SkinUtils.h logic/SkinUtils.cpp +logic/JavaCheckerJob.h +logic/JavaCheckerJob.cpp +# Assets +logic/assets/AssetsUtils.h +logic/assets/AssetsUtils.cpp ) @@ -410,6 +421,7 @@ gui/dialogs/EditNotesDialog.ui gui/dialogs/AccountListDialog.ui gui/dialogs/AccountSelectDialog.ui gui/dialogs/EditAccountDialog.ui +gui/dialogs/UpdateDialog.ui # Widgets/other gui/widgets/MCModInfoFrame.ui @@ -580,22 +592,11 @@ FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\") COMPONENT Runtime ) - -INSTALL( - CODE " -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\") - set(\${type_var} other PARENT_SCOPE) - endif() -endfunction() - -include(BundleUtilities) -fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\") -" - 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) |