CMake install and bundling improvements (esp. OS X)

This patch improves the cmake bundling process:
- reworked bundle handling for OS X: only when installing resources are copied, otherwise
only the smallest bundle is built
- on OS X, the utility programs (tex2lyx) are now installed in the right location
- it removes some unneeded BUNDLE DESTINATION
- it provides a basic support for QT plugins inclusion
- it properly builds a disk image on OS X (only the background image is missing)
- it fixes the library paths for all executables (not only LyX)
- Use the COPYING file for cmake install license
This commit is contained in:
Benjamin Piwowarski 2014-03-09 10:21:51 +01:00 committed by Richard Heck
parent c2e67a41ce
commit 14de3aa49b
9 changed files with 216 additions and 88 deletions

View File

@ -38,6 +38,8 @@ file(MAKE_DIRECTORY "${LYX_TESTS_USERDIR}")
if(COMMAND cmake_policy) if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 OLD) cmake_policy(SET CMP0003 OLD)
cmake_policy(SET CMP0005 OLD) cmake_policy(SET CMP0005 OLD)
# Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION
cmake_policy(SET CMP0006 NEW)
endif() endif()
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
@ -297,41 +299,66 @@ else()
set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION}) set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
endif() endif()
if(LYX_PROGRAM_SUFFIX) # Set the programs (lyx, tex2lyx, etc.) suffix
set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}") # When building an OS X bundle, we will append
else() # the suffix only to the bundle, not to the programs
set(PROGRAM_SUFFIX "") set(PROGRAM_SUFFIX "")
if(LYX_PROGRAM_SUFFIX AND NOT (APPLE AND LYX_BUNDLE))
set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}")
endif() endif()
set(_lyx "${PACKAGE_BASE}${PROGRAM_SUFFIX}")
set(_tex2lyx tex2lyx${PROGRAM_SUFFIX})
add_custom_target(lyx_version ALL add_custom_target(lyx_version ALL
COMMAND ${CMAKE_COMMAND} -DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_CMAKE_PATH=${TOP_CMAKE_PATH} -DTOP_BINARY_DIR=${TOP_BINARY_DIR} -DLYX_DATE=${LYX_DATE} -P ${TOP_SCRIPT_PATH}/LyXGetVersion.cmake COMMAND ${CMAKE_COMMAND} -DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_CMAKE_PATH=${TOP_CMAKE_PATH} -DTOP_BINARY_DIR=${TOP_BINARY_DIR} -DLYX_DATE=${LYX_DATE} -P ${TOP_SCRIPT_PATH}/LyXGetVersion.cmake
) )
set_target_properties(lyx_version PROPERTIES FOLDER "applications") set_target_properties(lyx_version PROPERTIES FOLDER "applications")
if(APPLE) # Default paths for installed utilities (tex2lyx, lyxclient, etc.)
set(osx_bundle_program_name ${PACKAGE_BASE}${PROGRAM_SUFFIX}) set(LYX_UTILITIES_INSTALL_PATH bin)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
endif()
if(LYX_BUNDLE) if(LYX_BUNDLE)
set(LYX_CPACK ON) set(LYX_CPACK ON)
message(STATUS) message(STATUS)
message(STATUS "Bundle creation is enabled (experimental):") message(STATUS "Bundle creation is enabled (experimental):")
message(STATUS " make") message(STATUS " make")
message(STATUS " make install/strip") message(STATUS " make install/strip")
message(STATUS " make package") message(STATUS " make package")
if(APPLE) if(APPLE)
set(MACOSX_BUNDLE TRUE)
# This sets the bundle + executable names
set(_lyx "${PACKAGE_BASE}${LYX_INSTALL_SUFFIX}")
# This sets the Info.plist executable name
set(osx_bundle_program_name ${_lyx})
# Bundle name
set(LYX_BUNDLE_NAME ${_lyx})
# This will contain the list of files that need to be included
# in the bundle and their location within the bundle
set(OSX_BUNDLE_FILES "${TOP_SRC_DIR}/development/MacOSX/LyX.sdef;${TOP_SRC_DIR}/development/MacOSX/LyXapp.icns;${CMAKE_BINARY_DIR}/lyxrc.dist")
set(OSX_BUNDLE_DIRS "Resources;Resources;Resources")
# Process Info.plist and lyxrc.dist
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/lyxrc.dist.in" "${CMAKE_CURRENT_BINARY_DIR}/lyxrc.dist")
set(LYX_BUILD_BUNDLE MACOSX_BUNDLE) set(LYX_BUILD_BUNDLE MACOSX_BUNDLE)
set(CPACK_BUNDLE_NAME ${PACKAGE_BASE}${PROGRAM_SUFFIX}) set(LYX_DATA_SUBDIR ${LYX_BUNDLE_NAME}.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE)
# Variables used by CPack
set(CPACK_BUNDLE_NAME ${LYX_BUNDLE_NAME})
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist") set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
set(LYX_DATA_SUBDIR ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE) set(MACOSX_BUNDLE_STARTUP_COMMAND ${LYX_BUNDLE_NAME}.app)
set(MACOSX_BUNDLE_STARTUP_COMMAND ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app)
# Set the install paths
set(LYX_UTILITIES_INSTALL_PATH ${LYX_BUNDLE_NAME}.app/Contents/MacOS)
if(NOT LYX_INSTALL_PREFIX) if(NOT LYX_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/LyX CACHE PATH "Mac bundle dir" FORCE) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/LyX CACHE PATH "Mac bundle dir" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif() endif()
# Change the owner so that the install can work # Change the owner so that the install can work
install(CODE "set(BU_CHMOD_BUNDLE_ITEMS 1)") install(CODE "set(BU_CHMOD_BUNDLE_ITEMS 1)" COMPONENT Runtime)
elseif(UNIX) elseif(UNIX)
message(STATUS "To embed Qt in this bundle don't build with your system Qt:") message(STATUS "To embed Qt in this bundle don't build with your system Qt:")
message(STATUS " - fix PATH so a other qmake is found by cmake") message(STATUS " - fix PATH so a other qmake is found by cmake")
@ -390,8 +417,11 @@ set(LYX_LOCALEDIR "locale")
set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}") set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}")
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}") set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
set(LYX_MAN_DIR "/usr/local/man" CACHE STRING if(LYX_BUNDLE AND APPLE)
"Install location for man pages.") set(LYX_MAN_DIR "${LYX_DATA_SUBDIR}" CACHE STRING "Install location for man pages.")
else()
set(LYX_MAN_DIR "/usr/local/man/man1" CACHE STRING "Install location for man pages.")
endif()
mark_as_advanced(LYX_MAN_DIR) mark_as_advanced(LYX_MAN_DIR)
if(LYX_INSTALL AND WIN32) if(LYX_INSTALL AND WIN32)
@ -738,8 +768,6 @@ if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*")
MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}") MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}")
endif() endif()
set(_lyx "${PACKAGE_BASE}${PROGRAM_SUFFIX}")
set(_tex2lyx tex2lyx${PROGRAM_SUFFIX})
set (cmd ${CMAKE_CTEST_COMMAND}) set (cmd ${CMAKE_CTEST_COMMAND})
if (MSVC) if (MSVC)
@ -751,12 +779,6 @@ add_custom_target (lyx_run_tests COMMAND ${cmd})
set_target_properties(lyx_run_tests PROPERTIES FOLDER "tests") set_target_properties(lyx_run_tests PROPERTIES FOLDER "tests")
add_subdirectory(src "${TOP_BINARY_DIR}/src")
add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx")
add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts")
add_subdirectory(lib/examples "${TOP_BINARY_DIR}/lib/examples")
if(LYX_INSTALL) if(LYX_INSTALL)
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND") if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
message(STATUS "Python required to create doc!") message(STATUS "Python required to create doc!")
@ -764,11 +786,13 @@ if(LYX_INSTALL)
add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man") add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc") add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
endif() endif()
if(NOT(LYX_BUNDLE AND APPLE))
include(../Install) include(../Install)
endif() endif()
endif()
add_subdirectory(src "${TOP_BINARY_DIR}/src")
add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx")
add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts")
add_subdirectory(lib/examples "${TOP_BINARY_DIR}/lib/examples")
add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc") add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc")
add_subdirectory(development/autotests "${TOP_BINARY_DIR}/autotests") add_subdirectory(development/autotests "${TOP_BINARY_DIR}/autotests")
if(LYX_ENABLE_URLTESTS) if(LYX_ENABLE_URLTESTS)
@ -813,4 +837,8 @@ if(ENABLE_DIST)
add_custom_target(git-archive DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_NAME}) add_custom_target(git-archive DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DIST_NAME})
endif() endif()
# Last directory to be included so that the fixup code (OS X)
# can be run last
add_subdirectory(development/cmake/post_install)
message(STATUS) message(STATUS)

