Updates desktop shell and application code for cross-Qt compatibility: uses begin/endFilterChange for Qt 6.10+, gates LayerShell usage to Qt < 6.5, and adds include handling for generated QML type registration files so nebula-shell builds reliably. Also fixes qInfo size formatting casts and updates README commands to invoke run-sway-vm.sh via `sh` for more portable execution.
131 lines
3.6 KiB
CMake
131 lines
3.6 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(nebula-shell LANGUAGES CXX)
|
|
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
message(FATAL_ERROR
|
|
"nebula-shell is a Linux Wayland shell using LayerShellQt.\n"
|
|
"Build and run it on the Ubuntu NebulaOS VM. Windows is not a supported target, "
|
|
"and LayerShellQt is not stubbed with other platform APIs.")
|
|
endif()
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
find_package(Qt6 6.4 REQUIRED COMPONENTS Core Gui Qml Quick)
|
|
find_package(LayerShellQt REQUIRED)
|
|
|
|
qt_standard_project_setup(REQUIRES 6.4)
|
|
|
|
set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml")
|
|
|
|
add_subdirectory(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../../../packages/nebula-ui"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/nebula-ui"
|
|
)
|
|
|
|
add_subdirectory(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../../../core/applications"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/nebula-applications"
|
|
)
|
|
|
|
qt_add_executable(nebula-shell
|
|
src/main.cpp
|
|
src/DesktopIconProvider.cpp
|
|
src/DesktopIconProvider.hpp
|
|
)
|
|
|
|
set(NEBULA_SHELL_QML_FILES
|
|
qml/Main.qml
|
|
qml/ShellState.qml
|
|
qml/surfaces/DesktopSurface.qml
|
|
qml/surfaces/TopBarSurface.qml
|
|
qml/surfaces/LauncherSurface.qml
|
|
qml/components/TopBar.qml
|
|
qml/components/NebulaButton.qml
|
|
qml/components/Clock.qml
|
|
qml/components/SystemArea.qml
|
|
qml/components/Launcher.qml
|
|
qml/components/AppItem.qml
|
|
qml/mock/MockApps.qml
|
|
)
|
|
|
|
foreach(qml_file IN LISTS NEBULA_SHELL_QML_FILES)
|
|
get_filename_component(qml_name "${qml_file}" NAME)
|
|
set_source_files_properties("${qml_file}" PROPERTIES
|
|
QT_RESOURCE_ALIAS "${qml_name}"
|
|
)
|
|
endforeach()
|
|
|
|
set_source_files_properties(qml/ShellState.qml PROPERTIES
|
|
QT_QML_SINGLETON_TYPE TRUE
|
|
QT_RESOURCE_ALIAS ShellState.qml
|
|
)
|
|
set_source_files_properties(qml/mock/MockApps.qml PROPERTIES
|
|
QT_QML_SINGLETON_TYPE TRUE
|
|
QT_RESOURCE_ALIAS MockApps.qml
|
|
)
|
|
|
|
qt_add_qml_module(nebula-shell
|
|
URI Nebula.Shell
|
|
VERSION 1.0
|
|
RESOURCE_PREFIX /qt/qml
|
|
QML_FILES ${NEBULA_SHELL_QML_FILES}
|
|
SOURCES
|
|
src/OutputTracker.hpp
|
|
src/OutputTracker.cpp
|
|
DEPENDENCIES
|
|
QtQuick
|
|
Nebula.UI
|
|
Nebula.Applications
|
|
)
|
|
|
|
target_link_libraries(nebula-shell
|
|
PRIVATE
|
|
Qt6::Core
|
|
Qt6::Gui
|
|
Qt6::Qml
|
|
Qt6::Quick
|
|
LayerShellQt::Interface
|
|
NebulaUI
|
|
NebulaApplications
|
|
)
|
|
|
|
if(TARGET NebulaUIplugin)
|
|
target_link_libraries(nebula-shell PRIVATE NebulaUIplugin)
|
|
endif()
|
|
if(TARGET NebulaApplicationsplugin)
|
|
target_link_libraries(nebula-shell PRIVATE NebulaApplicationsplugin)
|
|
endif()
|
|
|
|
# Generated nebula-shell_qmltyperegistrations.cpp includes "OutputTracker.hpp"
|
|
# via __has_include. Keep src/ on the include path so that succeeds.
|
|
target_include_directories(nebula-shell PRIVATE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
)
|
|
|
|
set_source_files_properties(
|
|
"${CMAKE_CURRENT_BINARY_DIR}/nebula-shell_qmltyperegistrations.cpp"
|
|
PROPERTIES
|
|
COMPILE_OPTIONS "-include;${CMAKE_CURRENT_SOURCE_DIR}/src/OutputTracker.hpp"
|
|
)
|
|
|
|
set_target_properties(nebula-shell PROPERTIES
|
|
OUTPUT_NAME nebula-shell
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
|
)
|
|
|
|
# Shared Qt discovers QML plugins at runtime. Skip qmlimportscanner / static
|
|
# plugin importing so Qt 6.8+ does not warn about missing Qt6::*plugin targets.
|
|
if(QT6_IS_SHARED_LIBS_BUILD)
|
|
set_target_properties(nebula-shell PROPERTIES
|
|
QT_QML_MODULE_NO_IMPORT_SCAN TRUE
|
|
)
|
|
endif()
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(nebula-shell PRIVATE -Wall -Wextra)
|
|
endif()
|