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

This commit is contained in:
2020-03-16 13:11:30 +00:00
parent 628a54bc68
commit 4741baadef

View File

@@ -1,15 +1,57 @@
# create make target "deploy"
# usage: deploy_target(<target> <full_app_name> <version> <icon> <label> <copyright> <info>
# [DEPLOY_DIR <dir>] [DESTINATION <dir>] [NO_AUTO_ICON_EXT])
#
# 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
# "org.Company.my_app"
# "0.0.1"
# "icons/my_app.icns"
# "My Application"
# "Company"
# "Info about My Application"
# DESTINATION packages
#
# Create make target "deploy"
#
# This macro use "deploy_tool" from sdk,
# make sure it can be executed from shell
#
# use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable,
# depends on target platform
# use "RELEASE_DIR" variable, where can be found
# * executable on Windows, Linux
# * <T>.app directory with installed executable on MacOS
# can use "DEPLOY_ADD_LIBPATH" variable as additional
# library search path
#
macro(deploy_target _T full_app_name version icon label copyright info)
set(_DESTINATION)
set(_DEPLOY_DIR)
set(_is_dest 0)
set(_is_deploy_dir 0)
foreach(_i ${ARGN})
if (_is_dest)
set(_is_dest 0)
set(_DESTINATION "${_i}/")
else()
if (_is_deploy_dir)
set(_is_deploy_dir 0)
set(_DEPLOY_DIR "${_i}/")
else()
if ("x${_i}" STREQUAL "xDESTINATION")
set(_is_dest 1)
else()
if ("x${_i}" STREQUAL "xDEPLOY_DIR")
set(_is_deploy_dir 1)
endif()
endif()
endif()
endif()
#message("-i = ${_i}")
endforeach()
get_filename_component(_ICON_NAME "${icon}" NAME)
get_filename_component(_ICON_FN "${icon}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(_TV "${_T}-${version}")
@@ -35,7 +77,7 @@ macro(deploy_target _T full_app_name version icon label copyright info)
set(MACOSX_BUNDLE_INFO_STRING "${info}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "6.0")
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE TRUE)
set(_AGD "${RELEASE_DIR}/${_T}.app")
set(_AGD "${_DEPLOY_DIR}${_T}.app")
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
add_custom_target(deploy
# gather .app dir
@@ -49,7 +91,7 @@ macro(deploy_target _T full_app_name version icon label copyright info)
COMMAND cp -r ${_AGD} ${_DMG}
COMMAND ln --symbolic /Applications ${_DMG}
# generate dmg
COMMAND genisoimage -quiet -V ${_T} -D -R -apple -no-pad -o ${RELEASE_DIR}/${_TV}.dmg ${_DMG}
COMMAND genisoimage -quiet -V ${_T} -D -R -apple -no-pad -o ${_DESTINATION}${_TV}.dmg ${_DMG}
COMMENT "Generating ${_TV}.dmg"
)
endif()