git-svn-id: svn://db.shs.com.ru/pip@982 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]])
|
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]] [PLUGIN_DIRS <dir> [<dir> ...]])
|
||||||
#
|
#
|
||||||
# DEPLOY_DIR - dir where you install
|
# DEPLOY_DIR - dir where you install
|
||||||
# * executable on Windows, Linux
|
# * executable on Windows, Linux
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
# Example:
|
# Example:
|
||||||
# deploy_target(my_app DESTINATION packages)
|
# deploy_target(my_app DESTINATION packages)
|
||||||
#
|
#
|
||||||
# Create make target "deploy"
|
# Create make target "deploy_<target>", depends on target "deploy"
|
||||||
#
|
#
|
||||||
# This macro use "deploy_tool" from sdk,
|
# This macro use "deploy_tool" from sdk,
|
||||||
# make sure it can be executed from shell
|
# make sure it can be executed from shell
|
||||||
@@ -277,10 +277,27 @@ macro(deploy_target _T)
|
|||||||
set(_DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
set(_DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}")
|
set(_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(_RES_DIRS)
|
set(_RES_DIRS)
|
||||||
|
set(_PLUG_DIRS)
|
||||||
set(_is_dest 0)
|
set(_is_dest 0)
|
||||||
set(_is_deploy_dir 0)
|
set(_is_deploy_dir 0)
|
||||||
set(_is_res_dirs 0)
|
set(_is_res_dirs 0)
|
||||||
|
set(_is_plug_dirs 0)
|
||||||
foreach(_i ${ARGN})
|
foreach(_i ${ARGN})
|
||||||
|
if ("x${_i}" STREQUAL "xDESTINATION")
|
||||||
|
set(_is_res_dirs 0)
|
||||||
|
set(_is_plug_dirs 0)
|
||||||
|
set(_is_dest 1)
|
||||||
|
elseif ("x${_i}" STREQUAL "xDEPLOY_DIR")
|
||||||
|
set(_is_res_dirs 0)
|
||||||
|
set(_is_plug_dirs 0)
|
||||||
|
set(_is_deploy_dir 1)
|
||||||
|
elseif ("x${_i}" STREQUAL "xRESOURCE_DIRS")
|
||||||
|
set(_is_res_dirs 1)
|
||||||
|
set(_is_plug_dirs 0)
|
||||||
|
elseif ("x${_i}" STREQUAL "xPLUGIN_DIRS")
|
||||||
|
set(_is_res_dirs 0)
|
||||||
|
set(_is_plug_dirs 1)
|
||||||
|
else()
|
||||||
if (_is_dest)
|
if (_is_dest)
|
||||||
set(_is_dest 0)
|
set(_is_dest 0)
|
||||||
set(_DESTINATION "${_i}/")
|
set(_DESTINATION "${_i}/")
|
||||||
@@ -293,13 +310,12 @@ macro(deploy_target _T)
|
|||||||
else()
|
else()
|
||||||
list(APPEND _RES_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${_i}")
|
list(APPEND _RES_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${_i}")
|
||||||
endif()
|
endif()
|
||||||
|
elseif (_is_plug_dirs)
|
||||||
|
if (IS_ABSOLUTE "${_i}")
|
||||||
|
list(APPEND _PLUG_DIRS "${_i}")
|
||||||
else()
|
else()
|
||||||
if ("x${_i}" STREQUAL "xDESTINATION")
|
list(APPEND _PLUG_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${_i}")
|
||||||
set(_is_dest 1)
|
endif()
|
||||||
elseif ("x${_i}" STREQUAL "xDEPLOY_DIR")
|
|
||||||
set(_is_deploy_dir 1)
|
|
||||||
elseif ("x${_i}" STREQUAL "xRESOURCE_DIRS")
|
|
||||||
set(_is_res_dirs 1)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
#message("-i = ${_i}")
|
#message("-i = ${_i}")
|
||||||
@@ -326,7 +342,7 @@ macro(deploy_target _T)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
#message("app depend libpath ${_DEP_LIBPATH}")
|
#message("app depend libpath ${_DEP_LIBPATH}")
|
||||||
set(_CMD_RES)
|
set(_CMD_COPY)
|
||||||
set(_has_deploy 0)
|
set(_has_deploy 0)
|
||||||
if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux")
|
if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux")
|
||||||
if (NOT CMAKE_LDD)
|
if (NOT CMAKE_LDD)
|
||||||
@@ -355,10 +371,18 @@ macro(deploy_target _T)
|
|||||||
set(_C_echo ">>" "${_AGD}/DEBIAN/control")
|
set(_C_echo ">>" "${_AGD}/DEBIAN/control")
|
||||||
set(_D_echof ">" "${_AGD}/usr/share/applications/${_DEBNAME}.desktop")
|
set(_D_echof ">" "${_AGD}/usr/share/applications/${_DEBNAME}.desktop")
|
||||||
set(_D_echo ">>" "${_AGD}/usr/share/applications/${_DEBNAME}.desktop")
|
set(_D_echo ">>" "${_AGD}/usr/share/applications/${_DEBNAME}.desktop")
|
||||||
foreach(_r ${_RES_DIRS})
|
if (_RES_DIRS)
|
||||||
set(_CMD_RES ${_CMD_RES} COMMAND cp -r "${_r}" "${_AGD}/usr/share/${${_T}_COMPANY}")
|
set(_CMD_COPY ${_CMD_COPY} COMMAND mkdir -p "${_AGD}/usr/share/${${_T}_COMPANY}")
|
||||||
|
endif()
|
||||||
|
foreach(_d ${_RES_DIRS})
|
||||||
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -r "${_d}" "${_AGD}/usr/share/${${_T}_COMPANY}")
|
||||||
|
endforeach()
|
||||||
|
if (_PLUG_DIRS)
|
||||||
|
set(_CMD_COPY ${_CMD_COPY} COMMAND mkdir -p "${_AGD}/usr/lib/${${_T}_COMPANY}")
|
||||||
|
endif()
|
||||||
|
foreach(_d ${_PLUG_DIRS})
|
||||||
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -r "${_d}" "${_AGD}/usr/lib/${${_T}_COMPANY}")
|
||||||
endforeach()
|
endforeach()
|
||||||
set(_CMD_COPY)
|
|
||||||
if (_DEP_LIBS)
|
if (_DEP_LIBS)
|
||||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_DEP_LIBS} ${_AGD}/usr/lib)
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_DEP_LIBS} ${_AGD}/usr/lib)
|
||||||
endif()
|
endif()
|
||||||
@@ -370,18 +394,16 @@ macro(deploy_target _T)
|
|||||||
COMMAND mkdir -p ${_AGD}/DEBIAN
|
COMMAND mkdir -p ${_AGD}/DEBIAN
|
||||||
COMMAND mkdir -p ${_AGD}/usr/bin
|
COMMAND mkdir -p ${_AGD}/usr/bin
|
||||||
COMMAND mkdir -p ${_AGD}/usr/lib
|
COMMAND mkdir -p ${_AGD}/usr/lib
|
||||||
COMMAND mkdir -p ${_AGD}/usr/share/${${_T}_COMPANY}
|
|
||||||
COMMAND mkdir -p ${_AGD}/usr/share/pixmaps
|
COMMAND mkdir -p ${_AGD}/usr/share/pixmaps
|
||||||
COMMAND mkdir -p ${_AGD}/usr/share/applications
|
COMMAND mkdir -p ${_AGD}/usr/share/applications
|
||||||
COMMAND cp -f ${_DEPLOY_DIR}/${_T} ${_AGD}/usr/bin
|
COMMAND cp -f ${_DEPLOY_DIR}/${_T} ${_AGD}/usr/bin
|
||||||
${_CMD_COPY}
|
${_CMD_COPY}
|
||||||
${_CMD_RES}
|
|
||||||
|
|
||||||
COMMAND echo "Package: ${_DEBNAME}" ${_C_echof}
|
COMMAND echo "Package: ${_DEBNAME}" ${_C_echof}
|
||||||
COMMAND echo "Version: ${${_T}_VERSION}" ${_C_echo}
|
COMMAND echo "Version: ${${_T}_VERSION}" ${_C_echo}
|
||||||
COMMAND echo "Architecture: ${_DEB_ARCH}" ${_C_echo}
|
COMMAND echo "Architecture: ${_DEB_ARCH}" ${_C_echo}
|
||||||
COMMAND echo "Maintainer: ${${_T}_COMPANY} <>" ${_C_echo}
|
COMMAND echo "Maintainer: ${${_T}_COMPANY} <>" ${_C_echo}
|
||||||
COMMAND deploy_tool --prefix "Depends: " --dependencies -l ${CMAKE_LDD} ${_DEPLOY_DIR}/${_T} -a "${_DEP_LIBS_CS}" -o "${_AGD}/usr/lib" ${_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 echo "Conflicts:" ${_C_echo}
|
COMMAND echo "Conflicts:" ${_C_echo}
|
||||||
COMMAND echo "Replaces:" ${_C_echo}
|
COMMAND echo "Replaces:" ${_C_echo}
|
||||||
COMMAND echo "Section: misc" ${_C_echo}
|
COMMAND echo "Section: misc" ${_C_echo}
|
||||||
@@ -432,16 +454,16 @@ macro(deploy_target _T)
|
|||||||
set(_MKDIR if not exist "\"${_AGD}\"" mkdir "\"${_AGD}\"")
|
set(_MKDIR if not exist "\"${_AGD}\"" mkdir "\"${_AGD}\"")
|
||||||
set(_MKDIR_P if not exist "\"${_DESTINATION}\"" mkdir "\"${_DESTINATION}\"")
|
set(_MKDIR_P if not exist "\"${_DESTINATION}\"" mkdir "\"${_DESTINATION}\"")
|
||||||
endif()
|
endif()
|
||||||
foreach(_r ${_RES_DIRS})
|
foreach(_d ${_RES_DIRS} ${_PLUG_DIRS})
|
||||||
get_filename_component(_dirname "${_r}" NAME)
|
get_filename_component(_dirname "${_d}" NAME)
|
||||||
file(TO_NATIVE_PATH "${_r}/" _wr)
|
file(TO_NATIVE_PATH "${_d}/" _wr)
|
||||||
if ("x${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "xWindows")
|
if ("x${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "xWindows")
|
||||||
set(_CMD_RES ${_CMD_RES} COMMAND if not exist "\"${_AGD}${_dirname}\"" mkdir "\"${_AGD}${_dirname}\"")
|
set(_CMD_COPY ${_CMD_COPY} COMMAND if not exist "\"${_AGD}${_dirname}\"" mkdir "\"${_AGD}${_dirname}\"")
|
||||||
string(REPLACE "/" "\\" _wr "${_wr}")
|
string(REPLACE "/" "\\" _wr "${_wr}")
|
||||||
else()
|
else()
|
||||||
set(_CMD_RES ${_CMD_RES} COMMAND mkdir -p "${_AGD}${_dirname}")
|
set(_CMD_COPY ${_CMD_COPY} COMMAND mkdir -p "${_AGD}${_dirname}")
|
||||||
endif()
|
endif()
|
||||||
set(_CMD_RES ${_CMD_RES} COMMAND ${_COPY} "${_wr}*" "\"${_AGD}${_dirname}${_SEP}\"" ${_COPY_SUFFIX})
|
set(_CMD_COPY ${_CMD_COPY} COMMAND ${_COPY} "${_wr}*" "\"${_AGD}${_dirname}${_SEP}\"" ${_COPY_SUFFIX})
|
||||||
endforeach()
|
endforeach()
|
||||||
add_custom_target(deploy_${_T}
|
add_custom_target(deploy_${_T}
|
||||||
# gather dir
|
# gather dir
|
||||||
@@ -449,11 +471,11 @@ macro(deploy_target _T)
|
|||||||
COMMAND ${_MKDIR_P}
|
COMMAND ${_MKDIR_P}
|
||||||
COMMAND ${_COPY} "\"${_DEPLOY_DIR}${_T}.exe\"" "\"${_AGD}\"" ${_COPY_SUFFIX}
|
COMMAND ${_COPY} "\"${_DEPLOY_DIR}${_T}.exe\"" "\"${_AGD}\"" ${_COPY_SUFFIX}
|
||||||
#COMMAND ${_COPY} "${_DEPLOY_DIR}lang${_SEP}*" "\"${_AGD}lang${_SEP}\"" ${_COPY_SUFFIX}
|
#COMMAND ${_COPY} "${_DEPLOY_DIR}lang${_SEP}*" "\"${_AGD}lang${_SEP}\"" ${_COPY_SUFFIX}
|
||||||
${_CMD_RES}
|
${_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\""
|
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}
|
||||||
# zip
|
# zip
|
||||||
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\""
|
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\""
|
||||||
COMMENT "Generating ${_TV}.zip"
|
COMMENT "Generating ${_TV}.zip"
|
||||||
)
|
)
|
||||||
set(_has_deploy 1)
|
set(_has_deploy 1)
|
||||||
@@ -471,23 +493,25 @@ macro(deploy_target _T)
|
|||||||
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_ROOT}/Modules/PIMacOSBundle.plist.in")
|
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_ROOT}/Modules/PIMacOSBundle.plist.in")
|
||||||
set(_AGD "${_DEPLOY_DIR}/${_T}.app")
|
set(_AGD "${_DEPLOY_DIR}/${_T}.app")
|
||||||
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
|
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
|
||||||
set(_CMD_COPY)
|
|
||||||
if (_ICON_NAME)
|
if (_ICON_NAME)
|
||||||
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_ICON_FN} ${_AGD}/Contents/Resources)
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -f ${_ICON_FN} ${_AGD}/Contents/Resources)
|
||||||
endif()
|
endif()
|
||||||
foreach(_r ${_RES_DIRS})
|
foreach(_d ${_RES_DIRS})
|
||||||
set(_CMD_RES ${_CMD_RES} COMMAND cp -r "${_r}" "${_AGD}/Contents/Resources")
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -r "${_d}" "${_AGD}/Contents/Resources")
|
||||||
|
endforeach()
|
||||||
|
foreach(_d ${_PLUG_DIRS})
|
||||||
|
set(_CMD_COPY ${_CMD_COPY} COMMAND cp -r "${_d}" "${_AGD}/Contents/PlugIns")
|
||||||
endforeach()
|
endforeach()
|
||||||
add_custom_target(deploy_${_T}
|
add_custom_target(deploy_${_T}
|
||||||
# gather .app dir
|
# gather .app dir
|
||||||
COMMAND mkdir -p ${_AGD}/Contents/Resources
|
COMMAND mkdir -p ${_AGD}/Contents/Resources
|
||||||
COMMAND mkdir -p ${_AGD}/Contents/Frameworks
|
COMMAND mkdir -p ${_AGD}/Contents/Frameworks
|
||||||
|
COMMAND mkdir -p ${_AGD}/Contents/PlugIns
|
||||||
COMMAND mkdir -p ${_DESTINATION}
|
COMMAND mkdir -p ${_DESTINATION}
|
||||||
${_CMD_COPY}
|
${_CMD_COPY}
|
||||||
${_CMD_RES}
|
|
||||||
#COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
|
#COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
|
||||||
#COMMAND cp -r ${_DEPLOY_DIR}/lang ${_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}
|
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}
|
||||||
# prepare dmg dir
|
# prepare dmg dir
|
||||||
COMMAND rm -rf ${_DMG}
|
COMMAND rm -rf ${_DMG}
|
||||||
COMMAND mkdir -p ${_DMG}
|
COMMAND mkdir -p ${_DMG}
|
||||||
|
|||||||
Reference in New Issue
Block a user