2020-03-29 14:21:17 +03:00
|
|
|
#
|
2020-12-17 18:11:22 +03:00
|
|
|
# Copyright (C) 2018-2021 QuasarApp.
|
2020-03-29 14:21:17 +03:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
# of this license document, but changing it is not allowed.
|
|
|
|
#
|
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
|
2021-03-25 14:29:26 +03:00
|
|
|
# This module implementation next cmake functions :
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# The library contains 2 methods type it is Added methods and init methods.
|
|
|
|
# All inits method must be invoked before adds methods. If you change order then some add method will be ignored.
|
2020-12-12 12:40:24 +03:00
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
|
|
|
# ***Testing***
|
2021-03-25 14:29:26 +03:00
|
|
|
# addTestsArg( name testExec arg ) // Name target for test utility of your application.
|
|
|
|
# - name - Prefix for target (any word).
|
|
|
|
# - testExec - Name of tests utility (without extensions).
|
|
|
|
# - arg - Arguments for testExec.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addTests (name testExec )// Name target for test utility of your application (without arguments).
|
|
|
|
# - name - Prefix for target (any word).
|
|
|
|
# - testExec - Name of tests utility (without extensions).
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# initTests - Init main test target for tessting all added tests, this method need to call before all invoiced addTests methods.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# *** Deployment ***
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDeploy(name targets targetDir) // Add deploy target for deployed your application via CQtDeployer tool.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - targets - This is list of CQtDeployer targets see CQtDeployer help https://github.com/QuasarApp/CQtDeployer/wiki/Options (-bin).
|
|
|
|
# - targetDir - This is target directory see option targetDir of CQtDeployer help https://github.com/QuasarApp/CQtDeployer/wiki/Options (-targetDir).
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDeployFromFile(name) // Some as initDeploy, but use CQtDeployer.json for configuration.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDeployFromCustomFile(name file) // Some as initDeploy, but use custom path for deployment file for configuration.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - file - This is path to config file of cqtdeployer.
|
2020-04-22 21:09:56 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDeploySnap(name targetDir) // Add to deploy step substeps for create a snap package.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - targetDir - Destanation direcroty for snap files.
|
2021-05-14 18:41:00 +03:00
|
|
|
# The addDeploySnap method are support the SNAPCRAFT_MODE variable. If you need to use custom snapcraft mode.
|
|
|
|
# Example:
|
|
|
|
# set(SNAPCRAFT_MODE "--destructive-mode")
|
|
|
|
# addDeploySnap("Client" ${TARGET_DIR})
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDeployQIF(name sourceDir targetDir config) // Add to deploy step substeps for create Qt Install FrameWork Installer.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - location for created installer.
|
|
|
|
# - sourceDir - Path to folder with qif template.
|
|
|
|
# - config - Path to config file of qif template.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-10-08 17:28:52 +03:00
|
|
|
# addSignedDeployAPK(name input aliase keystore keystorePass targetDir) // Add subtargets of deploy setep for create signed android apk file.
|
2021-03-25 14:29:26 +03:00
|
|
|
# - name - This is prefix of added subtarget (any word).
|
2021-04-22 17:16:58 +03:00
|
|
|
# - android_src - Path to folder with the android_manifest file.
|
2021-03-25 14:29:26 +03:00
|
|
|
# - aliase - Aliase for key store.
|
|
|
|
# - keystore - Path of key store.
|
|
|
|
# - keystorePass - Pass of keystore file.
|
|
|
|
# - targetDir - Target dir for output apk file.
|
2021-04-27 12:25:45 +03:00
|
|
|
# - extraLibs - list f the extra libraryes (like the openssl)
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-10-08 17:28:52 +03:00
|
|
|
# addDeployAPK(name input aliase keystore keystorePass targetDir) // Add subtargets of deploy setep for create android apk file.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - android_src - Path to folder with the android_manifest file.
|
|
|
|
# - targetDir - Target dir for output apk file.
|
|
|
|
# - extraLibs - list f the extra libraryes (like the openssl)
|
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# initDeploy() // Create a main deploy target for all addDeploy subtargets. This method need to call before invoiced of all addDeploy methods.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# *** Release ***
|
2021-03-25 14:29:26 +03:00
|
|
|
# initRelease() // Create the general release target for all subtargets addRelease. This method need to call before invoice all addRelease methods.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addReleaseSnap(name) // Create subtargets for publish snap deployed snap package.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addReleaseQif(name sourceDir targetDir) // Create subtargets for publish the qif package on qif repository.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - sourceDir - Path to folder with qif template.
|
|
|
|
# - targetDir - Path to target directory.
|
2020-04-26 15:14:38 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# *** Dcumentation ***
|
2021-03-25 14:29:26 +03:00
|
|
|
# initDoc() // Create the general doc target for all subtargets addDoc. This method need to call before invoice all addDoc methods.
|
2020-04-26 15:14:38 +03:00
|
|
|
#
|
2021-03-25 14:29:26 +03:00
|
|
|
# addDoc(name doxygenFile) // Create subtargets for generate documentation of cpp code.
|
|
|
|
# - name - This is prefix of added subtarget (any word).
|
|
|
|
# - doxygenFile - This is path to doxygen configuration file.
|
2020-04-26 15:14:38 +03:00
|
|
|
#
|
2020-04-09 17:54:18 +03:00
|
|
|
|
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
if(DEFINED QUASARAPP_DEFAULT_TARGETS)
|
|
|
|
return()
|
|
|
|
else()
|
|
|
|
set(QUASARAPP_DEFAULT_TARGETS 1)
|
|
|
|
endif()
|
|
|
|
|
2020-04-26 15:14:38 +03:00
|
|
|
set(DOC_TARGETS_LIST "")
|
2020-04-22 21:09:56 +03:00
|
|
|
set(TEST_TARGETS_LIST "")
|
|
|
|
set(DEPLOY_TARGETS_LIST "")
|
|
|
|
set(RELEASE_TARGETS_LIST "")
|
2020-05-03 16:10:42 +03:00
|
|
|
set(DIR_FOR_TESTING ${PROJECT_SOURCE_DIR}/Testing)
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2021-04-22 17:16:58 +03:00
|
|
|
if (ANDROID)
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/qt-android-cmake/AddQtAndroidApk.cmake)
|
|
|
|
endif()
|
|
|
|
|
2020-04-21 21:29:57 +03:00
|
|
|
function(emptyTarget targetName)
|
|
|
|
|
|
|
|
if(TARGET ${targetName})
|
|
|
|
message("the ${targetName} target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET ${targetName})
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
${targetName}
|
|
|
|
)
|
|
|
|
|
|
|
|
endfunction()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
function(initTests)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
if(TARGET test)
|
|
|
|
message("the test target already created!")
|
|
|
|
return()
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endif(TARGET test)
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
message("test sub targets: ${TEST_TARGETS_LIST}")
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
test
|
|
|
|
COMMENT "=================== Run Test ==================="
|
2020-05-09 00:39:13 +03:00
|
|
|
DEPENDS
|
2020-05-03 16:10:42 +03:00
|
|
|
)
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
message("prepare tests for ${TEST_TARGETS_LIST}")
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endfunction()
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
function(addTestsArg name testExec arg)
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
if(TARGET test${name})
|
|
|
|
message("the test${name} target already created!")
|
|
|
|
return()
|
|
|
|
endif(TARGET test${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2021-04-21 19:33:53 +03:00
|
|
|
set(EXEC_TEST "${CMAKE_CURRENT_BINARY_DIR}/${testExec}")
|
2021-04-21 19:25:49 +03:00
|
|
|
set(RUN_CMD "${DIR_FOR_TESTING}/${name}/${testExec}.sh")
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
if (WIN32)
|
2021-04-21 19:33:53 +03:00
|
|
|
set(EXEC_TEST "${CMAKE_CURRENT_BINARY_DIR}/${testExec}.exe")
|
2021-04-21 19:25:49 +03:00
|
|
|
set(RUN_CMD "${DIR_FOR_TESTING}/${name}/${testExec}.exe")
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endif (WIN32)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2021-04-20 17:01:36 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
find_program(Q_MAKE_EXE qmake)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deployTest${name}
|
2021-05-09 10:36:56 +03:00
|
|
|
COMMAND cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir \"${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}\" -recursiveDepth 5
|
2021-04-13 16:18:23 +03:00
|
|
|
COMMENT "Deploy Test: cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir ${CMAKE_SOURCE_DIR} -recursiveDepth 5"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-05-03 16:10:42 +03:00
|
|
|
)
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
test${name}
|
|
|
|
COMMAND ${RUN_CMD} ${arg}
|
|
|
|
COMMENT "=================== Run Test ==================="
|
|
|
|
WORKING_DIRECTORY ${DIR_FOR_TESTING}/${name}
|
|
|
|
DEPENDS deployTest${name}
|
|
|
|
)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(test test${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endfunction()
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
function(addTests name testExec)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
if(TARGET test${name})
|
|
|
|
message("the test${name} target already created!")
|
|
|
|
return()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endif(TARGET test${name})
|
2020-04-19 17:11:21 +03:00
|
|
|
|
2021-04-21 19:33:53 +03:00
|
|
|
set(EXEC_TEST "${CMAKE_CURRENT_BINARY_DIR}/${testExec}")
|
2021-04-21 19:25:49 +03:00
|
|
|
set(RUN_CMD "${DIR_FOR_TESTING}/${name}/${testExec}.sh")
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
if (WIN32)
|
2021-04-21 19:33:53 +03:00
|
|
|
set(EXEC_TEST "${CMAKE_CURRENT_BINARY_DIR}/${testExec}.exe")
|
2021-04-21 19:25:49 +03:00
|
|
|
set(RUN_CMD "${DIR_FOR_TESTING}/${name}/${testExec}.exe")
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endif (WIN32)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
find_program(Q_MAKE_EXE qmake)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deployTest${name}
|
2021-05-09 10:36:56 +03:00
|
|
|
COMMAND cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir \"${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}\" -recursiveDepth 5
|
2021-04-13 16:18:23 +03:00
|
|
|
COMMENT "Deploy Test: cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir ${CMAKE_SOURCE_DIR} -recursiveDepth 5"
|
2020-05-03 16:10:42 +03:00
|
|
|
)
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
test${name}
|
|
|
|
COMMAND ${RUN_CMD}
|
|
|
|
COMMENT "=================== Run Test ==================="
|
|
|
|
WORKING_DIRECTORY ${DIR_FOR_TESTING}/${name}
|
|
|
|
DEPENDS deployTest${name}
|
|
|
|
)
|
2020-05-09 00:39:13 +03:00
|
|
|
|
|
|
|
add_dependencies(test test${name})
|
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
message("prepare tests for ${RUN_CMD}")
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-05-03 16:10:42 +03:00
|
|
|
endfunction()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(initDeploy)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-19 17:01:28 +03:00
|
|
|
if(TARGET deploy)
|
2020-04-19 17:11:21 +03:00
|
|
|
message("the deploy target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET deploy)
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
message("deploy subtargets: ${DEPLOY_TARGETS_LIST}")
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deploy
|
|
|
|
COMMENT "=================== Run deploy ==================="
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-22 21:09:56 +03:00
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(addDeploy name targets targetDir)
|
|
|
|
|
|
|
|
if(TARGET deploy${name})
|
|
|
|
message("the deploy${name} target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET deploy${name})
|
|
|
|
|
2020-04-04 19:49:49 +03:00
|
|
|
find_program(Q_MAKE_EXE qmake)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deploy${name}
|
2021-05-09 10:36:56 +03:00
|
|
|
COMMAND cqtdeployer clear -binPrefix \"${CMAKE_BINARY_DIR}\" -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir \"${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}\" -recursiveDepth 5
|
2021-04-21 19:18:21 +03:00
|
|
|
COMMENT "Deploy: cqtdeployer clear -binPrefix \"${CMAKE_BINARY_DIR}\" -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir ${CMAKE_SOURCE_DIR} -recursiveDepth 5"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy deploy${name})
|
2020-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addDeployFromFile name)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
if(TARGET deploy${name})
|
|
|
|
message("the deploy${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET deploy${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-04 19:49:49 +03:00
|
|
|
find_program(Q_MAKE_EXE qmake)
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deploy${name}
|
2021-05-09 11:41:21 +03:00
|
|
|
COMMAND cqtdeployer -qmake ${Q_MAKE_EXE} -binPrefix \"${CMAKE_BINARY_DIR}\" -libDir \"${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}\"
|
|
|
|
COMMENT "Deploy: cqtdeployer -qmake ${Q_MAKE_EXE} -binPrefix \"${CMAKE_BINARY_DIR}\" -libDir ${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy deploy${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(addDeployFromCustomFile name file)
|
|
|
|
|
|
|
|
if(TARGET deploy${name})
|
|
|
|
message("the deploy${name} target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET deploy${name})
|
|
|
|
|
|
|
|
find_program(Q_MAKE_EXE qmake)
|
2020-04-08 18:30:19 +03:00
|
|
|
|
2020-04-04 19:49:49 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deploy${name}
|
2021-05-09 11:41:21 +03:00
|
|
|
COMMAND cqtdeployer -qmake ${Q_MAKE_EXE} -binPrefix \"${CMAKE_BINARY_DIR}\" -confFile ${file} -libDir \"${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}\"
|
|
|
|
COMMENT "Deploy: cqtdeployer -qmake ${Q_MAKE_EXE} -binPrefix \"${CMAKE_BINARY_DIR}\" -confFile ${file} -libDir ${CMAKE_SOURCE_DIR},${CMAKE_BINARY_DIR}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-04 19:49:49 +03:00
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy deploy${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-04 19:49:49 +03:00
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addDeploySnap name targetDir)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
if(TARGET snap${name})
|
|
|
|
message("the snap${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET snap${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-21 21:29:57 +03:00
|
|
|
find_program(SNAPCRAFT_EXE "snapcraft")
|
|
|
|
|
|
|
|
if(NOT EXISTS ${SNAPCRAFT_EXE})
|
2021-03-25 14:29:26 +03:00
|
|
|
message("please install the snapcraft before deploy this project! Use: sudo snap install snapcraft --classic")
|
2020-04-21 21:29:57 +03:00
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${SNAPCRAFT_EXE})
|
|
|
|
|
2020-04-04 19:49:49 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snapClear${name}
|
2021-05-14 18:41:00 +03:00
|
|
|
COMMAND snapcraft clean ${SNAPCRAFT_MODE}
|
|
|
|
COMMENT "clear snap: snapcraft clean ${SNAPCRAFT_MODE}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-09 17:54:18 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snapcraft${name}
|
2021-05-14 18:41:00 +03:00
|
|
|
COMMAND snapcraft ${SNAPCRAFT_MODE}
|
|
|
|
COMMENT "create snap: snapcraft ${SNAPCRAFT_MODE}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-05-04 12:09:39 +03:00
|
|
|
DEPENDS deploy${name} snapClear${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snapcraftCopy${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy *.snap ${targetDir}
|
2020-05-04 12:09:39 +03:00
|
|
|
COMMENT "copy snap: ${CMAKE_COMMAND} -E copy *.snap ${targetDir}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-05-04 12:09:39 +03:00
|
|
|
DEPENDS snapcraft${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-04-21 21:29:57 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snap${name}
|
|
|
|
COMMENT "deploy snap${name}"
|
2020-05-04 12:09:39 +03:00
|
|
|
DEPENDS snapcraftCopy${name}
|
2020-04-21 21:29:57 +03:00
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy snap${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addDeployQIF name sourceDir targetDir config)
|
2020-04-08 18:30:19 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
if(TARGET qifDeploy${name})
|
|
|
|
message("the qifDeploy${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET qifDeploy${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
find_program(BINARYCREATOR_EXE binarycreator)
|
|
|
|
|
2020-04-21 21:29:57 +03:00
|
|
|
IF(NOT EXISTS ${BINARYCREATOR_EXE})
|
|
|
|
message("the Binarycreator not exits please install or adde path to QtInstaller Framework to PATH and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${BINARYCREATOR_EXE})
|
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.run)
|
2020-04-08 18:30:19 +03:00
|
|
|
if (WIN32)
|
2020-04-09 17:54:18 +03:00
|
|
|
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.exe)
|
2020-04-08 18:30:19 +03:00
|
|
|
endif (WIN32)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
qifDeploy${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMAND ${BINARYCREATOR_EXE} --offline-only -c ${config} -p ${sourceDir}/packages ${OUT_EXE}
|
|
|
|
COMMENT "deploy qif: ${BINARYCREATOR_EXE} --offline-only -c ${config} -p ${sourceDir}/packages ${OUT_EXE}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-25 13:57:44 +03:00
|
|
|
DEPENDS deploy${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy qifDeploy${name})
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
endfunction()
|
|
|
|
|
2021-10-08 17:28:52 +03:00
|
|
|
function(addDeployAPK name android_src targetDir extraLibs)
|
|
|
|
|
|
|
|
if(TARGET deployAPK${name})
|
|
|
|
message("the deployAPK${name} target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET deployAPK${name})
|
|
|
|
|
|
|
|
IF(NOT DEFINED ENV{ANDROID_SDK_ROOT})
|
|
|
|
message("the ANDROID_SDK_ROOT is not defined. define ANDROID_SDK_ROOT variable and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
IF(DEFINED ENV{ANDROID_API_VERSION})
|
|
|
|
set(ANDROID_PLATFORM_LEVEL $ENV{ANDROID_API_VERSION})
|
|
|
|
else()
|
|
|
|
set(ANDROID_PLATFORM_LEVEL 30)
|
|
|
|
endif()
|
|
|
|
message("The ANDROID_PLATFORM_LEVEL = ${ANDROID_PLATFORM_LEVEL}")
|
|
|
|
|
|
|
|
|
|
|
|
add_qt_android_apk(createAPK${name} ${name}
|
|
|
|
PACKAGE_SOURCES ${android_src}
|
|
|
|
DEPENDS ${extraLibs}
|
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deployAPK${name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy *.apk ${targetDir}
|
|
|
|
COMMENT "copt apk: ${CMAKE_COMMAND} -E copy *.apk ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${QT_ANDROID_APP_BINARY_DIR}/build/outputs/apk/release
|
|
|
|
DEPENDS createAPK${name}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deployAAB${name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy *.aab ${targetDir}
|
|
|
|
COMMENT "copt aab: ${CMAKE_COMMAND} -E copy *.aab ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${QT_ANDROID_APP_BINARY_DIR}/build/outputs/bundle/release
|
|
|
|
DEPENDS deployAPK${name}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
add_dependencies(deploy deployAPK${name})
|
|
|
|
add_dependencies(deploy deployAAB${name})
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(addSignedDeployAPK name android_src aliase keystore keystorePass targetDir extraLibs)
|
2020-04-09 17:54:18 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
if(TARGET deployAPK${name})
|
|
|
|
message("the deployAPK${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET deployAPK${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2021-04-19 16:43:34 +03:00
|
|
|
IF(NOT DEFINED ENV{ANDROID_SDK_ROOT})
|
|
|
|
message("the ANDROID_SDK_ROOT is not defined. define ANDROID_SDK_ROOT variable and run cmake again!")
|
2020-04-21 21:29:57 +03:00
|
|
|
return()
|
2021-04-19 16:43:34 +03:00
|
|
|
endif()
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2021-04-27 00:18:17 +03:00
|
|
|
IF(DEFINED ENV{ANDROID_API_VERSION})
|
|
|
|
set(ANDROID_PLATFORM_LEVEL $ENV{ANDROID_API_VERSION})
|
2021-04-26 23:45:12 +03:00
|
|
|
else()
|
2021-04-28 14:53:12 +03:00
|
|
|
set(ANDROID_PLATFORM_LEVEL 30)
|
2021-04-26 23:45:12 +03:00
|
|
|
endif()
|
|
|
|
message("The ANDROID_PLATFORM_LEVEL = ${ANDROID_PLATFORM_LEVEL}")
|
|
|
|
|
|
|
|
|
2021-04-22 17:16:58 +03:00
|
|
|
add_qt_android_apk(createAPK${name} ${name}
|
|
|
|
PACKAGE_SOURCES ${android_src}
|
2021-10-08 17:46:17 +03:00
|
|
|
KEYSTORE ${keystore} ${aliase}
|
|
|
|
KEYSTORE_PASSWORD ${keystorePass}
|
2021-04-27 12:25:45 +03:00
|
|
|
DEPENDS ${extraLibs}
|
2021-04-22 17:16:58 +03:00
|
|
|
)
|
2020-04-09 17:54:18 +03:00
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deployAPK${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy *.apk ${targetDir}
|
2021-07-23 14:16:01 +03:00
|
|
|
COMMENT "copt apk: ${CMAKE_COMMAND} -E copy *.apk ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${QT_ANDROID_APP_BINARY_DIR}/build/outputs/apk/release
|
2020-04-22 21:09:56 +03:00
|
|
|
DEPENDS createAPK${name}
|
2020-04-09 21:45:58 +03:00
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
)
|
|
|
|
|
2021-07-23 14:16:01 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
deployAAB${name}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy *.aab ${targetDir}
|
|
|
|
COMMENT "copt aab: ${CMAKE_COMMAND} -E copy *.aab ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${QT_ANDROID_APP_BINARY_DIR}/build/outputs/bundle/release
|
|
|
|
DEPENDS deployAPK${name}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(deploy deployAPK${name})
|
2021-07-23 14:16:01 +03:00
|
|
|
add_dependencies(deploy deployAAB${name})
|
2020-05-09 00:39:13 +03:00
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(initRelease)
|
|
|
|
|
2020-04-19 17:01:28 +03:00
|
|
|
if(TARGET release)
|
2020-04-19 17:11:21 +03:00
|
|
|
message("the release target already created!")
|
|
|
|
return()
|
|
|
|
|
2020-04-19 17:01:28 +03:00
|
|
|
endif(TARGET release)
|
2020-04-22 21:09:56 +03:00
|
|
|
message("release subtargets: ${RELEASE_TARGETS_LIST}")
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
release
|
|
|
|
COMMENT "=================== Relese project ==================="
|
2020-04-04 19:49:49 +03:00
|
|
|
)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addReleaseSnap name)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
if(TARGET snapRelease${name})
|
|
|
|
message("the snapRelease${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET snapRelease${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snapRelease${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMAND snapcraft push
|
2020-04-22 21:09:56 +03:00
|
|
|
COMMENT "snapRelease${name} release"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-09 17:54:18 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(release snapRelease${name})
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addReleaseQif name sourceDir targetDir)
|
|
|
|
if(TARGET qifRelease${name})
|
|
|
|
message("the qifRelease${name} target already created!")
|
2020-04-19 17:11:21 +03:00
|
|
|
return()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
endif(TARGET qifRelease${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-09 21:45:58 +03:00
|
|
|
find_program(BINARYCREATOR_EXE binarycreator)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
IF(NOT EXISTS ${BINARYCREATOR_EXE})
|
|
|
|
message("the Binarycreator not exits please install or adde path to QtInstaller Framework to PATH and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${BINARYCREATOR_EXE})
|
|
|
|
|
2020-04-09 21:45:58 +03:00
|
|
|
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.run)
|
|
|
|
if (WIN32)
|
|
|
|
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.exe)
|
|
|
|
endif (WIN32)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
qifDeployOnline${name}
|
2020-04-09 21:45:58 +03:00
|
|
|
COMMAND ${BINARYCREATOR_EXE} --online-only -c ${config} -p ${sourceDir}/packages ${OUT_EXE}
|
|
|
|
COMMENT "deploy qif online: ${BINARYCREATOR_EXE} --online-only -c ${config} -p ${sourceDir}/packages ${OUT_EXE}"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-09 21:45:58 +03:00
|
|
|
|
|
|
|
)
|
2020-04-08 18:30:19 +03:00
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
qifRelease${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
${sourceDir}
|
|
|
|
${CMAKE_BINARY_DIR}/Repo
|
2020-04-22 21:09:56 +03:00
|
|
|
COMMENT "qifRelease${name} release ${CMAKE_COMMAND} -E copy_directory ${sourceDir} ${CMAKE_BINARY_DIR}/Repo"
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-22 21:09:56 +03:00
|
|
|
DEPENDS qifDeployOnline${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(RELEASE_TARGETS_LIST ${RELEASE_TARGETS_LIST} qifRelease${name} PARENT_SCOPE)
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(release qifRelease${name})
|
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2020-04-26 15:14:38 +03:00
|
|
|
function(addDoc name doxygenFile)
|
|
|
|
|
|
|
|
if(TARGET doxygen${name})
|
|
|
|
message("the doxygen${name} target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET doxygen${name})
|
|
|
|
|
|
|
|
find_program(DOXYGEN_EXECUTABLE doxygen)
|
|
|
|
|
|
|
|
IF(NOT EXISTS ${DOXYGEN_EXECUTABLE})
|
|
|
|
message("the doxygen not exits please install or add a path to doxygen to a PATH envirement variable and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${DOXYGEN_EXECUTABLE})
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
doxygen${name}
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${doxygenFile}
|
|
|
|
COMMENT "${DOXYGEN_EXECUTABLE} ${doxygenFile}"
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-05-09 00:39:13 +03:00
|
|
|
add_dependencies(doc doxygen${name})
|
|
|
|
|
2020-04-26 15:14:38 +03:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(initDoc)
|
|
|
|
if(TARGET doc)
|
|
|
|
message("the doc target already created!")
|
|
|
|
return()
|
|
|
|
|
|
|
|
endif(TARGET doc)
|
|
|
|
|
|
|
|
message("doc subtargets: ${DOC_TARGETS_LIST}")
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
|
|
|
doc
|
|
|
|
COMMENT "=================== Run generate docs ==================="
|
2021-04-13 16:18:23 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2020-04-26 15:14:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2020-03-29 14:21:17 +03:00
|
|
|
function(initAll)
|
2020-05-03 16:10:42 +03:00
|
|
|
initTests()
|
2020-04-26 15:14:38 +03:00
|
|
|
initDoc()
|
2020-04-22 21:09:56 +03:00
|
|
|
initDeploy()
|
|
|
|
initRelease()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|