]> git.lyx.org Git - lyx.git/blobdiff - development/cmake/LyxPackaging.cmake
Allow for cite engine and format definitions/modifications in layouts
[lyx.git] / development / cmake / LyxPackaging.cmake
index e0611225b5082ed51af8e1185840faaa219f6f27..140072c8b955a3132dd19bf14d6bff4bff9e4f75 100644 (file)
@@ -6,6 +6,8 @@
 if(LYX_BUNDLE)
        if(APPLE)
                set(CPACK_GENERATOR DragNDrop)
+               set(CPACK_DMG_BACKGROUND_IMAGE "${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png")
+               set(CPACK_DMG_DS_STORE "${CMAKE_BINARY_DIR}/ds_store/.DS_Store")
        elseif(UNIX)
                set(CPACK_GENERATOR STGZ)
        elseif(WIN32)
@@ -13,18 +15,108 @@ if(LYX_BUNDLE)
        endif()
 endif()
 
+# Overwrite package name dependent on platform
+# (Ignores the top project)
+if(APPLE)
+       # true on all systems whre __APPLE__ is defined in header files
+       set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
+elseif(UNIX)
+       # True also for cygwin
+       set(CPACK_PACKAGE_NAME "lyx${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
+else()
+       set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
+endif()
 
 set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
 set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
-FILE(STRINGS "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
 
 
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
 
-#
-# needed by rpm
-set(CPACK_SET_DESTDIR "ON")
-FILE(READ "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
+if (APPLE)
+       # We don't need absolute paths
+       set(CPACK_SET_DESTDIR "OFF")
+elseif(WIN32)
+    set(CPACK_GENERATOR ZIP)
+    set(CPACK_BINARY_ZIP 1)
+    if(MINGW)
+        set(runtime)
+        if(LYX_XMINGW)
+            execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
+            list(APPEND runtime /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll)
+        else()
+            set(GCC_LIBGCC ${CMAKE_CXX_COMPILER})
+        endif()
+        get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)        
+        macro(add_runtime_dll _DLL)
+            file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/${_DLL})
+            list(APPEND runtime ${GCC_RUNTIME})
+        endmacro()
+        add_runtime_dll(libgcc*.dll)
+        add_runtime_dll(libstd*.dll)
+        add_runtime_dll(libwin*.dll)
+        if(NOT runtime)
+            message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}")
+        endif()
+
+        if(LYX_USE_QT MATCHES "QT5")
+            get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
+            get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
+            install(FILES
+                ${runtime}
+                ${QT_BINARY_DIR}/Qt5Core.dll
+                ${QT_BINARY_DIR}/Qt5Network.dll
+                ${QT_BINARY_DIR}/Qt5Gui.dll
+                ${QT_BINARY_DIR}/Qt5Widgets.dll
+                ${QT_BINARY_DIR}/Qt5Concurrent.dll
+                ${QT_BINARY_DIR}/Qt5OpenGL.dll
+                ${QT_BINARY_DIR}/Qt5PrintSupport.dll
+                ${QT_BINARY_DIR}/Qt5Svg.dll
+                ${QT_BINARY_DIR}/Qt5WinExtras.dll
+                DESTINATION bin
+                CONFIGURATIONS Release)
+            install(FILES
+                ${QT_BINARY_DIR}/../plugins/platforms/qminimal.dll
+                ${QT_BINARY_DIR}/../plugins/platforms/qwindows.dll
+                DESTINATION bin/platforms
+                CONFIGURATIONS Release)
+            install(FILES
+                ${QT_BINARY_DIR}/../plugins/printsupport/windowsprintersupport.dll
+                DESTINATION bin/printsupport
+                CONFIGURATIONS Release)
+            install(FILES
+                ${QT_BINARY_DIR}/../plugins/imageformats/qgif.dll
+                ${QT_BINARY_DIR}/../plugins/imageformats/qjpeg.dll
+                ${QT_BINARY_DIR}/../plugins/imageformats/qsvg.dll
+                ${QT_BINARY_DIR}/../plugins/imageformats/qico.dll
+                DESTINATION bin/imageformats
+                CONFIGURATIONS Release)
+            install(FILES
+                ${QT_BINARY_DIR}/../plugins/iconengines/qsvgicon.dll
+                DESTINATION bin/iconengines
+                CONFIGURATIONS Release)
+        else()
+            install(FILES
+                ${runtime}
+                ${QT_BINARY_DIR}/QtCore4.dll
+                ${QT_BINARY_DIR}/QtGui4.dll
+                ${QT_BINARY_DIR}/QtNetwork4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qico4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
+                ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
+                DESTINATION bin CONFIGURATIONS Release)
+        endif()
+    endif()
+else()
+       # needed by rpm
+       set(CPACK_SET_DESTDIR "ON")
+endif()
+
+FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
 set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
 set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
 #
@@ -32,23 +124,18 @@ set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
 set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
 
-# This is experimental, valid on _my_ system (Kornel)
-set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqtgui4 (>= 4.4.3-0)")
-if(ASPELL_FOUND)
-       set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaspell15 (>= 0.60.6-1),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-endif()
-if(ENCHANT_FOUND)
-       set(CPACK_DEBIAN_PACKAGE_DEPENDS "libenchant1c2a (>= 1.6.0-0),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-endif()
-if(LYX_EXTERNAL_BOOST)
-       if(Boost_FOUND)
-               set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-regex1.40.0 (>= 1.40.0-4),libboost-signals1.40.0 (>= 1.40.0-4),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-       endif()
-endif()
+# We depend on python scripting
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.6)")
+
+# use dpkg-shlibdeps to generate additional info for package dependency list.
+set(CPACK_DEBIAN_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
+set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
+
 #
 # for the next ones, cpack insists on data with values in some file
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_description.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
 
 # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
 # as the release in rpm-package-build.
@@ -74,14 +161,25 @@ SET(CPACK_SOURCE_IGNORE_FILES
 "/\\\\.bzr/"
 "/\\\\.hg/"
 "/\\\\.git/"
+"/\\\\.project$"
+"/\\\\.cproject$"
+"/\\\\.history$"
+"/\\\\.gitignore$"
+"/\\\\.gitattributes$"
+"\\\\.#"
 "\\\\.swp$"
+"\\\\.my$"
+"\\\\.pyc$"
+"\\\\.patch$"
 "~$"
-"\\\\.history$"
-"\\\\.#"
 "/#"
 "/_CPack_Packages/"
 "/CMakeCache.txt$"
-"CPackSourceConfig\\\\.cmake"
+"/CPackSourceConfig\\\\.cmake$"
+"/configCompiler\\\\.h$"
+"/install_manifest\\\\.txt$"
+"/cmake_install\\\\.cmake$"
+"/POTFILES"
 "\\\\.tar\\\\.gz$"
 "\\\\.tar\\\\.bz2$"
 "\\\\.tar\\\\.Z$"
@@ -89,13 +187,18 @@ SET(CPACK_SOURCE_IGNORE_FILES
 "\\\\.rpm$"
 "\\\\.rej$"
 "\\\\.orig$"
+"/core$"
 "/CMakeFiles/"
-"Makefile\\\\.in"
+"/Makefile\\\\.in$"
 "/Makefile$"
 "/autom4te\\\\.cache/"
 "/\\\\.deps/"
 "/build/"
+"/attic/"
+"/HTML/"
 "/lyx-2\\\\."
+"/expectedTestFailures$"
+"/MergedManuals.lyx$"
 )
 
 if(LYX_CPACK)