git-svn-id: svn://db.shs.com.ru/libs@894 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2020-03-24 11:12:16 +00:00
parent b4c64b0d7d
commit a11dd99c93
2 changed files with 146 additions and 84 deletions

View File

@@ -1,14 +1,4 @@
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW) # Support if() IN_LIST
endif()
set(__prop_names "LABEL;VERSION;FULLNAME;COMPANY;ICON;INFO")
include(TargetArch)
if (NOT MY_ARCH)
target_architecture(MY_ARCH)
endif()
# usage: set_deploy_property(<target> NAME <value> [NAME <value> [...]])
# set_deploy_property(<target> NAME <value> [NAME <value> [...]])
#
# Set target deploy property, where NAME one of:
# * LABEL - application icon name
@@ -20,6 +10,56 @@ endif()
#
# You can setup several properties in one command
#
#
#
#
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]])
#
# DEPLOY_DIR - dir where you install
# * executable on Windows, Linux
# * <T>.app directory with executable on MacOS
#
# DESTINATION - dir where macro place package
#
# Example:
# deploy_target(my_app DESTINATION packages)
#
# Create make target "deploy"
#
# 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()"
#
# use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable,
# depends on target platform
# can use "DEPLOY_ADD_LIBPATH" variable as additional
# library search path
#
#
#
#
# make_rc(<target> <rc_out_file>)
#
# Generate Windows *.rc file from deploy properties
# and return file path to <rc_out_file>
#
# You should set deploy properties before
# call this macro, see "set_deploy_property()"
#
#
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW) # Support if() IN_LIST
endif()
set(__prop_names "LABEL;VERSION;FULLNAME;COMPANY;ICON;INFO")
include(TargetArch)
if (NOT MY_ARCH)
target_architecture(MY_ARCH)
endif()
macro(set_deploy_property _T)
set(_name)
set(_is_name 1)
@@ -39,14 +79,6 @@ macro(set_deploy_property _T)
endmacro()
# usage: make_rc(<target> <rc_out_file>)
#
# Generate Windows *.rc file from deploy properties
# and return file path to <rc_out_file>
#
# You should set deploy properties before
# call this macro, see "set_deploy_property()"
#
macro(make_rc _T _out)
if (WIN32)
set(WINDOWS_RC_FULLNAME "${${_T}_FULLNAME}")
@@ -108,29 +140,6 @@ END
endmacro()
# usage: deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]])
#
# DEPLOY_DIR - dir where you install
# * executable on Windows, Linux
# * <T>.app directory with executable on MacOS
#
# DESTINATION - dir where macro place package
#
# Example:
# deploy_target(my_app DESTINATION packages)
#
# Create make target "deploy"
#
# 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()"
#
# use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable,
# depends on target platform
# can use "DEPLOY_ADD_LIBPATH" variable as additional
# library search path
#
macro(deploy_target _T)
set(_DESTINATION "${CMAKE_INSTALL_PREFIX}")
set(_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}")
@@ -321,6 +330,7 @@ macro(deploy_target _T)
set(MACOSX_BUNDLE_COPYRIGHT "${${_T}_COMPANY}")
set(MACOSX_BUNDLE_INFO_STRING "${${_T}_INFO}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "6.0")
set(MACOSX_BUNDLE_SIGNATURE "????")
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE TRUE)
set(_AGD "${_DEPLOY_DIR}/${_T}.app")
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
@@ -347,7 +357,7 @@ macro(deploy_target _T)
COMMAND cp -r ${_AGD} ${_DMG}
COMMAND ln --symbolic /Applications ${_DMG}
# generate dmg
COMMAND genisoimage -quiet -V ${_T} -D -R -apple -no-pad -o ${_DESTINATION}/${_TV}.dmg ${_DMG}
COMMAND genisoimage -quiet -V "${MACOSX_BUNDLE_BUNDLE_NAME}" -D -R -apple -no-pad -o ${_DESTINATION}/${_TV}.dmg ${_DMG}
COMMENT "Generating ${_TV}.dmg"
)
endif()