View File

@ -0,0 +1,63 @@
# Copied from Lyx-Mac-binary-release.sh
# TODO: In order to avoid having two versions,
# call this file from Lyx-Mac-binary-release.sh
FILE=$1
LyxName=$2
IMAGEPATH=$3
X_BOUNDS=$4
Y_BOUNDS=$5
# Creates the structure
mkdir -p "${FILE}"
touch "${FILE}/${LyxName}.app"
touch "${FILE}/Applications"
# Copy the background and make sure the file is visible
# For some reason (OS X cache?), we need to remove the previous
# file
rm -f "$FILE/background.png"
cp "$IMAGEPATH" "$FILE/background.png"
xattr -c "$FILE/background.png"
Y_POSITION=$((Y_BOUNDS - 65))
Y_BOUNDS=$((Y_BOUNDS + 20))
LYX_X_POSITION=$((X_BOUNDS / 4))
LYX_Y_POSITION=$Y_POSITION
APP_X_POSITION=$((3 * X_BOUNDS / 4))
APP_Y_POSITION=$Y_POSITION
WITH_DOCUMENTS=$(test -d "${FILE}/Documents" && echo true || echo false)
osascript <<-EOF
tell application "Finder"
set f to POSIX file ("$FILE" as string) as alias
set image to POSIX file ("$IMAGEPATH" as string) as alias
tell folder f
open
tell container window
set toolbar visible to false
set statusbar visible to false
set current view to icon view
delay 1 -- sync
set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
end tell
delay 1 -- sync
set icon size of the icon view options of container window to 64
set arrangement of the icon view options of container window to not arranged
if ${WITH_DOCUMENTS} then
set position of item "Documents" to {$LYX_X_POSITION,0}
end if
set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
set background picture of the icon view options of container window to file "background.png"
set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
update without registering applications
delay 5 -- sync
close
end tell
delay 5 -- sync
end tell
EOF
# Hide again the background
chflags hidden "$FILE/background.png"

