|
|
|
@ -5,35 +5,36 @@ if(IS_IN_SOURCE_BUILD)
|
|
|
|
|
message(AUTHOR_WARNING "You are building MultiMC in-source. This is NOT recommended!")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
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(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)
|
|
|
|
|
|
|
|
|
|
######## Set compiler flags ########
|
|
|
|
|
include(UseCXX11)
|
|
|
|
|
include(Coverage)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
|
|
|
|
|
|
|
|
|
@ -67,85 +68,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 ()
|
|
|
|
|
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}")
|
|
|
|
|
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"
|
|
|
|
|
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"
|
|
|
|
|
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"
|
|
|
|
|
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 ()
|
|
|
|
|
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)
|
|
|
|
@ -164,60 +164,51 @@ 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
|
|
|
|
|
include(GitFunctions)
|
|
|
|
|
git_run(COMMAND rev-parse HEAD DEFAULT "Unknown" OUTPUT_VAR MultiMC_GIT_COMMIT)
|
|
|
|
|
message(STATUS "Git commit: ${MultiMC_GIT_COMMIT}")
|
|
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
ENDIF(MultiMC_CODE_COVERAGE)
|
|
|
|
|
|
|
|
|
|
######## Configure header ########
|
|
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR}/BuildConfig.cpp")
|
|
|
|
|
|
|
|
|
|
######## 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")
|
|
|
|
|
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()
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
@ -236,12 +227,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})
|
|
|
|
|
|
|
|
|
@ -546,7 +537,6 @@ logic/tools/JVisualVM.cpp
|
|
|
|
|
|
|
|
|
|
######## UIs ########
|
|
|
|
|
SET(MULTIMC_UIS
|
|
|
|
|
|
|
|
|
|
# Windows
|
|
|
|
|
gui/MainWindow.ui
|
|
|
|
|
gui/ConsoleWindow.ui
|
|
|
|
@ -587,7 +577,7 @@ foreach(file ${MULTIMC_UIS})
|
|
|
|
|
list(APPEND FILES_TO_TRANSLATE "${absfile}")
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
SET(MULTIMC_QRCS
|
|
|
|
|
set(MULTIMC_QRCS
|
|
|
|
|
resources/backgrounds/backgrounds.qrc
|
|
|
|
|
resources/multimc/multimc.qrc
|
|
|
|
|
resources/instances/instances.qrc
|
|
|
|
@ -595,78 +585,78 @@ 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
|
|
|
|
|
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
|
|
|
|
|
elseif(UNIX) ## LINUX and similar
|
|
|
|
|
install(TARGETS MultiMC
|
|
|
|
|
BUNDLE DESTINATION . COMPONENT Runtime
|
|
|
|
|
RUNTIME DESTINATION bin COMPONENT Runtime
|
|
|
|
|
)
|
|
|
|
|
INSTALL(PROGRAMS package/linux/MultiMC DESTINATION .)
|
|
|
|
|
install(PROGRAMS package/linux/MultiMC DESTINATION .)
|
|
|
|
|
|
|
|
|
|
ELSEIF(WIN32) ## WINDOWS
|
|
|
|
|
INSTALL(TARGETS MultiMC
|
|
|
|
|
elseif(WIN32) ## WINDOWS
|
|
|
|
|
install(TARGETS MultiMC
|
|
|
|
|
BUNDLE DESTINATION . COMPONENT Runtime
|
|
|
|
|
LIBRARY DESTINATION . COMPONENT Runtime
|
|
|
|
|
RUNTIME DESTINATION . COMPONENT Runtime
|
|
|
|
|
)
|
|
|
|
|
ENDIF()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
#### Dist package logic ####
|
|
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
|
|
|
|
# Image formats
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
|
|
|
|
|
DESTINATION ${PLUGIN_DEST_DIR}
|
|
|
|
|
COMPONENT Runtime
|
|
|
|
@ -674,7 +664,7 @@ INSTALL(
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Platform plugins
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
DIRECTORY "${QT_PLUGINS_DIR}/platforms"
|
|
|
|
|
DESTINATION ${PLUGIN_DEST_DIR}
|
|
|
|
|
COMPONENT Runtime
|
|
|
|
@ -682,7 +672,7 @@ INSTALL(
|
|
|
|
|
)
|
|
|
|
|
else()
|
|
|
|
|
# Image formats
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
|
|
|
|
|
DESTINATION ${PLUGIN_DEST_DIR}
|
|
|
|
|
COMPONENT Runtime
|
|
|
|
@ -692,7 +682,7 @@ INSTALL(
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Platform plugins
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
DIRECTORY "${QT_PLUGINS_DIR}/platforms"
|
|
|
|
|
DESTINATION ${PLUGIN_DEST_DIR}
|
|
|
|
|
COMPONENT Runtime
|
|
|
|
@ -700,9 +690,9 @@ INSTALL(
|
|
|
|
|
REGEX "d\\." EXCLUDE
|
|
|
|
|
REGEX "_debug\\." EXCLUDE
|
|
|
|
|
)
|
|
|
|
|
IF(APPLE)
|
|
|
|
|
if(APPLE)
|
|
|
|
|
# Accessible plugin to make buttons look decent on osx
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
DIRECTORY "${QT_PLUGINS_DIR}/accessible"
|
|
|
|
|
DESTINATION ${PLUGIN_DEST_DIR}
|
|
|
|
|
COMPONENT Runtime
|
|
|
|
@ -710,64 +700,64 @@ IF(APPLE)
|
|
|
|
|
REGEX "d\\." EXCLUDE
|
|
|
|
|
REGEX "_debug\\." EXCLUDE
|
|
|
|
|
)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# qtconf
|
|
|
|
|
INSTALL(
|
|
|
|
|
install(
|
|
|
|
|
CODE "
|
|
|
|
|
FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
|
|
|
|
|
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
|
|
|
|
|
"
|
|
|
|
|
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(
|
|
|
|
|
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)
|
|
|
|
|
@ONLY
|
|
|
|
|
)
|
|
|
|
|
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" COMPONENT Runtime)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######## Package ########
|
|
|
|
|
|
|
|
|
|
# Package with CPack
|
|
|
|
|
IF(UNIX)
|
|
|
|
|
if(UNIX)
|
|
|
|
|
if(APPLE)
|
|
|
|
|
SET(CPACK_GENERATOR "ZIP")
|
|
|
|
|
set(CPACK_GENERATOR "ZIP")
|
|
|
|
|
else()
|
|
|
|
|
SET(CPACK_GENERATOR "TGZ")
|
|
|
|
|
set(CPACK_GENERATOR "TGZ")
|
|
|
|
|
endif()
|
|
|
|
|
ELSEIF(WIN32)
|
|
|
|
|
SET(CPACK_GENERATOR "ZIP")
|
|
|
|
|
ENDIF()
|
|
|
|
|
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
|
|
|
|
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})
|
|
|
|
|
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(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(Coverity)
|
|
|
|
|
|
|
|
|
|