2020-03-29 14:21:17 +03:00
|
|
|
#
|
|
|
|
# Copyright (C) 2018-2020 QuasarApp.
|
|
|
|
# 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
|
|
|
|
|
|
|
# This module implementation next cmake cunctions :
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# ***Testing***
|
2020-04-22 21:09:56 +03:00
|
|
|
# addTestsArg( name testExec arg ) // name target for test utiliry of your application
|
|
|
|
# - name - prefix for taget (any word)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - testExec - name of tests utility (without extensions)
|
|
|
|
# - arg - arguments fot testExec
|
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# addTests (name testExec )// name target for test utiliry of your application (without arguments)
|
|
|
|
# - name - prefix for taget (any word)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - testExec - name of tests utility (without extensions)
|
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# initTests - init main test target for tessting all added tests, this method need to call after all invoced addTests methods.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# *** Deployment ***
|
2020-04-22 21:09:56 +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)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - 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-22 21:09:56 +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
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# addDeployFromCustomFile(name file) // some as initDeploy but use custo path for deployment file for configuration.
|
|
|
|
# - name - this is prefix of added subtarget (any word)
|
|
|
|
# - file - this is path to config file of cqtdeployer
|
|
|
|
#
|
|
|
|
# addDeploySnap(name targetDir) // add to deploy step substeps for create a snap package
|
|
|
|
# - name - this is prefix of added subtarget (any word)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - targetDir - distanation direcroty for snap files
|
|
|
|
#
|
2020-04-22 21:09:56 +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)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - location for created installer
|
|
|
|
# - sourceDir - path to folder with qif template
|
|
|
|
# - config - path to config file of qif template
|
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# addDeployAPK(name input aliase keystore keystorePass targetDir) // add subtargets of deploy setep for create signed android apk file
|
|
|
|
# - name - this is prefix of added subtarget (any word)
|
2020-04-09 17:54:18 +03:00
|
|
|
# - input - path to input android json file : *-deployment-settings.json
|
|
|
|
# - aliase - aliase for key store
|
|
|
|
# - keystore - path of key store
|
|
|
|
# - keystorePass - pass of keystore file
|
|
|
|
# - targetDir - target dir for output apk file
|
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# initDeploy() // create a main deploy target fpr all addDeploy subtargets. this method need to call fater invoced of all addDeploy methods
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# *** Release ***
|
2020-04-22 21:09:56 +03:00
|
|
|
# initRelease() // create the general release target for all subtargets addRelease. This method need to call after invoce all addRelease methods.
|
2020-04-09 17:54:18 +03:00
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# initReleaseSnap(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
|
|
|
#
|
2020-04-22 21:09:56 +03:00
|
|
|
# initReleaseQif(name sourceDir targetDir) // create subtargets for publish the qif package on qif repository
|
|
|
|
# - name - this is prefix of added subtarget (any word)
|
2020-04-09 21:45:58 +03:00
|
|
|
# - sourceDir - path to folder with qif template
|
|
|
|
# - targetDir - path to target derictory
|
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-22 21:09:56 +03:00
|
|
|
set(TEST_TARGETS_LIST "")
|
|
|
|
set(DEPLOY_TARGETS_LIST "")
|
|
|
|
set(RELEASE_TARGETS_LIST "")
|
|
|
|
set(DIR_FOR_TESTING ${PROJECT_SOURCE_DIR}/BuildetTests)
|
|
|
|
|
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-04-25 22:16:21 +03:00
|
|
|
#function(initTests)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# if(TARGET test)
|
|
|
|
# message("the test target already created!")
|
|
|
|
# return()
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# endif(TARGET test)
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# message("test sub targets: ${TEST_TARGETS_LIST}")
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# ADD_CUSTOM_TARGET(
|
|
|
|
# test
|
|
|
|
# COMMENT "=================== Run Test ==================="
|
|
|
|
# DEPENDS ${TEST_TARGETS_LIST}
|
|
|
|
# )
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# message("prepare tests for ${TEST_TARGETS_LIST}")
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
#endfunction()
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
#function(addTestsArg name testExec arg)
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +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
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# set(EXEC_TEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testExec})
|
|
|
|
# set(RUN_CMD BuildetTests/${testExec}.sh)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# if (WIN32)
|
|
|
|
# set(EXEC_TEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testExec}.exe)
|
|
|
|
# set(RUN_CMD BuildetTests/${testExec}.exe)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# endif (WIN32)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# find_program(Q_MAKE_EXE qmake)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# find_program(CQT_EXE cqtdeployer)
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# IF(NOT EXISTS ${CQT_EXE})
|
|
|
|
# message("the cqtdeployer not exits please install the cqtdeployer and run cmake again!")
|
|
|
|
# return()
|
|
|
|
# endif(NOT EXISTS ${CQT_EXE})
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# ADD_CUSTOM_TARGET(
|
|
|
|
# deployTest${name}
|
|
|
|
# COMMAND cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5
|
|
|
|
# COMMENT "Deploy Test: cqtdeployer clear -bin ${EXEC_TEST} -targetDir BuildetTests -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5"
|
|
|
|
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
# )
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +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-04-25 22:16:21 +03:00
|
|
|
# set(TEST_TARGETS_LIST ${TEST_TARGETS_LIST} test${name} PARENT_SCOPE)
|
2020-04-22 21:09:56 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# message("prepare tests for ${RUN_CMD} with arg : ${arg}")
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
#endfunction()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
#function(addTests name testExec)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# if(TARGET test${name})
|
|
|
|
# message("the test${name} target already created!")
|
|
|
|
# return()
|
2020-04-19 17:11:21 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# endif(TARGET test${name})
|
2020-04-19 17:01:28 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# set(EXEC_TEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testExec})
|
|
|
|
# set(RUN_CMD ${PROJECT_SOURCE_DIR}/BuildetTests/${testExec}.sh)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# if (WIN32)
|
|
|
|
# set(EXEC_TEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testExec}.exe)
|
|
|
|
# set(RUN_CMD ${PROJECT_SOURCE_DIR}/BuildetTests/${testExec}.exe)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# endif (WIN32)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# find_program(Q_MAKE_EXE qmake)
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# find_program(CQT_EXE cqtdeployer)
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# IF(NOT EXISTS ${CQT_EXE})
|
|
|
|
# message("the cqtdeployer not exits please install the cqtdeployer and run cmake again!")
|
|
|
|
# return()
|
|
|
|
# endif(NOT EXISTS ${CQT_EXE})
|
2020-04-21 21:29:57 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# ADD_CUSTOM_TARGET(
|
|
|
|
# deployTest${name}
|
|
|
|
# COMMAND cqtdeployer clear -bin ${EXEC_TEST} -qmake ${Q_MAKE_EXE} -targetDir ${DIR_FOR_TESTING}/${name} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5
|
|
|
|
# COMMENT "Deploy Test: cqtdeployer clear -bin ${EXEC_TEST} -targetDir BuildetTests -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5"
|
|
|
|
# )
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# add_test(
|
|
|
|
# test${name}
|
|
|
|
# COMMAND ${RUN_CMD}
|
|
|
|
# COMMENT "=================== Run Test ==================="
|
|
|
|
# WORKING_DIRECTORY BuildetTests
|
|
|
|
# DEPENDS deployTest${name}
|
|
|
|
# )
|
|
|
|
# set(TEST_TARGETS_LIST ${TEST_TARGETS_LIST} test${name} PARENT_SCOPE)
|
2020-03-29 14:21:17 +03:00
|
|
|
|
2020-04-25 22:16:21 +03:00
|
|
|
# message("prepare tests for ${RUN_CMD}")
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-25 22:16:21 +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 ==================="
|
|
|
|
DEPENDS ${DEPLOY_TARGETS_LIST}
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
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-21 21:29:57 +03:00
|
|
|
find_program(CQT_EXE cqtdeployer)
|
|
|
|
|
|
|
|
IF(NOT EXISTS ${CQT_EXE})
|
|
|
|
message("the cqtdeployer not exits please install the cqtdeployer and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${CQT_EXE})
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deploy${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMAND cqtdeployer clear -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5
|
|
|
|
COMMENT "Deploy: cqtdeployer clear -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} deploy${name} PARENT_SCOPE)
|
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-21 21:29:57 +03:00
|
|
|
find_program(CQT_EXE cqtdeployer)
|
|
|
|
|
|
|
|
IF(NOT EXISTS ${CQT_EXE})
|
|
|
|
message("the cqtdeployer not exits please install the cqtdeployer and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${CQT_EXE})
|
2020-04-04 19:49:49 +03:00
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
deploy${name}
|
|
|
|
COMMAND cqtdeployer -qmake ${Q_MAKE_EXE}
|
|
|
|
COMMENT "Deploy: cqtdeployer -qmake ${Q_MAKE_EXE}"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} deploy${name} PARENT_SCOPE)
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
find_program(CQT_EXE cqtdeployer)
|
|
|
|
|
|
|
|
IF(NOT EXISTS ${CQT_EXE})
|
|
|
|
message("the cqtdeployer not exits please install the cqtdeployer and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT EXISTS ${CQT_EXE})
|
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}
|
|
|
|
COMMAND cqtdeployer -qmake ${Q_MAKE_EXE} -confFile ${file}
|
|
|
|
COMMENT "Deploy: cqtdeployer -qmake ${Q_MAKE_EXE} -confFile ${file}"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2020-04-04 19:49:49 +03:00
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} deploy${name} PARENT_SCOPE)
|
|
|
|
|
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})
|
|
|
|
message("please install the snapcraft befor deploy this project! Use: sudo snap install snapcraft --classic")
|
|
|
|
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}
|
2020-04-09 17:54:18 +03:00
|
|
|
COMMAND snapcraft clean
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMENT "clear snap: snapcraft clear"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
snapcraft${name}
|
2020-04-08 18:30:19 +03:00
|
|
|
COMMAND snapcraft
|
|
|
|
COMMENT "create snap: snapcraft"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2020-04-25 13:57:44 +03:00
|
|
|
DEPENDS deploy${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}
|
|
|
|
COMMENT "copt snap: ${CMAKE_COMMAND} -E copy *.snap ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
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}"
|
|
|
|
DEPENDS snapClear${name} snapcraft${name} snapcraftCopy${name}
|
2020-04-21 21:29:57 +03:00
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} snap${name} PARENT_SCOPE)
|
|
|
|
|
|
|
|
|
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}"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2020-04-25 13:57:44 +03:00
|
|
|
DEPENDS deploy${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
|
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} qifDeploy${name} PARENT_SCOPE)
|
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
endfunction()
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
function(addDeployAPK name input aliase keystore keystorePass targetDir)
|
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
|
|
|
|
2020-04-21 21:29:57 +03:00
|
|
|
IF(NOT DEFINED $ENV{ANDROID_HOME})
|
|
|
|
message("the ANDROID_HOME is not defined. define ANDROID_HOME variable and run cmake again!")
|
|
|
|
return()
|
|
|
|
endif(NOT DEFINED $ENV{ANDROID_HOME})
|
|
|
|
|
|
|
|
|
2020-04-09 17:54:18 +03:00
|
|
|
set(OUTPUT_ANDROID "--output ${PROJECT_SOURCE_DIR}/AndroidBuild")
|
|
|
|
set(INPUT_ANDROID "--input ${input}")
|
|
|
|
set(JDK "--jdk /usr")
|
|
|
|
set(SIGN "--sign '${keystore}' --storepass '${keystorePass}' --keypass '${keystorePass}' --release")
|
|
|
|
|
|
|
|
find_program(A_DEPLOYER androiddeployqt)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(
|
2020-04-22 21:09:56 +03:00
|
|
|
createAPK${name}
|
2020-04-09 17:54:18 +03:00
|
|
|
COMMAND ${A_DEPLOYER} ${INPUT_ANDROID} ${OUTPUT_ANDROID} ${JDK} --gradle ${SIGN}
|
|
|
|
COMMENT "Run deploy android apk : ${A_DEPLOYER} ${INPUT_ANDROID} ${OUTPUT_ANDROID} ${JDK} --gradle ${SIGN}"
|
|
|
|
)
|
|
|
|
|
|
|
|
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}
|
|
|
|
COMMENT "copt apk: ${CMAKE_COMMAND} -E copy *.apk ${targetDir}"
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/AndroidBuild/build/outputs/apk/
|
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
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(DEPLOY_TARGETS_LIST ${DEPLOY_TARGETS_LIST} deployAPK${name} PARENT_SCOPE)
|
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-22 21:09:56 +03:00
|
|
|
DEPENDS ${RELEASE_TARGETS_LIST}
|
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"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
2020-04-08 18:30:19 +03:00
|
|
|
)
|
|
|
|
|
2020-04-22 21:09:56 +03:00
|
|
|
set(RELEASE_TARGETS_LIST ${RELEASE_TARGETS_LIST} snapRelease${name} PARENT_SCOPE)
|
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}"
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
|
|
|
|
)
|
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"
|
2020-04-09 17:54:18 +03:00
|
|
|
WORKING_DIRECTORY ${PROJECT_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-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(initAll)
|
2020-04-25 22:16:21 +03:00
|
|
|
# initTests()
|
2020-04-22 21:09:56 +03:00
|
|
|
initDeploy()
|
|
|
|
initRelease()
|
2020-03-29 14:21:17 +03:00
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|