View File

@ -5,18 +5,6 @@
if(NOT(LYX_BUNDLE) AND APPLE) if(NOT(LYX_BUNDLE) AND APPLE)
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX") message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX")
endif() endif()
set(OSX_BUNDLE_FILES "")
# Install files into OS X bundle
macro(lyx_install_osx basedir files)
if(LYX_BUNDLE_PROPERTY_MODE STREQUAL "ON")
foreach(file ${files})
set_source_files_properties("${file}" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${basedir}")
endforeach()
else()
list(APPEND OSX_BUNDLE_FILES "${files}")
endif()
endmacro(lyx_install_osx)
# the macro scans the directories "_parent_src_dir/_dir/_current_dir" for *._file_type files # the macro scans the directories "_parent_src_dir/_dir/_current_dir" for *._file_type files
# and installs the files in CMAKE_INSTALL_PREFIX/_current_dir # and installs the files in CMAKE_INSTALL_PREFIX/_current_dir
@ -71,23 +59,14 @@ macro(lyx_install _parent_src_dir _gl_dir _file_type)
if(_glob_dir STREQUAL ".") if(_glob_dir STREQUAL ".")
set(_base_dir .) set(_base_dir .)
endif() endif()
#message(STATUS "install ${LYX_DATA_SUBDIR}${_dir}/${_base_dir}: ${files_list} ")
#message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${LYX_DATA_SUBDIR}${_dir}/${_base_dir}") install(FILES ${files_list} DESTINATION "${LYX_DATA_SUBDIR}${_dir}/${_base_dir}")
if(APPLE)
lyx_install_osx("${_dir}/${_based_dir}" "${files_list}")
else()
install(FILES ${files_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
endif(APPLE)
endif() endif()
if(program_list) if(program_list)
if(_glob_dir STREQUAL ".") if(_glob_dir STREQUAL ".")
set(_base_dir .) set(_base_dir .)
endif() endif()
if(APPLE) install(FILES ${program_list} DESTINATION "${LYX_DATA_SUBDIR}${_dir}/${_base_dir}")
lyx_install_osx("${_dir}/${_based_dir}" "${program_list}")
else()
install(PROGRAMS ${program_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
endif(APPLE)
endif() endif()
endforeach(_current_dir) endforeach(_current_dir)
endforeach(_glob_dir) endforeach(_glob_dir)
@ -123,14 +102,15 @@ lyx_install(${TOP_SRC_DIR}/lib . * .)
# Install # Install
if(APPLE) if(APPLE)
lyx_install(${TOP_SRC_DIR}/development/MacOSX . *.sdef .) if(LYX_BUNDLE)
lyx_install(${TOP_SRC_DIR}/development/MacOSX . *.icns .) install(FILES ${TOP_SRC_DIR}/development/MacOSX/spotlight/Info.plist DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents/Library/Spotlight/LyX-Metadata.mdimporter/Contents")
lyx_install(${TOP_SRC_DIR}/development/MacOSX . qt.conf .) install(FILES "${TOP_SRC_DIR}/development/MacOSX/PkgInfo" DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents")
endif() endif()
install(PROGRAMS ${TOP_SRC_DIR}/lib/scripts/listerrors DESTINATION scripts) install(FILES "${TOP_SRC_DIR}/development/MacOSX/lyxeditor" DESTINATION "${LYX_UTILITIES_INSTALL_PATH}")
install(FILES "${TOP_SRC_DIR}/development/MacOSX/LyX.icns" DESTINATION "${LYX_DATA_SUBDIR}")
if(UNIX) set(program_suffix ${PROGRAM_SUFFIX})
elseif(UNIX)
set(program_suffix ${PROGRAM_SUFFIX}) set(program_suffix ${PROGRAM_SUFFIX})
configure_file(${TOP_SRC_DIR}/lib/lyx.desktop.in lyx${PROGRAM_SUFFIX}.desktop) configure_file(${TOP_SRC_DIR}/lib/lyx.desktop.in lyx${PROGRAM_SUFFIX}.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx${PROGRAM_SUFFIX}.desktop DESTINATION applications) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx${PROGRAM_SUFFIX}.desktop DESTINATION applications)

View File

@ -1 +1 @@
GPL GPL

View File

@ -6,6 +6,8 @@
if(LYX_BUNDLE) if(LYX_BUNDLE)
if(APPLE) if(APPLE)
set(CPACK_GENERATOR DragNDrop) 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) elseif(UNIX)
set(CPACK_GENERATOR STGZ) set(CPACK_GENERATOR STGZ)
elseif(WIN32) elseif(WIN32)
@ -32,7 +34,10 @@ FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMA
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
if (NOT WIN32) if (APPLE)
# We don't need absolute paths
set(CPACK_SET_DESTDIR "OFF")
elseif (NOT WIN32)
# needed by rpm # needed by rpm
set(CPACK_SET_DESTDIR "ON") set(CPACK_SET_DESTDIR "ON")
endif() endif()
@ -54,7 +59,7 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# #
# for the next ones, cpack insists on data with values in some file # for the next ones, cpack insists on data with values in some file
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt") set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${TOP_CMAKE_PATH}/LyX_license.txt") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
# Use the revision number saved in ${LYX_PACKAGE_RELEASE} # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
# as the release in rpm-package-build. # as the release in rpm-package-build.

View File

@ -0,0 +1,65 @@
# Finish the construction of the bundle
# by including the necessary QT libraries
set(QTPLUGINS "")
# Find a qt plugin and install it in the plugins directory
macro(install_qt_plugin _qt_plugin_name)
get_target_property(qtlib "${_qt_plugin_name}" LOCATION)
if(EXISTS ${qtlib})
get_filename_component(qtdir ${qtlib} PATH)
get_filename_component(qtdir ${qtdir} NAME)
# Installing QT plugin ${qtlib} into ${qtplugin_dest_dir}/plugins/${qtdir}
install(FILES "${qtlib}" DESTINATION ${qtplugin_dest_dir}/plugins/${qtdir} COMPONENT Runtime)
else()
message(FATAL_ERROR "Could not find QT plugin ${_qt_plugin_name}")
endif()
endmacro()
if(LYX_BUNDLE)
if(NOT APPLE)
set(installed_lyx_path bin/${_lyx}${CMAKE_EXECUTABLE_SUFFIX})
set(qtplugin_dest_dir bin)
set(qt_conf_path bin/qt.conf)
else()
set(installed_lyx_path ${LYX_BUNDLE_NAME}.app)
set(qtplugin_dest_dir "${LYX_BUNDLE_NAME}.app/Contents")
set(qt_conf_path "${LYX_BUNDLE_NAME}.app/Contents/Resources/qt.conf")
endif()
if(Qt5Core_FOUND)
install_qt_plugin("Qt5::QJpegPlugin")
install_qt_plugin("Qt5::QGifPlugin")
install_qt_plugin("Qt5::QICOPlugin")
if(APPLE)
install_qt_plugin("Qt5::QCocoaIntegrationPlugin")
endif()
else()
# With QT4, just copy all the plugins
file(GLOB QT_PLUGIN_DIRECTORIES "${QT_PLUGINS_DIR}/*")
install(DIRECTORY ${QT_PLUGIN_DIRECTORIES} DESTINATION "${qtplugin_dest_dir}/plugins/" COMPONENT Runtime)
endif()
# Install code does the following:
# - Creates the qt.conf file
# - install the platform specific plugins (with Qt5)
# - Fixup the bundle
install(CODE "include(BundleUtilities)
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qt_conf_path}\" \"\")
file(GLOB_RECURSE QTPLUGINS
\"\${CMAKE_INSTALL_PREFIX}/${qtplugin_dest_dir}/plugins/*/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
message(STATUS \"QT plugins [\${CMAKE_INSTALL_PREFIX}/${qtplugin_dest_dir}/plugins/*/*${CMAKE_SHARED_LIBRARY_SUFFIX}]: \${QTPLUGINS}\")
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${installed_lyx_path}\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIRS}\")"
COMPONENT Runtime
)
if (APPLE AND LYX_DMG)
# Setup the disk image layout
install(CODE "
message(STATUS \"Creating the folder view options (.DS_Store)\")
execute_process(COMMAND /bin/ln -sf /Applications \"\${CMAKE_INSTALL_PREFIX}\")
execute_process(COMMAND /bin/bash \"${CMAKE_CURRENT_SOURCE_DIR}/../../MacOSX/set_bundle_display_options.sh\"
\"${CMAKE_BINARY_DIR}/ds_store\" \"${_lyx}\" \"${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png\" 560 364)
")
endif()
endif()

View File

@ -107,10 +107,6 @@ lyx_find_info_files(LyXCMakeFiles ${TOP_MODULE_PATH}/*)
lyx_find_info_files(LyXCMakeFiles ${TOP_SCRIPT_PATH}/*) lyx_find_info_files(LyXCMakeFiles ${TOP_SCRIPT_PATH}/*)
lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*) lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*)
if (APPLE AND LYX_BUNDLE)
include(../Install)
endif()
add_executable(${_lyx} add_executable(${_lyx}
${WIN32_CONSOLE} ${WIN32_CONSOLE}
${LYX_BUILD_BUNDLE} ${LYX_BUILD_BUNDLE}
@ -170,22 +166,26 @@ endif()
project_source_group("${GROUP_CODE}" lyx_sources lyx_headers) project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
install(TARGETS ${_lyx}
install(TARGETS ${_lyx} BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION bin RUNTIME DESTINATION bin COMPONENT Runtime)
BUNDLE DESTINATION .)
if(LYX_BUNDLE) if(LYX_BUNDLE)
if(NOT APPLE) if(APPLE)
set(installed_lyx ${CMAKE_INSTALL_PREFIX}/bin/${_lyx}${CMAKE_EXECUTABLE_SUFFIX}) # Now that lyx executable is defined, we can the files that should be included
else() # directly in the bundle. Note that resources are not copied with this mechanism:
# only the files necessary to run the executable are processed here (LyX.sdef, LyX.icns, etc.)
list(LENGTH OSX_BUNDLE_FILES OSX_BUNDLE_LAST_INDEX)
math(EXPR OSX_BUNDLE_LAST_INDEX "${OSX_BUNDLE_LAST_INDEX} - 1")
foreach(_i RANGE ${OSX_BUNDLE_LAST_INDEX})
list(GET OSX_BUNDLE_FILES ${_i} _file)
list(GET OSX_BUNDLE_DIRS ${_i} _directory)
# Sets the location of the file into the OS X bundle
set_source_files_properties("${_file}" PROPERTIES MACOSX_PACKAGE_LOCATION "${_directory}")
endforeach()
set_target_properties(${_lyx} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/../Info.plist") set_target_properties(${_lyx} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/../Info.plist")
set(installed_lyx ${CMAKE_INSTALL_PREFIX}/${_lyx}.app)
set(LYX_BUNDLE_PROPERTY_MODE "ON")
include("../Install")
endif() endif()
install(CODE "include(BundleUtilities)
fixup_bundle(\"${installed_lyx}\" \"\" \"\") " COMPONENT RUNTIME)
endif() endif()
add_subdirectory(tests) add_subdirectory(tests)

View File

@ -40,12 +40,5 @@ if(APPLE)
target_link_libraries(${_lyxclient} "-framework AppKit") target_link_libraries(${_lyxclient} "-framework AppKit")
endif() endif()
if(LYX_BUNDLE) install(TARGETS ${_lyxclient} DESTINATION ${LYX_UTILITIES_INSTALL_PATH})
install(TARGETS ${_lyxclient}
RUNTIME DESTINATION bin
BUNDLE DESTINATION .)
else()
install(TARGETS ${_lyxclient} DESTINATION bin)
endif()

View File

@ -65,11 +65,5 @@ project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers)
add_subdirectory(test) add_subdirectory(test)
if(LYX_BUNDLE) install(TARGETS ${_tex2lyx} DESTINATION ${LYX_UTILITIES_INSTALL_PATH})
install(TARGETS ${_tex2lyx}
RUNTIME DESTINATION bin
BUNDLE DESTINATION .)
else()
install(TARGETS ${_tex2lyx} DESTINATION bin)
endif()