132 lines
4.1 KiB
CMake
132 lines
4.1 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(presenter)
|
|
set(APP_NAME ${PROJECT_NAME})
|
|
|
|
include(FeatureSummary)
|
|
|
|
set(QT5_MIN_VERSION 5.15)
|
|
set(KF5_MIN_VERSION 5.83)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
#set(CMAKE_C_COMPILER gcc)
|
|
#set(CMAKE_CXX_COMPILER g++)
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
include(KDEInstallDirs)
|
|
include(KDECMakeSettings)
|
|
include(KDECompilerSettings NO_POLICY_SCOPE)
|
|
include(ECMSetupVersion)
|
|
include(ECMGenerateHeaders)
|
|
include(ECMPoQmTools)
|
|
|
|
kde_enable_exceptions()
|
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Widgets Sql X11Extras QmlImportScanner)
|
|
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 WindowSystem I18n Archive CoreAddons)
|
|
|
|
find_package(FFmpeg)
|
|
set_package_properties(FFmpeg PROPERTIES TYPE REQUIRED)
|
|
|
|
find_package(Libmpv)
|
|
set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
|
|
|
find_package(YouTubeDl)
|
|
set_package_properties(YouTubeDl PROPERTIES TYPE RUNTIME)
|
|
|
|
find_package(Ytdlp)
|
|
set_package_properties(Ytdlp PROPERTIES TYPE RUNTIME)
|
|
|
|
FIND_PACKAGE(LibPoDoFo)
|
|
IF(NOT LIBPODOFO_FOUND)
|
|
MESSAGE("+++PoDoFo not found... building private copy")
|
|
SET(PODOFO_BUILD_STATIC 1)
|
|
SET(PODOFO_BUILD_SHARED 0)
|
|
SET(PODOFO_BUILD_LIB_ONLY 1)
|
|
ADD_SUBDIRECTORY(externals/required_libpodofo)
|
|
SET(LIBPODOFO_H ${CMAKE_CURRENT_SOURCE_DIR}/externals/required_libpodofo)
|
|
SET(LIBPODOFO_CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/externals/required_libpodofo)
|
|
SET(LIBPODOFO_LIB podofo_static)
|
|
MESSAGE("+++Done setting up private PoDoFo copy")
|
|
ENDIF(NOT LIBPODOFO_FOUND)
|
|
|
|
|
|
INCLUDE_DIRECTORIES(
|
|
${LIBPODOFO_H}
|
|
${LIBPODOFO_CONFIG_H}
|
|
)
|
|
|
|
|
|
# find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)
|
|
# execute_process(COMMAND ${XDG-DESKTOP-MENU_EXECUTABLE} install --novender librepresenter.desktop)
|
|
|
|
get_target_property(QMAKE Qt::qmake IMPORTED_LOCATION)
|
|
find_package(Corrosion QUIET)
|
|
if(NOT Corrosion_FOUND)
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
Corrosion
|
|
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
|
|
GIT_TAG v0.3.0
|
|
)
|
|
|
|
FetchContent_MakeAvailable(Corrosion)
|
|
endif()
|
|
|
|
add_subdirectory(src)
|
|
set(CRATE libre-presenter)
|
|
|
|
# Corrosion creates a CMake target with the same name as the crate.
|
|
corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES ${CRATE})
|
|
|
|
# The Rust library's build script needs to be told where to output the
|
|
# generated headers so CMake can find them. To do this, tell Corrosion
|
|
# to set the CXXQT_EXPORT_DIR environment variable when calling `cargo build`.
|
|
# Also, set the QMAKE environment variable to ensure the Rust library uses
|
|
# the same installation of Qt as CMake.
|
|
set(CXXQT_EXPORT_DIR "${CMAKE_CURRENT_BINARY_DIR}/cxxqt")
|
|
corrosion_set_env_vars(${CRATE}
|
|
"CXXQT_EXPORT_DIR=${CXXQT_EXPORT_DIR}"
|
|
"QMAKE=${QMAKE}"
|
|
)
|
|
|
|
# Include the headers generated by the Rust library's build script. Each
|
|
# crate gets its own subdirectory under CXXQT_EXPORT_DIR. This allows you
|
|
# to include headers generated by multiple crates without risk of one crate
|
|
# overwriting another's files.
|
|
target_include_directories(${CRATE} INTERFACE "${CXXQT_EXPORT_DIR}/${CRATE}")
|
|
|
|
# Link the Rust INTERFACE library target to Qt. Do this on the library target
|
|
# rather than the main executable. This way, CMake targets besides the main
|
|
# executable which link the Rust library, for example tests, will also link Qt.
|
|
target_link_libraries(${CRATE} INTERFACE
|
|
Qt5::Quick
|
|
Qt5::Qml
|
|
Qt5::Gui
|
|
Qt5::QuickControls2
|
|
Qt5::Widgets
|
|
Qt5::Sql
|
|
Qt5::X11Extras
|
|
KF5::Kirigami2
|
|
KF5::I18n
|
|
KF5::Archive
|
|
KF5::CoreAddons
|
|
KF5::WindowSystem
|
|
podofo
|
|
mpv
|
|
)
|
|
|
|
# Link to the Rust library
|
|
target_link_libraries(${APP_NAME} PRIVATE ${CRATE})
|
|
|
|
# If we are using a statically linked Qt then we need to import any qml plugins
|
|
qt_import_qml_plugins(${APP_NAME})
|
|
|
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|