mirror of
https://github.com/QuasarApp/CMake.git
synced 2025-04-27 02:04:42 +00:00
fix output projects and create android targets
This commit is contained in:
parent
d32f8e936d
commit
726276fa59
@ -20,9 +20,12 @@ SET(LIB_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE})
|
||||
message("${} LIB_OUTPUT_DIR = ${LIB_OUTPUT_DIR}")
|
||||
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}/bin)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
|
||||
SET(${PROJECT_NAME}_BIN_DIR ${LIB_OUTPUT_DIR})
|
||||
|
||||
|
||||
message(STATUS "buid type " ${CMAKE_BUILD_TYPE})
|
||||
message(STATUS "Project " ${PROJECT_NAME})
|
||||
|
@ -5,6 +5,59 @@
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
|
||||
# This module implementation next cmake cunctions :
|
||||
#
|
||||
#
|
||||
# ***Testing***
|
||||
# initTestsArg( testExec arg ) // init "test" target for test utiliry of your application
|
||||
# - testExec - name of tests utility (without extensions)
|
||||
# - arg - arguments fot testExec
|
||||
#
|
||||
# initTests // init "test" target for test utiliry of your application (without arguments)
|
||||
# - testExec - name of tests utility (without extensions)
|
||||
#
|
||||
# initTestsDefault - init empty target tests
|
||||
#
|
||||
#
|
||||
# *** Deployment ***
|
||||
# initDeploy(targets targetDir) // init deploy target for deployed your application via cqtdeployer tool
|
||||
# - 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)
|
||||
#
|
||||
# initDeployQML(targets targetDir qml) // some as initDeploy but with qml location option
|
||||
# - 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)
|
||||
# - qml - this is qml location dir see help of qmlDir option of cqtdeployer help https://github.com/QuasarApp/CQtDeployer/wiki/Options (-qmlDir)
|
||||
#
|
||||
# initDeploySnap(targetDir) // add to deploy step substeps for create a snap package
|
||||
# - targetDir - distanation direcroty for snap files
|
||||
#
|
||||
# initDeployQIF(sourceDir targetDir config) // add to deploy step substeps for create Qt Install FrameWork Installer
|
||||
# - location for created installer
|
||||
# - sourceDir - path to folder with qif template
|
||||
# - config - path to config file of qif template
|
||||
#
|
||||
# initDeployAPK(input aliase keystore keystorePass targetDir) // add subtargets of deploy setep for create signed android apk file
|
||||
# - 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
|
||||
#
|
||||
# initDeployDefault() // create a enpty step for deployment
|
||||
#
|
||||
#
|
||||
# *** Release ***
|
||||
# initRelease() // create the general release target
|
||||
#
|
||||
# initReleaseSnap() // create subtargets for publish snap deployed snap package
|
||||
#
|
||||
# initReleaseQif(sourceDir) // create subtargets for publish the qif package on qif repository
|
||||
# -sourceDir - path to folder with qif template
|
||||
|
||||
|
||||
|
||||
if(DEFINED QUASARAPP_DEFAULT_TARGETS)
|
||||
return()
|
||||
else()
|
||||
@ -82,12 +135,13 @@ function(initDeploy targets targetDir)
|
||||
cqtdeployer
|
||||
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"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
deploy
|
||||
COMMENT "=================== Run deploy ==================="
|
||||
DEPENDS cqtdeployer snapClear snapcraft snapcraftCopy
|
||||
DEPENDS cqtdeployer snapClear snapcraft snapcraftCopy deployAPK
|
||||
)
|
||||
|
||||
endfunction()
|
||||
@ -100,34 +154,42 @@ function(initDeployQML targets targetDir qml)
|
||||
cqtdeployer
|
||||
COMMAND cqtdeployer clear -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5 -qmlDir ${qml}
|
||||
COMMENT "Deploy: cqtdeployer clear -bin ${targets} -qmake ${Q_MAKE_EXE} -targetDir ${targetDir} -libDir ${PROJECT_SOURCE_DIR} -recursiveDepth 5 -qmlDir ${qml}"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
deploy
|
||||
COMMENT "=================== Run deploy ==================="
|
||||
DEPENDS cqtdeployer snapClear snapcraft snapcraftCopy
|
||||
DEPENDS cqtdeployer snapClear snapcraft snapcraftCopy deployAPK
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(initDeploySnap sourceDir)
|
||||
function(initDeploySnap targetDir)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
snapClear
|
||||
COMMAND snapcraft clear
|
||||
COMMAND snapcraft clean
|
||||
COMMENT "clear snap: snapcraft clear"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
snapcraft
|
||||
COMMAND snapcraft
|
||||
COMMENT "create snap: snapcraft"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
snapcraftCopy
|
||||
COMMAND ${CMAKE_COMMAND} -E copy *.snap ${sourceDir}
|
||||
COMMENT "copt snap: ${CMAKE_COMMAND} -E copy *.snap ${sourceDir}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy *.snap ${targetDir}
|
||||
COMMENT "copt snap: ${CMAKE_COMMAND} -E copy *.snap ${targetDir}"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
endfunction()
|
||||
@ -136,15 +198,52 @@ function(initDeployQIF sourceDir targetDir config)
|
||||
|
||||
find_program(BINARYCREATOR_EXE binarycreator)
|
||||
|
||||
set(OUT_EXE ${sourceDir}/${PROJECT_NAME}OfllineInstaller.run)
|
||||
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.run)
|
||||
if (WIN32)
|
||||
set(OUT_EXE ${sourceDir}/${PROJECT_NAME}OfllineInstaller.exe)
|
||||
set(OUT_EXE ${targetDir}/${PROJECT_NAME}OfllineInstaller.exe)
|
||||
endif (WIN32)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
qifDeploy
|
||||
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}"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(initDeployAPK input aliase keystore keystorePass targetDir)
|
||||
|
||||
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(
|
||||
deployAPK
|
||||
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(
|
||||
cpAPK
|
||||
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/
|
||||
)
|
||||
|
||||
|
||||
endfunction()
|
||||
|
||||
function(initRelease)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
release
|
||||
COMMENT "=================== Relese project ==================="
|
||||
DEPENDS snapRelease qifRelease
|
||||
)
|
||||
|
||||
endfunction()
|
||||
@ -155,6 +254,8 @@ function(initReleaseSnap)
|
||||
snapRelease
|
||||
COMMAND snapcraft push
|
||||
COMMENT "snapcraft release"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
endfunction()
|
||||
@ -167,6 +268,8 @@ function(initReleaseQif sourceDir)
|
||||
${sourceDir}
|
||||
${CMAKE_BINARY_DIR}/Repo
|
||||
COMMENT "qifRelease release ${CMAKE_COMMAND} -E copy_directory ${sourceDir} ${CMAKE_BINARY_DIR}/Repo"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user