DeployMacros LIBS support

This commit is contained in:
2020-05-20 19:49:14 +03:00
parent ecadc0f2e0
commit f625b87577

View File

@@ -69,17 +69,24 @@ before call this macro, see
deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>]
deploy_target(<target> [DEPLOY_DIR <dir>]
[DESTINATION <dir>]
[RESOURCES <dir|file> [<dir|file> ...] ]
[PLUGINS <dir|file> [<dir|file> ...] ]
[FILES <dir|file> [<dir|file> ...] ]
[OPTIONS <flag> ...] [VERBOSE] [ZIP_NO_DMG]
[LIBS <dir|file> [<dir|file> ...] ]
[OPTIONS <flag> ...]
[VERBOSE]
[DMG_NO_ZIP]
[DEB_USR_DIR] [DEB_ADD_SERVICE])
Create make target "deploy_<target>", depends on target "deploy".
On this target create release package, containing all dependencies:
*.zip on Windows, *.deb on Linux, *.dmg an MacOS, *.apk and *.aab on Android.
If not defined ZIP_NO_DMG then *.dmg.zip will be created on MacOS.
* .zip on Windows
* .deb on Linux
* .dmg[.zip] on MacOS
* .apk/.aab on Android
If not defined DMG_NO_ZIP then *.dmg.zip will be created on MacOS.
You should set version and deploy properties
before call this macro, see
@@ -94,17 +101,19 @@ DEPLOY_DIR - dir where you install
* <T>.app directory with executable on MacOS
DESTINATION - dir where macro place package
RESOURCES, PLUGINS and FILES - list of directories and files, copied to:
| | Windows | Linux | Linux (DEB_USR_DIR) | MacOS |
|-----------|---------|---------------------|---------------------------|--------------------|
| RESOURCES | root | /opt/COMPANY/target | /usr/share/COMPANY/target | Contents/Resources |
| PLUGINS | root | /opt/COMPANY/target | /usr/lib/COMPANY/target | Contents/PlugIns |
| FILES | root | /opt/COMPANY/target | /usr/bin | Contents/MacOS |
| | Windows | Linux | Linux (DEB_USR_DIR) | MacOS |
|-----------|---------|-------------------------|---------------------------|---------------------|
| RESOURCES | root | /opt/COMPANY/target | /usr/share/COMPANY/target | Contents/Resources |
| PLUGINS | root | /opt/COMPANY/target | /usr/lib/COMPANY/target | Contents/PlugIns |
| FILES | root | /opt/COMPANY/target | /usr/bin | Contents/MacOS |
| LIBS | root | /opt/COMPANY/target/lib | /usr/lib | Contents/Frameworks |
Relative paths are taken from DEPLOY_DIR
Also check library dependencies from PLUGINS and FILES
Important! RESOURCES, PLUGINS and FILES lists check
Important! RESOURCES, PLUGINS, FILES and LIBS lists check
at cmake-time, so if entry ends with "/" it treat
as directory, else - file
@@ -553,6 +562,8 @@ macro(deploy_target _T)
set(_PLUG_FILES)
set(_FILE_DIRS)
set(_FILE_FILES)
set(_LIBS_DIRS)
set(_LIBS_FILES)
set(_VERB)
set(_WVERB 1> NUL)
set(_OPTIONS)
@@ -560,14 +571,14 @@ macro(deploy_target _T)
set(_DEB_OPT 1)
set(_DEB_SERVICE 0)
set(_cur_arg)
set(__args "DESTINATION;DEPLOY_DIR;RESOURCES;PLUGINS;FILES;OPTIONS;VERBOSE;ZIP_NO_DMG;DEB_USR_DIR;DEB_ADD_SERVICE")
set(__args "DESTINATION;DEPLOY_DIR;RESOURCES;PLUGINS;FILES;LIBS;OPTIONS;VERBOSE;DMG_NO_ZIP;DEB_USR_DIR;DEB_ADD_SERVICE")
foreach(_i ${ARGN})
if (_i IN_LIST __args)
set(_cur_arg "${_i}")
if ("${_cur_arg}" STREQUAL "VERBOSE")
set(_VERB -v)
set(_WVERB)
elseif("${_cur_arg}" STREQUAL "ZIP_NO_DMG")
elseif("${_cur_arg}" STREQUAL "DMG_NO_ZIP")
set(_ZIP_DMG 0)
elseif("${_cur_arg}" STREQUAL "DEB_USR_DIR")
set(_DEB_OPT 0)
@@ -586,6 +597,8 @@ macro(deploy_target _T)
__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 "LIBS")
__add_file_or_dir(_LIBS_DIRS _LIBS_FILES "${_i}" "${_DEPLOY_DIR}")
elseif ("${_cur_arg}" STREQUAL "OPTIONS")
list(APPEND _OPTIONS "${_i}")
endif()
@@ -599,7 +612,7 @@ macro(deploy_target _T)
set(_DEP_LIBS)
set(_add_search_path)
set(_added_)
set(_ADD_DEPS ${_PLUG_DIRS} ${_PLUG_FILES} ${_FILE_DIRS} ${_FILE_FILES})
set(_ADD_DEPS ${_PLUG_DIRS} ${_PLUG_FILES} ${_FILE_DIRS} ${_FILE_FILES} ${_LIBS_DIRS} ${_LIBS_FILES})
__gather_deps(${_T} _add_search_path _DEP_LIBS _DEP_LIBS_CS _added_)
foreach (_L ${DEPLOY_ADD_LIBPATH})
set(_add_search_path "${_add_search_path}${_dt_delim}${_L}")
@@ -690,6 +703,7 @@ macro(deploy_target _T)
__make_copy(_CMD_ _FILE_DIRS _FILE_FILES ${_bin_path})
__make_copy(_CMD_ _PLUG_DIRS _PLUG_FILES ${_pli_path})
__make_copy(_CMD_ _RES_DIRS _RES_FILES ${_res_path})
__make_copy(_CMD_ _LIBS_DIRS _LIBS_FILES ${_lib_path})
set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f "${_DEPLOY_DIR}/${_T}" "${_bin_path}/")
if (_DEP_LIBS)
set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f "${_DEP_LIBS}" "${_lib_path}/")
@@ -837,6 +851,7 @@ macro(deploy_target _T)
__make_copy(_CMD_ _RES_DIRS _RES_FILES "${_AGD}")
__make_copy(_CMD_ _PLUG_DIRS _PLUG_FILES "${_AGD}")
__make_copy(_CMD_ _FILE_DIRS _FILE_FILES "${_AGD}")
__make_copy(_CMD_ _LIBS_DIRS _LIBS_FILES "${_AGD}")
set(_zip_name "${_TV}_windows_${MY_ARCH}.zip")
add_custom_target(deploy_${_T}
# gather dir
@@ -866,6 +881,7 @@ macro(deploy_target _T)
__make_copy(_CMD_ _RES_DIRS _RES_FILES "${_AGD}/Contents/Resources")
__make_copy(_CMD_ _PLUG_DIRS _PLUG_FILES "${_AGD}/Contents/PlugIns")
__make_copy(_CMD_ _FILE_DIRS _FILE_FILES "${_AGD}/Contents/MacOS")
__make_copy(_CMD_ _LIBS_DIRS _LIBS_FILES "${_AGD}/Contents/Frameworks")
if (_ICON_NAME)
set(_CMD_ ${_CMD_} COMMAND cp ${_VERB} -f ${_ICON_FN} ${_AGD}/Contents/Resources)
endif()