diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e649e39..55645e3c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,9 +186,39 @@ ENDIF() # Extra libs and files to package. +IF(WIN32) +SET(LIB_INSTALL_PREFIX .) +SET(LIB_INSTALL_PREFIX_ABS ${CMAKE_INSTALL_PREFIX}) +ELSE() +SET(LIB_INSTALL_PREFIX lib) +SET(LIB_INSTALL_PREFIX_ABS ${CMAKE_INSTALL_PREFIX}/lib) +ENDIF() + + # Image format plugins. SET(IMAGE_FORMAT_PLUGINS svg ico gif jpeg) +INCLUDE(GetPrerequisites) + +MACRO(INCLUDE_DLL_DEPS DLL_FILE DEST) +GET_PREREQUISITES(${DLL_FILE} DLL_PREREQS 1 1 "" "") + +INSTALL(FILES ${DLL_FILE} DESTINATION ${DEST}) + +FOREACH(PREREQ ${DLL_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}") + + INSTALL(FILES ${PREREQ_ACTUAL} RENAME ${PREREQ_NAME} DESTINATION ${LIB_INSTALL_PREFIX}) +ENDFOREACH() +ENDMACRO() + + IF(WIN32) # Windows @@ -202,17 +232,14 @@ ENDIF() # Install platform plugins. SET(PLATFORM_PLUGINS windows minimal) FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/platforms/q${PLATFORM_PLUGIN}${D}.dll" DESTINATION platforms) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/platforms/q${PLATFORM_PLUGIN}${D}.dll" platforms) ENDFOREACH() # Install image format plugins. FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/q${IMGFMT_PLUGIN}${D}.dll" DESTINATION imageformats) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/q${IMGFMT_PLUGIN}${D}.dll" imageformats) ENDFOREACH() -# Additional libs -INSTALL(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION .) - ELSEIF(UNIX) IF (APPLE) @@ -226,22 +253,23 @@ ELSE() # Install platform plugins. SET(PLATFORM_PLUGINS linuxfb xcb minimal) FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/platforms/libq${PLATFORM_PLUGIN}.so" DESTINATION platforms) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/platforms/libq${PLATFORM_PLUGIN}.so" platforms) ENDFOREACH() # Install image format plugins. FOREACH(IMGFMT_PLUGIN ${IMAGE_FORMAT_PLUGINS}) - INSTALL(FILES "${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" DESTINATION imageformats) + INCLUDE_DLL_DEPS("${Qt5_DIR}/plugins/imageformats/libq${IMGFMT_PLUGIN}.so" imageformats) ENDFOREACH() +# This stuff *should* be added automatically by the INCLUDE_DLL_DEPS macro. # Install ICU libs. -SET(ICU_LIBS data i18n io le lx test tu uc) -FOREACH(ICU_LIB ${ICU_LIBS}) - INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) -ENDFOREACH() +#SET(ICU_LIBS data i18n io le lx test tu uc) +#FOREACH(ICU_LIB ${ICU_LIBS}) +# INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) +#ENDFOREACH() # Install additional libs. -INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) +#INSTALL(FILES "${Qt5_DIR}/lib/libQt5DBus.so.5.0.1" DESTINATION lib RENAME libQt5DBus.so.5) # Install the start script. INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .) @@ -269,6 +297,25 @@ IF(UNIX) ELSEIF(WIN32) SET(CPACK_GENERATOR "ZIP") ENDIF() -set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) -set(CPACK_PACKAGE_FILE_NAME "MultiMC") +SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + +SET(CPACK_GENERATOR NSIS) +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() + INCLUDE(CPack)