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

This commit is contained in:
2020-03-16 11:45:11 +00:00
parent 0ea19348ee
commit 24a60e288b

View File

@@ -1,11 +1,30 @@
# use "CMAKE_OTOOL" variable
# use "RELEASE_DIR" variable, where <T>.app directory with installed binary
# can use "DEPLOY_ADD_LIBPATH" variable
# 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
#
# create make target "deploy"
#
macro(deploy_target _T full_app_name version icon label copyright info)
get_filename_component(_ICON_NAME "${icon}" NAME)
get_filename_component(_ICON_FN "${icon}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(_TV "${_T}-${version}")
set(_DEP_LIBPATH)
get_target_property(_LL ${_T} LINK_LIBRARIES)
foreach (_L ${_LL})
if (TARGET ${_L})
get_target_property(_II ${_L} IMPORTED)
if (NOT _II)
#message("depend on ${_L}")
set(_DEP_LIBPATH "${_DEP_LIBPATH}\;$<TARGET_FILE_DIR:${_L}>")
endif()
endif()
endforeach()
message("app depend libpath ${_DEP_LIBPATH}")
if (APPLE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "${full_app_name}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${version}")
@@ -18,12 +37,12 @@ macro(deploy_target _T full_app_name version icon label copyright info)
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE TRUE)
set(_AGD "${RELEASE_DIR}/${_T}.app")
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
add_custom_target(generate_package
add_custom_target(deploy
# gather .app dir
COMMAND mkdir -p ${_AGD}/Contents/Resources
COMMAND mkdir -p ${_AGD}/Contents/Frameworks
COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
COMMAND deploy_tool -M "${CMAKE_OTOOL}" -P cocoa -S mac -q ${Qt5_ROOT} -s \"${CMAKE_PREFIX_PATH}/lib\;${DEPLOY_ADD_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}
# prepare dmg dir
COMMAND rm -rf ${_DMG}
COMMAND mkdir -p ${_DMG}