Fixed install to automatically include required DLLs. Suck it, DLL hell!

This commit is contained in:
Andrew 2013-02-12 11:57:18 -06:00
parent 5a4b2ad000
commit 397c0cb555

View File

@ -186,9 +186,39 @@ ENDIF()
# Extra libs and files to package. # 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. # Image format plugins.
SET(IMAGE_FORMAT_PLUGINS svg ico gif jpeg) 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) IF(WIN32)
# Windows # Windows
@ -202,17 +232,14 @@ ENDIF()
# Install platform plugins. # Install platform plugins.
SET(PLATFORM_PLUGINS windows minimal) SET(PLATFORM_PLUGINS windows minimal)
FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) 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() ENDFOREACH()
# Install image format plugins. # Install image format plugins.
FOREACH(IMGFMT_PLUGIN ${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() ENDFOREACH()
# Additional libs
INSTALL(FILES "${Qt5_DIR}/bin/libEGL${D}.dll" DESTINATION .)
ELSEIF(UNIX) ELSEIF(UNIX)
IF (APPLE) IF (APPLE)
@ -226,22 +253,23 @@ ELSE()
# Install platform plugins. # Install platform plugins.
SET(PLATFORM_PLUGINS linuxfb xcb minimal) SET(PLATFORM_PLUGINS linuxfb xcb minimal)
FOREACH(PLATFORM_PLUGIN ${PLATFORM_PLUGINS}) 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() ENDFOREACH()
# Install image format plugins. # Install image format plugins.
FOREACH(IMGFMT_PLUGIN ${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() ENDFOREACH()
# This stuff *should* be added automatically by the INCLUDE_DLL_DEPS macro.
# Install ICU libs. # Install ICU libs.
SET(ICU_LIBS data i18n io le lx test tu uc) #SET(ICU_LIBS data i18n io le lx test tu uc)
FOREACH(ICU_LIB ${ICU_LIBS}) #FOREACH(ICU_LIB ${ICU_LIBS})
INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib) # INSTALL(FILES "/usr/lib/libicu${ICU_LIB}.so.48.1.1" DESTINATION lib)
ENDFOREACH() #ENDFOREACH()
# Install additional libs. # 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 the start script.
INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .) INSTALL(FILES "${CMAKE_CURRENT_SOURCE_DIR}/package/linux/MultiMC" DESTINATION .)
@ -269,6 +297,25 @@ IF(UNIX)
ELSEIF(WIN32) ELSEIF(WIN32)
SET(CPACK_GENERATOR "ZIP") SET(CPACK_GENERATOR "ZIP")
ENDIF() ENDIF()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_FILE_NAME "MultiMC")
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) INCLUDE(CPack)