summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-12-01 14:28:47 -0600
committerAndrew <forkk@forkk.net>2013-12-01 14:28:47 -0600
commit613699b3626aea750093ab7eaaeccaa28c0e87c6 (patch)
tree7fd542b8f4be10359ba2aaeac9834f1b5c86a750 /CMakeLists.txt
parent2427ad687137bbcfc7303a931d7e0b74d5325e48 (diff)
parent75c4d97b90e39f2bda6e682def0fdda044cbcf6f (diff)
downloadMultiMC-613699b3626aea750093ab7eaaeccaa28c0e87c6.tar
MultiMC-613699b3626aea750093ab7eaaeccaa28c0e87c6.tar.gz
MultiMC-613699b3626aea750093ab7eaaeccaa28c0e87c6.tar.lz
MultiMC-613699b3626aea750093ab7eaaeccaa28c0e87c6.tar.xz
MultiMC-613699b3626aea750093ab7eaaeccaa28c0e87c6.zip
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt223
1 files changed, 126 insertions, 97 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3cacbe2..79a69225 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,14 +27,14 @@ ENDIF()
######## Set compiler flags ########
IF(APPLE)
message(STATUS "Using APPLE CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
ELSEIF(UNIX)
# assume GCC, add C++0x/C++11 stuff
MESSAGE(STATUS "Using UNIX CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
ELSEIF(MINGW)
MESSAGE(STATUS "Using MINGW CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
ENDIF()
################################ INCLUDE LIBRARIES ################################
@@ -48,6 +48,23 @@ find_package(Qt5LinguistTools REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
+# The Qt5 cmake files don't provide its install paths, so ask qmake.
+get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
+function(QUERY_QMAKE VAR RESULT)
+ exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
+ if(NOT return_code)
+ file(TO_CMAKE_PATH "${output}" output)
+ set(${RESULT} ${output} PARENT_SCOPE)
+ endif(NOT return_code)
+endfunction(QUERY_QMAKE)
+
+query_qmake(QT_INSTALL_PLUGINS QT_PLUGINS_DIR)
+query_qmake(QT_INSTALL_IMPORTS QT_IMPORTS_DIR)
+query_qmake(QT_INSTALL_LIBS QT_LIBS_DIR)
+query_qmake(QT_HOST_DATA QT_DATA_DIR)
+set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs)
+
+
######## Included Libs ########
# Add quazip
@@ -289,11 +306,14 @@ logic/auth/MojangAccount.h
logic/auth/MojangAccount.cpp
logic/auth/YggdrasilTask.h
logic/auth/YggdrasilTask.cpp
-logic/auth/AuthenticateTask.h
-logic/auth/AuthenticateTask.cpp
-logic/auth/ValidateTask.h
-logic/auth/ValidateTask.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
+logic/auth/flows/InvalidateTask.h
+logic/auth/flows/InvalidateTask.cpp
# legacy instances
logic/LegacyInstance.h
@@ -439,7 +459,6 @@ CONFIGURE_FILE(generated.qrc.in generated.qrc)
QT5_ADD_RESOURCES(GENERATED_QRC ${CMAKE_CURRENT_BINARY_DIR}/generated.qrc)
QT5_ADD_RESOURCES(GRAPHICS_QRC graphics.qrc)
-
# Add executable
ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32
${MULTIMC_SOURCES} ${MULTIMC_UI} ${GRAPHICS_QRC} ${GENERATED_QRC} ${MULTIMC_RCS})
@@ -449,110 +468,122 @@ TARGET_LINK_LIBRARIES(MultiMC xz-embedded unpack200 quazip libUtil libSettings l
QT5_USE_MODULES(MultiMC Core Widgets Network Xml ${MultiMC_QT_ADDITIONAL_MODULES})
ADD_DEPENDENCIES(MultiMC MultiMCLauncher JavaCheck)
-option(BUILD_KEYRING_TEST "Build the simple keyring test binary" OFF)
-IF(BUILD_KEYRING_TEST)
- # test.cpp
- ADD_EXECUTABLE(Test test.cpp)
- QT5_USE_MODULES(Test Core)
- TARGET_LINK_LIBRARIES(Test libUtil libSettings)
-ENDIF()
-
################################ INSTALLATION AND PACKAGING ################################
-# use QtCreator's QTDIR var
-IF(DEFINED ENV{QTDIR})
- SET(Qt5_DIR $ENV{QTDIR})
-ENDIF()
-######## Plugin and library folders ########
-
-SET(PLUGIN_DEST_DIR plugins)
-SET(QTCONF_DEST_DIR .)
-SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC")
-
-IF(WIN32)
- SET(PLUGIN_DEST_DIR .)
- SET(QTCONF_DEST_DIR .)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
-ENDIF()
+######## Packaging/install paths setup ########
-IF(UNIX)
-IF(APPLE)
+IF(UNIX AND APPLE)
SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS)
SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
-ELSE()
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
-ENDIF()
-ENDIF()
-
-SET(QT_PLUGINS_DIR ${Qt5_DIR}/plugins)
-SET(QT_LIBRARY_DIRS ${Qt5_DIR}/lib)
-
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
-######## OS X Bundle Info ########
-
-IF(APPLE)
SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC")
SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.")
- SET(MACOSX_BUNDLE_BUNDLE_VERSION
- "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
#SET(MACOSX_BUNDLE_GUI_IDENTIFIER "")
SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns)
-ENDIF(APPLE)
+ELSEIF(UNIX)
+ SET(PLUGIN_DEST_DIR plugins)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
+ELSEIF(WIN32)
+ SET(PLUGIN_DEST_DIR .)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
+ENDIF()
+
+# directories to look for dependencies
+SET(DIRS "${QT_LIBS_DIR}")
######## Install ########
#### Executable ####
-IF(WIN32)
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- LIBRARY DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION . COMPONENT Runtime
-)
-ENDIF()
-IF(UNIX)
-IF(APPLE)
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime
-)
-ELSE()
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION bin COMPONENT Runtime
-)
-INSTALL(PROGRAMS package/linux/MultiMC DESTINATION .)
-ENDIF()
-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 .)
-#### Plugins ####
+ELSEIF(WIN32) ## WINDOWS
+ INSTALL(TARGETS MultiMC
+ BUNDLE DESTINATION . COMPONENT Runtime
+ LIBRARY DESTINATION . COMPONENT Runtime
+ RUNTIME DESTINATION . COMPONENT Runtime
+ )
+ENDIF()
-OPTION(MultiMC_INSTALL_SHARED_LIBS "if set, Qt's shared libraries will be copied to the installation directory on install")
+#### Dist package logic ####
-IF (MultiMC_INSTALL_SHARED_LIBS)
- # Image formats
- INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${PLUGIN_DEST_DIR} COMPONENT Runtime)
+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)
+# 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
+)
- # qtconf
- INSTALL(CODE "
- FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
- " COMPONENT Runtime)
+# 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
+)
+endif()
+
+# qtconf
+INSTALL(
+ CODE "
+FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
+"
+ COMPONENT Runtime
+)
- # Dirs to look for dependencies.
- SET(DIRS "${QT_LIBRARY_DIRS}")
+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
+)
- INSTALL(CODE "
- file(GLOB_RECURSE QTPLUGINS
- \"\${CMAKE_INSTALL_PREFIX}/${PLUGIN_DEST_DIR}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
- include(BundleUtilities)
- fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
- " COMPONENT Runtime)
-ENDIF()
######## Package ########
@@ -596,14 +627,12 @@ include_directories(${PROJECT_BINARY_DIR}/include)
file (GLOB TRANSLATIONS_FILES translations/*.ts)
option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files (WARNING: make clean will delete the source .ts files! Danger!)")
-if (UPDATE_TRANSLATIONS)
- qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
-else (UPDATE_TRANSLATIONS)
- qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
-endif (UPDATE_TRANSLATIONS)
+IF(UPDATE_TRANSLATIONS)
+ qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
+ELSE()
+ qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
+ENDIF()
add_custom_target (translations DEPENDS ${QM_FILES})
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/translations)
-
-