From 2f619e40436175b4fb30c449e43305039d87348a Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 5 Feb 2013 12:09:20 -0600 Subject: [PATCH] Added install target for Windows. --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++-- dependencies.cmake.in | 25 +++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 dependencies.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 570900f74..cb9e6faa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.9) -project(MultiMC5) +project(MultiMC) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -144,6 +144,11 @@ gui/settingsdialog.ui gui/newinstancedialog.ui ) +IF(WIN32) +SET(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} +Ws2_32) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(resources/MultiMCLauncher.jar GENERATED) QT5_WRAP_UI(MULTIMC_UI ${MULTIMC5_UIS}) @@ -153,4 +158,47 @@ add_executable(MultiMC ${MULTIMC_SOURCES} ${MULTIMC_HEADERS} ${MULTIMC_UI} ${MUL qt5_use_modules(MultiMC Widgets) target_link_libraries(MultiMC quazip patchlib ${MultiMC_LINK_ADDITIONAL_LIBS}) add_dependencies(MultiMC MultiMCLauncher) -install(TARGETS MultiMC RUNTIME DESTINATION bin) +install(TARGETS MultiMC RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + +IF(WIN32) +IF(CMAKE_BUILD_TYPE STREQUAL "Debug") +SET(D "d") +ELSE() +SET(D "") +ENDIF() + +install(FILES "${Qt5_DIR}/plugins/platforms/qwindows${D}.dll" DESTINATION platforms) +install(FILES "${Qt5_DIR}/plugins/platforms/qminimal${D}.dll" DESTINATION platforms) +install(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION ${CMAKE_INSTALL_PREFIX}) + +install(FILES "${Qt5_DIR}/plugins/imageformats/qsvg${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qico${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qgif${D}.dll" DESTINATION imageformats) +install(FILES "${Qt5_DIR}/plugins/imageformats/qjpeg${D}.dll" DESTINATION imageformats) + +ELSEIF(UNIX) +ENDIF() + + +GET_TARGET_PROPERTY(BINARY_LOCATION MultiMC LOCATION) +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake" + @ONLY + ) +INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake") + + +# 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_FILE_NAME "MultiMC") +INCLUDE(CPack) diff --git a/dependencies.cmake.in b/dependencies.cmake.in new file mode 100644 index 000000000..1790b97bb --- /dev/null +++ b/dependencies.cmake.in @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.9) + +message(STATUS "Running install script...") + +SET(Qt5_DIR @Qt5_DIR@) + +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) + SET(PREREQ_ACTUAL "${Qt5_DIR}/bin/${PREREQ}") + + message(STATUS "Adding install prerequisite: ${PREREQ_NAME}") + + FILE(INSTALL + DESTINATION "${CMAKE_INSTALL_PREFIX}" + TYPE PROGRAM + RENAME "${PREREQ_NAME}" + FILES "${PREREQ_ACTUAL}" + ) +ENDFOREACH()