From 3ec285829559396ccd06f72106ff1e39cfbd9fcc Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Wed, 10 Aug 2022 10:41:15 +0200 Subject: [PATCH 1/6] chore: add cmake build system - add a cmake based build sytem which is - easy to understand - easy to maintain - covering Linux, Windows and MacOS platforms - allow to build for Qt5 and Qt6 without modifying the cmake files - reasonable structure in QtCreator - create a structure with - concise root CMakeLists.txt - separate files for each src subdirectory - separate files for finding dependencies - currently missing - support for Windows only rudimentary (WIP) - support for MacOS only rudimentary (WIP) - flexible install locations - add `UBPlatformUtile::applicationEtcDirectory()` - use it whenever referencing files in this directory - allow to configure these directories at build time and runtime - create complete installation tree - cover /usr and /opt based installations - move non-config files out of etc - move template files from resources/etc to resources/template - adapt code accessing these resources --- .gitignore | 1 + CMakeLists.txt | 234 ++++++++++++++++++ cmake/DependencyFFmpeg.cmake | 12 + cmake/DependencyOpenSSL.cmake | 7 + cmake/DependencyPoppler.cmake | 20 ++ cmake/DependencyQt.cmake | 39 +++ cmake/DependencyQuaZip.cmake | 43 ++++ cmake/DependencyX11.cmake | 18 ++ cmake/DependencyZlib.cmake | 6 + cmake/FetchContentFreetype.cmake | 13 + cmake/FetchContentPoppler.cmake | 18 ++ cmake/FetchContentQuaZip.cmake | 23 ++ cmake/FetchContentXpdf.cmake | 28 +++ cmake/Platform.cmake | 16 ++ cmake/Version.cmake | 23 ++ plugins/cffadaptor/src/CMakeLists.txt | 7 + resources/forms/CMakeLists.txt | 13 + resources/images/ch.openboard.OpenBoard.svg | 4 + .../linux/ch.openboard.OpenBoard.desktop | 11 + .../linux/ch.openboard.application-ubz.svg | 36 +++ .../linux/ch.openboard.openboard-ubz.xml | 10 + resources/{etc => template}/asyncAPI.js | 0 resources/{etc => template}/img/loading.gif | Bin .../intranet-podcast-metadata.template | 0 ...pper.application.x-shockwave-flash.swf.htm | 0 .../npapi-wrapper.config.xml | 0 src/adaptors/CMakeLists.txt | 38 +++ src/adaptors/UBWidgetUpgradeAdaptor.cpp | 2 +- src/api/CMakeLists.txt | 8 + src/board/CMakeLists.txt | 12 + src/core/CMakeLists.txt | 38 +++ src/core/UBApplication.cpp | 2 +- src/core/UBSettings.cpp | 2 +- src/desktop/CMakeLists.txt | 10 + src/document/CMakeLists.txt | 10 + src/domain/CMakeLists.txt | 58 +++++ src/domain/UBGraphicsWidgetItem.cpp | 10 +- src/frameworks/CMakeLists.txt | 32 +++ src/frameworks/UBPlatformUtils.h | 1 + src/frameworks/UBPlatformUtils_linux.cpp | 14 ++ src/frameworks/UBPlatformUtils_mac.mm | 5 + src/frameworks/UBPlatformUtils_win.cpp | 4 + src/globals/CMakeLists.txt | 3 + src/gui/CMakeLists.txt | 98 ++++++++ src/network/CMakeLists.txt | 14 ++ src/pdf-merger/CMakeLists.txt | 50 ++++ src/pdf/CMakeLists.txt | 8 + src/podcast/CMakeLists.txt | 30 +++ .../intranet/UBIntranetPodcastPublisher.cpp | 2 +- src/tools/CMakeLists.txt | 22 ++ src/web/CMakeLists.txt | 35 +++ src/web/UBWebController.cpp | 2 +- 52 files changed, 1082 insertions(+), 10 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake/DependencyFFmpeg.cmake create mode 100644 cmake/DependencyOpenSSL.cmake create mode 100644 cmake/DependencyPoppler.cmake create mode 100644 cmake/DependencyQt.cmake create mode 100644 cmake/DependencyQuaZip.cmake create mode 100644 cmake/DependencyX11.cmake create mode 100644 cmake/DependencyZlib.cmake create mode 100644 cmake/FetchContentFreetype.cmake create mode 100644 cmake/FetchContentPoppler.cmake create mode 100644 cmake/FetchContentQuaZip.cmake create mode 100644 cmake/FetchContentXpdf.cmake create mode 100644 cmake/Platform.cmake create mode 100644 cmake/Version.cmake create mode 100644 plugins/cffadaptor/src/CMakeLists.txt create mode 100644 resources/forms/CMakeLists.txt create mode 100644 resources/images/ch.openboard.OpenBoard.svg create mode 100644 resources/linux/ch.openboard.OpenBoard.desktop create mode 100644 resources/linux/ch.openboard.application-ubz.svg create mode 100644 resources/linux/ch.openboard.openboard-ubz.xml rename resources/{etc => template}/asyncAPI.js (100%) rename resources/{etc => template}/img/loading.gif (100%) rename resources/{etc => template}/intranet-podcast-metadata.template (100%) rename resources/{etc => template}/npapi-wrapper.application.x-shockwave-flash.swf.htm (100%) rename resources/{etc => template}/npapi-wrapper.config.xml (100%) create mode 100644 src/adaptors/CMakeLists.txt create mode 100644 src/api/CMakeLists.txt create mode 100644 src/board/CMakeLists.txt create mode 100644 src/core/CMakeLists.txt create mode 100644 src/desktop/CMakeLists.txt create mode 100644 src/document/CMakeLists.txt create mode 100644 src/domain/CMakeLists.txt create mode 100644 src/frameworks/CMakeLists.txt create mode 100644 src/globals/CMakeLists.txt create mode 100644 src/gui/CMakeLists.txt create mode 100644 src/network/CMakeLists.txt create mode 100644 src/pdf-merger/CMakeLists.txt create mode 100644 src/pdf/CMakeLists.txt create mode 100644 src/podcast/CMakeLists.txt create mode 100644 src/tools/CMakeLists.txt create mode 100644 src/web/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 5bd5bf9ad..d82a98268 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ Thumbs.db *.vcproj* *.ncb *.pro.user +*.txt.user *.idb .project .settings diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..65b487911 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,234 @@ +cmake_minimum_required(VERSION 3.16) + +# ========================================================================== +# OpenBoard cmake build file +# +# Configuration variables: +# CMAKE_INSTALL_PREFIX +# Path to install prefix, defaults to /usr/local (see cmake documentation) +# Typically set to /usr or /opt +# SYSCONF_INSTALL_DIR +# Path to config file prefix +# Typically set to /etc, defaults to /opt/openboard/etc if CMAKE_INSTALL_PREFIX is /opt +# QT_VERSION +# Qt Version to use +# Set to 5 or 6, defaults to 5 +# +# Typical invocation +# cmake -S -B -DCMAKE_INSTALL_PREFIX:PATH=/usr -DSYSCONF_INSTALL_DIR:PATH=/etc +# or +# cmake -S -B -DCMAKE_INSTALL_PREFIX:PATH=/opt +# +# Build and install +# cmake --build . [-j] +# DESTDIR= cmake --install . +# ========================================================================== + +# ========================================================================== +# Basic project information +# +# The project will now be named all lowercase on all platforms +# ========================================================================== + +project(openboard VERSION 1.7.0 LANGUAGES CXX) + +set(VERSION_TYPE a) # a = alpha, b = beta, rc = release candidate, r = release, other => error +set(VERSION_BUILD 1027) + +include(cmake/Version.cmake) +include(cmake/Platform.cmake) + +# ========================================================================== +# Configuration options +# ========================================================================== + +set(QT_VERSION 5 CACHE STRING "Qt major version number to use - 5 or 6") + +# Internal setting +set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication - do not change") + + +# ========================================================================== +# Non-source file locations +# ========================================================================== + +set(OPENBOARD_QRC_FILE resources/OpenBoard.qrc) + +set(OPENBOARD_FORMS_DIR resources/forms src/web/simplebrowser) +set(OPENBOARD_TS_DIR resources/i18n) +set(OPENBOARD_FONT_DIR resources/customizations resources/fonts) +set(OPENBOARD_ETC_DIR resources/etc) +set(OPENBOARD_LIBRARY_DIR resources/library) +set(OPENBOARD_TEMPLATE_DIR resources/template) + +set(OPENBOARD_ICON_FILE resources/images/ch.openboard.OpenBoard.svg) + +if(LINUX) + set(OPENBOARD_DESKTOP_FILE resources/linux/ch.openboard.OpenBoard.desktop) + set(OPENBOARD_MIMETYPE_FILE resources/linux/ch.openboard.openboard-ubz.xml) + set(OPENBOARD_MIMEICON_FILE resources/linux/ch.openboard.application-ubz.svg) +endif() + + +# ========================================================================== +# Basic compiler settings +# ========================================================================== + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) + +list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS + ${OPENBOARD_FORMS_DIR} +) + +# OpenMP support +include(FindOpenMP) + +if(OPENMP_FOUND) + string(APPEND CMAKE_CXX_FLAGS " " ${OpenMP_CXX_FLAGS}) +endif() + + +# ========================================================================== +# Target and dependencies +# +# Note: the executable is using lowercase on all platforms +# ========================================================================== + +add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE) + +# manage dependencies +include(cmake/DependencyQt.cmake) +include(cmake/DependencyOpenSSL.cmake) +include(cmake/DependencyPoppler.cmake) +include(cmake/DependencyZlib.cmake) + +if(LINUX) + include(cmake/DependencyQuaZip.cmake) + include(cmake/DependencyFFmpeg.cmake) + include(cmake/DependencyX11.cmake) +elseif(WIN32) + include(cmake/FetchContentFreetype.cmake) + include(cmake/FetchContentQuaZip.cmake) +elseif(MACOS) +# TODO +endif() + +# add source path to include directories +target_include_directories(${PROJECT_NAME} PRIVATE + src +) + +# add sources from subdirectories +add_subdirectory(src/adaptors) +add_subdirectory(src/api) +add_subdirectory(src/board) +add_subdirectory(src/core) +add_subdirectory(src/desktop) +add_subdirectory(src/document) +add_subdirectory(src/domain) +add_subdirectory(src/frameworks) +add_subdirectory(src/globals) +add_subdirectory(src/gui) +add_subdirectory(src/network) +add_subdirectory(src/pdf) +add_subdirectory(src/pdf-merger) +add_subdirectory(src/podcast) +add_subdirectory(src/singleapplication) +add_subdirectory(src/tools) +add_subdirectory(src/web) +add_subdirectory(plugins/cffadaptor/src) +add_subdirectory(resources/forms) + +# statically link singleapplication +target_link_libraries(${PROJECT_NAME} + SingleApplication::SingleApplication +) + +# platform specific framework definitions and libraries +if(WIN32) + target_link_libraries(${PROJECT_NAME} + User32 + Gdi32 + AdvApi32 + Ole32 + ) +elseif(MACOS) + target_compile_definitions(${PROJECT_NAME} PRIVATE + Q_WS_MACX + ) + + target_link_libraries(${PROJECT_NAME} + "-framework AVFoundation" + "-framework Carbon" + "-framework Cocoa" + "-framework CoreMedia" + "-framework Foundation" + ) +endif() + + +# ========================================================================== +# Resources +# ========================================================================== + +qt_add_resources(OPENBOARD_RESOURCES ${OPENBOARD_QRC_FILE}) +target_sources(${PROJECT_NAME} PRIVATE ${OPENBOARD_RESOURCES}) + + +# ========================================================================== +# Translations +# ========================================================================== + +file(GLOB OPENBOARD_TS_FILES ${OPENBOARD_TS_DIR}/*.ts) +set_source_files_properties(${OPENBOARD_TS_FILES} PROPERTIES OUTPUT_LOCATION ${PROJECT_BINARY_DIR}/i18n) +qt_add_translation(QM_FILES ${OPENBOARD_TS_FILES}) +target_sources(${PROJECT_NAME} PRIVATE ${QM_FILES}) + + +# ========================================================================== +# Installation +# ========================================================================== + +if(LINUX) + include(GNUInstallDirs) + + # set relative install paths + if(CMAKE_INSTALL_PREFIX STREQUAL "/opt") + set(OPENBOARD_INSTALL_SYSCONFDIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc) + set(OPENBOARD_INSTALL_DATADIR ${PROJECT_NAME}) + set(CMAKE_INSTALL_BINDIR "/usr/bin") + set(CMAKE_INSTALL_DATAROOTDIR "/usr/share") + else() + set(SYSCONF_INSTALL_DIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE PATH + "Install directory for system-wide configuration files") + set(OPENBOARD_INSTALL_SYSCONFDIR ${SYSCONF_INSTALL_DIR}/${PROJECT_NAME}) + set(OPENBOARD_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}) + endif() + + # set absolute install paths + set(OPENBOARD_ETC_PREFIX "${OPENBOARD_INSTALL_SYSCONFDIR}") + set(OPENBOARD_APP_PREFIX "${CMAKE_INSTALL_PREFIX}/${OPENBOARD_INSTALL_DATADIR}") + + message(STATUS "OpenBoard ETC_PREFIX is " ${OPENBOARD_ETC_PREFIX}) + message(STATUS "OpenBoard APP_PREFIX is " ${OPENBOARD_APP_PREFIX}) + + target_compile_definitions(${PROJECT_NAME} PRIVATE + ETC_PREFIX="${OPENBOARD_ETC_PREFIX}" + APP_PREFIX="${OPENBOARD_APP_PREFIX}" + ) + + # install files + install(TARGETS ${PROJECT_NAME} RUNTIME) + install(DIRECTORY ${OPENBOARD_FONT_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) + install(DIRECTORY ${OPENBOARD_ETC_DIR}/ DESTINATION ${OPENBOARD_INSTALL_SYSCONFDIR}) + install(DIRECTORY ${OPENBOARD_LIBRARY_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) + install(DIRECTORY ${OPENBOARD_TEMPLATE_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) + install(DIRECTORY ${PROJECT_BINARY_DIR}/i18n DESTINATION ${OPENBOARD_INSTALL_DATADIR}) + install(FILES ${OPENBOARD_ICON_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) + install(FILES ${OPENBOARD_DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + install(FILES ${OPENBOARD_MIMETYPE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages) + install(FILES ${OPENBOARD_MIMEICON_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/mimetypes) +endif() diff --git a/cmake/DependencyFFmpeg.cmake b/cmake/DependencyFFmpeg.cmake new file mode 100644 index 000000000..c652432e0 --- /dev/null +++ b/cmake/DependencyFFmpeg.cmake @@ -0,0 +1,12 @@ +# Find FFmpeg +# +# FFmpeg only supports PkgConfig + +find_package(PkgConfig REQUIRED) +pkg_check_modules(FFmpeg REQUIRED IMPORTED_TARGET libavcodec libavformat libavutil libswresample libswscale) + +if (FFmpeg_FOUND) + target_link_libraries(${PROJECT_NAME} + PkgConfig::FFmpeg + ) +endif() diff --git a/cmake/DependencyOpenSSL.cmake b/cmake/DependencyOpenSSL.cmake new file mode 100644 index 000000000..e10ba1672 --- /dev/null +++ b/cmake/DependencyOpenSSL.cmake @@ -0,0 +1,7 @@ +# Find OpenSSL + +find_package(OpenSSL 1.1 REQUIRED) + +target_link_libraries(${PROJECT_NAME} + OpenSSL::Crypto +) diff --git a/cmake/DependencyPoppler.cmake b/cmake/DependencyPoppler.cmake new file mode 100644 index 000000000..b25d4af20 --- /dev/null +++ b/cmake/DependencyPoppler.cmake @@ -0,0 +1,20 @@ +# Find poppler + +find_package(Poppler QUIET COMPONENTS Core Cpp) + +if (Poppler_FOUND) + target_link_libraries(${PROJECT_NAME} + Poppler::Core + Poppler::Cpp + ) +else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(Poppler REQUIRED IMPORTED_TARGET poppler poppler-cpp) + + if (Poppler_FOUND) + target_link_libraries(${PROJECT_NAME} + PkgConfig::Poppler + ) + endif() + +endif() diff --git a/cmake/DependencyQt.cmake b/cmake/DependencyQt.cmake new file mode 100644 index 000000000..d8d0a1339 --- /dev/null +++ b/cmake/DependencyQt.cmake @@ -0,0 +1,39 @@ +# Find supported Qt version + +set(QT_COMPONENTS + Concurrent + DBus + Multimedia + MultimediaWidgets + Network + PrintSupport + Svg + UiTools + WebEngineWidgets + Xml +) + +if(QT_VERSION STREQUAL "5") + find_package(Qt5 5.12 REQUIRED COMPONENTS + ${QT_COMPONENTS} + LinguistTools + ) +elseif(QT_VERSION STREQUAL "6") + find_package(Qt6 6.2 REQUIRED COMPONENTS + ${QT_COMPONENTS} + SvgWidgets + LinguistTools + ) + + target_link_libraries(${PROJECT_NAME} + Qt6::SvgWidgets + ) +else() + message(FATAL_ERROR "Qt Version ${QT_VERSION} not supported") +endif() + +list(TRANSFORM QT_COMPONENTS PREPEND Qt::) + +target_link_libraries(${PROJECT_NAME} + ${QT_COMPONENTS} +) diff --git a/cmake/DependencyQuaZip.cmake b/cmake/DependencyQuaZip.cmake new file mode 100644 index 000000000..bd37bac5e --- /dev/null +++ b/cmake/DependencyQuaZip.cmake @@ -0,0 +1,43 @@ +# Find QuaZip + +find_package(QuaZip-Qt${QT_VERSION} 1.0 QUIET) + +if(QuaZip-Qt${QT_VERSION}_FOUND) + target_link_libraries(openboard + QuaZip::QuaZip + ) +else() + # Try to find the package using pkg-config with several names + find_package(PkgConfig REQUIRED) + + pkg_check_modules(QuaZip QUIET IMPORTED_TARGET quazip-qt${QT_VERSION}) + + if(NOT QuaZip_FOUND) + pkg_check_modules(QuaZip QUIET IMPORTED_TARGET quazip1-qt${QT_VERSION}) + endif() + + if(NOT QuaZip_FOUND) + pkg_check_modules(QuaZip QUIET IMPORTED_TARGET libquazip${QT_VERSION}-1) + endif() + + if(NOT QuaZip_FOUND) + pkg_check_modules(QuaZip QUIET IMPORTED_TARGET quazip${QT_VERSION}) + endif() + + if(QuaZip_FOUND) + message(STATUS "Found QuaZip version " ${QuaZip_VERSION}) + target_link_libraries(${PROJECT_NAME} + PkgConfig::QuaZip + ) + else() + # Just assume default directories of QuaZip < 1.0 + message(STATUS "QuaZip not found, assuming default include directory " /usr/include/quazip${QT_VERSION}) + target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE + /usr/include/quazip${QT_VERSION} + ) + target_link_libraries(${PROJECT_NAME} + quazip${QT_VERSION} + ) + endif() +endif() + diff --git a/cmake/DependencyX11.cmake b/cmake/DependencyX11.cmake new file mode 100644 index 000000000..f630160b7 --- /dev/null +++ b/cmake/DependencyX11.cmake @@ -0,0 +1,18 @@ +# Find FFmpeg + +find_package(X11 QUIET) + +if (X11_FOUND) + target_link_libraries(${PROJECT_NAME} + X11 + ) +else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(X11 REQUIRED x11) + + if (X11_FOUND) + target_link_libraries(${PROJECT_NAME} + PkgConfig::X11 + ) + endif() +endif() diff --git a/cmake/DependencyZlib.cmake b/cmake/DependencyZlib.cmake new file mode 100644 index 000000000..d3e8fb651 --- /dev/null +++ b/cmake/DependencyZlib.cmake @@ -0,0 +1,6 @@ +# Find zlib + +find_package(ZLIB REQUIRED) +target_link_libraries(${PROJECT_NAME} + z +) diff --git a/cmake/FetchContentFreetype.cmake b/cmake/FetchContentFreetype.cmake new file mode 100644 index 000000000..2aa5e318e --- /dev/null +++ b/cmake/FetchContentFreetype.cmake @@ -0,0 +1,13 @@ +# Fetch Freetype + +include(FetchContent) + +FetchContent_Declare( + Freetype + GIT_REPOSITORY https://gitlab.freedesktop.org/freetype/freetype.git + GIT_TAG VER-2-12-1 +) + +FetchContent_MakeAvailable( + Freetype +) diff --git a/cmake/FetchContentPoppler.cmake b/cmake/FetchContentPoppler.cmake new file mode 100644 index 000000000..74097bcf6 --- /dev/null +++ b/cmake/FetchContentPoppler.cmake @@ -0,0 +1,18 @@ +# Fetch libpoppler + +include(FetchContent) + +FetchContent_Declare( + Poppler + GIT_REPOSITORY https://gitlab.freedesktop.org/poppler/poppler.git + GIT_TAG poppler-22.08.0 +) + +FetchContent_MakeAvailable( + Poppler +) + +target_link_libraries(${PROJECT_NAME} + Poppler::Core + Poppler::Cpp +) diff --git a/cmake/FetchContentQuaZip.cmake b/cmake/FetchContentQuaZip.cmake new file mode 100644 index 000000000..fe529b1b7 --- /dev/null +++ b/cmake/FetchContentQuaZip.cmake @@ -0,0 +1,23 @@ +# Fetch QuaZip + +include(FetchContent) + +if(QT_VERSION STREQUAL "5") + set(QUAZIP_QT_MAJOR_VERSION 5 CACHE STRING "QuaZip Qt version") +elseif(QT_VERSION STREQUAL "6") + set(QUAZIP_QT_MAJOR_VERSION 6) +endif() + +FetchContent_Declare( + QuaZip + GIT_REPOSITORY https://github.com/stachenov/quazip.git + GIT_TAG v1.3 +) + +FetchContent_MakeAvailable( + QuaZip +) + +target_link_libraries(${PROJECT_NAME} + QuaZip::QuaZip +) diff --git a/cmake/FetchContentXpdf.cmake b/cmake/FetchContentXpdf.cmake new file mode 100644 index 000000000..6a05b2110 --- /dev/null +++ b/cmake/FetchContentXpdf.cmake @@ -0,0 +1,28 @@ +# Fetch xpdf + +include(FetchContent) + +if(QT_VERSION STREQUAL "5") + set(CMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets TRUE) + set(CMAKE_DISABLE_FIND_PACKAGE_Qt4Widgets TRUE) +elseif(QT_VERSION STREQUAL "6") + set(CMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets TRUE) + set(CMAKE_DISABLE_FIND_PACKAGE_Qt4Widgets TRUE) +endif() + +set(CMAKE_POLICY_DEFAULT_CMP0048 NEW) + +FetchContent_Declare( + Xpdf + URL https://dl.xpdfreader.com/xpdf-4.04.tar.gz +) + +FetchContent_MakeAvailable( + Xpdf +) +# this does not work. Xpdf does not build a library for reuse, it only builds executable tools +target_link_libraries(${PROJECT_NAME} + goo + fofi + splash +) diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake new file mode 100644 index 000000000..4085b3d5c --- /dev/null +++ b/cmake/Platform.cmake @@ -0,0 +1,16 @@ +# +# Define LINUX and MACOS platform specifiers +# Set platform specific variables +# + +if(UNIX) + if(APPLE) + set(MACOS 1) + else() + set(LINUX 1) + endif() +endif() + +if(MACOS) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13) +endif() diff --git a/cmake/Version.cmake b/cmake/Version.cmake new file mode 100644 index 000000000..08292aed6 --- /dev/null +++ b/cmake/Version.cmake @@ -0,0 +1,23 @@ +# +# Version +# + +set(VERSION "${${PROJECT_NAME}_VERSION}-${VERSION_TYPE}.${VERSION_BUILD}") + +if(VERSION_TYPE STREQUAL "r") + set(VERSION "${${PROJECT_NAME}_VERSION}") +endif() + +if(WIN32) + set(VERSION_RC "${${PROJECT_NAME}_VERSION_MAJOR},${${PROJECT_NAME}_VERSION_MINOR},${${PROJECT_NAME}_VERSION_PATCH},${VERSION_TYPE},${VERSION_BUILD}") +else() + set(VERSION_RC "${${PROJECT_NAME}_VERSION_MAJOR},${${PROJECT_NAME}_VERSION_MINOR},${${PROJECT_NAME}_VERSION_PATCH},${VERSION_TYPE}") +endif() + +string(REPLACE "a" "160" VERSION_RC ${VERSION_RC}) # 0xA0 +string(REPLACE "b" "176" VERSION_RC ${VERSION_RC}) # 0xB0 +string(REPLACE "rc" "192" VERSION_RC ${VERSION_RC}) # 0xC0 +string(REPLACE "r" "240" VERSION_RC ${VERSION_RC}) # 0xF0 + +add_compile_definitions(UBVERSION="${VERSION}") +add_compile_definitions(UBVERSION_RC=${VERSION_RC}) diff --git a/plugins/cffadaptor/src/CMakeLists.txt b/plugins/cffadaptor/src/CMakeLists.txt new file mode 100644 index 000000000..6109d8fb2 --- /dev/null +++ b/plugins/cffadaptor/src/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(openboard PRIVATE + UBCFFAdaptor.cpp +) + +target_include_directories(${PROJECT_NAME} PRIVATE + . +) diff --git a/resources/forms/CMakeLists.txt b/resources/forms/CMakeLists.txt new file mode 100644 index 000000000..554b52e93 --- /dev/null +++ b/resources/forms/CMakeLists.txt @@ -0,0 +1,13 @@ +qt_add_resources(${PROJECT_NAME} + blackoutWidget.ui + brushProperties.ui + capturePublishing.ui + CMakeLists.txt + documents.ui + intranetPodcastPublishingDialog.ui + mainWindow.ui + preferences.ui + preferences.ui.autosave + trapFlash.ui + youTubePublishingDialog.ui +) diff --git a/resources/images/ch.openboard.OpenBoard.svg b/resources/images/ch.openboard.OpenBoard.svg new file mode 100644 index 000000000..4eecaaa2b --- /dev/null +++ b/resources/images/ch.openboard.OpenBoard.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/linux/ch.openboard.OpenBoard.desktop b/resources/linux/ch.openboard.OpenBoard.desktop new file mode 100644 index 000000000..f7da8c44d --- /dev/null +++ b/resources/linux/ch.openboard.OpenBoard.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=OpenBoard +Comment=OpenBoard, an interactive white board application +Exec=openboard %f +Icon=ch.openboard.OpenBoard +StartupNotify=true +Terminal=false +Type=Application +MimeType=application/ubz +Categories=Education; diff --git a/resources/linux/ch.openboard.application-ubz.svg b/resources/linux/ch.openboard.application-ubz.svg new file mode 100644 index 000000000..0320a2c88 --- /dev/null +++ b/resources/linux/ch.openboard.application-ubz.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/linux/ch.openboard.openboard-ubz.xml b/resources/linux/ch.openboard.openboard-ubz.xml new file mode 100644 index 000000000..aaa7feaf8 --- /dev/null +++ b/resources/linux/ch.openboard.openboard-ubz.xml @@ -0,0 +1,10 @@ + + + + + OpenBoard document file + Document OpenBoard + OpenBoard Dokument + + + diff --git a/resources/etc/asyncAPI.js b/resources/template/asyncAPI.js similarity index 100% rename from resources/etc/asyncAPI.js rename to resources/template/asyncAPI.js diff --git a/resources/etc/img/loading.gif b/resources/template/img/loading.gif similarity index 100% rename from resources/etc/img/loading.gif rename to resources/template/img/loading.gif diff --git a/resources/etc/intranet-podcast-metadata.template b/resources/template/intranet-podcast-metadata.template similarity index 100% rename from resources/etc/intranet-podcast-metadata.template rename to resources/template/intranet-podcast-metadata.template diff --git a/resources/etc/npapi-wrapper.application.x-shockwave-flash.swf.htm b/resources/template/npapi-wrapper.application.x-shockwave-flash.swf.htm similarity index 100% rename from resources/etc/npapi-wrapper.application.x-shockwave-flash.swf.htm rename to resources/template/npapi-wrapper.application.x-shockwave-flash.swf.htm diff --git a/resources/etc/npapi-wrapper.config.xml b/resources/template/npapi-wrapper.config.xml similarity index 100% rename from resources/etc/npapi-wrapper.config.xml rename to resources/template/npapi-wrapper.config.xml diff --git a/src/adaptors/CMakeLists.txt b/src/adaptors/CMakeLists.txt new file mode 100644 index 000000000..ef91e1096 --- /dev/null +++ b/src/adaptors/CMakeLists.txt @@ -0,0 +1,38 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBCFFSubsetAdaptor.cpp + UBCFFSubsetAdaptor.h + UBExportAdaptor.cpp + UBExportAdaptor.h + UBExportCFF.cpp + UBExportCFF.h + UBExportDocument.cpp + UBExportDocument.h + UBExportDocumentSetAdaptor.cpp + UBExportDocumentSetAdaptor.h + UBExportFullPDF.cpp + UBExportFullPDF.h + UBExportPDF.cpp + UBExportPDF.h + UBExportWeb.cpp + UBExportWeb.h + UBImportAdaptor.cpp + UBImportAdaptor.h + UBImportCFF.cpp + UBImportCFF.h + UBImportDocument.cpp + UBImportDocument.h + UBImportDocumentSetAdaptor.cpp + UBImportDocumentSetAdaptor.h + UBImportImage.cpp + UBImportImage.h + UBImportPDF.cpp + UBImportPDF.h + UBMetadataDcSubsetAdaptor.cpp + UBMetadataDcSubsetAdaptor.h + UBSvgSubsetAdaptor.cpp + UBSvgSubsetAdaptor.h + UBThumbnailAdaptor.cpp + UBThumbnailAdaptor.h + UBWidgetUpgradeAdaptor.cpp + UBWidgetUpgradeAdaptor.h +) diff --git a/src/adaptors/UBWidgetUpgradeAdaptor.cpp b/src/adaptors/UBWidgetUpgradeAdaptor.cpp index b3df61105..fe782975c 100644 --- a/src/adaptors/UBWidgetUpgradeAdaptor.cpp +++ b/src/adaptors/UBWidgetUpgradeAdaptor.cpp @@ -206,7 +206,7 @@ UBWidgetUpgradeAdaptor::Widget::Widget(const QString &dir) : m_path(dir), m_hasU if (widgetHashes.empty()) { - QFile widgetsMd5sum(UBPlatformUtils::applicationResourcesDirectory() + "/etc/widgets.md5sum"); + QFile widgetsMd5sum(UBPlatformUtils::applicationEtcDirectory() + "/widgets.md5sum"); if (widgetsMd5sum.open(QIODevice::ReadOnly)) { diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt new file mode 100644 index 000000000..0e2636097 --- /dev/null +++ b/src/api/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBW3CWidgetAPI.cpp + UBW3CWidgetAPI.h + UBWidgetMessageAPI.cpp + UBWidgetMessageAPI.h + UBWidgetUniboardAPI.cpp + UBWidgetUniboardAPI.h +) diff --git a/src/board/CMakeLists.txt b/src/board/CMakeLists.txt new file mode 100644 index 000000000..8e20f849e --- /dev/null +++ b/src/board/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBBoardController.cpp + UBBoardController.h + UBBoardPaletteManager.cpp + UBBoardPaletteManager.h + UBBoardView.cpp + UBBoardView.h + UBDrawingController.cpp + UBDrawingController.h + UBFeaturesController.cpp + UBFeaturesController.h +) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 000000000..eda1052a9 --- /dev/null +++ b/src/core/CMakeLists.txt @@ -0,0 +1,38 @@ +target_sources(${PROJECT_NAME} PRIVATE + main.cpp + UB.h + UBApplication.cpp + UBApplication.h + UBApplicationController.cpp + UBApplicationController.h + UBDisplayManager.cpp + UBDisplayManager.h + UBDocumentManager.cpp + UBDocumentManager.h + UBDownloadManager.cpp + UBDownloadManager.h + UBDownloadThread.cpp + UBDownloadThread.h + UBForeignObjectsHandler.cpp + UBForeignObjectsHandler.h + UBIdleTimer.cpp + UBIdleTimer.h + UBMimeData.cpp + UBMimeData.h + UBOpenSankoreImporter.cpp + UBOpenSankoreImporter.h + UBPersistenceManager.cpp + UBPersistenceManager.h + UBPersistenceWorker.cpp + UBPersistenceWorker.h + UBPreferencesController.cpp + UBPreferencesController.h + UBSceneCache.cpp + UBSceneCache.h + UBSetting.cpp + UBSetting.h + UBSettings.cpp + UBSettings.h + UBTextTools.cpp + UBTextTools.h +) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 45365f916..e164d0183 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -140,7 +140,7 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : Single setStyle("fusion"); - QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationResourcesDirectory() + "/etc/"+ qApp->applicationName()+".css"); + QString css = UBFileSystemUtils::readTextFile(UBPlatformUtils::applicationEtcDirectory() + "/"+ qApp->applicationName()+".css"); if (css.length() > 0) setStyleSheet(css); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 74962bb41..bb7fe2ea0 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -158,7 +158,7 @@ QSettings* UBSettings::getAppSettings() if (!UBSettings::sAppSettings) { QString tmpSettings = QDir::tempPath() + "/" + qApp->applicationName() + ".config"; - QString appSettings = UBPlatformUtils::applicationResourcesDirectory() + "/etc/" + qApp->applicationName() + ".config"; + QString appSettings = UBPlatformUtils::applicationEtcDirectory() + "/" + qApp->applicationName() + ".config"; // tmpSettings exists when upgrading Uniboard on Mac (see UBPlatformUtils_mac.mm updater:willInstallUpdate:) if (QFile::exists(tmpSettings)) diff --git a/src/desktop/CMakeLists.txt b/src/desktop/CMakeLists.txt new file mode 100644 index 000000000..6721aca8a --- /dev/null +++ b/src/desktop/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBCustomCaptureWindow.cpp + UBCustomCaptureWindow.h + UBDesktopAnnotationController.cpp + UBDesktopAnnotationController.h + UBDesktopPalette.cpp + UBDesktopPalette.h + UBDesktopPropertyPalette.cpp + UBDesktopPropertyPalette.h +) diff --git a/src/document/CMakeLists.txt b/src/document/CMakeLists.txt new file mode 100644 index 000000000..01211a908 --- /dev/null +++ b/src/document/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBDocumentContainer.cpp + UBDocumentContainer.h + UBDocumentController.cpp + UBDocumentController.h + UBDocumentProxy.cpp + UBDocumentProxy.h + UBSortFilterProxyModel.cpp + UBSortFilterProxyModel.h +) diff --git a/src/domain/CMakeLists.txt b/src/domain/CMakeLists.txt new file mode 100644 index 000000000..15bcab6b5 --- /dev/null +++ b/src/domain/CMakeLists.txt @@ -0,0 +1,58 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBGraphicsDelegateFrame.cpp + UBGraphicsDelegateFrame.h + UBGraphicsGroupContainerItem.cpp + UBGraphicsGroupContainerItem.h + UBGraphicsGroupContainerItemDelegate.cpp + UBGraphicsGroupContainerItemDelegate.h + UBGraphicsItemDelegate.cpp + UBGraphicsItemDelegate.h + UBGraphicsItemGroupUndoCommand.cpp + UBGraphicsItemGroupUndoCommand.h + UBGraphicsItemTransformUndoCommand.cpp + UBGraphicsItemTransformUndoCommand.h + UBGraphicsItemUndoCommand.cpp + UBGraphicsItemUndoCommand.h + UBGraphicsItemZLevelUndoCommand.cpp + UBGraphicsItemZLevelUndoCommand.h + UBGraphicsMediaItem.cpp + UBGraphicsMediaItem.h + UBGraphicsMediaItemDelegate.cpp + UBGraphicsMediaItemDelegate.h + UBGraphicsPDFItem.cpp + UBGraphicsPDFItem.h + UBGraphicsPixmapItem.cpp + UBGraphicsPixmapItem.h + UBGraphicsPolygonItem.cpp + UBGraphicsPolygonItem.h + UBGraphicsScene.cpp + UBGraphicsScene.h + UBGraphicsStroke.cpp + UBGraphicsStroke.h + UBGraphicsStrokesGroup.cpp + UBGraphicsStrokesGroup.h + UBGraphicsSvgItem.cpp + UBGraphicsSvgItem.h + UBGraphicsTextItem.cpp + UBGraphicsTextItem.h + UBGraphicsTextItemDelegate.cpp + UBGraphicsTextItemDelegate.h + UBGraphicsTextItemUndoCommand.cpp + UBGraphicsTextItemUndoCommand.h + UBGraphicsWidgetItem.cpp + UBGraphicsWidgetItem.h + UBGraphicsWidgetItemDelegate.cpp + UBGraphicsWidgetItemDelegate.h + UBItem.cpp + UBItem.h + UBPageSizeUndoCommand.cpp + UBPageSizeUndoCommand.h + UBResizableGraphicsItem.cpp + UBResizableGraphicsItem.h + UBSelectionFrame.cpp + UBSelectionFrame.h + UBUndoCommand.cpp + UBUndoCommand.h + UBWebEngineView.cpp + UBWebEngineView.h +) diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 73796cefd..f93ae5d3d 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -1280,14 +1280,14 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates() if (!sTemplateLoaded) { sNPAPIWrapperTemplates.clear(); - QString etcPath = UBPlatformUtils::applicationResourcesDirectory() + "/etc/"; + QString templatePath = UBPlatformUtils::applicationResourcesDirectory() + "/template/"; - QDir etcDir(etcPath); + QDir templateDir(templatePath); - foreach(QString fileName, etcDir.entryList()) { + foreach(QString fileName, templateDir.entryList()) { if (fileName.startsWith("npapi-wrapper") && (fileName.endsWith(".htm") || fileName.endsWith(".html"))) { - QString htmlContent = UBFileSystemUtils::readTextFile(etcPath + fileName); + QString htmlContent = UBFileSystemUtils::readTextFile(templatePath + fileName); if (htmlContent.length() > 0) { QStringList tokens = fileName.split("."); @@ -1304,7 +1304,7 @@ void UBGraphicsW3CWidgetItem::loadNPAPIWrappersTemplates() } } } - sNPAPIWrappperConfigTemplate = UBFileSystemUtils::readTextFile(etcPath + "npapi-wrapper.config.xml"); + sNPAPIWrappperConfigTemplate = UBFileSystemUtils::readTextFile(templatePath + "npapi-wrapper.config.xml"); sTemplateLoaded = true; } } diff --git a/src/frameworks/CMakeLists.txt b/src/frameworks/CMakeLists.txt new file mode 100644 index 000000000..3bb0d7766 --- /dev/null +++ b/src/frameworks/CMakeLists.txt @@ -0,0 +1,32 @@ +target_sources(openboard PRIVATE + UBBase32.cpp + UBBase32.h + UBCoreGraphicsScene.cpp + UBCoreGraphicsScene.h + UBCryptoUtils.cpp + UBCryptoUtils.h + UBFileSystemUtils.cpp + UBFileSystemUtils.h + UBGeometryUtils.cpp + UBGeometryUtils.h + UBPlatformUtils.cpp + UBPlatformUtils.h + UBStringUtils.cpp + UBStringUtils.h + UBVersion.cpp + UBVersion.h +) + +if(LINUX) + target_sources(openboard PRIVATE + UBPlatformUtils_linux.cpp + ) +elseif(WIN32) + target_sources(openboard PRIVATE + UBPlatformUtils_win.cpp + ) +elseif(MACOS) + target_sources(openboard PRIVATE + UBPlatformUtils_mac.mm + ) +endif() diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 3717f1e33..953af0cda 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -191,6 +191,7 @@ class UBPlatformUtils static void init(); static void destroy(); static QString applicationResourcesDirectory(); + static QString applicationEtcDirectory(); static void hideFile(const QString &filePath); static void setFileType(const QString &filePath, unsigned long fileType); static void fadeDisplayOut(); diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index e80dff306..117c6b7bf 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,20 @@ void UBPlatformUtils::init() QString UBPlatformUtils::applicationResourcesDirectory() { +#ifdef APP_PREFIX + return QProcessEnvironment::systemEnvironment().value("APP_PREFIX", APP_PREFIX); +#else return QApplication::applicationDirPath(); +#endif +} + +QString UBPlatformUtils::applicationEtcDirectory() +{ +#ifdef ETC_PREFIX + return QProcessEnvironment::systemEnvironment().value("ETC_PREFIX", ETC_PREFIX); +#else + return applicationResourcesDirectory() + "/etc"; +#endif } void UBPlatformUtils::hideFile(const QString &filePath) diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 0be545ca9..d7adbcbc8 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -123,6 +123,11 @@ OSStatus emptySetSystemUIMode ( return path; } +QString UBPlatformUtils::applicationEtcDirectory() +{ + return applicationResourcesDirectory() + "/etc"; +} + void UBPlatformUtils::hideFile(const QString &filePath) { FSRef ref; diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index 2931b56b1..f084ba012 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -53,6 +53,10 @@ QString UBPlatformUtils::applicationResourcesDirectory() return QApplication::applicationDirPath(); } +QString UBPlatformUtils::applicationEtcDirectory() +{ + return applicationResourcesDirectory() + "/etc"; +} void UBPlatformUtils::hideFile(const QString &filePath) { diff --git a/src/globals/CMakeLists.txt b/src/globals/CMakeLists.txt new file mode 100644 index 000000000..f49f865ec --- /dev/null +++ b/src/globals/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBGlobals.h +) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt new file mode 100644 index 000000000..524041d07 --- /dev/null +++ b/src/gui/CMakeLists.txt @@ -0,0 +1,98 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBActionPalette.cpp + UBActionPalette.h + UBBackgroundPalette.cpp + UBBackgroundPalette.h + UBBlackoutWidget.cpp + UBBlackoutWidget.h + UBBoardThumbnailsView.cpp + UBBoardThumbnailsView.h + UBCachePropertiesWidget.cpp + UBCachePropertiesWidget.h + UBCircleFrame.cpp + UBCircleFrame.h + UBColorPicker.cpp + UBColorPicker.h + UBDockDownloadWidget.cpp + UBDockDownloadWidget.h + UBDockPalette.cpp + UBDockPalette.h + UBDockPaletteWidget.cpp + UBDockPaletteWidget.h + UBDocumentThumbnailWidget.cpp + UBDocumentThumbnailWidget.h + UBDocumentToolsPalette.cpp + UBDocumentToolsPalette.h + UBDownloadWidget.cpp + UBDownloadWidget.h + UBFavoriteToolPalette.cpp + UBFavoriteToolPalette.h + UBFeaturesActionBar.cpp + UBFeaturesActionBar.h + UBFeaturesWidget.cpp + UBFeaturesWidget.h + UBFloatingPalette.cpp + UBFloatingPalette.h + UBIconButton.cpp + UBIconButton.h + UBKeyboardPalette.cpp + UBKeyboardPalette.h + UBLeftPalette.cpp + UBLeftPalette.h + UBMagnifer.cpp + UBMagnifer.h + UBMainWindow.cpp + UBMainWindow.h + UBMessageWindow.cpp + UBMessageWindow.h + UBMessagesDialog.cpp + UBMessagesDialog.h + UBMousePressFilter.cpp + UBMousePressFilter.h + UBOpenSankoreImporterWidget.cpp + UBOpenSankoreImporterWidget.h + UBPageNavigationWidget.cpp + UBPageNavigationWidget.h + UBPropertyPalette.cpp + UBPropertyPalette.h + UBResources.cpp + UBResources.h + UBRightPalette.cpp + UBRightPalette.h + UBRubberBand.cpp + UBRubberBand.h + UBScreenMirror.cpp + UBScreenMirror.h + UBSpinningWheel.cpp + UBSpinningWheel.h + UBStartupHintsPalette.cpp + UBStartupHintsPalette.h + UBStylusPalette.cpp + UBStylusPalette.h + UBThumbnailView.cpp + UBThumbnailView.h + UBThumbnailWidget.cpp + UBThumbnailWidget.h + UBToolWidget.cpp + UBToolWidget.h + UBToolbarButtonGroup.cpp + UBToolbarButtonGroup.h + UBUpdateDlg.cpp + UBUpdateDlg.h + UBWebToolsPalette.cpp + UBWebToolsPalette.h + UBWidgetMirror.cpp + UBWidgetMirror.h + UBZoomPalette.cpp + UBZoomPalette.h +) + +if(LINUX) + target_sources(openboard PRIVATE + UBKeyboardPalette_linux.cpp + ) +elseif(WIN32) + target_sources(openboard PRIVATE + UBKeyboardPalette_win.cpp + ) +endif() diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt new file mode 100644 index 000000000..c8a76aa13 --- /dev/null +++ b/src/network/CMakeLists.txt @@ -0,0 +1,14 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBAutoSaver.cpp + UBAutoSaver.h + UBCookieJar.cpp + UBCookieJar.h + UBHttpFileDownloader.cpp + UBHttpFileDownloader.h + UBHttpGet.cpp + UBHttpGet.h + UBNetworkAccessManager.cpp + UBNetworkAccessManager.h + UBServerXMLHttpRequest.cpp + UBServerXMLHttpRequest.h +) diff --git a/src/pdf-merger/CMakeLists.txt b/src/pdf-merger/CMakeLists.txt new file mode 100644 index 000000000..e70903075 --- /dev/null +++ b/src/pdf-merger/CMakeLists.txt @@ -0,0 +1,50 @@ +target_sources(${PROJECT_NAME} PRIVATE + ASCII85Decode.cpp + ASCII85Decode.h + ASCIIHexDecode.cpp + ASCIIHexDecode.h + AnnotsHandler.cpp + AnnotsHandler.h + CCITTFaxDecode.cpp + CCITTFaxDecode.h + ContentHandler.cpp + ContentHandler.h + DCTDecode.cpp + DCTDecode.h + Document.cpp + Document.h + Filter.cpp + Filter.h + FilterPredictor.cpp + FilterPredictor.h + FlateDecode.cpp + FlateDecode.h + JBIG2Decode.cpp + JBIG2Decode.h + LZWDecode.cpp + LZWDecode.h + Merger.cpp + Merger.h + Object.cpp + Object.h + OverlayDocumentParser.cpp + OverlayDocumentParser.h + Page.cpp + Page.h + PageElementHandler.cpp + PageElementHandler.h + Parser.cpp + Parser.h + Rectangle.cpp + Rectangle.h + RemoveHimselfHandler.cpp + RemoveHimSelfHandler.h + RunLengthDecode.cpp + RunLengthDecode.h + Utils.cpp + Utils.h +) + +target_include_directories(${PROJECT_NAME} PRIVATE + . +) diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt new file mode 100644 index 000000000..278eb64d2 --- /dev/null +++ b/src/pdf/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${PROJECT_NAME} PRIVATE + GraphicsPDFItem.cpp + GraphicsPDFItem.h + PDFRenderer.cpp + PDFRenderer.h + XPDFRenderer.cpp + XPDFRenderer.h +) diff --git a/src/podcast/CMakeLists.txt b/src/podcast/CMakeLists.txt new file mode 100644 index 000000000..ca7087809 --- /dev/null +++ b/src/podcast/CMakeLists.txt @@ -0,0 +1,30 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBAbstractVideoEncoder.cpp + UBAbstractVideoEncoder.h + UBPodcastController.cpp + UBPodcastController.h + UBPodcastRecordingPalette.cpp + UBPodcastRecordingPalette.h + intranet/UBIntranetPodcastPublisher.cpp + intranet/UBIntranetPodcastPublisher.h + youtube/UBYouTubePublisher.cpp + youtube/UBYouTubePublisher.h +) + +if(WIN32) + target_sources(${PROJECT_NAME} PRIVATE + windowsmedia/UBWindowsMediaVideoEncoder.cpp + windowsmedia/UBWindowsMediaVideoEncoder.h + windowsmedia/UBWindowsMediaFile.cpp + windowsmedia/UBWindowsMediaFile.h + windowsmedia/UBWaveRecorder.cpp + windowsmedia/UBWaveRecorder.h + ) +else() + target_sources(${PROJECT_NAME} PRIVATE + ffmpeg/UBFFmpegVideoEncoder.cpp + ffmpeg/UBFFmpegVideoEncoder.h + ffmpeg/UBMicrophoneInput.cpp + ffmpeg/UBMicrophoneInput.h + ) +endif() diff --git a/src/podcast/intranet/UBIntranetPodcastPublisher.cpp b/src/podcast/intranet/UBIntranetPodcastPublisher.cpp index 3f9a96f40..d7a107b64 100644 --- a/src/podcast/intranet/UBIntranetPodcastPublisher.cpp +++ b/src/podcast/intranet/UBIntranetPodcastPublisher.cpp @@ -154,7 +154,7 @@ QString UBIntranetPodcastPublisher::metadata() QString computerName = UBPlatformUtils::computerName(); QString fileSize = QString("%1").arg(fi.size()); - QString templatePath = UBPlatformUtils::applicationResourcesDirectory() + "/etc/intranet-podcast-metadata.template"; + QString templatePath = UBPlatformUtils::applicationResourcesDirectory() + "/template/intranet-podcast-metadata.template"; QString templateContent = UBFileSystemUtils::readTextFile(templatePath); return templateContent.replace("{title}", mTitle) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt new file mode 100644 index 000000000..3886d6963 --- /dev/null +++ b/src/tools/CMakeLists.txt @@ -0,0 +1,22 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBAbstractDrawRuler.cpp + UBAbstractDrawRuler.h + UBGraphicsAxes.cpp + UBGraphicsAxes.h + UBGraphicsCache.cpp + UBGraphicsCache.h + UBGraphicsCompass.cpp + UBGraphicsCompass.h + UBGraphicsCurtainItem.cpp + UBGraphicsCurtainItem.h + UBGraphicsCurtainItemDelegate.cpp + UBGraphicsCurtainItemDelegate.h + UBGraphicsProtractor.cpp + UBGraphicsProtractor.h + UBGraphicsRuler.cpp + UBGraphicsRuler.h + UBGraphicsTriangle.cpp + UBGraphicsTriangle.h + UBToolsManager.cpp + UBToolsManager.h +) diff --git a/src/web/CMakeLists.txt b/src/web/CMakeLists.txt new file mode 100644 index 000000000..45277ec12 --- /dev/null +++ b/src/web/CMakeLists.txt @@ -0,0 +1,35 @@ +target_sources(${PROJECT_NAME} PRIVATE + UBEmbedContent.cpp + UBEmbedContent.h + UBEmbedController.cpp + UBEmbedController.h + UBEmbedParser.cpp + UBEmbedParser.h + UBWebController.cpp + UBWebController.h + simplebrowser/WBHistory.cpp + simplebrowser/WBHistory.h + simplebrowser/WBModelMenu.cpp + simplebrowser/WBModelMenu.h + simplebrowser/browserwindow.cpp + simplebrowser/browserwindow.h + simplebrowser/downloadmanagerwidget.cpp + simplebrowser/downloadmanagerwidget.h + simplebrowser/downloadwidget.cpp + simplebrowser/downloadwidget.h + simplebrowser/tabwidget.cpp + simplebrowser/tabwidget.h + simplebrowser/webpage.cpp + simplebrowser/webpage.h + simplebrowser/webpopupwindow.cpp + simplebrowser/webpopupwindow.h + simplebrowser/webview.cpp + simplebrowser/webview.h +) + +qt_add_resources(${PROJECT_NAME} + simplebrowser/certificateerrordialog.ui + simplebrowser/downloadmanagerwidget.ui + simplebrowser/downloadwidget.ui + simplebrowser/passworddialog.ui +) diff --git a/src/web/UBWebController.cpp b/src/web/UBWebController.cpp index c57a3c454..29738daff 100644 --- a/src/web/UBWebController.cpp +++ b/src/web/UBWebController.cpp @@ -428,7 +428,7 @@ void UBWebController::injectScripts(QWebEngineView *view) qDebug() << "Injecting qwebchannel.js"; QString src = js.readAll(); - QFile asyncwrapper(UBPlatformUtils::applicationResourcesDirectory() + "/etc/asyncAPI.js"); + QFile asyncwrapper(UBPlatformUtils::applicationResourcesDirectory() + "/template/asyncAPI.js"); if (asyncwrapper.open(QIODevice::ReadOnly)) { From ec95135c4aea791fd78cf78b9eb600618c7ae591 Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Sun, 30 Oct 2022 08:09:24 +0100 Subject: [PATCH 2/6] fix: compatibility with Qt 5.12 and Qt 6 - use qt5_add_resources and qt5_add_translation for Qt 5.12 - add .ui and .ts files using target_sources - add QT_VERSION when linking to Qt libraries (needed for Qt 5.12) --- CMakeLists.txt | 18 +++++++++++++++--- cmake/DependencyQt.cmake | 2 +- resources/forms/CMakeLists.txt | 3 +-- src/web/CMakeLists.txt | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65b487911..f6900ac39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ cmake_minimum_required(VERSION 3.16) # cmake -S -B -DCMAKE_INSTALL_PREFIX:PATH=/opt # # Build and install +# cd # cmake --build . [-j] # DESTDIR= cmake --install . # ========================================================================== @@ -174,7 +175,12 @@ endif() # Resources # ========================================================================== -qt_add_resources(OPENBOARD_RESOURCES ${OPENBOARD_QRC_FILE}) +if(Qt5_VERSION AND Qt5_VERSION VERSION_LESS "5.15") + qt5_add_resources(OPENBOARD_RESOURCES ${OPENBOARD_QRC_FILE}) +else() + qt_add_resources(OPENBOARD_RESOURCES ${OPENBOARD_QRC_FILE}) +endif() + target_sources(${PROJECT_NAME} PRIVATE ${OPENBOARD_RESOURCES}) @@ -184,8 +190,14 @@ target_sources(${PROJECT_NAME} PRIVATE ${OPENBOARD_RESOURCES}) file(GLOB OPENBOARD_TS_FILES ${OPENBOARD_TS_DIR}/*.ts) set_source_files_properties(${OPENBOARD_TS_FILES} PROPERTIES OUTPUT_LOCATION ${PROJECT_BINARY_DIR}/i18n) -qt_add_translation(QM_FILES ${OPENBOARD_TS_FILES}) -target_sources(${PROJECT_NAME} PRIVATE ${QM_FILES}) + +if(Qt5_VERSION AND Qt5_VERSION VERSION_LESS "5.15") + qt5_add_translation(QM_FILES ${OPENBOARD_TS_FILES}) +else() + qt_add_translation(QM_FILES ${OPENBOARD_TS_FILES}) +endif() + +target_sources(${PROJECT_NAME} PRIVATE ${QM_FILES} ${OPENBOARD_TS_FILES}) # ========================================================================== diff --git a/cmake/DependencyQt.cmake b/cmake/DependencyQt.cmake index d8d0a1339..506f12293 100644 --- a/cmake/DependencyQt.cmake +++ b/cmake/DependencyQt.cmake @@ -32,7 +32,7 @@ else() message(FATAL_ERROR "Qt Version ${QT_VERSION} not supported") endif() -list(TRANSFORM QT_COMPONENTS PREPEND Qt::) +list(TRANSFORM QT_COMPONENTS PREPEND Qt${QT_VERSION}::) target_link_libraries(${PROJECT_NAME} ${QT_COMPONENTS} diff --git a/resources/forms/CMakeLists.txt b/resources/forms/CMakeLists.txt index 554b52e93..547ea5411 100644 --- a/resources/forms/CMakeLists.txt +++ b/resources/forms/CMakeLists.txt @@ -1,4 +1,4 @@ -qt_add_resources(${PROJECT_NAME} +target_sources(${PROJECT_NAME} PRIVATE blackoutWidget.ui brushProperties.ui capturePublishing.ui @@ -7,7 +7,6 @@ qt_add_resources(${PROJECT_NAME} intranetPodcastPublishingDialog.ui mainWindow.ui preferences.ui - preferences.ui.autosave trapFlash.ui youTubePublishingDialog.ui ) diff --git a/src/web/CMakeLists.txt b/src/web/CMakeLists.txt index 45277ec12..590476e34 100644 --- a/src/web/CMakeLists.txt +++ b/src/web/CMakeLists.txt @@ -27,7 +27,7 @@ target_sources(${PROJECT_NAME} PRIVATE simplebrowser/webview.h ) -qt_add_resources(${PROJECT_NAME} +target_sources(${PROJECT_NAME} PRIVATE simplebrowser/certificateerrordialog.ui simplebrowser/downloadmanagerwidget.ui simplebrowser/downloadwidget.ui From 86903f2fb91193fae1d2af9a5895734f137036d8 Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Sat, 5 Nov 2022 08:52:48 +0100 Subject: [PATCH 3/6] chore: add cpack packaging (by @sebojolais) - add cpack packaging instructions - configure for deb and rpm packages based on proposal of @sebojolais --- CMakeLists.txt | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6900ac39..ebd94ffce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,9 @@ cmake_minimum_required(VERSION 3.16) # cd # cmake --build . [-j] # DESTDIR= cmake --install . +# +# Package +# cpack -G # ========================================================================== # ========================================================================== @@ -31,7 +34,12 @@ cmake_minimum_required(VERSION 3.16) # The project will now be named all lowercase on all platforms # ========================================================================== -project(openboard VERSION 1.7.0 LANGUAGES CXX) +project(openboard + VERSION 1.7.0 + DESCRIPTION "OpenBoard is an open source cross-platform interactive white board application designed primarily for use in schools. It was originally forked from Open-Sankoré, which was itself based on Uniboard." + HOMEPAGE_URL "https://www.openboard.org" + LANGUAGES CXX +) set(VERSION_TYPE a) # a = alpha, b = beta, rc = release candidate, r = release, other => error set(VERSION_BUILD 1027) @@ -244,3 +252,25 @@ if(LINUX) install(FILES ${OPENBOARD_MIMETYPE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages) install(FILES ${OPENBOARD_MIMEICON_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/mimetypes) endif() + + +# ========================================================================== +# Packaging +# ========================================================================== + +include(InstallRequiredSystemLibraries) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION "${VERSION}") +set(CPACK_PACKAGE_CONTACT "The OpenBoard team") +set(CPACK_STRIP_FILES TRUE) + +# Debian specific settings +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") +set(CPACK_DEBIAN_PACKAGE_SUGGESTS onboard) + +# RPM specific settings +set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") +set(CPACK_RPM_PACKAGE_SUGGESTS onboard) + +# create packager +include(CPack) From f18b9ccde44c3e014a247684a8966816df3b3e4f Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Sat, 3 Dec 2022 18:30:14 +0100 Subject: [PATCH 4/6] fixup: remove unused UBIdleTimer --- src/core/CMakeLists.txt | 2 -- src/core/UBApplication.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index eda1052a9..2b362252e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -15,8 +15,6 @@ target_sources(${PROJECT_NAME} PRIVATE UBDownloadThread.h UBForeignObjectsHandler.cpp UBForeignObjectsHandler.h - UBIdleTimer.cpp - UBIdleTimer.h UBMimeData.cpp UBMimeData.h UBOpenSankoreImporter.cpp diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index e164d0183..d89c2009a 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -43,7 +43,6 @@ #include "UBPersistenceManager.h" #include "UBDocumentManager.h" #include "UBPreferencesController.h" -#include "UBIdleTimer.h" #include "UBApplicationController.h" #include "board/UBBoardController.h" From 34c09bc5d984398cd31cf25538701a871e9d5d25 Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Wed, 21 Dec 2022 11:47:59 +0100 Subject: [PATCH 5/6] chore: allow to set build version for build - make VERSION_BUILD and VERSION_TYPE CACHE variables - this allows to overwrite them using -D when invoking cmake --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebd94ffce..5d884045d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,8 @@ project(openboard LANGUAGES CXX ) -set(VERSION_TYPE a) # a = alpha, b = beta, rc = release candidate, r = release, other => error -set(VERSION_BUILD 1027) +set(VERSION_TYPE r CACHE STRING "a = alpha, b = beta, rc = release candidate, r = release") +set(VERSION_BUILD 1027 CACHE STRING "Build version for non-release builds") include(cmake/Version.cmake) include(cmake/Platform.cmake) From a91f2cecb1f8bfcece4565c083875936a71034f1 Mon Sep 17 00:00:00 2001 From: letsfindaway Date: Fri, 24 Mar 2023 14:15:12 +0100 Subject: [PATCH 6/6] feat: add startup hints to cmake build - package startupHints directory - use absolute paths to make webengine happy --- CMakeLists.txt | 2 ++ src/frameworks/UBPlatformUtils_linux.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d884045d..6d4887722 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ set(OPENBOARD_FONT_DIR resources/customizations resources/fonts) set(OPENBOARD_ETC_DIR resources/etc) set(OPENBOARD_LIBRARY_DIR resources/library) set(OPENBOARD_TEMPLATE_DIR resources/template) +set(OPENBOARD_STARTUP_HINTS resources/startupHints) set(OPENBOARD_ICON_FILE resources/images/ch.openboard.OpenBoard.svg) @@ -246,6 +247,7 @@ if(LINUX) install(DIRECTORY ${OPENBOARD_ETC_DIR}/ DESTINATION ${OPENBOARD_INSTALL_SYSCONFDIR}) install(DIRECTORY ${OPENBOARD_LIBRARY_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) install(DIRECTORY ${OPENBOARD_TEMPLATE_DIR} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) + install(DIRECTORY ${OPENBOARD_STARTUP_HINTS} DESTINATION ${OPENBOARD_INSTALL_DATADIR}) install(DIRECTORY ${PROJECT_BINARY_DIR}/i18n DESTINATION ${OPENBOARD_INSTALL_DATADIR}) install(FILES ${OPENBOARD_ICON_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps) install(FILES ${OPENBOARD_DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 117c6b7bf..1328539de 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -55,7 +55,8 @@ void UBPlatformUtils::init() QString UBPlatformUtils::applicationResourcesDirectory() { #ifdef APP_PREFIX - return QProcessEnvironment::systemEnvironment().value("APP_PREFIX", APP_PREFIX); + QString prefix = QProcessEnvironment::systemEnvironment().value("APP_PREFIX", APP_PREFIX); + return QFileInfo(prefix).absoluteFilePath(); #else return QApplication::applicationDirPath(); #endif @@ -64,7 +65,8 @@ QString UBPlatformUtils::applicationResourcesDirectory() QString UBPlatformUtils::applicationEtcDirectory() { #ifdef ETC_PREFIX - return QProcessEnvironment::systemEnvironment().value("ETC_PREFIX", ETC_PREFIX); + QString prefix = QProcessEnvironment::systemEnvironment().value("ETC_PREFIX", ETC_PREFIX); + return QFileInfo(prefix).absoluteFilePath(); #else return applicationResourcesDirectory() + "/etc"; #endif