diff --git a/CMakeLists.txt b/CMakeLists.txt index 9948e43bf..c29e4fa48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,420 +1,420 @@ cmake_minimum_required(VERSION 2.8.12) cmake_policy(SET CMP0043 NEW) project(gcompris-qt C CXX) # get all the redist dll needed for windows when compiling with vc set(CMAKE_INSTALL_UCRT_LIBRARIES 1) include(InstallRequiredSystemLibraries) # Set c++11 support include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11) +check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) - set(my_cxx_flags "-std=c++11") + set(my_cxx_flags "-std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) - set(my_cxx_flags "-std=c++0x") + set(my_cxx_flags "-std=c++0x") else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}") # enable qml debugging for DEBUG builds: set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG") set(GCOMPRIS_MAJOR_VERSION 0) -set(GCOMPRIS_MINOR_VERSION 98) +set(GCOMPRIS_MINOR_VERSION 97) set(GCOMPRIS_PATCH_VERSION 0) if("${ANDROID_ARCH}" STREQUAL "arm64") -set(GCOMPRIS_PATCH_VERSION 1) + set(GCOMPRIS_PATCH_VERSION 1) endif() # Set the BUILD_DATE string(TIMESTAMP BUILD_DATE %Y%m) # cmake modules setup find_package(ECM 1.4.0 QUIET NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake/) set(CMAKE_PREFIX_PATH "${Qt5_DIR}/lib/cmake/Qt5") # KDE po to qm tools if(ECM_FOUND) include(kdeFetchTranslation) include(ECMAddTests) include(ECMPoQmTools) - if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") + if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() option(BUILD_TESTING "Build and enable unit tests" OFF) include(ECMCoverageOption) -endif(ECM_FOUND) +endif() # add tools (cppcheck, clang-tidy...) if build on testing mode only # (slower compilation) if(BUILD_TESTING) include(CodeQualityUtils) endif() set(QT_REQUIRED_VERSION 5.6.0) if(CMAKE_SYSTEM_NAME STREQUAL Android) find_package(ECM) set(ANDROID 1) # TODO: possibly should be setup by toolchain one day set(QT_QMAKE_EXECUTABLE "${_qt5Core_install_prefix}/bin/qmake") if(ECM_VERSION VERSION_GREATER "5.55.0") set(QT_REQUIRED_VERSION 5.12.0) endif() # workaround until this fix is in released ECM if(ECM_VERSION VERSION_LESS "5.15.0") add_definitions(-DANDROID) endif() endif() # Set executable filename if(ANDROID) set(GCOMPRIS_EXECUTABLE_NAME GCompris) elseif(SAILFISHOS) set(GCOMPRIS_EXECUTABLE_NAME harbour-gcompris-qt) elseif(WIN32) set(GCOMPRIS_EXECUTABLE_NAME GCompris) else() set(GCOMPRIS_EXECUTABLE_NAME gcompris-qt) endif() set(GCOMPRIS_VERSION ${GCOMPRIS_MAJOR_VERSION}.${GCOMPRIS_MINOR_VERSION}) # An integer value that represents the version of the application # Increase it at each release math(EXPR GCOMPRIS_VERSION_CODE "${GCOMPRIS_MAJOR_VERSION}*10000 + ${GCOMPRIS_MINOR_VERSION}*100 + ${GCOMPRIS_PATCH_VERSION}") # prevent build in source directory if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") message(SEND_ERROR "Building in the source directory is not supported.") message(FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} \".") -endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") +endif() find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED Qml Quick Gui Multimedia Core Svg Xml XmlPatterns LinguistTools Sensors) if(ANDROID) find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED AndroidExtras) -endif(ANDROID) +endif() if(SAILFISHOS) find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED Widgets) -endif(SAILFISHOS) +endif() ## For now we workaround CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION to clang with a command variable, so not needed # if(ANDROID AND ECM_VERSION VERSION_LESS "5.56.0" AND Qt5Core_VERSION VERSION_GREATER "5.11.99") # message(FATAL_ERROR "ECM ${ECM_VERSION} not compatible with Qt ${Qt5Core_VERSION} version for android.") # endif() if((UNIX AND NOT APPLE AND NOT SAILFISHOS AND NOT ANDROID) OR WIN32) find_package(OpenSSL REQUIRED) endif() -find_package (KF5 QUIET COMPONENTS +find_package(KF5 QUIET COMPONENTS DocTools ) if(ECM_FOUND) include(KDEInstallDirs) if(ECM_VERSION VERSION_GREATER "1.6.0") add_subdirectory(images) install(FILES org.kde.gcompris.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) install(FILES org.kde.gcompris.desktop DESTINATION ${KDE_INSTALL_APPDIR}) else() message(STATUS "ECM_VERSION is ${ECM_VERSION}, icons and desktop files won't be installed.") endif() endif() # Tell CMake to run moc when necessary: set(CMAKE_AUTOMOC ON) # As moc files are generated in the binary dir, tell CMake # to always look for includes there: set(CMAKE_INCLUDE_CURRENT_DIR ON) #get_cmake_property(_variableNames VARIABLES) #foreach (_variableName ${_variableNames}) # message("${_variableName}=${${_variableName}}") #endforeach() set(ACTIVATION_MODE "no" CACHE STRING "Policy for activation [no|inapp|internal]") option(WITH_DEMO_ONLY "Include only demo activities" OFF) option(WITH_DOWNLOAD "Internal download" ON) # @FIXME These permissions should be removed if download is disable # but it makes the application crash on exit (tested on Android 6) set(ANDROID_INTERNET_PERMISSION "") set(ANDROID_ACCESS_NETWORK_STATE_PERMISSION "") set(GRAPHICAL_RENDERER "auto" CACHE STRING "Policy for choosing the renderer backend [opengl|software|auto]") # Set output directory if(CMAKE_HOST_APPLE) set(_bundle_bin gcompris-qt.app/Contents/MacOS) set(_data_dest_dir bin/${_bundle_bin}/../Resources) else() set(_data_dest_dir share/${GCOMPRIS_EXECUTABLE_NAME}) endif() if(ANDROID) # Android .so output set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/android/libs/${ANDROID_ABI}/) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE) set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/android/assets/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE) if(ACTIVATION_MODE STREQUAL "inapp") set(ANDROID_BILLING_PERMISSION "") set(ANDROID_PACKAGE "net.gcompris") - else(ACTIVATION_MODE) + else() set(ANDROID_PACKAGE "net.gcompris.full") endif() add_subdirectory(android) elseif(CMAKE_HOST_APPLE) # MacOSX build set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/translations CACHE INTERNAL "" FORCE) set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE) else() # Desktop build set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(GCOMPRIS_TRANSLATIONS_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/translations CACHE INTERNAL "" FORCE) set(GCOMPRIS_RCC_DIR ${CMAKE_BINARY_DIR}/${_data_dest_dir}/rcc CACHE INTERNAL "" FORCE) -endif(ANDROID) +endif() # Always create these folders add_custom_command( OUTPUT shareFolders COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR} COMMAND cmake -E make_directory ${GCOMPRIS_RCC_DIR} ) add_custom_target( createShareFolders ALL DEPENDS shareFolders ) include(cmake/rcc.cmake) # Translations handling # Simple command calling the python script add_custom_command( OUTPUT retrievePoFilesFromSvn COMMAND python2 tools/l10n-fetch-po-files.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Install translations add_custom_target(getSvnTranslations DEPENDS retrievePoFilesFromSvn COMMENT "Re-run cmake after this to be able to run BuildTranslations with the latest files" ) # Get all po files in po/. You can get them doing: python2 tools/l10n-fetch-po-files.py file(GLOB TRANSLATIONS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "po/*.po") # Set the output dir for the translation files to /bin foreach(PoSource ${TRANSLATIONS_FILES}) # Changes the .po extension to .ts string(REPLACE ".po" ".ts" TsSource ${PoSource}) # Removes the po/ folder string(REPLACE "po/" "" TsSource ${TsSource}) # qm filename string(REPLACE ".ts" ".qm" QmOutput ${TsSource}) set(OutTsFile ${CMAKE_BINARY_DIR}/tmp/${TsSource}) add_custom_command( OUTPUT ${QmOutput} COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR} COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/tmp # Remove the obsolete translations and set po in the ts output file COMMAND msgattrib --no-obsolete ${CMAKE_CURRENT_SOURCE_DIR}/${PoSource} -o ${OutTsFile} # Convert the po into ts COMMAND Qt5::lconvert -if po -of ts -i ${OutTsFile} -o ${OutTsFile} # Convert the ts in qm removing non finished translations COMMAND Qt5::lrelease -compress -nounfinished ${OutTsFile} -qm ${GCOMPRIS_TRANSLATIONS_DIR}/${QmOutput} ) list(APPEND QM_FILES ${QmOutput}) endforeach() # Install translations -if (WIN32) +if(WIN32) add_custom_target(BuildTranslations DEPENDS ${QM_FILES} COMMENT "If you don't have the .po, you need to run make getSvnTranslations first then re-run cmake" ) else() add_custom_target(BuildTranslations ALL DEPENDS ${QM_FILES} COMMENT "If you don't have the .po, you need to run make getSvnTranslations first then re-run cmake" ) endif() add_custom_command( OUTPUT doBundleTranslations COMMAND 7z a -w${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME} ${CMAKE_BINARY_DIR}/translations-${GCOMPRIS_VERSION}.7z ${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME}/translations WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Bundle translations add_custom_target(BundleTranslations DEPENDS doBundleTranslations COMMENT "If you want to provide a zip of the translations on a server (run make BuildTranslations first)" ) add_custom_command( OUTPUT doDlAndInstallBundledTranslations COMMAND curl -fsS -o translations-${GCOMPRIS_VERSION}.7z - http://gcompris.net/download/translations-${GCOMPRIS_VERSION}.7z + http://gcompris.net/download/translations-${GCOMPRIS_VERSION}.7z COMMAND 7z x -y -o${CMAKE_BINARY_DIR}/share/${GCOMPRIS_EXECUTABLE_NAME} translations-${GCOMPRIS_VERSION}.7z WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) # Download and install bundled translations add_custom_target(DlAndInstallBundledTranslations DEPENDS doDlAndInstallBundledTranslations COMMENT "Download the bundled translation and install them in the build dir" ) if(CMAKE_HOST_APPLE) install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_bundle_bin}) elseif(ANDROID) install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION "share") else() install(DIRECTORY ${GCOMPRIS_TRANSLATIONS_DIR} DESTINATION ${_data_dest_dir}) endif() # Build standalone package option -> if ON, we will copy the required Qt files in the build package. # If OFF, "make install" will not copy Qt files so only GCompris files will be packaged. # By default, it is true on Windows (as we deliver NSIS package), macOS (bundled), android (apk) and false on linux (to do make install) # If you want to create a STGZ package for linux (auto-extractible), override this variable by typing : cmake -DBUILD_STANDALONE=ON if(UNIX AND NOT ANDROID AND NOT APPLE) option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" OFF) else() option(BUILD_STANDALONE "Build a standalone package when typing 'make package'" ON) endif() option(WITH_KIOSK_MODE "Set the kiosk mode by default" OFF) if(WIN32) set(COMPRESSED_AUDIO "mp3" CACHE STRING "Compressed Audio format [ogg|aac|mp3]") elseif(APPLE) set(COMPRESSED_AUDIO "aac" CACHE STRING "Compressed Audio format [ogg|aac|mp3]") else() set(COMPRESSED_AUDIO "ogg" CACHE STRING "Compressed Audio format [ogg|aac|mp3]") endif() file(GLOB_RECURSE OGG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/ "*.ogg") foreach(OGG_FILE ${OGG_FILES}) # This should only replace the extension string(REGEX REPLACE "ogg$" "aac" AAC_FILE ${OGG_FILE}) add_custom_command( OUTPUT ${AAC_FILE} # Put the good line depending on your installation COMMAND avconv -v warning -i ${OGG_FILE} -acodec libvo_aacenc ${AAC_FILE} #COMMAND ffmpeg -v warning -i ${OGG_FILE} -acodec aac -strict -2 ${AAC_FILE} ) list(APPEND AAC_FILES ${AAC_FILE}) # This should only replace the extension string(REGEX REPLACE "ogg$" "mp3" MP3_FILE ${OGG_FILE}) add_custom_command( OUTPUT ${MP3_FILE} # Put the good line depending on your installation #COMMAND avconv -v warning -i ${OGG_FILE} -acodec mp3 ${MP3_FILE} COMMAND ffmpeg -v warning -i ${OGG_FILE} -acodec mp3 -strict -2 ${MP3_FILE} ) list(APPEND MP3_FILES ${MP3_FILE}) endforeach() add_custom_target( createAacFromOgg DEPENDS ${AAC_FILES} ) add_custom_target( createMp3FromOgg DEPENDS ${MP3_FILES} ) # predownload assets (voices and images) and install them in the rcc folder set(DOWNLOAD_ASSETS "" CACHE STRING "Download and packages images and voices. use a list like: words,en,fr,pt_BR to retrieve multiple files") add_custom_command( OUTPUT predownloadAssets COMMAND python tools/download-assets.py ${DOWNLOAD_ASSETS} ${COMPRESSED_AUDIO} ${GCOMPRIS_RCC_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) add_custom_command( OUTPUT assetsFolders COMMAND cmake -E make_directory "${GCOMPRIS_RCC_DIR}/data2" COMMAND cmake -E make_directory "${GCOMPRIS_RCC_DIR}/data2/voices-${COMPRESSED_AUDIO}" COMMAND cmake -E make_directory "${GCOMPRIS_RCC_DIR}/data2/words" ) # Install assets add_custom_target(getAssets DEPENDS assetsFolders predownloadAssets ) add_custom_command( OUTPUT doBundleConvertedOggs COMMAND 7z a converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z '-ir!src/*${COMPRESSED_AUDIO}' WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Bundle oggs ready to be uploaded on a server. This ease build on system without the appropriate audio # convertion tools. add_custom_target(BundleConvertedOggs DEPENDS doBundleConvertedOggs COMMENT "Bundle the converted oggs to upload them on a server. First set COMPRESSED_AUDIO appropriately." ) add_custom_command( OUTPUT doDlAndInstallBundledConvertedOggs COMMAND curl -fsS -o converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z http://gcompris.net/download/converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z COMMAND 7z x -y converted_ogg_to_${COMPRESSED_AUDIO}-${GCOMPRIS_VERSION}.7z WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Download and install bundled converted oggs add_custom_target(DlAndInstallBundledConvertedOggs DEPENDS doDlAndInstallBundledConvertedOggs COMMENT "Download the bundled converted oggs and install them in the source dir" ) set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${GCOMPRIS_VERSION}) add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | xz > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.xz WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) if(KF5_FOUND) add_subdirectory(docs/docbook) -endif(KF5_FOUND) +endif() # qml-box2d include(cmake/box2d.cmake) add_subdirectory(src) if(SAILFISHOS) # Need to be done at the end, after src add_subdirectory(platforms/sailfishOS) endif() # only enable unit tests for linux if(BUILD_TESTING) enable_testing() add_subdirectory(tests) -endif(BUILD_TESTING) +endif() add_custom_target(binaries) add_dependencies(binaries ${GCOMPRIS_EXECUTABLE_NAME} rcc_core rcc_menu rcc_activities all_activities) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index c5f321afb..baab28f0d 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -1,217 +1,217 @@ #android build # copied/inspired from stellarium project (http://www.stellarium.org/wiki/index.php/Building_for_Android) -LIST(APPEND JAVA_SRCS "src/com/android/vending/billing/IInAppBillingService.aidl" "src/net/gcompris/GComprisActivity.java") +list(APPEND JAVA_SRCS "src/com/android/vending/billing/IInAppBillingService.aidl" "src/net/gcompris/GComprisActivity.java") -FOREACH(JavaSource ${JAVA_SRCS}) - ADD_CUSTOM_COMMAND( +foreach(JavaSource ${JAVA_SRCS}) + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${JavaSource} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${JavaSource} ${CMAKE_CURRENT_BINARY_DIR}/${JavaSource} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${JavaSource} ) - LIST(APPEND TARGET_JAVA_FILES ${CMAKE_CURRENT_BINARY_DIR}/${JavaSource}) -ENDFOREACH() + list(APPEND TARGET_JAVA_FILES ${CMAKE_CURRENT_BINARY_DIR}/${JavaSource}) +endforeach() -ADD_CUSTOM_TARGET (java_src DEPENDS ${TARGET_JAVA_FILES}) +add_custom_target(java_src DEPENDS ${TARGET_JAVA_FILES}) -find_program(ANDROID_DEPLOY_QT NAMES androiddeployqt PATHS ${_qt5Core_install_prefix}/bin/ ) +find_program(ANDROID_DEPLOY_QT NAMES androiddeployqt PATHS ${_qt5Core_install_prefix}/bin/) # Look for androiddeployqt program -if (NOT ANDROID_DEPLOY_QT) +if(NOT ANDROID_DEPLOY_QT) message(FATAL_ERROR "Could not find androiddeployqt. Make sure you set all the Qt5_* paths to the Qt for android compiled version.") -endif(NOT ANDROID_DEPLOY_QT) +endif() # Set version set(ANDROID_VERSION_NAME ${GCOMPRIS_VERSION}) # Set a name representing the build type set(APK_SUFFIX "-") if(ACTIVATION_MODE STREQUAL "inapp") set(APK_SUFFIX "-inapp${APK_SUFFIX}") elseif(ACTIVATION_MODE STREQUAL "internal") set(APK_SUFFIX "-internal${APK_SUFFIX}") -endif(ACTIVATION_MODE STREQUAL "inapp") +endif() # _HOST have been removed from ECM in https://cgit.kde.org/extra-cmake-modules.git/commit/?id=731ba7036effcc430f98031e7f2a9826f6234cba set(_HOST "${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}") string(TOLOWER "${_HOST}" _HOST) if(WITH_DEMO_ONLY) set(APK_SUFFIX "-demo${APK_SUFFIX}") -endif(WITH_DEMO_ONLY) +endif() if(WITH_DOWNLOAD) set(APK_SUFFIX "-dl${APK_SUFFIX}") -endif(WITH_DOWNLOAD) +endif() if(WITH_KIOSK_MODE) set(APK_SUFFIX "-kiosk${APK_SUFFIX}") -endif(WITH_KIOSK_MODE) +endif() # specific clang addition -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(STDCPP_PATH ",\"stdcpp-path\": \"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so\"") set(REMOVE_mandroid_FLAG_FOR_CLANG "sed -i -e 's/-mandroid//' Configure") endif() set(ANDROID_TOOLCHAIN arm-linux-androideabi) if("${ANDROID_ARCH}" STREQUAL "arm64") set(ANDROID_TOOLCHAIN aarch64-linux-android) endif() # set android package source for androiddeployqt json file set(PACKAGE_SOURCE_ANDROID ${CMAKE_BINARY_DIR}/tmpAndroid) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml @ONLY) # create json file parsed by the androiddeployqt set(ANDROID_SDK_ROOT $ENV{ANDROID_SDK_ROOT}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configAndroid.json.cmake ${PACKAGE_SOURCE_ANDROID}/configAndroid.json @ONLY) # Get all po files in po/ to create the values-{locale} in order to have the locales available in android file(GLOB TRANSLATIONS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "../po/*.po") foreach(PoSource ${TRANSLATIONS_FILES}) # Remove suffix ".po" string(REPLACE ".po" "" PoSource ${PoSource}) # Remove prefix "../po/gcompris_" string(REPLACE "../po/gcompris_" "" locale ${PoSource}) # replace _ par -r for locales with country string(REPLACE "_" "-r" locale ${locale}) add_custom_command( OUTPUT ${locale} COMMAND cmake -E make_directory ${GCOMPRIS_TRANSLATIONS_DIR} COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/android/res/values-${locale} COMMAND cmake -E copy ${CMAKE_SOURCE_DIR}/android/strings.xml ${CMAKE_BINARY_DIR}/android/res/values-${locale}/strings.xml ) list(APPEND ALL_LOCALES ${locale}) endforeach() -find_program(ZIP_ALIGN NAMES zipalign PATHS ${ANDROID_SDK_ROOT}/build-tools/${ANDROID_SDK_BUILD_TOOLS_REVISION}/ ) +find_program(ZIP_ALIGN NAMES zipalign PATHS ${ANDROID_SDK_ROOT}/build-tools/${ANDROID_SDK_BUILD_TOOLS_REVISION}/) -add_custom_command ( +add_custom_command( OUTPUT createApkFromAndroidDeployQtDebug DEPENDS ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${PACKAGE_SOURCE_ANDROID} COMMAND ${ANDROID_DEPLOY_QT} --output ${CMAKE_CURRENT_BINARY_DIR}/ --input ${PACKAGE_SOURCE_ANDROID}/configAndroid.json --debug --gradle COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/build/outputs/apk/debug/android-debug.apk ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-debug-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ) -add_custom_command ( +add_custom_command( OUTPUT createApkFromAndroidDeployQtRelease DEPENDS ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${PACKAGE_SOURCE_ANDROID} COMMAND ${ANDROID_DEPLOY_QT} --output ${CMAKE_CURRENT_BINARY_DIR}/ --input ${PACKAGE_SOURCE_ANDROID}/configAndroid.json --release --gradle COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/build/outputs/apk/release/android-release-unsigned.apk ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ) -add_custom_command ( +add_custom_command( OUTPUT createApkSignedFromAndroidDeployQtRelease DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk COMMAND jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $ENV{ANDROID_KEYSTORE} -storepass $ENV{ANDROID_KEYSTORE_PASSWD} ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk gcompris ) -add_custom_command ( +add_custom_command( OUTPUT createApkSignedAlignedFromAndroidDeployQtRelease DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-aligned-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk COMMAND ${ZIP_ALIGN} -v 4 ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-aligned-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ) -add_custom_command ( +add_custom_command( OUTPUT apkInstall DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-aligned-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk COMMAND ${ANDROID_SDK_ROOT}/platform-tools/adb install -r ${CMAKE_CURRENT_BINARY_DIR}/GCompris-Android-release-signed-aligned-${ANDROID_ABI}${APK_SUFFIX}${GCOMPRIS_VERSION}.apk ) # Command to create apk from Makefile -add_custom_target (apk_debug - DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkFromAndroidDeployQtDebug java_src +add_custom_target(apk_debug + DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkFromAndroidDeployQtDebug java_src ) # Command to create apk from Makefile -add_custom_target (apk_release - DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkFromAndroidDeployQtRelease java_src +add_custom_target(apk_release + DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkFromAndroidDeployQtRelease java_src ) # Command to create signed apk from Makefile -add_custom_target (apk_signed - DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkSignedFromAndroidDeployQtRelease java_src +add_custom_target(apk_signed + DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkSignedFromAndroidDeployQtRelease java_src ) # Command to create signed aligned apk from Makefile -add_custom_target (apk_signed_aligned - DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkSignedAlignedFromAndroidDeployQtRelease java_src +add_custom_target(apk_signed_aligned + DEPENDS ${ALL_LOCALES} move_translations_to_assets package_openssl createApkSignedAlignedFromAndroidDeployQtRelease java_src ) # Command to install the signed aligned apk through adb from Makefile -add_custom_target (apk_install - DEPENDS apkInstall +add_custom_target(apk_install + DEPENDS apkInstall ) # compile openssl needed to download from https include(ExternalProject) set(OPENSSL_DIR "${CMAKE_BINARY_DIR}/external/openssl/") set(SCRIPT_BUILD "build_openssl.sh.in") if("${ANDROID_ARCH}" STREQUAL "arm64") set(SCRIPT_BUILD "build_openssl_64.sh.in") endif() message(STATUS "Building ${SCRIPT_BUILD}") configure_file("${SCRIPT_BUILD}" "build_openssl.sh" @ONLY) if("${ANDROID_ARCH}" STREQUAL "arm") ExternalProject_Add( ext_openssl DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${OPENSSL_DIR} URL https://www.openssl.org/source/openssl-1.0.2q.tar.gz URL_HASH SHA256=5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684 CONFIGURE_COMMAND echo "Configuration not needed" BUILD_COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/build_openssl.sh" INSTALL_COMMAND "" ) add_custom_command( OUTPUT package_openssl COMMAND ${CMAKE_COMMAND} -E copy "${OPENSSL_DIR}/libcrypto.so.1.0.0" "${CMAKE_BINARY_DIR}/android/libs/${ANDROID_ABI}/libcrypto.so" COMMAND ${CMAKE_COMMAND} -E copy "${OPENSSL_DIR}/libssl.so.1.0.0" "${CMAKE_BINARY_DIR}/android/libs/${ANDROID_ABI}/libssl.so" ) else() # For Qt 5.12.5, it needs libcrypto_1_1.so and libssl_1_1.so set(suffix_libssl "") if(Qt5Core_VERSION VERSION_LESS "5.13.0") set(suffix_libssl "_1_1") endif() ExternalProject_Add( ext_openssl DOWNLOAD_DIR ${CMAKE_BINARY_DIR} SOURCE_DIR ${OPENSSL_DIR} URL https://www.openssl.org/source/openssl-1.1.1c.tar.gz URL_HASH SHA256=f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90 CONFIGURE_COMMAND echo "Configuration not needed" BUILD_COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/build_openssl.sh" INSTALL_COMMAND "" ) -add_custom_command( +add_custom_command( OUTPUT package_openssl COMMAND ${CMAKE_COMMAND} -E copy "${OPENSSL_DIR}/libcrypto.so.1.1" "${CMAKE_BINARY_DIR}/android/libs/${ANDROID_ABI}/libcrypto${suffix_libssl}.so" COMMAND ${CMAKE_COMMAND} -E copy "${OPENSSL_DIR}/libssl.so.1.1" "${CMAKE_BINARY_DIR}/android/libs/${ANDROID_ABI}/libssl${suffix_libssl}.so" ) endif() # add_custom_command( OUTPUT move_translations_to_assets COMMAND ${CMAKE_COMMAND} -E copy_directory ${GCOMPRIS_TRANSLATIONS_DIR} ${CMAKE_BINARY_DIR}/android/assets/share/GCompris ) -if (TARGET create-apk) - set(PACKAGE_DIR ${PACKAGE_SOURCE_ANDROID}) - set_target_properties(create-apk-GCompris PROPERTIES ANDROID_APK_DIR "${PACKAGE_DIR}") - add_custom_target(gcompris-move-metadata ALL - COMMAND cmake -E echo "Moving GCompris shared Android resources" - COMMAND cmake -E make_directory ${PACKAGE_SOURCE_ANDROID} - COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}" "${PACKAGE_SOURCE_ANDROID}" - ) - add_dependencies(create-apk gcompris-move-metadata) +if(TARGET create-apk) + set(PACKAGE_DIR ${PACKAGE_SOURCE_ANDROID}) + set_target_properties(create-apk-GCompris PROPERTIES ANDROID_APK_DIR "${PACKAGE_DIR}") + add_custom_target(gcompris-move-metadata ALL + COMMAND cmake -E echo "Moving GCompris shared Android resources" + COMMAND cmake -E make_directory ${PACKAGE_SOURCE_ANDROID} + COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}" "${PACKAGE_SOURCE_ANDROID}" + ) + add_dependencies(create-apk gcompris-move-metadata) endif() diff --git a/cmake/CodeQualityUtils.cmake b/cmake/CodeQualityUtils.cmake index 3c98e3d5a..25b75e593 100644 --- a/cmake/CodeQualityUtils.cmake +++ b/cmake/CodeQualityUtils.cmake @@ -1,25 +1,25 @@ # These tools are run (for now) only if BUILD_TESTING is ON # Another useful tool could be clazy compiler too # Run cppcheck on the code find_program(CPPCHECK_EXE NAMES cppcheck) if(CPPCHECK_EXE) set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXE}) list( - APPEND CMAKE_CXX_CPPCHECK + APPEND CMAKE_CXX_CPPCHECK "--enable=all" "--inconclusive" - "--force" + "--force" "--inline-suppr" ) endif() # Run clang-tidy find_program(CLANG_TIDY_EXE NAMES clang-tidy) if(CLANG_TIDY_EXE) set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE}) list( APPEND CMAKE_CXX_CLANG_TIDY "-checks=*,-fuchsia*,-google*,-hicpp*,-llvm*,-cppcoreguidelines-*,-modernize-use-auto,-readability-*" ) endif() diff --git a/cmake/box2d.cmake b/cmake/box2d.cmake index 1179f9044..4e77b925e 100644 --- a/cmake/box2d.cmake +++ b/cmake/box2d.cmake @@ -1,83 +1,83 @@ set(QML_BOX2D_MODULE "auto" CACHE STRING "Policy for qml-box2d module [auto|submodule|system|disabled]") -if (NOT ${QML_BOX2D_MODULE} STREQUAL "disabled") +if(NOT ${QML_BOX2D_MODULE} STREQUAL "disabled") include(qt_helper) getQtQmlPath(_qt_qml_system_path) - set (_box2d_system_dir "${_qt_qml_system_path}/Box2D.2.0") + set(_box2d_system_dir "${_qt_qml_system_path}/Box2D.2.0") - if (${QML_BOX2D_MODULE} STREQUAL "submodule") + if(${QML_BOX2D_MODULE} STREQUAL "submodule") message(STATUS "Building qml-box2d module from submodule") set(_need_box2d_submodule "TRUE") else() # try to find module in system scope find_library(QML_BOX2D_LIBRARY NAMES Box2D libBox2D PATHS ${_box2d_system_dir} NO_DEFAULT_PATH) - if (QML_BOX2D_LIBRARY) + if(QML_BOX2D_LIBRARY) message(STATUS "Using system qml-box2d plugin at ${QML_BOX2D_LIBRARY}") # for packaging builds, copy the module manually to the correct location if(SAILFISHOS) file(COPY ${_box2d_system_dir}/qmldir ${QML_BOX2D_LIBRARY} DESTINATION share/harbour-gcompris-qt/lib/qml/Box2D.2.0) elseif(ANDROID) file(COPY ${_box2d_system_dir}/qmldir ${QML_BOX2D_LIBRARY} DESTINATION lib/qml/Box2D.2.0) endif() # FIXME: add others as needed else() - if (${QML_BOX2D_MODULE} STREQUAL "auto") + if(${QML_BOX2D_MODULE} STREQUAL "auto") message(STATUS "Did not find the qml-box2d module in system scope, falling back to submodule build ...") - set (_need_box2d_submodule "TRUE") + set(_need_box2d_submodule "TRUE") else() message(FATAL_ERROR "Did not find the qml-box2d module in system scope and submodule build was not requested. Can't continue!") endif() endif() endif() - if (_need_box2d_submodule) + if(_need_box2d_submodule) # build qml-box2d ourselves from submodule include(ExternalProject) get_property(_qmake_program TARGET ${Qt5Core_QMAKE_EXECUTABLE} PROPERTY IMPORT_LOCATION) - set (_box2d_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/external/qml-box2d) + set(_box2d_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/external/qml-box2d) if(WIN32) - set (_box2d_library_dir "release/") - set (_box2d_library_file "Box2D.dll") + set(_box2d_library_dir "release/") + set(_box2d_library_file "Box2D.dll") elseif(CMAKE_HOST_APPLE) - set (_box2d_library_dir "") - set (_box2d_library_file "libBox2D.dylib") + set(_box2d_library_dir "") + set(_box2d_library_file "libBox2D.dylib") else() - set (_box2d_library_dir "") - set (_box2d_library_file "libBox2D.so") + set(_box2d_library_dir "") + set(_box2d_library_file "libBox2D.so") endif() - set (_box2d_install_dir ${CMAKE_CURRENT_BINARY_DIR}/lib/qml/Box2D.2.0) + set(_box2d_install_dir ${CMAKE_CURRENT_BINARY_DIR}/lib/qml/Box2D.2.0) # make sure submodule is up2date find_package(Git) if(GIT_FOUND) execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif() # for visual studio, we need to create a vcxproj if(WIN32 AND NOT MINGW) set(_qmake_options -spec win32-msvc -tp vc) else() set(_qmake_options "") endif() ExternalProject_Add(qml_box2d DOWNLOAD_COMMAND "" SOURCE_DIR ${_box2d_source_dir} CONFIGURE_COMMAND ${_qmake_program} ${_qmake_options} ${_box2d_source_dir}/box2d.pro BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} INSTALL_DIR ${_box2d_install_dir} INSTALL_COMMAND cp ${_box2d_library_dir}${_box2d_library_file} ${_box2d_source_dir}/qmldir ${_box2d_install_dir} ) add_library(qml-box2d SHARED IMPORTED) set_target_properties(qml-box2d PROPERTIES IMPORTED_LOCATION ${_box2d_install_dir}/${_box2d_library_file}) if(SAILFISHOS) install(DIRECTORY ${_box2d_install_dir} DESTINATION share/harbour-gcompris-qt/lib/qml) elseif(APPLE) install(DIRECTORY ${_box2d_install_dir} DESTINATION gcompris-qt.app/Contents/lib/qml) else() install(DIRECTORY ${_box2d_install_dir} DESTINATION lib/qml) endif() endif() endif() diff --git a/cmake/kdeFetchTranslation.cmake b/cmake/kdeFetchTranslation.cmake index 55d89f6b6..0b64f0895 100644 --- a/cmake/kdeFetchTranslation.cmake +++ b/cmake/kdeFetchTranslation.cmake @@ -1,90 +1,90 @@ # # This file is mostly copied from the KDECMakeSettings.cmake: # https://github.com/KDE/extra-cmake-modules/blob/master/kde-modules/KDECMakeSettings.cmake#L320 # Once the last version of ECM will be available on most distributions, we'll # need to switch to it (or at least use it if available else switch to existing # l10n-fetch-po-files.py script to retrieve the po) # # License of KDECMakeSettings.cmake #============================================================================= # Copyright 2014 Alex Merry # Copyright 2013 Aleix Pol # Copyright 2012-2013 Stephen Kelly # Copyright 2007 Matthias Kretz # Copyright 2006-2007 Laurent Montel # Copyright 2006-2013 Alex Neundorf # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if(NOT TARGET fetch-translations AND KDE_L10N_AUTO_TRANSLATIONS) set(KDE_L10N_BRANCH "trunk" CACHE STRING "Branch from l10n.kde.org to fetch from: trunk | stable | lts | trunk_kde4 | stable_kde4") set(_reponame "gcompris") set(releaseme_clone_commands COMMAND git clone --depth 1 https://anongit.kde.org/releaseme.git ) add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/releaseme" ${releaseme_clone_commands} COMMENT "Fetching releaseme scripts to download translations..." ) set(_l10n_po_dir "${CMAKE_BINARY_DIR}/po") set(_l10n_poqm_dir "${CMAKE_BINARY_DIR}/poqm") if(CMAKE_VERSION VERSION_GREATER 3.2) set(extra BYPRODUCTS ${_l10n_po_dir} ${_l10n_poqm_dir}) endif() set(fetch_commands COMMAND ruby "${CMAKE_BINARY_DIR}/releaseme/fetchpo.rb" --origin ${KDE_L10N_BRANCH} --project "${_reponame}" --output-dir "${_l10n_po_dir}" --output-poqm-dir "${_l10n_poqm_dir}" "${CMAKE_SOURCE_DIR}" ) add_custom_target(fetch-translations ${_EXTRA_ARGS} COMMENT "Downloading translations for ${_reponame} branch ${KDE_L10N_BRANCH}..." COMMAND git -C "${CMAKE_BINARY_DIR}/releaseme" pull COMMAND cmake -E remove_directory ${_l10n_po_dir} COMMAND cmake -E remove_directory ${_l10n_poqm_dir} ${fetch_commands} ${extra} ${move_translations} DEPENDS "${CMAKE_BINARY_DIR}/releaseme" ) set(move_translations COMMAND bash ${CMAKE_SOURCE_DIR}/tools/move_translations.sh ${_l10n_poqm_dir} ${CMAKE_SOURCE_DIR}/po ) - if (NOT EXISTS ${_l10n_po_dir} OR NOT EXISTS ${_l10n_poqm_dir}) + if(NOT EXISTS ${_l10n_po_dir} OR NOT EXISTS ${_l10n_poqm_dir}) execute_process(${releaseme_clone_commands}) execute_process(${fetch_commands}) execute_process(${move_translations}) endif() endif() diff --git a/cmake/qt_helper.cmake b/cmake/qt_helper.cmake index 81696e56c..0cc987e4f 100644 --- a/cmake/qt_helper.cmake +++ b/cmake/qt_helper.cmake @@ -1,106 +1,106 @@ function(getQtPluginPaths _plugin_target _absolute_path _subdir _file) getQtPluginsPath(_qt_plugins_path) get_target_property(_plugin_path ${_plugin_target} LOCATION) if(NOT _plugin_path) message(FATAL_ERROR "Could not find ${_plugin_target} plugin path") endif() get_filename_component(_plugin_file ${_plugin_path} NAME) get_filename_component(_plugin_dir ${_plugin_path} PATH) file(RELATIVE_PATH _plugin_subdir ${_qt_plugins_path} ${_plugin_dir}) set(${_absolute_path} ${_plugin_path} PARENT_SCOPE) set(${_subdir} ${_plugin_subdir} PARENT_SCOPE) set(${_file} ${_plugin_file} PARENT_SCOPE) endfunction() # Determine Qt5's plugin-path deriving from lib-dir and trying different # locations corresponding to different directory layouts, e.g.: # # Debian: # /usr/lib/i386-linux-gnu/libQt5Qml.so.5.4.1 # /usr/lib/i386-linux-gnu/qt5/plugins/ # Opensuse: # /usr/lib64/libQt5Multimedia.so.5 # /usr/lib64/qt5/plugins/ # Qt installer: # /opt/Qt5.5.1/5.5/gcc/lib/libQt5Qml.so.5.5.1 # /opt/Qt5.5.1/5.5/gcc/plugins/ # # The qml/-dir is always a sibling of the plugins/ dir. function(getQtPluginsPath _path) get_target_property(_lib_file Qt5::Qml LOCATION) get_filename_component(_lib_dir ${_lib_file} PATH) # try $_lib_dir/qt5/plugins (Debian/Opensuse) set(_plugin_root ${_lib_dir}/qt5/plugins) - if (NOT IS_DIRECTORY ${_plugin_root}) + if(NOT IS_DIRECTORY ${_plugin_root}) # try $_lib_dir/../plugins (Qt installer) get_filename_component(_lib_dir_base ${_lib_dir} PATH) if(APPLE) set(_plugin_root ${_lib_dir_base}/../plugins) else() set(_plugin_root ${_lib_dir_base}/plugins) endif() endif() set(${_path} ${_plugin_root} PARENT_SCOPE) endfunction() function(getQtQmlPath _path) getQtPluginsPath(_qt_plugins_path) get_filename_component(_root ${_qt_plugins_path} PATH) set(${_path} ${_root}/qml PARENT_SCOPE) endfunction() function(installQtPlugin _plugin _dest_dir _lib) getQtPluginPaths(${_plugin} _absolute_path _plugin_subdir _plugin_file) #needed to build with msys2 if(MINGW) string(REGEX REPLACE "share/qt5/" "" _plugin_subdir ${_plugin_subdir}) endif() install(FILES ${_absolute_path} DESTINATION ${_dest_dir}/${_plugin_subdir}) set(_lib "\${CMAKE_INSTALL_PREFIX}/${_dest_dir}/${_plugin_subdir}/${_plugin_file}" PARENT_SCOPE) endfunction() -function(installQtPlugin2 _plugin _dest_dir _lib ) +function(installQtPlugin2 _plugin _dest_dir _lib) get_filename_component(_plugin_file ${_plugin} NAME) set(_ext ${CMAKE_SHARED_LIBRARY_SUFFIX}) get_filename_component(_plugin_subdir ${_plugin} PATH) get_filename_component(_plugin_subdir_root ${_plugin_subdir} PATH) getQtPluginsPath(_qt_plugin_path) install(DIRECTORY ${_qt_plugin_path}/${_plugin_subdir} DESTINATION ${_dest_dir}/${_plugin_subdir_root}) if(CMAKE_HOST_WIN32) set(_dbg_suffix "d") else() set(_dbg_suffix "_debug") endif() set(_install_path \${CMAKE_INSTALL_PREFIX}/${_dest_dir}/${_plugin_subdir}) if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") install(CODE "file(REMOVE \"${_install_path}/${_plugin_file}${_ext}\")") set(_plugin_file ${_plugin_file}${_dbg_suffix}${_ext}) else() install(CODE "file(REMOVE \"${_install_path}/${_plugin_file}${_dbg_suffix}${_ext}\")") set(_plugin_file ${_plugin_file}${_ext}) endif() set(_lib "${_install_path}/${_plugin_file}" PARENT_SCOPE) endfunction() -function(installQmlPlugin _plugin _dest_dir _lib ) +function(installQmlPlugin _plugin _dest_dir _lib) get_filename_component(_plugin_file ${_plugin} NAME) set(_ext ${CMAKE_SHARED_LIBRARY_SUFFIX}) get_filename_component(_qml_subdir ${_plugin} PATH) get_filename_component(_qml_subdir_root ${_qml_subdir} PATH) getQtQmlPath(_qt_qml_path) install(DIRECTORY ${_qt_qml_path}/${_qml_subdir} DESTINATION ${_dest_dir}/${_qml_subdir_root}) if(CMAKE_HOST_WIN32) set(_dbg_suffix "d") else() set(_dbg_suffix "_debug") endif() set(_install_path \${CMAKE_INSTALL_PREFIX}/${_dest_dir}/${_qml_subdir}) if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") install(CODE "file(REMOVE \"${_install_path}/${_plugin_file}${_ext}\")") set(_plugin_file ${_plugin_file}${_dbg_suffix}${_ext}) else() install(CODE "file(REMOVE \"${_install_path}/${_plugin_file}${_dbg_suffix}${_ext}\")") set(_plugin_file ${_plugin_file}${_ext}) endif() set(_lib "${_install_path}/${_plugin_file}" PARENT_SCOPE) endfunction() diff --git a/platforms/sailfishOS/CMakeLists.txt b/platforms/sailfishOS/CMakeLists.txt index dd4f2efcb..364a7c2c4 100644 --- a/platforms/sailfishOS/CMakeLists.txt +++ b/platforms/sailfishOS/CMakeLists.txt @@ -1,27 +1,27 @@ # Fill spec file with all the translation and rcc files foreach(QM_FILE ${QM_FILES}) list(APPEND TRANSLATION_OUTPUT_FILES \"/usr/${_data_dest_dir}/translations/${QM_FILE}\") endforeach() set(TRANSLATION_GENERATED_FILES "") if(TRANSLATION_OUTPUT_FILES) string(REPLACE "\"\"" "\"\n\"" TRANSLATION_GENERATED_FILES ${TRANSLATION_OUTPUT_FILES}) endif() # is there a better way to get all the activity rcc files? get_cmake_property(_variableNames VARIABLES) foreach(_variableName ${_variableNames}) string(FIND ${_variableName} "USE_" isActivity) # return the index if found, -1 else. We look for string that starts with USE_ so 0. if(NOT ${isActivity}) string(SUBSTRING ${_variableName} 4 -1 filename) list(APPEND RCC_OUTPUT_FILES \"/usr/${_data_dest_dir}/rcc/${filename}.rcc\") endif() endforeach() list(APPEND RCC_OUTPUT_FILES \"/usr/${_data_dest_dir}/rcc/menu.rcc\") -list(APPEND RCC_OUTPUT_FILES \"/usr/${_data_dest_dir}/rcc/core.rcc\") +list(APPEND RCC_OUTPUT_FILES \"/usr/${_data_dest_dir}/rcc/core.rcc\") list(APPEND RCC_OUTPUT_FILES \"/usr/${_data_dest_dir}/rcc/activities.rcc\") string(REPLACE "\"\"" "\"\n\"" RCC_GENERATED_FILES ${RCC_OUTPUT_FILES}) configure_file(${PROJECT_SOURCE_DIR}/platforms/sailfishOS/harbour-gcompris-qt.spec.cmake ${CMAKE_BINARY_DIR}/harbour-gcompris-qt.spec @ONLY) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b0229178d..0d8b69148 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,357 +1,356 @@ include(qt_helper) configure_file(config.h.in "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) if(WITH_KIOSK_MODE) add_definitions(-DWITH_KIOSK_MODE) endif() if(SAILFISHOS) add_definitions(-DSAILFISHOS) endif() if(ANDROID) # needed since ECM 5.45 (https://bugs.kde.org/show_bug.cgi?id=394042) include_directories(SYSTEM "${CMAKE_SYSROOT}/usr/include" ) endif() set(gcompris_SRCS - ActivityInfo.cpp - ActivityInfo.h - ActivityInfoTree.cpp - ActivityInfoTree.h - ApplicationInfo.cpp - ApplicationInfo.h - ApplicationSettings.cpp - ApplicationSettings.h - File.cpp - File.h - Directory.cpp - Directory.h - DownloadManager.cpp - DownloadManager.h - GComprisPlugin.cpp - GComprisPlugin.h - main.cpp - config.h.in - synth/ADSRenvelope.cpp - synth/ADSRenvelope.h - synth/GSynth.cpp - synth/GSynth.h - synth/linearSynthesis.cpp - synth/linearSynthesis.h - synth/modulation.cpp - synth/modulation.h - synth/generator.cpp - synth/generator.h - synth/preset.h - synth/preset.cpp - synth/waveform.cpp - synth/waveform.h + ActivityInfo.cpp + ActivityInfo.h + ActivityInfoTree.cpp + ActivityInfoTree.h + ApplicationInfo.cpp + ApplicationInfo.h + ApplicationSettings.cpp + ApplicationSettings.h + File.cpp + File.h + Directory.cpp + Directory.h + DownloadManager.cpp + DownloadManager.h + GComprisPlugin.cpp + GComprisPlugin.h + main.cpp + config.h.in + synth/ADSRenvelope.cpp + synth/ADSRenvelope.h + synth/GSynth.cpp + synth/GSynth.h + synth/linearSynthesis.cpp + synth/linearSynthesis.h + synth/modulation.cpp + synth/modulation.h + synth/generator.cpp + synth/generator.h + synth/preset.h + synth/preset.cpp + synth/waveform.cpp + synth/waveform.h ) if(ANDROID) list(APPEND gcompris_SRCS ApplicationAndroid.cpp) else() list(APPEND gcompris_SRCS ApplicationSettingsDefault.cpp ApplicationInfoDefault.cpp) endif() # Resources set(GCOMPRIS_RESOURCES "${PROJECT_SOURCE_DIR}/installer") if(CMAKE_HOST_WIN32) set(gcompris_icon GCompris.ico) set(gcompris_RES ${GCOMPRIS_RESOURCES}/${gcompris_icon} - GCompris.rc + GCompris.rc ) elseif(CMAKE_HOST_APPLE) set(gcompris_icon GCompris.icns) set(gcompris_RES ${GCOMPRIS_RESOURCES}/${gcompris_icon}) set_source_files_properties(${gcompris_RES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") endif() set(used_qt_modules Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Multimedia Qt5::Core Qt5::Svg Qt5::Xml Qt5::XmlPatterns Qt5::Sensors) if(ANDROID) add_library(${GCOMPRIS_EXECUTABLE_NAME} SHARED ${gcompris_SRCS}) set(used_qt_modules ${used_qt_modules} Qt5::AndroidExtras) elseif(CMAKE_HOST_APPLE) add_executable(${GCOMPRIS_EXECUTABLE_NAME} MACOSX_BUNDLE ${gcompris_SRCS} ${gcompris_RES}) elseif(CMAKE_HOST_WIN32) add_executable(${GCOMPRIS_EXECUTABLE_NAME} WIN32 ${gcompris_SRCS} ${gcompris_RES}) elseif(SAILFISHOS) add_executable(${GCOMPRIS_EXECUTABLE_NAME} ${gcompris_SRCS} ${gcompris_RES}) set(used_qt_modules ${used_qt_modules} Qt5::Widgets) else() add_executable(${GCOMPRIS_EXECUTABLE_NAME} ${gcompris_SRCS} ${gcompris_RES}) endif() # only build the lib for testing purpose if(BUILD_TESTING) add_library(gcompris_core SHARED ${gcompris_SRCS}) target_link_libraries(gcompris_core ${used_qt_modules}) endif() target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} ${used_qt_modules}) GCOMPRIS_ADD_RCC(core *.qml *.js resource/*.${COMPRESSED_AUDIO} resource/*.gif resource/*.png resource/*.svg resource/bonus/* resource/sounds/* resource/fonts/* qmldir COPYING) # Installation # ============ install(TARGETS ${GCOMPRIS_EXECUTABLE_NAME} ARCHIVE DESTINATION bin RUNTIME DESTINATION bin LIBRARY DESTINATION lib BUNDLE DESTINATION .) if(BUILD_STANDALONE) # Qt plugins to install set(_qt_plugins "") if(NOT SAILFISHOS) list(APPEND _qt_plugins Qt5::QJpegPlugin) endif() if(APPLE) list(APPEND _qt_plugins Qt5::QTgaPlugin Qt5::QTiffPlugin Qt5::QCocoaIntegrationPlugin) elseif(WIN32) list(APPEND _qt_plugins Qt5::QWindowsIntegrationPlugin Qt5::QWindowsAudioPlugin Qt5::AudioCaptureServicePlugin Qt5::DSServicePlugin) elseif(UNIX AND NOT ANDROID AND NOT SAILFISHOS) list(APPEND _qt_plugins Qt5::QXcbIntegrationPlugin Qt5::QXcbEglIntegrationPlugin Qt5::QXcbGlxIntegrationPlugin Qt5::QAlsaPlugin Qt5::QPulseAudioPlugin) endif() list(APPEND _qt_plugins Qt5::genericSensorPlugin Qt5::QtSensorGesturePlugin Qt5::QShakeSensorGesturePlugin) # Qml plugins to install if(WIN32) set(_lib_prefix "") else() set(_lib_prefix "lib") endif() set(_qt_plugins2 imageformats/${_lib_prefix}qsvg) if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT SAILFISHOS) list(APPEND _qt_plugins2 mediaservice/${_lib_prefix}gstaudiodecoder mediaservice/${_lib_prefix}gstcamerabin mediaservice/${_lib_prefix}gstmediacapture mediaservice/${_lib_prefix}gstmediaplayer) elseif(APPLE) list(APPEND _qt_plugins2 audio/${_lib_prefix}qtaudio_coreaudio mediaservice/${_lib_prefix}qavfmediaplayer mediaservice/${_lib_prefix}qtmedia_audioengine mediaservice/${_lib_prefix}qavfcamera) endif() - + set(_qml_plugins QtGraphicalEffects/${_lib_prefix}qtgraphicaleffectsplugin QtGraphicalEffects/private/${_lib_prefix}qtgraphicaleffectsprivate QtQuick/Window.2/${_lib_prefix}windowplugin QtQuick/Particles.2/${_lib_prefix}particlesplugin QtQuick.2/${_lib_prefix}qtquick2plugin QtMultimedia/${_lib_prefix}declarative_multimedia QtSensors/${_lib_prefix}declarative_sensors) - + if(NOT SAILFISHOS) list(APPEND _qml_plugins QtQuick/Controls/${_lib_prefix}qtquickcontrolsplugin QtQuick/Layouts/${_lib_prefix}qquicklayoutsplugin) endif() set(GCOMPRIS_OTHER_LIBS) if(APPLE) set(_app gcompris-qt.app) set(_qtconf_destdir ${_app}/Contents/Resources) set(_qt_plugins_destdir ${_app}/Contents/plugins) set(_qt_qml_destdir ${_app}/Contents/qml) set(GCOMPRIS_BUNDLE "\${CMAKE_INSTALL_PREFIX}/${_app}") set_target_properties(gcompris-qt PROPERTIES MACOSX_BUNDLE_INFO_STRING "GCompris, Educational game for children 2 to 10" MACOSX_BUNDLE_ICON_FILE "${gcompris_icon}" MACOSX_BUNDLE_GUI_IDENTIFIER "net.gcompris" MACOSX_BUNDLE_LONG_VERSION_STRING "${GCOMPRIS_MAJOR_VERSION}.${GCOMPRIS_MINOR_VERSION}.${GCOMPRIS_PATCH_VERSION}" MACOSX_BUNDLE_BUNDLE_NAME "gcompris-qt" MACOSX_BUNDLE_SHORT_VERSION_STRING "${GCOMPRIS_VERSION}" MACOSX_BUNDLE_BUNDLE_VERSION "${GCOMPRIS_VERSION}" MACOSX_BUNDLE_COPYRIGHT "GPL License, Copyright 2000-2019 Timothee Giet and Others.") set_source_files_properties(${GCOMPRIS_RESOURCES}/${gcompris_icon} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") else() set(_qtconf_destdir bin) set(_qt_plugins_destdir bin/plugins) set(_qt_qml_destdir bin/qml) if(CMAKE_HOST_WIN32) set(GCOMPRIS_BUNDLE "\${CMAKE_INSTALL_PREFIX}/bin/${GCOMPRIS_EXECUTABLE_NAME}.exe") else() set(GCOMPRIS_BUNDLE "\${CMAKE_INSTALL_PREFIX}/bin/${GCOMPRIS_EXECUTABLE_NAME}") endif() endif() # install qt.conf file install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/qt.conf DESTINATION ${_qtconf_destdir}) # install qt plugins foreach(_plugin ${_qt_plugins}) installQtPlugin(${_plugin} ${_qt_plugins_destdir} _lib) list(APPEND GCOMPRIS_OTHER_LIBS ${_lib}) endforeach() foreach(_plugin ${_qt_plugins2}) if(APPLE) installQtPlugin2(${_plugin} ${_qt_plugins_destdir}/../Plugins _lib) else() installQtPlugin2(${_plugin} ${_qt_plugins_destdir} _lib) endif() list(APPEND GCOMPRIS_OTHER_LIBS ${_lib}) endforeach() # install qml plugins foreach(_plugin ${_qml_plugins}) installQmlPlugin(${_plugin} ${_qt_qml_destdir} _lib) list(APPEND GCOMPRIS_OTHER_LIBS ${_lib}) endforeach() ## install QtGraphicalEffects (which is not a lib but only qml files) # BUT, actually there are some libs in it, and this does not work on APPLE. Moved to _qml_plugins instead # #set(_qml_subdir QtGraphicalEffects) #getQtQmlPath(_qt_qml_path) #install(DIRECTORY ${_qt_qml_path}/QtGraphicalEffects DESTINATION ${_qt_qml_destdir}) # Fix for Linux 'make package' that fails to link with libicu; also package OpenSSL libs from system if(UNIX AND NOT APPLE AND NOT SAILFISHOS AND NOT ANDROID) add_library( libicudata SHARED IMPORTED ) - FILE(GLOB LIBICUDATA_SO "${Qt5_DIR}/../../libicudata.so.[0-9][0-9]") - if ("${LIBICUDATA_SO}" STREQUAL "") - FILE(GLOB LIBICUDATA_SO "/usr/lib/*/libicudata.so.[0-9][0-9]") + file(GLOB LIBICUDATA_SO "${Qt5_DIR}/../../libicudata.so.[0-9][0-9]") + if("${LIBICUDATA_SO}" STREQUAL "") + file(GLOB LIBICUDATA_SO "/usr/lib/*/libicudata.so.[0-9][0-9]") endif() set_target_properties( libicudata PROPERTIES IMPORTED_LOCATION ${LIBICUDATA_SO} ) add_library( libicui18n SHARED IMPORTED ) - FILE(GLOB LIBICUI18N_SO "${Qt5_DIR}/../../libicui18n.so.[0-9][0-9]") - if ("${LIBICUI18N_SO}" STREQUAL "") - FILE(GLOB LIBICUI18N_SO "/usr/lib/*/libicui18n.so.[0-9][0-9]") + file(GLOB LIBICUI18N_SO "${Qt5_DIR}/../../libicui18n.so.[0-9][0-9]") + if("${LIBICUI18N_SO}" STREQUAL "") + file(GLOB LIBICUI18N_SO "/usr/lib/*/libicui18n.so.[0-9][0-9]") endif() set_target_properties( libicui18n PROPERTIES IMPORTED_LOCATION ${LIBICUI18N_SO} ) add_library( libicuuc SHARED IMPORTED ) - FILE(GLOB LIBICUUC_SO "${Qt5_DIR}/../../libicuuc.so.[0-9][0-9]") - if ("${LIBICUUC_SO}" STREQUAL "") - FILE(GLOB LIBICUUC_SO "/usr/lib/*/libicuuc.so.[0-9][0-9]") + file(GLOB LIBICUUC_SO "${Qt5_DIR}/../../libicuuc.so.[0-9][0-9]") + if("${LIBICUUC_SO}" STREQUAL "") + file(GLOB LIBICUUC_SO "/usr/lib/*/libicuuc.so.[0-9][0-9]") endif() set_target_properties( libicuuc PROPERTIES IMPORTED_LOCATION ${LIBICUUC_SO} ) - TARGET_LINK_LIBRARIES(${GCOMPRIS_EXECUTABLE_NAME} libicudata libicui18n libicuuc) + target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} libicudata libicui18n libicuuc) # package installed OpenSSL libraries install(FILES "${OPENSSL_SSL_LIBRARY}" DESTINATION bin) install(FILES "${OPENSSL_CRYPTO_LIBRARY}" DESTINATION bin) install(FILES "${OPENSSL_SSL_LIBRARY}.10" DESTINATION bin) install(FILES "${OPENSSL_CRYPTO_LIBRARY}.10" DESTINATION bin) install(FILES "${OPENSSL_SSL_LIBRARY}.1.0.2k" DESTINATION bin) install(FILES "${OPENSSL_CRYPTO_LIBRARY}.1.0.2k" DESTINATION bin) - TARGET_LINK_LIBRARIES(${GCOMPRIS_EXECUTABLE_NAME} OpenSSL::SSL OpenSSL::Crypto) + target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} OpenSSL::SSL OpenSSL::Crypto) endif() - + #Add OpenSSL support on Windows builds if(WIN32) if(MINGW) if(CMAKE_SIZEOF_VOID_P EQUAL 8) #64bit set(OPENSSL_DLL_SUFFIX "-x64") endif() install(FILES "${Qt5_DIR}/../../../bin/libcrypto-1_1${OPENSSL_DLL_SUFFIX}.dll" DESTINATION bin) install(FILES "${Qt5_DIR}/../../../bin/libssl-1_1${OPENSSL_DLL_SUFFIX}.dll" DESTINATION bin) - else(MINGW) # appveyor + else() # appveyor install(FILES "${OPENSSL_INCLUDE_DIR}/../libeay32.dll" DESTINATION bin) install(FILES "${OPENSSL_INCLUDE_DIR}/../libssl32.dll" DESTINATION bin) install(FILES "${OPENSSL_INCLUDE_DIR}/../ssleay32.dll" DESTINATION bin) endif() target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} OpenSSL::SSL OpenSSL::Crypto) endif() -endif(BUILD_STANDALONE) +endif() # Hack: do not fixup Qt and Qml plugins on Windows because fixup_bundle takes ages (cmake bug ?) -> Johnny : we need this even if it takes time because some required dependencies are pulled here #if(WIN32) set(GCOMPRIS_OTHER_LIBS "") endif() # install fixup_bundle script to resolve and fixup runtime dependencies if(BUILD_STANDALONE AND NOT ANDROID) configure_file(${CMAKE_SOURCE_DIR}/cmake/FixBundle.cmake.in FixBundle.cmake) install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) # install a startup script for linux bundle if(UNIX AND NOT APPLE AND NOT SAILFISHOS) install(PROGRAMS ../../tools/gcompris-qt.sh DESTINATION bin) endif() endif() if(WIN32 AND NOT MINGW) # install libEGL.dll, libGLESv2.dll, d3dcompiler_47.dll from Qt installation. Not sure if there is a clean way to get them... # Qt5_Dir is like C:/Qt/Qt5.5.1/5.5/mingw492_32/lib/cmake/Qt5 install(FILES ${Qt5_DIR}/../../../bin/libEGL.dll DESTINATION bin) install(FILES ${Qt5_DIR}/../../../bin/libGLESv2.dll DESTINATION bin) install(FILES ${Qt5_DIR}/../../../bin/d3dcompiler_47.dll DESTINATION bin) target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} ${Qt5_DIR}/../../libEGL.lib) target_link_libraries(${GCOMPRIS_EXECUTABLE_NAME} ${Qt5_DIR}/../../libGLESv2.lib) install(FILES ${Qt5_DIR}/../../../bin/opengl32sw.dll DESTINATION bin) # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS contains visual c++ libraries install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin) endif() - + # Packaging # ========= set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GCompris is a high quality educational software suite, including a large number of activities for children aged 2 to 10.") set(CPACK_PACKAGE_VERSION_MAJOR ${GCOMPRIS_MAJOR_VERSION}) set(CPACK_PACKAGE_VERSION_MINOR ${GCOMPRIS_MINOR_VERSION}) set(CPACK_PACKAGE_VERSION_PATCH ${GCOMPRIS_PATCH_VERSION}) set(CPACK_PACKAGE_VERSION ${GCOMPRIS_VERSION}) set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README") if(WIN32) set(CPACK_PACKAGE_INSTALL_DIRECTORY "${GCOMPRIS_EXECUTABLE_NAME}-Qt") set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${GCOMPRIS_EXECUTABLE_NAME}-Qt") set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/installer\\\\gcompris-header.bmp") set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/installer\\\\GCompris-install.ico") set(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/installer\\\\GCompris-uninstall.ico") set(CPACK_NSIS_EXECUTABLES_DIRECTORY "bin") set(CPACK_PACKAGE_EXECUTABLES "${GCOMPRIS_EXECUTABLE_NAME};GCompris") set(CPACK_CREATE_DESKTOP_LINKS "${GCOMPRIS_EXECUTABLE_NAME};GCompris") set(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\\\\\gcompris.net") set(CPACK_NSIS_DISPLAY_NAME "GCompris Educational Software") set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${GCOMPRIS_EXECUTABLE_NAME}") set(CPACK_PACKAGE_VENDOR "GCompris team") # Create shortcuts in menu to be able to launch in software or opengl mode list(APPEND CPACK_NSIS_CREATE_ICONS_EXTRA " CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\GCompris (Safe Mode).lnk' '$INSTDIR\\\\bin\\\\${GCOMPRIS_EXECUTABLE_NAME}.exe' '--software-renderer'") list(APPEND CPACK_NSIS_CREATE_ICONS_EXTRA " CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\GCompris.lnk' '$INSTDIR\\\\bin\\\\${GCOMPRIS_EXECUTABLE_NAME}.exe' '--opengl-renderer'") - string (REPLACE ";" "\n" CPACK_NSIS_CREATE_ICONS_EXTRA "${CPACK_NSIS_CREATE_ICONS_EXTRA}") - -else(WIN32) + string(REPLACE ";" "\n" CPACK_NSIS_CREATE_ICONS_EXTRA "${CPACK_NSIS_CREATE_ICONS_EXTRA}") +else() set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/GCompris64.png") endif() if(APPLE) set(CPACK_GENERATOR "DragNDrop") set(CPACK_DMG_DS_STORE "${GCOMPRIS_RESOURCES}/dmg_DS_Store") set(CPACK_DMG_BACKGROUND_IMAGE "${GCOMPRIS_RESOURCES}/dmg_background.png") elseif(WIN32) set(CPACK_GENERATOR "NSIS") elseif(SAILFISHOS) configure_file(${PROJECT_SOURCE_DIR}/platforms/sailfishOS/harbour-gcompris-qt.spec.cmake ${CMAKE_BINARY_DIR}/harbour-gcompris-qt.spec @ONLY) install(FILES ${PROJECT_SOURCE_DIR}/platforms/sailfishOS/harbour-gcompris-qt.desktop DESTINATION share/applications) install(FILES ${PROJECT_SOURCE_DIR}/platforms/sailfishOS/harbour-gcompris-qt.png DESTINATION share/icons/hicolor/86x86/apps) set(CPACK_RPM_PACKAGE_SUMMARY "gcompris-qt") # BUILD_ARCH is either armv7hl or i486 set(CPACK_RPM_PACKAGE_ARCHITECTURE "${BUILD_ARCH}") set(CPACK_RPM_PACKAGE_NAME "${GCOMPRIS_EXECUTABLE_NAME}") set(CPACK_RPM_PACKAGE_VERSION "${GCOMPRIS_VERSION}") set(CPACK_RPM_PACKAGE_LICENSED "GPLv3") set(CPACK_RPM_PACKAGE_URL "https://www.gcompris.org") set(CPACK_RPM_PACKAGE_DESCRIPTION "GCompris is a high quality educational software suite comprising of numerous activities for children aged 2 to 10.") set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_BINARY_DIR}/harbour-gcompris-qt.spec") set(CMAKE_INSTALL_PREFIX "/usr") set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") set(CPACK_GENERATOR "RPM") else() set(CPACK_GENERATOR "STGZ") endif() include(CPack)