diff --git a/cmake/DeployMacros.cmake b/cmake/DeployMacros.cmake index a72b01f8..47290ac6 100644 --- a/cmake/DeployMacros.cmake +++ b/cmake/DeployMacros.cmake @@ -41,25 +41,40 @@ # # # deploy_target( [DEPLOY_DIR ] [DESTINATION ] -# [RESOURCES [ ...]] -# [PLUGINS [ ...]] -# [FILES [ ...]]) +# [RESOURCES [ ...]] +# [PLUGINS [ ...]] +# [FILES [ ...]]) +# +# Create make target "deploy_", depends on target "deploy" +# On this target create release package, containing all dependencies: +# *.zip on Windows, *.deb on Linux and *.dmg an MacOS +# +# You should set version and deploy properties +# before call this macro, see +# "set_version()" and "set_deploy_property()" +# +# Example: +# deploy_target(my_app DESTINATION packages) +# # # DEPLOY_DIR - dir where you install # * executable on Windows, Linux # * .app directory with executable on MacOS # # DESTINATION - dir where macro place package +# RESOURCES, PLUGINS and FILES - list of directories and files, copied to: # -# Example: -# deploy_target(my_app DESTINATION packages) +# | Windows | Linux | MacOS +# ----------|---------|--------------------|------------------- +# RESOURCES | root | /usr/share/COMPANY | Contents/Resources +# PLUGINS | root | /usr/lib/COMPANY | Contents/PlugIns +# FILES | root | /usr/bin | Contents/MacOS # -# Create make target "deploy_", depends on target "deploy" +# Also check library dependencies from PLUGINS and FILES # -# This macro use "deploy_tool" from sdk, -# make sure it can be executed from shell -# You should set deploy properties before -# call this macro, see "set_deploy_property()" +# +# This macro using "deploy_tool" from PIP, +# so make sure it can be executed from shell # # use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable, # depends on target platform @@ -356,6 +371,7 @@ macro(deploy_target _T) set(_DEP_LIBPATH) set(_DEP_LIBS_CS) set(_DEP_LIBS) + set(_ADD_DEPS ${_PLUG_DIRS} ${_PLUG_FILES} ${_FILE_DIRS} ${_FILE_FILES}) get_target_property(_LL ${_T} LINK_LIBRARIES) foreach (_L ${_LL}) if (TARGET ${_L}) @@ -436,7 +452,7 @@ macro(deploy_target _T) 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} ${_PLUG_DIRS} ${_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 echo "Conflicts:" ${_C_echo} COMMAND echo "Replaces:" ${_C_echo} COMMAND echo "Section: misc" ${_C_echo} @@ -537,7 +553,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\"" ${_PLUG_DIRS} + 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} # zip COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\"" COMMENT "Generating ${_TV}.zip" @@ -582,7 +598,7 @@ macro(deploy_target _T) ${_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} ${_PLUG_DIRS} + 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} # prepare dmg dir COMMAND rm -rf ${_DMG} COMMAND mkdir -p ${_DMG}