mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
cmake: build a .dmg file on Mac, looks not as nice as the official installer but it runs
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38765 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd056f8117
commit
41a0adcb47
@ -57,6 +57,8 @@ LYX_OPTION(ENCHANT "Require Enchant" OFF ALL)
|
|||||||
LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
|
LYX_OPTION(HUNSPELL "Require Hunspell" OFF ALL)
|
||||||
LYX_OPTION(DEVEL_VERSION "Build developer version" OFF ALL)
|
LYX_OPTION(DEVEL_VERSION "Build developer version" OFF ALL)
|
||||||
LYX_OPTION(RELEASE "Build release version, build debug when disabled" OFF ALL)
|
LYX_OPTION(RELEASE "Build release version, build debug when disabled" OFF ALL)
|
||||||
|
LYX_OPTION(DEBUG "Enforce debug build" OFF ALL)
|
||||||
|
LYX_OPTION(NO_OPTIMIZE "Don't use any optimization/debug flags" OFF ALL)
|
||||||
LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" ON ALL)
|
LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" ON ALL)
|
||||||
LYX_OPTION(PCH "Use precompiled headers" OFF ALL)
|
LYX_OPTION(PCH "Use precompiled headers" OFF ALL)
|
||||||
LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL)
|
LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL)
|
||||||
@ -81,6 +83,9 @@ LYX_OPTION(WALL "Enable all warnings" OFF MSVC)
|
|||||||
LYX_OPTION(CONFIGURE_CHECKS "Also run configure checks for MSVC" OFF MSVC)
|
LYX_OPTION(CONFIGURE_CHECKS "Also run configure checks for MSVC" OFF MSVC)
|
||||||
LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
|
LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
|
||||||
|
|
||||||
|
# APPLE specific
|
||||||
|
LYX_OPTION(DMG "Build as Mac bundle, needed for .dmg (experimental) " OFF GCC)
|
||||||
|
LYX_OPTION(COCOA "Use Cocoa on Mac" OFF GCC)
|
||||||
|
|
||||||
if(help OR HELP)
|
if(help OR HELP)
|
||||||
message(STATUS)
|
message(STATUS)
|
||||||
@ -111,6 +116,7 @@ if(LYX_INSTALL)
|
|||||||
set(LYX_PROFILE OFF)
|
set(LYX_PROFILE OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(LYX_MERGE_FILES)
|
if(LYX_MERGE_FILES)
|
||||||
set(LYX_PCH OFF)
|
set(LYX_PCH OFF)
|
||||||
else()
|
else()
|
||||||
@ -136,6 +142,7 @@ if(LYX_DEPENDENCIES_DOWNLOAD)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message(STATUS)
|
message(STATUS)
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${TOP_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${TOP_BINARY_DIR}/bin)
|
||||||
@ -203,7 +210,22 @@ foreach(_c_l ${_config_lines} )
|
|||||||
endforeach(_c_l)
|
endforeach(_c_l)
|
||||||
|
|
||||||
|
|
||||||
if (LYX_INSTALL_PREFIX)
|
if(LYX_DMG)
|
||||||
|
set(bundle_dir ${TOP_BINARY_DIR}/bin)
|
||||||
|
set(LYX_CPACK 1)
|
||||||
|
set(LYX_BUNDLE MACOSX_BUNDLE)
|
||||||
|
set(LYX_INSTALL_PREFIX LyX2.1 CACHE STRING "LyX bundle install prefix" FORCE)
|
||||||
|
set(LYX_DATA_SUBDIR LyX.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE)
|
||||||
|
message(STATUS)
|
||||||
|
message(STATUS "Bundle creation is enabled.")
|
||||||
|
message(STATUS "It is experimental, to increase turn around speed use:")
|
||||||
|
message(STATUS " cmake -DLYX_MERGE_FILES=1 -DLYX_NO_OPTIMIZE=1 -DLYX_INSTALL=1 -DLYX_DMG=1 ../trunk")
|
||||||
|
message(STATUS "or use the shell script 'developent/cmake/dmg'")
|
||||||
|
message(STATUS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(LYX_INSTALL_PREFIX)
|
||||||
set(CMAKE_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE)
|
set(CMAKE_INSTALL_PREFIX ${LYX_INSTALL_PREFIX} CACHE PATH "LyX user's choice install prefix" FORCE)
|
||||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
endif()
|
endif()
|
||||||
@ -238,10 +260,12 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if(NOT LYX_DATA_SUBDIR)
|
||||||
set(LYX_DATA_SUBDIR "Resources/" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
if (WIN32)
|
||||||
else()
|
set(LYX_DATA_SUBDIR "Resources/" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
||||||
set(LYX_DATA_SUBDIR "" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
else()
|
||||||
|
set(LYX_DATA_SUBDIR "" CACHE STRING "Subdirectory for all lyx-system-data" FORCE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}")
|
set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}")
|
||||||
@ -250,6 +274,7 @@ set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}
|
|||||||
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
|
set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(NOT GROUP_CODE)
|
if(NOT GROUP_CODE)
|
||||||
#set(GROUP_CODE "The Golden Code")
|
#set(GROUP_CODE "The Golden Code")
|
||||||
set(GROUP_CODE flat)
|
set(GROUP_CODE flat)
|
||||||
@ -260,7 +285,6 @@ set(LYX_CPP_FILES *.cpp)
|
|||||||
set(LYX_HPP_FILES *.h)
|
set(LYX_HPP_FILES *.h)
|
||||||
set(LYX_MOC_FILES moc_*.cpp)
|
set(LYX_MOC_FILES moc_*.cpp)
|
||||||
|
|
||||||
|
|
||||||
include(ProjectSourceGroup)
|
include(ProjectSourceGroup)
|
||||||
|
|
||||||
|
|
||||||
@ -269,12 +293,19 @@ if(LYX_PROFILE)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" CACHE TYPE STRING FORCE)
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" CACHE TYPE STRING FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LYX_RELEASE)
|
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build release version" FORCE)
|
if(LYX_NO_OPTIMIZE)
|
||||||
|
set(CMAKE_BUILD_TYPE None)
|
||||||
|
set(LYX_DEBUG OFF)
|
||||||
|
set(LYX_RELEASE OFF)
|
||||||
|
elseif(LYX_RELEASE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
set(LYX_DEBUG OFF)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build debug version" FORCE)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# When shared libs are supported enable this option
|
# When shared libs are supported enable this option
|
||||||
#LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL)
|
#LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL)
|
||||||
if(LYX_SHARED_LIBRARIES)
|
if(LYX_SHARED_LIBRARIES)
|
||||||
@ -555,6 +586,11 @@ if(LYX_NLS)
|
|||||||
message(STATUS)
|
message(STATUS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# CPack packaging
|
||||||
|
#
|
||||||
|
# http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack
|
||||||
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
|
set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_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_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||||
@ -612,6 +648,47 @@ endif()
|
|||||||
# so we do not provide infofiles for
|
# so we do not provide infofiles for
|
||||||
# CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
|
# CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(CPACK_GENERATOR NSIS ZIP)
|
||||||
|
set(CPACK_BINARY_ZIP 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set(CPACK_STRIP_FILES 1)
|
||||||
|
|
||||||
|
# sources
|
||||||
|
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
|
||||||
|
set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
|
||||||
|
|
||||||
|
|
||||||
|
if(LYX_DMG)
|
||||||
|
set(CPACK_PACKAGE_NAME LyX)
|
||||||
|
set(CPACK_GENERATOR DragNDrop)
|
||||||
|
|
||||||
|
# We start from bin/lyx.app, all is build into the final bundle folder
|
||||||
|
# On Mac the paths to required shared libraries are hardcoded in the
|
||||||
|
# binary/library. This is fixed by the macro 'fixup_bundle'
|
||||||
|
# Hardcoded pathes to libraries are resolved automatically
|
||||||
|
|
||||||
|
|
||||||
|
set(app ${bundle_dir}/LyX.app)
|
||||||
|
set(contents_dir LyX.app/Contents/)
|
||||||
|
install(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${bundle_dir}/${contents_dir}/plugins COMPONENT Runtime)
|
||||||
|
|
||||||
|
message(STATUS "Qt Plugins: ${QT_PLUGINS_DIR}/imageformats DESTINATION ${bundle_dir}/${contents_dir}/plugins")
|
||||||
|
|
||||||
|
install(CODE
|
||||||
|
"file(GLOB qt_plugins \"${bundle_dir}/${contents_dir}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
|
||||||
|
include(BundleUtilities)
|
||||||
|
fixup_bundle(\"${app}\" \"\${qt_plugins}\" \"${dir}\") "
|
||||||
|
COMPONENT RUNTIME)
|
||||||
|
|
||||||
|
file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "")
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${contents_dir}/Resources COMPONENT Runtime)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(LYX_CPACK)
|
if(LYX_CPACK)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endif()
|
endif()
|
||||||
|
32
development/cmake/dmg
Executable file
32
development/cmake/dmg
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z $1 ]
|
||||||
|
then
|
||||||
|
echo "Pass the path to the lyx sources, e.g. dmg ../lyx-devel"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cmake -DLYX_MERGE_FILES=1 -DLYX_COCOA=1 -DLYX_NO_OPTIMIZE=1 -DLYX_INSTALL=1 -DLYX_DMG=1 $1
|
||||||
|
|
||||||
|
if [ "$?" -nq "0" ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -j4
|
||||||
|
|
||||||
|
if [ "$?" -nq "0" ]
|
||||||
|
then
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
make install/strip
|
||||||
|
|
||||||
|
if [ "$?" -nq "0" ]
|
||||||
|
then
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
make package
|
@ -106,6 +106,7 @@ lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*)
|
|||||||
|
|
||||||
add_executable(${_lyx}
|
add_executable(${_lyx}
|
||||||
${WIN32_CONSOLE}
|
${WIN32_CONSOLE}
|
||||||
|
${LYX_BUNDLE}
|
||||||
${lyx_sources}
|
${lyx_sources}
|
||||||
${lyx_headers}
|
${lyx_headers}
|
||||||
${vld_files}
|
${vld_files}
|
||||||
@ -114,6 +115,10 @@ add_executable(${_lyx}
|
|||||||
${lyx_cmake_files}
|
${lyx_cmake_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(LYX_BUNDLE)
|
||||||
|
set(MACOSX_BUNDLE_STRATUP_COMMAND ${_lyx})
|
||||||
|
endif()
|
||||||
|
|
||||||
lyx_add_gcc_pch(${_lyx})
|
lyx_add_gcc_pch(${_lyx})
|
||||||
|
|
||||||
target_link_libraries(${_lyx}
|
target_link_libraries(${_lyx}
|
||||||
@ -141,7 +146,11 @@ endif()
|
|||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(${_lyx} "-bind_at_load")
|
target_link_libraries(${_lyx} "-bind_at_load")
|
||||||
target_link_libraries(${_lyx} "-framework Carbon")
|
if(LYX_COCOA)
|
||||||
|
target_link_libraries(${_lyx} "-framework Cocoa")
|
||||||
|
else()
|
||||||
|
target_link_libraries(${_lyx} "-framework Carbon")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
@ -150,5 +159,10 @@ endif()
|
|||||||
|
|
||||||
project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
|
project_source_group("${GROUP_CODE}" lyx_sources lyx_headers)
|
||||||
|
|
||||||
install(TARGETS ${_lyx} DESTINATION bin)
|
if(LYX_BUNDLE)
|
||||||
|
install(TARGETS ${_lyx}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
BUNDLE DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(TARGETS ${_lyx} DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
@ -42,6 +42,12 @@ if(APPLE)
|
|||||||
target_link_libraries(${_lyxclient} "-framework Carbon")
|
target_link_libraries(${_lyxclient} "-framework Carbon")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(LYX_BUNDLE)
|
||||||
|
install(TARGETS ${_lyxclient}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
BUNDLE DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(TARGETS ${_lyxclient} DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${_lyxclient} DESTINATION bin)
|
|
||||||
|
|
||||||
|
@ -57,5 +57,11 @@ endif()
|
|||||||
|
|
||||||
project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers)
|
project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers)
|
||||||
|
|
||||||
install(TARGETS ${_tex2lyx} DESTINATION bin)
|
if(LYX_BUNDLE)
|
||||||
|
install(TARGETS ${_tex2lyx}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
BUNDLE DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(TARGETS ${_tex2lyx} DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user