Warning, /education/gcompris/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 #=============================================================================
0002 # SPDX-FileCopyrightText: 2014 Johnny Jazeix <jazeix@gmail.com>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005 #=============================================================================
0006 cmake_minimum_required(VERSION 3.7)
0007 
0008 project(gcompris-qt C CXX)
0009 
0010 # get all the redist dll needed for windows when compiling with vc
0011 set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
0012 include(InstallRequiredSystemLibraries)
0013 
0014 # Set c++11 support
0015 set(CMAKE_CXX_STANDARD 11)
0016 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0017 set(CMAKE_CXX_EXTENSIONS OFF)
0018 
0019 # enable qml debugging for DEBUG builds:
0020 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG")
0021 
0022 set(GCOMPRIS_MAJOR_VERSION 4)
0023 set(GCOMPRIS_MINOR_VERSION 0)
0024 set(GCOMPRIS_PATCH_VERSION 0)
0025 
0026 if("${CMAKE_ANDROID_ARCH}" STREQUAL "arm64")
0027   set(GCOMPRIS_PATCH_VERSION 1)
0028 endif()
0029 
0030 # Set the BUILD_DATE
0031 string(TIMESTAMP BUILD_DATE %Y%m)
0032 
0033 include(FeatureSummary)
0034 
0035 # cmake modules setup
0036 find_package(ECM 1.4.0 QUIET NO_MODULE)
0037 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/)
0038 set(CMAKE_PREFIX_PATH "${Qt5_DIR}/")
0039 
0040 # KDE po to qm tools
0041 if(ECM_FOUND)
0042   include(ECMAddTests)
0043 
0044   option(BUILD_TESTING "Build and enable unit tests" OFF)
0045   include(ECMCoverageOption)
0046 endif()
0047 
0048 # add tools (cppcheck, clang-tidy...) if build on testing mode only
0049 # (slower compilation)
0050 if(BUILD_TESTING)
0051   include(CodeQualityUtils)
0052 endif()
0053 
0054 set(QT_REQUIRED_VERSION 5.12.0)
0055 
0056 if(CMAKE_SYSTEM_NAME STREQUAL Android)
0057   find_package(ECM)
0058   set(ANDROID 1)
0059   # Require ndk minimum version to 21
0060   if(ANDROID_NDK_REVISION VERSION_LESS "21.0.0")
0061     message(FATAL_ERROR "android ndk 21 minimal required, actually using ${ANDROID_NDK_REVISION}")
0062   endif()
0063   # TODO: possibly should be setup by toolchain one day
0064   set(QT_QMAKE_EXECUTABLE "${_qt5Core_install_prefix}/bin/qmake")
0065   if(ECM_VERSION VERSION_GREATER "5.55.0")
0066     set(QT_REQUIRED_VERSION 5.12.0)
0067   endif()
0068 
0069   # workaround until this fix is in released ECM
0070   if(ECM_VERSION VERSION_LESS "5.15.0")
0071     add_definitions(-DANDROID)
0072   endif()
0073 endif()
0074 
0075 # Set executable filename
0076 if(ANDROID)
0077   set(GCOMPRIS_EXECUTABLE_NAME GCompris)
0078 elseif(WIN32)
0079   set(GCOMPRIS_EXECUTABLE_NAME GCompris)
0080 else()
0081   set(GCOMPRIS_EXECUTABLE_NAME gcompris-qt)
0082 endif()
0083 
0084 set(GCOMPRIS_VERSION ${GCOMPRIS_MAJOR_VERSION}.${GCOMPRIS_MINOR_VERSION})
0085 
0086 # An integer value that represents the version of the application
0087 # Increase it at each release
0088 math(EXPR GCOMPRIS_VERSION_CODE "${GCOMPRIS_MAJOR_VERSION}*10000 + ${GCOMPRIS_MINOR_VERSION}*100 + ${GCOMPRIS_PATCH_VERSION}")
0089 
0090 # prevent build in source directory
0091 if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
0092     message(SEND_ERROR "Building in the source directory is not supported.")
0093     message(FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\"
0094             directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
0095 endif()
0096 
0097 set(QT_COMPONENTS Qml Quick Gui Multimedia Core Svg Network LinguistTools Sensors QuickControls2 QuickTemplates2 Charts Widgets)
0098 find_package(Qt5 ${QT_REQUIRED_VERSION} COMPONENTS
0099     ${QT_COMPONENTS})
0100 
0101 set_package_properties(Qt5 PROPERTIES TYPE REQUIRED)
0102 foreach(COMPONENT ${QT_COMPONENTS})
0103   set_package_properties(Qt5${COMPONENT} PROPERTIES TYPE REQUIRED)
0104 endforeach()
0105 
0106 if(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.15.0")
0107   find_package(Qt5 ${QT_REQUIRED_VERSION} COMPONENTS QmlModels QmlWorkerScript QuickParticles)
0108   set_package_properties(Qt5QmlWorkerScript PROPERTIES TYPE REQUIRED)
0109   set_package_properties(Qt5QuickParticles PROPERTIES TYPE REQUIRED)
0110   set_package_properties(Qt5QmlModels PROPERTIES TYPE REQUIRED)
0111 endif()
0112 
0113 if(ANDROID)
0114     find_package(Qt5 ${QT_REQUIRED_VERSION} COMPONENTS AndroidExtras)
0115     set_package_properties(Qt5AndroidExtras PROPERTIES TYPE REQUIRED)
0116 endif()
0117 
0118 # Starting C++20, emit() is a function in standard library. To avoid using Qt keywords like signals, slots, emit, we define this variable
0119 add_definitions(
0120     -DQT_USE_QSTRINGBUILDER
0121     -DQT_NO_CAST_TO_ASCII
0122     -DQT_NO_URL_CAST_FROM_STRING
0123     -DQT_NO_KEYWORDS
0124     -DQT_NO_FOREACH
0125 )
0126 
0127 ## For now we workaround CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION to clang with a command variable, so not needed
0128 # if(ANDROID AND ECM_VERSION VERSION_LESS "5.56.0" AND Qt5Core_VERSION VERSION_GREATER "5.11.99")
0129 #   message(FATAL_ERROR "ECM ${ECM_VERSION} not compatible with Qt ${Qt5Core_VERSION} version for android.")
0130 # endif()
0131 
0132 if((UNIX AND NOT APPLE AND NOT ANDROID) OR WIN32)
0133     find_package(OpenSSL)
0134     set_package_properties(OpenSSL PROPERTIES TYPE REQUIRED)
0135 endif()
0136 
0137 
0138 option(COMPILE_DOC "Enable compilation of GCompris docbook" OFF)
0139 if(COMPILE_DOC)
0140   find_package(KF5 QUIET COMPONENTS DocTools)
0141 endif()
0142 
0143 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0144 
0145 if(ECM_FOUND)
0146     include(KDEInstallDirs)
0147 
0148     if(ECM_VERSION VERSION_GREATER "1.6.0")
0149         add_subdirectory(images)
0150         install(FILES org.kde.gcompris.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
0151         install(FILES org.kde.gcompris.desktop DESTINATION ${KDE_INSTALL_APPDIR})
0152     else()
0153         message(STATUS "ECM_VERSION is ${ECM_VERSION}, icons and desktop files won't be installed.")
0154     endif()
0155 endif()
0156 
0157 # Tell CMake to run moc when necessary:
0158 set(CMAKE_AUTOMOC ON)
0159 
0160 # As moc files are generated in the binary dir, tell CMake
0161 # to always look for includes there:
0162 set(CMAKE_INCLUDE_CURRENT_DIR ON)
0163 
0164 #get_cmake_property(_variableNames VARIABLES)
0165 #foreach (_variableName ${_variableNames})
0166 #    message("${_variableName}=${${_variableName}}")
0167 #endforeach()
0168 
0169 option(WITH_DOWNLOAD "Internal download" ON)
0170 # @FIXME These permissions should be removed if download is disable
0171 #        but it makes the application crash on exit (tested on Android 6)
0172 set(ANDROID_INTERNET_PERMISSION "<uses-permission android:name=\"android.permission.INTERNET\" />")
0173 set(ANDROID_ACCESS_NETWORK_STATE_PERMISSION "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />")
0174 
0175 set(GRAPHICAL_RENDERER "auto" CACHE STRING "Policy for choosing the renderer backend [opengl|software|auto]")
0176 
0177 # Set output directory
0178 if(CMAKE_HOST_APPLE)
0179   set(_bundle_bin gcompris-qt.app/Contents/MacOS)
0180   set(_data_dest_dir bin/${_bundle_bin}/../Resources)
0181 else()
0182   set(_data_dest_dir share/${GCOMPRIS_EXECUTABLE_NAME})
0183 endif()
0184 if(ANDROID)
0185   # Android .so output
0186   if(Qt5Widgets_VERSION VERSION_LESS "5.14.0")
0187     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/android-build/libs/${ANDROID_ABI}/)
0188   endif()
0189   set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE)
0190   set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/android-build/assets/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE)
0191   set(ANDROID_PACKAGE "net.gcompris.full")
0192   add_subdirectory(android)
0193 elseif(CMAKE_HOST_APPLE)
0194   # MacOSX build
0195   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
0196   set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/translations CACHE INTERNAL "" FORCE)
0197   set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE)
0198 else()
0199   # Desktop build
0200   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
0201   set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/translations CACHE INTERNAL "" FORCE)
0202   set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE)
0203 endif()
0204 
0205 # Always create these folders
0206 add_custom_command(
0207   OUTPUT shareFolders
0208   COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR}
0209   COMMAND cmake -E make_directory ${GCOMPRIS_RCC_DIR}
0210   )
0211 add_custom_target(
0212   createShareFolders ALL
0213   DEPENDS shareFolders
0214   )
0215 
0216 include(cmake/rcc.cmake)
0217 
0218 # Translations handling
0219 
0220 # Get all supported locales by GCompris from LanguageList.qml file, excluded the commented ones
0221 file(STRINGS "${CMAKE_SOURCE_DIR}/src/core/LanguageList.qml" handledGComprisLocaleList ENCODING UTF-8 REGEX "[^//]{.*UTF-8")
0222 foreach(localeLine ${handledGComprisLocaleList})
0223   # We match the pattern locale.UTF-8
0224   string(REGEX MATCH ".*\"([a-zA-Z_@]*)\.UTF-8.*" _ ${localeLine})
0225   set(localeFull ${CMAKE_MATCH_1})
0226   list(APPEND gcomprisLocales ${localeFull})
0227   # Add simplified locale
0228   string(REGEX MATCH "([a-zA-Z@]*)_.*" _ ${localeFull})
0229   set(localeShort ${CMAKE_MATCH_1})
0230   list(APPEND gcomprisLocales ${localeShort})
0231 endforeach()
0232 # Remove all duplicated shortened locales
0233 list(REMOVE_DUPLICATES gcomprisLocales)
0234 
0235 #skipping translations can be useful during dev builds
0236 option(SKIP_TRANSLATIONS "Skip building translation files" OFF)
0237 if(NOT SKIP_TRANSLATIONS)
0238   # Get all po files in poqm/
0239   file(GLOB TRANSLATIONS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "poqm/*/gcompris_qt.po")
0240   foreach(PoSource ${TRANSLATIONS_FILES})
0241     # Get the locale
0242     string(REGEX MATCH "poqm/([a-zA-Z@_\-]*)/gcompris_qt.po" _ ${PoSource})
0243     set(locale ${CMAKE_MATCH_1})
0244 
0245     # search in src/core/LanguageList the line corresponding to the locale. If exists, then add the custom_command
0246     if(NOT ${locale} IN_LIST gcomprisLocales)
0247       message(STATUS "Locale ${locale} not supported by GCompris")
0248       continue()
0249     endif()
0250     message(STATUS "Locale ${locale} is supported by GCompris")
0251 
0252     # Changes the .po extension to .ts
0253     string(REPLACE ".po" ".ts" TsSource ${PoSource})
0254     # Replace qt in gcompris_qt.po with the locale
0255     string(REPLACE "qt" "${locale}" TsSource ${TsSource})
0256     # Removes the poqm/${locale} folder prefix
0257     string(REPLACE "poqm/${locale}/" "" TsSource ${TsSource})
0258     # qm extension filename
0259     string(REPLACE ".ts" ".qm" QmOutput ${TsSource})
0260 
0261     set(OutTsFile ${CMAKE_BINARY_DIR}/tmp/${TsSource})
0262 
0263     add_custom_command(
0264       OUTPUT ${QmOutput}
0265       COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR}
0266       COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/tmp
0267       # Remove the obsolete translations and set po in the ts output file
0268       COMMAND msgattrib --no-obsolete  ${CMAKE_CURRENT_SOURCE_DIR}/${PoSource} -o ${OutTsFile}
0269       # Convert the po into ts
0270       COMMAND Qt5::lconvert -if po -of ts -i ${OutTsFile} -o ${OutTsFile}
0271       # Convert the ts in qm removing non finished translations
0272       COMMAND Qt5::lrelease -compress -nounfinished ${OutTsFile} -qm ${GCOMPRIS_TRANSLATIONS_DIR}/${QmOutput}
0273       )
0274     list(APPEND QM_FILES ${QmOutput})
0275   endforeach()
0276 endif()
0277   
0278 # Install translations
0279 if(WIN32)
0280     add_custom_target(BuildTranslations
0281         DEPENDS ${QM_FILES}
0282     )
0283 else()
0284     add_custom_target(BuildTranslations ALL
0285         DEPENDS ${QM_FILES}
0286     )
0287 endif()
0288 
0289 add_custom_command(
0290     OUTPUT doBundleTranslations
0291     COMMAND 7z a -w${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME}
0292                ${CMAKE_BINARY_DIR}/translations-${GCOMPRIS_VERSION}.7z
0293                ${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME}/translations
0294     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0295     )
0296 # Bundle translations
0297 add_custom_target(BundleTranslations
0298   DEPENDS doBundleTranslations
0299   COMMENT "If you want to provide a zip of the translations on a server (run make BuildTranslations first)"
0300   )
0301 
0302 add_custom_command(
0303     OUTPUT doDlAndInstallBundledTranslations
0304     COMMAND curl -fsS -o translations-${GCOMPRIS_VERSION}.7z
0305                https://gcompris.net/download/translations-${GCOMPRIS_VERSION}.7z
0306     COMMAND 7z x -y -o${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME}
0307                translations-${GCOMPRIS_VERSION}.7z
0308     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
0309     )
0310 # Download and install bundled translations
0311 add_custom_target(DlAndInstallBundledTranslations
0312   DEPENDS doDlAndInstallBundledTranslations
0313   COMMENT "Download the bundled translation and install them in the build dir"
0314   )
0315 
0316 if(CMAKE_HOST_APPLE)
0317   install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_bundle_bin})
0318 elseif(ANDROID)
0319   install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION "share")
0320 else()
0321   install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_data_dest_dir})
0322 endif()
0323 
0324 # Build standalone package option -> if ON, we will copy the required Qt files in the build package.
0325 # If OFF, "make install" will not copy Qt files so only GCompris files will be packaged.
0326 # By default, it is true on Windows (as we deliver NSIS package), macOS (bundled), android (apk) and false on linux (to do make install)
0327 # If you want to create a STGZ package for linux (auto-extractible), override this variable by typing : cmake -DBUILD_STANDALONE=ON
0328 if(UNIX AND NOT ANDROID AND NOT APPLE)
0329   option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" OFF)
0330 else()
0331   option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" ON)
0332 endif()
0333 
0334 option(WITH_KIOSK_MODE "Set the kiosk mode by default" OFF)
0335 
0336 if(WIN32)
0337   set(COMPRESSED_AUDIO "mp3" CACHE STRING "Compressed Audio format [ogg|aac|mp3]")
0338 elseif(APPLE)
0339   set(COMPRESSED_AUDIO "aac" CACHE STRING "Compressed Audio format [ogg|aac|mp3]")
0340 else()
0341   set(COMPRESSED_AUDIO "ogg" CACHE STRING "Compressed Audio format [ogg|aac|mp3]")
0342 endif()
0343 
0344 file(GLOB_RECURSE OGG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/ "*.ogg")
0345 
0346 foreach(OGG_FILE ${OGG_FILES})
0347   # This should only replace the extension
0348   string(REGEX REPLACE "ogg$" "aac" AAC_FILE ${OGG_FILE})
0349   add_custom_command(
0350     OUTPUT ${AAC_FILE}
0351     # Put the good line depending on your installation
0352     COMMAND avconv -v warning -i ${OGG_FILE} -acodec libvo_aacenc ${AAC_FILE}
0353     #COMMAND ffmpeg -v warning -i ${OGG_FILE} -acodec aac -strict -2 ${AAC_FILE}
0354     )
0355   list(APPEND AAC_FILES ${AAC_FILE})
0356 
0357   # This should only replace the extension
0358   string(REGEX REPLACE "ogg$" "mp3" MP3_FILE ${OGG_FILE})
0359   add_custom_command(
0360     OUTPUT ${MP3_FILE}
0361     # Put the good line depending on your installation
0362     #COMMAND avconv -v warning -i ${OGG_FILE} -acodec mp3 ${MP3_FILE}
0363     COMMAND ffmpeg -v warning -i ${OGG_FILE} -acodec mp3 -strict -2 ${MP3_FILE}
0364     )
0365   list(APPEND MP3_FILES ${MP3_FILE})
0366 endforeach()
0367 
0368 add_custom_target(
0369   createAacFromOgg
0370   DEPENDS ${AAC_FILES}
0371   )
0372 
0373 add_custom_target(
0374   createMp3FromOgg
0375   DEPENDS ${MP3_FILES}
0376   )
0377 
0378 if(ANDROID)
0379   set(GCOMPRIS_ASSETS_DIR ${GCOMPRIS_RCC_DIR}/../../../ CACHE INTERNAL "" FORCE)
0380 else()
0381   set(GCOMPRIS_ASSETS_DIR ${GCOMPRIS_RCC_DIR} CACHE INTERNAL "" FORCE)
0382 endif()
0383 
0384 # predownload assets (voices and images) and install them in the rcc folder
0385 set(DOWNLOAD_ASSETS "" CACHE STRING "Download and packages images and voices. use a list like: words,en,fr,pt_BR,music to retrieve multiple files")
0386 add_custom_command(
0387     OUTPUT predownloadAssets
0388     COMMAND python3 tools/download-assets.py ${DOWNLOAD_ASSETS} ${COMPRESSED_AUDIO} ${GCOMPRIS_ASSETS_DIR}
0389     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0390     )
0391 
0392 add_custom_command(
0393     OUTPUT assetsFolders
0394     COMMAND cmake -E make_directory "${GCOMPRIS_ASSETS_DIR}/data3"
0395     COMMAND cmake -E make_directory "${GCOMPRIS_ASSETS_DIR}/data3/voices-${COMPRESSED_AUDIO}"
0396     COMMAND cmake -E make_directory "${GCOMPRIS_ASSETS_DIR}/data3/words"
0397     COMMAND cmake -E make_directory "${GCOMPRIS_ASSETS_DIR}/data3/backgroundMusic"
0398     )
0399 # Install assets
0400 add_custom_target(getAssets
0401   DEPENDS assetsFolders predownloadAssets
0402   )
0403 
0404 add_custom_command(
0405     OUTPUT doBundleConvertedOggs
0406     COMMAND 7z a converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z '-ir!src/*${COMPRESSED_AUDIO}'
0407     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0408     )
0409 # Bundle oggs ready to be uploaded on a server. This ease build on system without the appropriate audio
0410 # convertion tools.
0411 add_custom_target(BundleConvertedOggs
0412   DEPENDS doBundleConvertedOggs
0413   COMMENT "Bundle the converted oggs to upload them on a server. First set COMPRESSED_AUDIO appropriately."
0414   )
0415 
0416 add_custom_command(
0417     OUTPUT doDlAndInstallBundledConvertedOggs
0418     COMMAND curl -fsS -o converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z
0419             https://gcompris.net/download/converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z
0420     COMMAND 7z x -y converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z
0421     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0422     )
0423 # Download and install bundled converted oggs
0424 add_custom_target(DlAndInstallBundledConvertedOggs
0425   DEPENDS doDlAndInstallBundledConvertedOggs
0426   COMMENT "Download the bundled converted oggs and install them in the source dir"
0427   )
0428 
0429 if(${GCOMPRIS_PATCH_VERSION} STREQUAL 0)
0430   set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${GCOMPRIS_VERSION})
0431 else()
0432   set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${GCOMPRIS_VERSION}.${GCOMPRIS_PATCH_VERSION})
0433 endif()
0434 
0435 add_custom_target(dist
0436     COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
0437         | xz > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.xz
0438     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
0439 
0440 if(KF5_FOUND)
0441     add_subdirectory(docs/docbook)
0442 endif()
0443 
0444 # qml-box2d
0445 include(cmake/box2d.cmake)
0446 
0447 add_subdirectory(src)
0448 
0449 if (UBUNTU_TOUCH)
0450     add_subdirectory(platforms/ubuntutouch)
0451 endif ()
0452 
0453 # only enable unit tests for linux
0454 if(BUILD_TESTING)
0455   enable_testing()
0456   add_subdirectory(tests)
0457 endif()
0458 
0459 add_custom_target(binaries)
0460 add_dependencies(binaries ${GCOMPRIS_EXECUTABLE_NAME} rcc_core rcc_menu rcc_activities all_activities)
0461 
0462 # Add a target to automatise the filling of the files requiring info for the releases: appdata/publiccode release date, fastlane changelog
0463 string(TIMESTAMP currentDay "%Y-%m-%d")
0464 add_custom_command(
0465     OUTPUT doUpdateReleaseDate
0466     COMMAND ./tools/bump_version.sh -v ${GCOMPRIS_VERSION} -r ${currentDay}
0467     COMMAND python3 ./tools/fdroid_update_fastlane_metadata.py ${GCOMPRIS_VERSION_CODE}
0468     COMMAND python3 ./tools/android_format_changelog.py ${GCOMPRIS_VERSION_CODE}
0469     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0470     )
0471 add_custom_target(updateReleaseDate
0472   DEPENDS doUpdateReleaseDate
0473   COMMENT "Run the scripts to bump the version if not already done. It assumes the changelog is already created for this version."
0474   )
0475