git-svn-id: svn://db.shs.com.ru/pip@1013 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,112 +1,114 @@
|
|||||||
# Important! You should include this file
|
#[[
|
||||||
# in your top-level CMakeLists.txt
|
|
||||||
#
|
Important! You should include this file
|
||||||
#
|
in your top-level CMakeLists.txt
|
||||||
#
|
|
||||||
#
|
|
||||||
# set_version(<target> [MAJOR <value>] [MINOR <value>] [REVISION <value>] [SUFFIX <value>] [BUILD <value>] [OUTPUT <file>])
|
|
||||||
#
|
|
||||||
# Set target version, optionally creates file
|
set_version(<target> [MAJOR <value>] [MINOR <value>] [REVISION <value>] [SUFFIX <value>] [BUILD <value>] [OUTPUT <file>])
|
||||||
#
|
|
||||||
# Create variable <target>_VERSION with full version name
|
Set target version, optionally creates file
|
||||||
#
|
|
||||||
# If OUTPUT then generate header <file> with
|
Create variable <target>_VERSION with full version name
|
||||||
# version macros - <target>_VERSION_<NAME>
|
|
||||||
# Also create macro <target>_VERSION_NAME with full string version
|
If OUTPUT then generate header <file> with
|
||||||
# Attention: macro <target>_VERSION is byte-packed integer version!
|
version macros - <target>_VERSION_<NAME>
|
||||||
#
|
Also create macro <target>_VERSION_NAME with full string version
|
||||||
#
|
Attention: macro <target>_VERSION is byte-packed integer version!
|
||||||
#
|
|
||||||
#
|
|
||||||
# set_lang(<target> <lang> [<lang> [...]])
|
|
||||||
#
|
|
||||||
# Set target translations, e.g. "ru" "fr"
|
set_lang(<target> <lang> [<lang> [...] ])
|
||||||
#
|
|
||||||
#
|
Set target translations, e.g. "ru" "fr"
|
||||||
#
|
|
||||||
#
|
|
||||||
# import_version(<target> <source_target>)
|
|
||||||
#
|
|
||||||
# Copy all version components and languages from <source_target>
|
import_version(<target> <source_target>)
|
||||||
#
|
|
||||||
#
|
Copy all version components and languages from <source_target>
|
||||||
#
|
|
||||||
#
|
|
||||||
# set_deploy_property(<target> [SHARED | STATIC] NAME <value> [NAME <value> [...]])
|
|
||||||
#
|
|
||||||
# Set target deploy property, where NAME one of:
|
set_deploy_property(<target> [SHARED | STATIC] NAME <value> [NAME <value> [...] ])
|
||||||
# * LABEL - application icon name
|
|
||||||
# * FULLNAME - package name in format "*.*.*"
|
Set target deploy property, where NAME one of:
|
||||||
# * COMPANY - company name
|
* LABEL - application icon name
|
||||||
# * ICON - icon file path
|
* FULLNAME - package name in format "*.*.*"
|
||||||
# * INFO - additional info
|
* COMPANY - company name
|
||||||
#
|
* ICON - icon file path
|
||||||
# Specify SHARED or STATIC if your target is library
|
* INFO - additional info
|
||||||
# You can setup several properties in one command
|
|
||||||
#
|
Specify SHARED or STATIC if your target is library
|
||||||
#
|
You can setup several properties in one command
|
||||||
#
|
|
||||||
#
|
|
||||||
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>]
|
|
||||||
# [RESOURCES <dir|file> [<dir|file> ...]]
|
|
||||||
# [PLUGINS <dir|file> [<dir|file> ...]]
|
deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>]
|
||||||
# [FILES <dir|file> [<dir|file> ...]]
|
[RESOURCES <dir|file> [<dir|file> ...] ]
|
||||||
# [OPTIONS <flag> ...] [VERBOSE])
|
[PLUGINS <dir|file> [<dir|file> ...] ]
|
||||||
#
|
[FILES <dir|file> [<dir|file> ...] ]
|
||||||
# Create make target "deploy_<target>", depends on target "deploy"
|
[OPTIONS <flag> ...] [VERBOSE])
|
||||||
# On this target create release package, containing all dependencies:
|
|
||||||
# *.zip on Windows, *.deb on Linux and *.dmg an MacOS
|
Create make target "deploy_<target>", depends on target "deploy"
|
||||||
#
|
On this target create release package, containing all dependencies:
|
||||||
# You should set version and deploy properties
|
*.zip on Windows, *.deb on Linux and *.dmg an MacOS
|
||||||
# before call this macro, see
|
|
||||||
# "set_version()" and "set_deploy_property()"
|
You should set version and deploy properties
|
||||||
#
|
before call this macro, see
|
||||||
# Example:
|
"set_version()" and "set_deploy_property()"
|
||||||
# deploy_target(my_app DESTINATION packages)
|
|
||||||
#
|
Example:
|
||||||
#
|
deploy_target(my_app DESTINATION packages)
|
||||||
# DEPLOY_DIR - dir where you install
|
|
||||||
# * executable on Windows, Linux
|
|
||||||
# * <T>.app directory with executable on MacOS
|
DEPLOY_DIR - dir where you install
|
||||||
#
|
* executable on Windows, Linux
|
||||||
# DESTINATION - dir where macro place package
|
* <T>.app directory with executable on MacOS
|
||||||
# RESOURCES, PLUGINS and FILES - list of directories and files, copied to:
|
|
||||||
#
|
DESTINATION - dir where macro place package
|
||||||
# | Windows | Linux | MacOS
|
RESOURCES, PLUGINS and FILES - list of directories and files, copied to:
|
||||||
# ----------|---------|---------------------------|-------------------
|
|
||||||
# RESOURCES | root | /usr/share/COMPANY/target | Contents/Resources
|
| Windows | Linux | MacOS
|
||||||
# PLUGINS | root | /usr/lib/COMPANY/target | Contents/PlugIns
|
----------|---------|---------------------------|-------------------
|
||||||
# FILES | root | /usr/bin | Contents/MacOS
|
RESOURCES | root | /usr/share/COMPANY/target | Contents/Resources
|
||||||
#
|
PLUGINS | root | /usr/lib/COMPANY/target | Contents/PlugIns
|
||||||
# Relative paths are taken from DEPLOY_DIR
|
FILES | root | /usr/bin | Contents/MacOS
|
||||||
# Also check library dependencies from PLUGINS and FILES
|
|
||||||
#
|
Relative paths are taken from DEPLOY_DIR
|
||||||
#
|
Also check library dependencies from PLUGINS and FILES
|
||||||
# This macro using "deploy_tool" from PIP,
|
|
||||||
# so make sure it can be executed from shell
|
|
||||||
# OPTIONS allow you to pass custom flags to "deploy_tool"
|
This macro using "deploy_tool" from PIP,
|
||||||
# You can see flags by launch "deploy_tool" without arguments
|
so make sure it can be executed from shell
|
||||||
#
|
OPTIONS allow you to pass custom flags to "deploy_tool"
|
||||||
# Using CMAKE_LDD, CMAKE_OTOOL or CMAKE_OBJDUMP variable,
|
You can see flags by launch "deploy_tool" without arguments
|
||||||
# depends on target platform
|
|
||||||
#
|
Using CMAKE_LDD, CMAKE_OTOOL or CMAKE_OBJDUMP variable,
|
||||||
# DEPLOY_ADD_LIBPATH variable used as additional
|
depends on target platform
|
||||||
# library search path
|
|
||||||
#
|
DEPLOY_ADD_LIBPATH variable used as additional
|
||||||
#
|
library search path
|
||||||
#
|
|
||||||
#
|
|
||||||
# make_rc(<target> <rc_out_file>)
|
|
||||||
#
|
|
||||||
# Generate Windows *.rc file from deploy properties
|
make_rc(<target> <rc_out_file>)
|
||||||
# and return file path to <rc_out_file>
|
|
||||||
# On other platforms this variable set to empty
|
Generate Windows *.rc file from deploy properties
|
||||||
#
|
and return file path to <rc_out_file>
|
||||||
# You should set version and deploy properties
|
On other platforms this variable set to empty
|
||||||
# before call this macro, see
|
|
||||||
# "set_version()" and "set_deploy_property()"
|
You should set version and deploy properties
|
||||||
#
|
before call this macro, see
|
||||||
#
|
"set_version()" and "set_deploy_property()"
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
||||||
@@ -117,6 +119,7 @@ if (POLICY CMP0053)
|
|||||||
cmake_policy(SET CMP0053 NEW)
|
cmake_policy(SET CMP0053 NEW)
|
||||||
endif()
|
endif()
|
||||||
set(__prop_names "LABEL;FULLNAME;COMPANY;ICON;INFO")
|
set(__prop_names "LABEL;FULLNAME;COMPANY;ICON;INFO")
|
||||||
|
list(APPEND __prop_names "ANDROID_TARGET_SDK;ANDROID_STORE_FILE;ANDROID_STORE_PASSWORD;ANDROID_KEY_PASSWORD;ANDROID_KEY_ALIAS")
|
||||||
set(__version_names "MAJOR;MINOR;REVISION;BUILD;SUFFIX")
|
set(__version_names "MAJOR;MINOR;REVISION;BUILD;SUFFIX")
|
||||||
include(TargetArch)
|
include(TargetArch)
|
||||||
if (NOT MY_ARCH)
|
if (NOT MY_ARCH)
|
||||||
@@ -409,6 +412,24 @@ macro(__make_copy _cmd _dirs _files _dest)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
#defaultConfig {
|
||||||
|
# resConfigs "ru"
|
||||||
|
#}
|
||||||
|
set(__gradle_sign
|
||||||
|
" signingConfigs {
|
||||||
|
release {
|
||||||
|
storeFile file(RELEASE_STORE_FILE)
|
||||||
|
storePassword RELEASE_STORE_PASSWORD
|
||||||
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
}")
|
||||||
|
|
||||||
# Help macros end
|
# Help macros end
|
||||||
|
|
||||||
@@ -466,7 +487,7 @@ macro(deploy_target _T)
|
|||||||
#message("depend on ${_L}")
|
#message("depend on ${_L}")
|
||||||
get_target_property(_LT ${_L} TYPE)
|
get_target_property(_LT ${_L} TYPE)
|
||||||
if ("x${_LT}" STREQUAL "xSHARED_LIBRARY")
|
if ("x${_LT}" STREQUAL "xSHARED_LIBRARY")
|
||||||
set(_DEP_LIBPATH "${_DEP_LIBPATH};$<TARGET_FILE_DIR:${_L}>")
|
set(_DEP_LIBPATH "${_DEP_LIBPATH}!$<TARGET_FILE_DIR:${_L}>")
|
||||||
set(_DEP_LIBS_CS "${_DEP_LIBS_CS};$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
|
set(_DEP_LIBS_CS "${_DEP_LIBS_CS};$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
|
||||||
set(_DEP_LIBS "${_DEP_LIBS}" "$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
|
set(_DEP_LIBS "${_DEP_LIBS}" "$<TARGET_FILE_DIR:${_L}>/$<TARGET_FILE_NAME:${_L}>")
|
||||||
endif()
|
endif()
|
||||||
@@ -576,7 +597,7 @@ macro(deploy_target _T)
|
|||||||
# gather dir
|
# gather dir
|
||||||
${_CMD_}
|
${_CMD_}
|
||||||
|
|
||||||
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
|
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin!${MINGW_BIN}!${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS}
|
||||||
# zip
|
# zip
|
||||||
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -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"
|
||||||
@@ -610,7 +631,7 @@ macro(deploy_target _T)
|
|||||||
${_CMD_}
|
${_CMD_}
|
||||||
#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 ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -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} ${_ADD_DEPS}
|
COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -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} ${_ADD_DEPS}
|
||||||
# prepare dmg dir
|
# prepare dmg dir
|
||||||
COMMAND rm -rf ${_DMG}
|
COMMAND rm -rf ${_DMG}
|
||||||
COMMAND mkdir ${_VERB} -p ${_DMG}
|
COMMAND mkdir ${_VERB} -p ${_DMG}
|
||||||
@@ -622,33 +643,57 @@ macro(deploy_target _T)
|
|||||||
)
|
)
|
||||||
set(_has_deploy 1)
|
set(_has_deploy 1)
|
||||||
elseif (DEFINED ANDROID_PLATFORM)
|
elseif (DEFINED ANDROID_PLATFORM)
|
||||||
|
set(_res_files)
|
||||||
|
set(_res_files "${_res_files}\n <qresource prefix=\"/\">")
|
||||||
|
foreach (_f ${_RES_FILES})
|
||||||
|
set(_res_files "${_res_files}\n <file>${_f}</file>")
|
||||||
|
endforeach()
|
||||||
|
set(_res_files "${_res_files}\n </qresource>")
|
||||||
|
foreach (_d ${_RES_DIRS})
|
||||||
|
file(GLOB_RECURSE _df "${_d}/*")
|
||||||
|
#message("FILES ${_d} = ${_df}")
|
||||||
|
get_filename_component(_dn "${_d}" NAME)
|
||||||
|
set(_res_files "${_res_files}\n <qresource prefix=\"${_dn}\">")
|
||||||
|
foreach (_f ${_df})
|
||||||
|
get_filename_component(_fn "${_f}" NAME)
|
||||||
|
set(_res_files "${_res_files}\n <file alias=\"${_fn}\">${_f}</file>")
|
||||||
|
endforeach()
|
||||||
|
set(_res_files "${_res_files}\n </qresource>")
|
||||||
|
endforeach()
|
||||||
|
set(_res_qrc "${CMAKE_CURRENT_BINARY_DIR}/android_res.qrc")
|
||||||
|
file(WRITE "${_res_qrc}" "<RCC>${_res_files}\n</RCC>")
|
||||||
|
#__make_copy(_CMD_ _RES_DIRS _RES_FILES "${_AGD}/res")
|
||||||
|
#__make_copy(_CMD_ _FILE_DIRS _FILE_FILES "${_AGD}/Contents/MacOS")
|
||||||
set(_AT ${_T}_lib)
|
set(_AT ${_T}_lib)
|
||||||
set(_ATA ${_AT}_${ANDROID_ABI})
|
set(_ATA ${_AT}_${ANDROID_ABI})
|
||||||
get_target_property(_sources ${_T} SOURCES)
|
get_target_property(_sources ${_T} SOURCES)
|
||||||
get_target_property(_libs ${_T} LINK_LIBRARIES)
|
get_target_property(_libs ${_T} LINK_LIBRARIES)
|
||||||
get_target_property(_incs ${_T} INCLUDE_DIRECTORIES)
|
get_target_property(_incs ${_T} INCLUDE_DIRECTORIES)
|
||||||
add_library(${_ATA} SHARED ${_sources})
|
qt5_add_resources(_res_out "${_res_qrc}")
|
||||||
|
add_library(${_ATA} SHARED ${_sources} ${_res_out})
|
||||||
target_link_libraries(${_ATA} ${_libs})
|
target_link_libraries(${_ATA} ${_libs})
|
||||||
target_include_directories(${_ATA} PRIVATE ${_incs})
|
target_include_directories(${_ATA} PRIVATE ${_incs})
|
||||||
set_target_properties(${_T} PROPERTIES EXCLUDE_FROM_ALL 1)
|
set_target_properties(${_T} PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||||
#message("create new target ${_ATA} ${_sources} ${_libs}")
|
#message("create new target ${_ATA} ${_sources} ${_libs}")
|
||||||
set(_AGD "${_DEPLOY_DIR}/${_T}.android")
|
set(_AGD "${_DEPLOY_DIR}/${_T}.android")
|
||||||
set(_file)
|
|
||||||
__make_dir(_CMD_ "${_AGD}")
|
__make_dir(_CMD_ "${_AGD}")
|
||||||
set(_dir "${CMAKE_BINARY_DIR}/android-build/libs")
|
set(_file)
|
||||||
__make_copy(_CMD_ _dir _file "${_AGD}")
|
set(_dir "${CMAKE_BINARY_DIR}/android-build/libs" "${CMAKE_CURRENT_SOURCE_DIR}/android/res" "${CMAKE_CURRENT_SOURCE_DIR}/android/src")
|
||||||
set(_dir "${CMAKE_CURRENT_SOURCE_DIR}/android/res")
|
|
||||||
__make_copy(_CMD_ _dir _file "${_AGD}")
|
|
||||||
set(_dir "${CMAKE_CURRENT_SOURCE_DIR}/android/src")
|
|
||||||
__make_copy(_CMD_ _dir _file "${_AGD}")
|
__make_copy(_CMD_ _dir _file "${_AGD}")
|
||||||
set(_dir)
|
set(_dir)
|
||||||
set(_file "${Qt5_ROOT}/src/android/templates/res/values/libs.xml")
|
set(_file "${Qt5_ROOT}/src/android/templates/res/values/libs.xml")
|
||||||
__make_copy(_CMD_ _dir _file "${_AGD}/res/values")
|
__make_copy(_CMD_ _dir _file "${_AGD}/res/values")
|
||||||
__make_copy(_CMD_ _RES_DIRS _RES_FILES "${_AGD}/res")
|
set(_dir "${Qt5_ROOT}/src/3rdparty/gradle/gradle")
|
||||||
|
set(_file "${Qt5_ROOT}/src/3rdparty/gradle/gradlew"
|
||||||
|
"${Qt5_ROOT}/src/3rdparty/gradle/gradlew.bat")
|
||||||
|
__make_copy(_CMD_ _dir _file "${_AGD}")
|
||||||
#__make_copy(_CMD_ _PLUG_DIRS _PLUG_FILES "${_AGD}/")
|
#__make_copy(_CMD_ _PLUG_DIRS _PLUG_FILES "${_AGD}/")
|
||||||
#__make_copy(_CMD_ _FILE_DIRS _FILE_FILES "${_AGD}/Contents/MacOS")
|
#message("bindir = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
message("bindir = ${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
#get_target_property(_LL ${_T} )
|
#get_target_property(_LL ${_T} )
|
||||||
|
set(SDK_ROOT "$ENV{ANDROID_SDK_ROOT}")
|
||||||
|
if("x${SDK_ROOT}" STREQUAL "x")
|
||||||
|
set(SDK_ROOT "$ENV{ANDROID_HOME}")
|
||||||
|
endif()
|
||||||
set(__archs "armeabi-v7a" "arm64-v8a" "x86" "x86_64")
|
set(__archs "armeabi-v7a" "arm64-v8a" "x86" "x86_64")
|
||||||
set(QT_ANDROID_ARCHITECTURES)
|
set(QT_ANDROID_ARCHITECTURES)
|
||||||
find_library(_lib_ c++_shared)
|
find_library(_lib_ c++_shared)
|
||||||
@@ -672,7 +717,7 @@ macro(deploy_target _T)
|
|||||||
string(REPLACE "${ANDROID_SYSROOT_${ANDROID_ABI}}" "${ANDROID_SYSROOT_${_a}}" _lib_${_a} "${_lib_}")
|
string(REPLACE "${ANDROID_SYSROOT_${ANDROID_ABI}}" "${ANDROID_SYSROOT_${_a}}" _lib_${_a} "${_lib_}")
|
||||||
#message("search = ${_a_prefix}/lib")
|
#message("search = ${_a_prefix}/lib")
|
||||||
__make_copy(_CMD_ _empty _lib_${_a} "${_AGD}/libs/${_a}")
|
__make_copy(_CMD_ _empty _lib_${_a} "${_AGD}/libs/${_a}")
|
||||||
set(_CMD_ ${_CMD_} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -s "\"${_a_prefix}/lib\"" -o "\"${_AGD}/libs/${_a}\"" --ignore "\"c:m:dl\"" "\"${_AGD}/libs/${_a}/lib${_AT}_${_a}.so\"" ${_ADD_DEPS})
|
set(_CMD_ ${_CMD_} COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -s "${_a_prefix}/lib!${Qt5_ROOT}/lib" -o "\"${_AGD}/libs/${_a}\"" --ignore "\"c!m!dl\"" "\"${_AGD}/libs/${_a}/lib${_AT}_${_a}.so\"" ${_ADD_DEPS})
|
||||||
#message("c++_${_a} -> ${_lib_${_a}}")
|
#message("c++_${_a} -> ${_lib_${_a}}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
@@ -683,11 +728,38 @@ macro(deploy_target _T)
|
|||||||
set(ANDROID_VERSION "${${_T}_VERSION}")
|
set(ANDROID_VERSION "${${_T}_VERSION}")
|
||||||
set(ANDROID_BUILD "${${_T}_VERSION_BUILD}")
|
set(ANDROID_BUILD "${${_T}_VERSION_BUILD}")
|
||||||
set(ANDROID_PACKAGE "${${_T}_FULLNAME}")
|
set(ANDROID_PACKAGE "${${_T}_FULLNAME}")
|
||||||
|
set(ANDROID_TARGET_SDK "${${_T}_ANDROID_TARGET_SDK}")
|
||||||
|
set(ANDROID_STORE_FILE "${${_T}_ANDROID_STORE_FILE}")
|
||||||
|
set(ANDROID_STORE_PASSWORD "${${_T}_ANDROID_STORE_PASSWORD}")
|
||||||
|
set(ANDROID_KEY_PASSWORD "${${_T}_ANDROID_KEY_PASSWORD}")
|
||||||
|
set(ANDROID_KEY_ALIAS "${${_T}_ANDROID_KEY_ALIAS}")
|
||||||
|
if (NOT IS_ABSOLUTE "${ANDROID_STORE_FILE}")
|
||||||
|
set(ANDROID_STORE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/android/${ANDROID_STORE_FILE}")
|
||||||
|
endif()
|
||||||
set(QT_DIR ${Qt5_ROOT})
|
set(QT_DIR ${Qt5_ROOT})
|
||||||
set(_out_json "${CMAKE_CURRENT_BINARY_DIR}/${_T}_android_deployment_settings.json")
|
|
||||||
configure_file("${CMAKE_BINARY_DIR}/android_deployment_settings.json.in" "${_out_json}")
|
configure_file("${CMAKE_BINARY_DIR}/android_deployment_settings.json.in" "${_out_json}")
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml.in" "${_AGD}/AndroidManifest.xml")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml.in" "${_AGD}/AndroidManifest.xml")
|
||||||
|
configure_file("${CMAKE_ROOT}/Modules/gradle.properties.in" "${_AGD}/gradle.properties")
|
||||||
|
set(_depstr)
|
||||||
|
foreach (_d ${ANDROID_GRADLE_DEPENDENCIES})
|
||||||
|
set(_depstr "${_depstr}\n ${_d}")
|
||||||
|
endforeach()
|
||||||
|
file(READ "${Qt5_ROOT}/src/android/templates/build.gradle" _file)
|
||||||
|
string(REPLACE "\ndependencies {" "\ndependencies {${_depstr}" _file "${_file}")
|
||||||
|
string(REPLACE "\nandroid {" "\nandroid {\n${__gradle_sign}" _file "${_file}")
|
||||||
|
string(REPLACE "['resources']" "['res']" _file "${_file}")
|
||||||
|
file(WRITE "${_AGD}/build.gradle" "${_file}")
|
||||||
|
set(_out_json "${CMAKE_CURRENT_BINARY_DIR}/${_T}_android_deployment_settings.json")
|
||||||
|
set(_CMD_ ${_CMD_} COMMAND "${SDK_ROOT}/tools/android" update project --path "\"${_AGD}\"" --target android-${ANDROID_TARGET_SDK} --name QtApp)
|
||||||
set(_CMD_ ${_CMD_} COMMAND "${Qt5_BIN}/androiddeployqt" --aux-mode --android-platform ${ANDROID_PLATFORM} --output "\"${_AGD}\"" --input "\"${_out_json}\"")
|
set(_CMD_ ${_CMD_} COMMAND "${Qt5_BIN}/androiddeployqt" --aux-mode --android-platform ${ANDROID_PLATFORM} --output "\"${_AGD}\"" --input "\"${_out_json}\"")
|
||||||
|
set(_CMD_ ${_CMD_} COMMAND "${_AGD}/gradlew" --no-daemon -p "\"${_AGD}\"" assembleDebug)
|
||||||
|
set(_CMD_ ${_CMD_} COMMAND "${_AGD}/gradlew" --no-daemon -p "\"${_AGD}\"" bundleRelease)
|
||||||
|
set(_dir)
|
||||||
|
set(_file "${_AGD}/build/outputs/apk/debug/${_T}.android-debug.apk")
|
||||||
|
if (ANDROID_STORE_FILE)
|
||||||
|
list(APPEND _file "${_AGD}/build/outputs/bundle/release/${_T}.android-release.aab")
|
||||||
|
endif()
|
||||||
|
__make_copy(_CMD_ _dir _file "${_DESTINATION}")
|
||||||
add_custom_target(deploy_${_T}
|
add_custom_target(deploy_${_T}
|
||||||
# gather .app dir
|
# gather .app dir
|
||||||
${_CMD_}
|
${_CMD_}
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
#[[
|
||||||
|
|
||||||
|
Also create imported targets:
|
||||||
|
* PIP - main library
|
||||||
|
* PIP::USB
|
||||||
|
* PIP::Crypt
|
||||||
|
* PIP::FFTW
|
||||||
|
* PIP::Compress
|
||||||
|
* PIP::IOUtils
|
||||||
|
* PIP::Concurrent
|
||||||
|
* PIP::Cloud
|
||||||
|
|
||||||
|
These targets include directories and depends on
|
||||||
|
main library
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
||||||
#set(_PIP_MODULES pip pip_usb pip_crypt pip_fftw)
|
#set(_PIP_MODULES pip pip_usb pip_crypt pip_fftw)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -42,15 +59,19 @@ else()
|
|||||||
list(APPEND _PIP_BINDIR "${CMAKE_PREFIX_PATH}/bin")
|
list(APPEND _PIP_BINDIR "${CMAKE_PREFIX_PATH}/bin")
|
||||||
endif()
|
endif()
|
||||||
list(APPEND _PIP_BINDIR "${PIP_DIR}/bin")
|
list(APPEND _PIP_BINDIR "${PIP_DIR}/bin")
|
||||||
|
set(_pip_suffix "")
|
||||||
|
#if(DEFINED ANDROID_PLATFORM)
|
||||||
|
# set(_pip_suffix "_${ANDROID_ABI}")
|
||||||
|
#endif()
|
||||||
|
|
||||||
find_library(PIP_LIBRARY pip HINTS ${_PIP_LIBDIR})
|
find_library(PIP_LIBRARY pip${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_USB_LIBRARY pip_usb HINTS ${_PIP_LIBDIR})
|
find_library(PIP_USB_LIBRARY pip_usb${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_CRYPT_LIBRARY pip_crypt HINTS ${_PIP_LIBDIR})
|
find_library(PIP_CRYPT_LIBRARY pip_crypt${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_FFTW_LIBRARY pip_fftw HINTS ${_PIP_LIBDIR})
|
find_library(PIP_FFTW_LIBRARY pip_fftw${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_COMPRESS_LIBRARY pip_compress HINTS ${_PIP_LIBDIR})
|
find_library(PIP_COMPRESS_LIBRARY pip_compress${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_IO_UTILS_LIBRARY pip_io_utils HINTS ${_PIP_LIBDIR})
|
find_library(PIP_IO_UTILS_LIBRARY pip_io_utils${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_CONCURRENT_LIBRARY pip_concurrent HINTS ${_PIP_LIBDIR})
|
find_library(PIP_CONCURRENT_LIBRARY pip_concurrent${_pip_suffix} HINTS ${_PIP_LIBDIR})
|
||||||
find_library(PIP_CLOUD_LIBRARY pip_cloud HINTS ${_PIP_LIBDIR})
|
find_library(PIP_CLOUD_LIBRARY pip_cloud HINTS${_pip_suffix} ${_PIP_LIBDIR})
|
||||||
find_file(PIP_H_INCLUDE "pip.h" HINTS ${_PIP_INCDIR} $ENV{SMSDK_DIR}/include/pip)
|
find_file(PIP_H_INCLUDE "pip.h" HINTS ${_PIP_INCDIR} $ENV{SMSDK_DIR}/include/pip)
|
||||||
#if (DEFINED ANDROID_PLATFORM)
|
#if (DEFINED ANDROID_PLATFORM)
|
||||||
# set(PIP_INCLUDES ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include/pip)
|
# set(PIP_INCLUDES ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include/pip)
|
||||||
@@ -63,13 +84,15 @@ if (NOT PIP_LIBRARY)
|
|||||||
message(FATAL_ERROR "Can`t find PIP library!")
|
message(FATAL_ERROR "Can`t find PIP library!")
|
||||||
endif()
|
endif()
|
||||||
set(_PIP_LIBRARY_PATH_ "${PIP_LIBRARY}")
|
set(_PIP_LIBRARY_PATH_ "${PIP_LIBRARY}")
|
||||||
|
set(_PIP_ADD_LIBS_ "")
|
||||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||||
find_library(DL_LIBRARY dl)
|
find_library(DL_LIBRARY dl)
|
||||||
list(APPEND PIP_LIBRARY ${DL_LIBRARY})
|
list(APPEND PIP_LIBRARY ${DL_LIBRARY})
|
||||||
if (NOT DEFINED ANDROID_PLATFORM)
|
if (NOT DEFINED ANDROID_PLATFORM)
|
||||||
find_library(PTHREAD_LIBRARY pthread)
|
find_library(PTHREAD_LIBRARY pthread)
|
||||||
find_library(UTIL_LIBRARY util)
|
find_library(UTIL_LIBRARY util)
|
||||||
list(APPEND PIP_LIBRARY ${PTHREAD_LIBRARY} ${UTIL_LIBRARY})
|
set(_PIP_ADD_LIBS_ ${PTHREAD_LIBRARY} ${UTIL_LIBRARY})
|
||||||
|
list(APPEND PIP_LIBRARY ${_PIP_ADD_LIBS_})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -95,5 +118,31 @@ if(PIP_FIND_VERSION VERSION_GREATER PIP_VERSION)
|
|||||||
message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!")
|
message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(__modules "USB;Crypt;FFTW;Compress;IOUtils;Concurrent;Cloud")
|
||||||
|
set(__module_USB "${PIP_USB_LIBRARY}" )
|
||||||
|
set(__module_Crypt "${PIP_CRYPT_LIBRARY}" )
|
||||||
|
set(__module_FFTW "${PIP_FFTW_LIBRARY}" )
|
||||||
|
set(__module_Compress "${PIP_COMPRESS_LIBRARY}" )
|
||||||
|
set(__module_IOUtils "${PIP_IO_UTILS_LIBRARY}" )
|
||||||
|
set(__module_Concurrent "${PIP_CONCURRENT_LIBRARY}")
|
||||||
|
set(__module_Cloud "${PIP_CLOUD_LIBRARY}" )
|
||||||
|
if((NOT TARGET PIP) AND PIP_LIBRARY)
|
||||||
|
add_library(PIP UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PIP PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${_PIP_LIBRARY_PATH_}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PIP_INCLUDES}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "${_PIP_ADD_LIBS_}")
|
||||||
|
endif()
|
||||||
|
foreach (_m ${__modules})
|
||||||
|
if((NOT TARGET PIP::${_m}) AND __module_${_m})
|
||||||
|
add_library(PIP::${_m} UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PIP::${_m} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${__module_${_m}}"
|
||||||
|
INTERFACE_LINK_LIBRARIES "PIP")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set_target_properties(PIP::IOUtils PROPERTIES INTERFACE_LINK_LIBRARIES "PIP::Crypt")
|
||||||
|
set_target_properties(PIP::Cloud PROPERTIES INTERFACE_LINK_LIBRARIES "PIP::IOUtils")
|
||||||
|
|
||||||
include(PIPMacros)
|
include(PIPMacros)
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
# pip_code_model(<out_var> file0 [file1 ...] [OPTIONS opt0 [opt1 ...]] [ABSOLUTE])
|
#[[
|
||||||
#
|
|
||||||
# Generate code model files for source files file0 [file1 ...]
|
pip_code_model(<out_var> file0 [file1 ...] [OPTIONS opt0 [opt1 ...] ] [ABSOLUTE])
|
||||||
#
|
|
||||||
# Options you can see by exec "pip_cmg -h"
|
Generate code model files for source files file0 [file1 ...]
|
||||||
# If not ABSOLUTE source files will be prepended by CMAKE_CURRENT_SOURCE_DIR
|
|
||||||
# You should add ${<out_var>} to your target
|
Options you can see by exec "pip_cmg -h"
|
||||||
#
|
If not ABSOLUTE source files will be prepended by CMAKE_CURRENT_SOURCE_DIR
|
||||||
#
|
You should add ${<out_var>} to your target
|
||||||
#
|
|
||||||
#
|
|
||||||
# pip_resources(<out_var> file)
|
|
||||||
#
|
|
||||||
# Generate C++ files for resource file
|
pip_resources(<out_var> file)
|
||||||
# You should add ${<out_var>} to your target
|
|
||||||
#
|
Generate C++ files for resource file
|
||||||
#
|
You should add ${<out_var>} to your target
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
macro(PIP_EXTRACT_OPTIONS _pip_files _pip_options _abs)
|
macro(PIP_EXTRACT_OPTIONS _pip_files _pip_options _abs)
|
||||||
|
|||||||
8
cmake/gradle.properties.in
Normal file
8
cmake/gradle.properties.in
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
androidBuildToolsVersion=
|
||||||
|
androidCompileSdkVersion=@ANDROID_TARGET_SDK@
|
||||||
|
buildDir=build
|
||||||
|
qt5AndroidDir=@Qt5_ROOT@/src/android/java
|
||||||
|
RELEASE_STORE_FILE=@ANDROID_STORE_FILE@
|
||||||
|
RELEASE_STORE_PASSWORD=@ANDROID_STORE_PASSWORD@
|
||||||
|
RELEASE_KEY_PASSWORD=@ANDROID_KEY_PASSWORD@
|
||||||
|
RELEASE_KEY_ALIAS=@ANDROID_KEY_ALIAS@
|
||||||
@@ -36,8 +36,8 @@ void usage() {
|
|||||||
piCout << "If some Qt dependency found, copy corresponding Qt plugins.";
|
piCout << "If some Qt dependency found, copy corresponding Qt plugins.";
|
||||||
piCout << "Styles and platforms selected by -S and -P flags,";
|
piCout << "Styles and platforms selected by -S and -P flags,";
|
||||||
piCout << "any other plugins described by --qt-plugins flag in next format:";
|
piCout << "any other plugins described by --qt-plugins flag in next format:";
|
||||||
piCout << "\"[*=:]<plugins>=<regexp>,<regexp>:<plugins>=<regexp>,<regexp>\", e.g.";
|
piCout << "\"[*=!]<plugins>=<regexp>,<regexp>!<plugins>=<regexp>,<regexp>\", e.g.";
|
||||||
piCout << "\"sqldrivers=lite,mysql:geoservices=:position=nmea\".";
|
piCout << "\"sqldrivers=lite,mysql!geoservices=!position=nmea\".";
|
||||||
piCout << "If no regexp specified for plugins, nothing will be copied.";
|
piCout << "If no regexp specified for plugins, nothing will be copied.";
|
||||||
piCout << "Default regexp set by \"*=<regexp>\".";
|
piCout << "Default regexp set by \"*=<regexp>\".";
|
||||||
piCout << "\"*=\" disable optional plugins.";
|
piCout << "\"*=\" disable optional plugins.";
|
||||||
@@ -54,8 +54,8 @@ void usage() {
|
|||||||
piCout << "";
|
piCout << "";
|
||||||
piCout << Bold << "Processing control";
|
piCout << Bold << "Processing control";
|
||||||
piCout << "-f, --fake " << Green << "- don`t copy, only print";
|
piCout << "-f, --fake " << Green << "- don`t copy, only print";
|
||||||
piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \";\", default \"/usr/lib\"";
|
piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \"!\", default \"/usr/lib\"";
|
||||||
piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \":\", default \"\"";
|
piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \"!\", default \"\"";
|
||||||
piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\"";
|
piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\"";
|
||||||
piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\"";
|
piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\"";
|
||||||
piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\"";
|
piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\"";
|
||||||
@@ -79,7 +79,7 @@ void usage() {
|
|||||||
piCout << "";
|
piCout << "";
|
||||||
piCout << Bold << "Input control";
|
piCout << Bold << "Input control";
|
||||||
piCout << "<file> ... " << Green << "- executable to process";
|
piCout << "<file> ... " << Green << "- executable to process";
|
||||||
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \";\". Libraries will be searched in <search_path>";
|
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \"!\". Libraries will be searched in <search_path>";
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QtDep {
|
struct QtDep {
|
||||||
@@ -391,9 +391,9 @@ int main(int argc, char * argv[]) {
|
|||||||
piDebug = cli.hasArgument("verbose");
|
piDebug = cli.hasArgument("verbose");
|
||||||
is_deps = cli.hasArgument("dependencies");
|
is_deps = cli.hasArgument("dependencies");
|
||||||
out_dir = cli.argumentValue("output");
|
out_dir = cli.argumentValue("output");
|
||||||
lib_dirs = cli.argumentValue("search_path").split(";");
|
lib_dirs = cli.argumentValue("search_path").split("!");
|
||||||
add_libs = cli.argumentValue("add_libs").split(";");
|
add_libs = cli.argumentValue("add_libs").split("!");
|
||||||
ignore_libs = cli.argumentValue("ignore").split(":");
|
ignore_libs = cli.argumentValue("ignore").split("!");
|
||||||
qt_dir = cli.argumentValue("qtdir");
|
qt_dir = cli.argumentValue("qtdir");
|
||||||
ldd = cli.argumentValue("ldd");
|
ldd = cli.argumentValue("ldd");
|
||||||
readelf = cli.argumentValue("Lreadelf");
|
readelf = cli.argumentValue("Lreadelf");
|
||||||
@@ -446,7 +446,7 @@ int main(int argc, char * argv[]) {
|
|||||||
platforms = qplatforms.split(",");
|
platforms = qplatforms.split(",");
|
||||||
styles = cli.argumentValue("Styles").split(",");
|
styles = cli.argumentValue("Styles").split(",");
|
||||||
if (styles.isEmpty()) styles << "";
|
if (styles.isEmpty()) styles << "";
|
||||||
PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split(":");
|
PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split("!");
|
||||||
piForeachC (PIString & qp, qpd) {
|
piForeachC (PIString & qp, qpd) {
|
||||||
int _i = qp.indexOf("=");
|
int _i = qp.indexOf("=");
|
||||||
if (_i < 0) continue;
|
if (_i < 0) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user