updates to build system
This commit is contained in:
parent
b5911d6ed4
commit
02c3e84cb6
8 changed files with 97 additions and 36 deletions
|
@ -1,10 +1,13 @@
|
|||
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)
|
||||
|
@ -26,7 +29,7 @@ include(ECMPoQmTools)
|
|||
|
||||
kde_enable_exceptions()
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Widgets Sql X11Extras)
|
||||
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 I18n Archive CoreAddons)
|
||||
|
||||
find_package(Libmpv)
|
||||
|
@ -51,12 +54,68 @@ INCLUDE_DIRECTORIES(
|
|||
${LIBPODOFO_CONFIG_H}
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# 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 qml-minimal)
|
||||
|
||||
# Corrosion creates a CMake target with the same name as the crate.
|
||||
corrosion_import_crate(MANIFEST_PATH src/rust/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
|
||||
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)
|
||||
|
||||
find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)
|
||||
execute_process(COMMAND ${XDG-DESKTOP-MENU_EXECUTABLE} install --novender librepresenter.desktop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue