git-svn-id: svn://db.shs.com.ru/pip@989 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
# * LABEL - application icon name
|
||||
# * FULLNAME - package name in format "*.*.*"
|
||||
# * COMPANY - company name
|
||||
# * ICON - icon file
|
||||
# * ICON - icon file path
|
||||
# * INFO - additional info
|
||||
#
|
||||
# Specify SHARED or STATIC if your target is library
|
||||
@@ -43,7 +43,8 @@
|
||||
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>]
|
||||
# [RESOURCES <dir|file> [<dir|file> ...]]
|
||||
# [PLUGINS <dir|file> [<dir|file> ...]]
|
||||
# [FILES <dir|file> [<dir|file> ...]])
|
||||
# [FILES <dir|file> [<dir|file> ...]]
|
||||
# [OPTIONS <flag> ...] [VERBOSE])
|
||||
#
|
||||
# Create make target "deploy_<target>", depends on target "deploy"
|
||||
# On this target create release package, containing all dependencies:
|
||||
@@ -64,11 +65,11 @@
|
||||
# DESTINATION - dir where macro place package
|
||||
# RESOURCES, PLUGINS and FILES - list of directories and files, copied to:
|
||||
#
|
||||
# | Windows | Linux | MacOS
|
||||
# ----------|---------|--------------------|-------------------
|
||||
# RESOURCES | root | /usr/share/COMPANY | Contents/Resources
|
||||
# PLUGINS | root | /usr/lib/COMPANY | Contents/PlugIns
|
||||
# FILES | root | /usr/bin | Contents/MacOS
|
||||
# | Windows | Linux | MacOS
|
||||
# ----------|---------|---------------------------|-------------------
|
||||
# RESOURCES | root | /usr/share/COMPANY/target | Contents/Resources
|
||||
# PLUGINS | root | /usr/lib/COMPANY/target | Contents/PlugIns
|
||||
# FILES | root | /usr/bin | Contents/MacOS
|
||||
#
|
||||
# Relative paths are taken from DEPLOY_DIR
|
||||
# Also check library dependencies from PLUGINS and FILES
|
||||
@@ -76,11 +77,14 @@
|
||||
#
|
||||
# This macro using "deploy_tool" from PIP,
|
||||
# so make sure it can be executed from shell
|
||||
# OPTIONS allow you to pass custom flags to "deploy_tool"
|
||||
# You can see flags by launch "deploy_tool" without arguments
|
||||
#
|
||||
# use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable,
|
||||
# depends on target platform
|
||||
# can use "DEPLOY_ADD_LIBPATH" variable as additional
|
||||
# library search path
|
||||
# Using CMAKE_LDD, CMAKE_OTOOL or CMAKE_OBJDUMP variable,
|
||||
# depends on target platform
|
||||
#
|
||||
# DEPLOY_ADD_LIBPATH variable used as additional
|
||||
# library search path
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -89,9 +93,11 @@
|
||||
#
|
||||
# Generate Windows *.rc file from deploy properties
|
||||
# and return file path to <rc_out_file>
|
||||
# On other platforms this variable set to empty
|
||||
#
|
||||
# You should set deploy properties before
|
||||
# call this macro, see "set_deploy_property()"
|
||||
# You should set version and deploy properties
|
||||
# before call this macro, see
|
||||
# "set_version()" and "set_deploy_property()"
|
||||
#
|
||||
#
|
||||
|
||||
@@ -321,48 +327,32 @@ macro(deploy_target _T)
|
||||
set(_PLUG_FILES)
|
||||
set(_FILE_DIRS)
|
||||
set(_FILE_FILES)
|
||||
set(_is_dest 0)
|
||||
set(_is_deploy_dir 0)
|
||||
set(_is_res 0)
|
||||
set(_is_plug 0)
|
||||
set(_is_file 0)
|
||||
set(_VERB)
|
||||
set(_WVERB 1> NUL)
|
||||
set(_OPTIONS)
|
||||
set(_cur_arg)
|
||||
set(__args "DESTINATION;DEPLOY_DIR;RESOURCES;PLUGINS;FILES;OPTIONS;VERBOSE")
|
||||
foreach(_i ${ARGN})
|
||||
if ("x${_i}" STREQUAL "xDESTINATION")
|
||||
set(_is_res 0)
|
||||
set(_is_plug 0)
|
||||
set(_is_file 0)
|
||||
set(_is_dest 1)
|
||||
elseif ("x${_i}" STREQUAL "xDEPLOY_DIR")
|
||||
set(_is_res 0)
|
||||
set(_is_plug 0)
|
||||
set(_is_file 0)
|
||||
set(_is_deploy_dir 1)
|
||||
elseif ("x${_i}" STREQUAL "xRESOURCES")
|
||||
set(_is_res 1)
|
||||
set(_is_plug 0)
|
||||
set(_is_file 0)
|
||||
elseif ("x${_i}" STREQUAL "xPLUGINS")
|
||||
set(_is_res 0)
|
||||
set(_is_plug 1)
|
||||
set(_is_file 0)
|
||||
elseif ("x${_i}" STREQUAL "xFILES")
|
||||
set(_is_res 0)
|
||||
set(_is_plug 0)
|
||||
set(_is_file 1)
|
||||
else()
|
||||
if (_is_dest)
|
||||
set(_is_dest 0)
|
||||
set(_DESTINATION "${_i}/")
|
||||
elseif (_is_deploy_dir)
|
||||
set(_is_deploy_dir 0)
|
||||
set(_DEPLOY_DIR "${_i}/")
|
||||
elseif (_is_res)
|
||||
__add_file_or_dir(_RES_DIRS _RES_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
elseif (_is_plug)
|
||||
__add_file_or_dir(_PLUG_DIRS _PLUG_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
elseif (_is_file)
|
||||
__add_file_or_dir(_FILE_DIRS _FILE_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
if (_i IN_LIST __args)
|
||||
set(_cur_arg "${_i}")
|
||||
if ("${_cur_arg}" STREQUAL "VERBOSE")
|
||||
set(_VERB -v)
|
||||
set(_WVERB)
|
||||
endif()
|
||||
elseif ("${_cur_arg}" STREQUAL "DESTINATION")
|
||||
set(_cur_arg)
|
||||
set(_DESTINATION "${_i}/")
|
||||
elseif ("${_cur_arg}" STREQUAL "DEPLOY_DIR")
|
||||
set(_cur_arg)
|
||||
set(_DEPLOY_DIR "${_i}/")
|
||||
elseif ("${_cur_arg}" STREQUAL "RESOURCES")
|
||||
__add_file_or_dir(_RES_DIRS _RES_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
elseif ("${_cur_arg}" STREQUAL "PLUGINS")
|
||||
__add_file_or_dir(_PLUG_DIRS _PLUG_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
elseif ("${_cur_arg}" STREQUAL "FILES")
|
||||
__add_file_or_dir(_FILE_DIRS _FILE_FILES "${_i}" "${_DEPLOY_DIR}")
|
||||
elseif ("${_cur_arg}" STREQUAL "OPTIONS")
|
||||
list(APPEND _OPTIONS "${_i}")
|
||||
endif()
|
||||
#message("-i = ${_i}")
|
||||
endforeach()
|
||||
@@ -421,39 +411,39 @@ macro(deploy_target _T)
|
||||
set(_D_echo ">>" "${_AGD}/usr/share/applications/${_DEBNAME}.desktop")
|
||||
macro(__make_copy _cmd _dirs _files _dest)
|
||||
if (${_dirs} OR ${_files})
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir -p "${_dest}")
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir ${_VERB} -p "${_dest}")
|
||||
endif()
|
||||
foreach(_d ${${_dirs}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -rf "${_d}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -rf "${_d}" "${_dest}/")
|
||||
endforeach()
|
||||
foreach(_f ${${_files}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -f "${_f}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -f "${_f}" "${_dest}/")
|
||||
endforeach()
|
||||
endmacro()
|
||||
__make_copy(_CMD_COPY _RES_DIRS _RES_FILES "${_AGD}/usr/share/${${_T}_COMPANY}")
|
||||
__make_copy(_CMD_COPY _PLUG_DIRS _PLUG_FILES "${_AGD}/usr/lib/${${_T}_COMPANY}")
|
||||
__make_copy(_CMD_COPY _RES_DIRS _RES_FILES "${_AGD}/usr/share/${${_T}_COMPANY}/${_T}")
|
||||
__make_copy(_CMD_COPY _PLUG_DIRS _PLUG_FILES "${_AGD}/usr/lib/${${_T}_COMPANY}/${_T}")
|
||||
__make_copy(_CMD_COPY _FILE_DIRS _FILE_FILES "${_AGD}/usr/bin")
|
||||
if (_DEP_LIBS)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_DEP_LIBS} ${_AGD}/usr/lib)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp ${_VERB} -f ${_DEP_LIBS} ${_AGD}/usr/lib)
|
||||
endif()
|
||||
if (_ICON_NAME)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_ICON_FN} ${_AGD}/usr/share/pixmaps)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/usr/share/pixmaps)
|
||||
endif()
|
||||
add_custom_target(deploy_${_T}
|
||||
# gather deb dir
|
||||
COMMAND mkdir -p ${_AGD}/DEBIAN
|
||||
COMMAND mkdir -p ${_AGD}/usr/bin
|
||||
COMMAND mkdir -p ${_AGD}/usr/lib
|
||||
COMMAND mkdir -p ${_AGD}/usr/share/pixmaps
|
||||
COMMAND mkdir -p ${_AGD}/usr/share/applications
|
||||
COMMAND cp -f ${_DEPLOY_DIR}/${_T} ${_AGD}/usr/bin
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/DEBIAN
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/usr/bin
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/usr/lib
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/usr/share/pixmaps
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/usr/share/applications
|
||||
COMMAND cp ${_VERB} -f ${_DEPLOY_DIR}/${_T} ${_AGD}/usr/bin
|
||||
${_CMD_COPY}
|
||||
|
||||
COMMAND echo "Package: ${_DEBNAME}" ${_C_echof}
|
||||
COMMAND echo "Version: ${_DEBVERSION}" ${_C_echo}
|
||||
COMMAND echo "Architecture: ${_DEB_ARCH}" ${_C_echo}
|
||||
COMMAND echo "Maintainer: ${${_T}_COMPANY} <>" ${_C_echo}
|
||||
COMMAND deploy_tool --prefix "Depends: " --dependencies -l ${CMAKE_LDD} -a "${_DEP_LIBS_CS}" -o "${_AGD}/usr/lib" ${_DEPLOY_DIR}/${_T} ${_ADD_DEPS} ${_C_echo}
|
||||
COMMAND deploy_tool ${_OPTIONS} --prefix "Depends: " --dependencies -l ${CMAKE_LDD} -a "${_DEP_LIBS_CS}" -o "${_AGD}/usr/lib" ${_DEPLOY_DIR}/${_T} ${_ADD_DEPS} ${_C_echo}
|
||||
COMMAND echo "Conflicts:" ${_C_echo}
|
||||
COMMAND echo "Replaces:" ${_C_echo}
|
||||
COMMAND echo "Section: misc" ${_C_echo}
|
||||
@@ -476,7 +466,7 @@ macro(deploy_target _T)
|
||||
#COMMAND -l "${CMAKE_LDD}" -P xcb -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib;${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/usr/lib -p ${_AGD}/usr/ ${_AGD}/Contents/MacOS/${_T}
|
||||
# generate deb
|
||||
COMMAND cd ${_AGD} "&&" md5deep -rl usr ">" DEBIAN/md5sums
|
||||
COMMAND mkdir -p ${_DESTINATION}
|
||||
COMMAND mkdir ${_VERB} -p ${_DESTINATION}
|
||||
COMMAND dpkg-deb -b ${_AGD} ${_DESTINATION}/${_TV}_${_DEB_ARCH}.deb
|
||||
VERBATIM
|
||||
COMMENT "Generating ${_TV}_${_DEB_ARCH}.deb"
|
||||
@@ -512,7 +502,7 @@ macro(deploy_target _T)
|
||||
__make_win_path("${_dest}" __d 1 "")
|
||||
set(${_cmd} ${${_cmd}} COMMAND if not exist "\"${__d}\"" mkdir "\"${__d}\"")
|
||||
else()
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir -p "${_dest}")
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir ${_VERB} -p "${_dest}")
|
||||
endif()
|
||||
endmacro()
|
||||
macro(__make_copy _cmd _dirs _files _dest)
|
||||
@@ -524,18 +514,18 @@ macro(deploy_target _T)
|
||||
foreach(_d ${${_dirs}})
|
||||
__make_win_path("${_d}" _wsrc 1 _dirname)
|
||||
__make_dir(${_cmd} "${_dest}/${_dirname}")
|
||||
set(${_cmd} ${${_cmd}} COMMAND xcopy /y /r "${_wsrc}*" "\"${_wdest}${_dirname}\\\"" 1> NUL)
|
||||
set(${_cmd} ${${_cmd}} COMMAND xcopy /y /r "${_wsrc}*" "\"${_wdest}${_dirname}\\\"" ${_WVERB})
|
||||
endforeach()
|
||||
foreach(_f ${${_files}})
|
||||
__make_win_path("${_f}" _wsrc 0 "")
|
||||
set(${_cmd} ${${_cmd}} COMMAND xcopy /y /r "\"${_wsrc}\"" "\"${_wdest}\"" 1> NUL)
|
||||
set(${_cmd} ${${_cmd}} COMMAND xcopy /y /r "\"${_wsrc}\"" "\"${_wdest}\"" ${_WVERB})
|
||||
endforeach()
|
||||
else()
|
||||
foreach(_d ${${_dirs}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -rf "${_d}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -rf "${_d}" "${_dest}/")
|
||||
endforeach()
|
||||
foreach(_f ${${_files}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -f "${_f}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -f "${_f}" "${_dest}/")
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -554,7 +544,7 @@ macro(deploy_target _T)
|
||||
# gather dir
|
||||
${_CMD_COPY}
|
||||
|
||||
COMMAND deploy_tool -W "\"${CMAKE_OBJDUMP}\"" -P windows -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
|
||||
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
|
||||
# zip
|
||||
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\""
|
||||
COMMENT "Generating ${_TV}.zip"
|
||||
@@ -576,35 +566,35 @@ macro(deploy_target _T)
|
||||
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
|
||||
macro(__make_copy _cmd _dirs _files _dest)
|
||||
if (${_dirs} OR ${_files})
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir -p "${_dest}")
|
||||
set(${_cmd} ${${_cmd}} COMMAND mkdir ${_VERB} -p "${_dest}")
|
||||
endif()
|
||||
foreach(_d ${${_dirs}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -rf "${_d}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -rf "${_d}" "${_dest}/")
|
||||
endforeach()
|
||||
foreach(_f ${${_files}})
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp -f "${_f}" "${_dest}/")
|
||||
set(${_cmd} ${${_cmd}} COMMAND cp ${_VERB} -f "${_f}" "${_dest}/")
|
||||
endforeach()
|
||||
endmacro()
|
||||
__make_copy(_CMD_COPY _RES_DIRS _RES_FILES "${_AGD}/Contents/Resources")
|
||||
__make_copy(_CMD_COPY _PLUG_DIRS _PLUG_FILES "${_AGD}/Contents/PlugIns")
|
||||
__make_copy(_CMD_COPY _FILE_DIRS _FILE_FILES "${_AGD}/Contents/MacOS")
|
||||
if (_ICON_NAME)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_ICON_FN} ${_AGD}/Contents/Resources)
|
||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/Contents/Resources)
|
||||
endif()
|
||||
add_custom_target(deploy_${_T}
|
||||
# gather .app dir
|
||||
COMMAND mkdir -p ${_AGD}/Contents/Resources
|
||||
COMMAND mkdir -p ${_AGD}/Contents/Frameworks
|
||||
COMMAND mkdir -p ${_DESTINATION}
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/Contents/Resources
|
||||
COMMAND mkdir ${_VERB} -p ${_AGD}/Contents/Frameworks
|
||||
COMMAND mkdir ${_VERB} -p ${_DESTINATION}
|
||||
${_CMD_COPY}
|
||||
#COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
|
||||
#COMMAND cp -r ${_DEPLOY_DIR}/lang ${_AGD}/Contents/Resources
|
||||
COMMAND deploy_tool -M "${CMAKE_OTOOL}" -P cocoa -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib;${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS}
|
||||
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib;${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS}
|
||||
# prepare dmg dir
|
||||
COMMAND rm -rf ${_DMG}
|
||||
COMMAND mkdir -p ${_DMG}
|
||||
COMMAND mkdir ${_VERB} -p ${_DMG}
|
||||
COMMAND cp -r ${_AGD} ${_DMG}
|
||||
COMMAND ln --symbolic /Applications ${_DMG}
|
||||
COMMAND ln ${_VERB} --symbolic /Applications ${_DMG}
|
||||
# generate dmg
|
||||
COMMAND genisoimage -quiet -V "${MACOSX_BUNDLE_BUNDLE_NAME}" -D -R -apple -no-pad -o ${_DESTINATION}/${_TV}.dmg ${_DMG}
|
||||
COMMENT "Generating ${_TV}.dmg"
|
||||
|
||||
Reference in New Issue
Block a user