chore(build): switched to meson

This commit is contained in:
Lemmy
2026-04-09 09:09:03 -04:00
parent b7716539ac
commit 872d135065
5 changed files with 399 additions and 587 deletions
-565
View File
@@ -1,565 +0,0 @@
cmake_minimum_required(VERSION 3.20)
project(Noctalia VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Export compile_commands.json for tooling
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# --- Sanitizers (opt-in via -DSANITIZE=ON) ---
option(SANITIZE "Enable AddressSanitizer + UndefinedBehaviorSanitizer" OFF)
if(SANITIZE)
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=address,undefined)
set(SANITIZE_ACTIVE TRUE)
endif()
# --- Dependencies ---
find_package(PkgConfig REQUIRED)
find_package(sdbus-c++ REQUIRED)
pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols)
pkg_check_modules(EGL REQUIRED egl)
pkg_check_modules(GLES2 REQUIRED glesv2)
pkg_check_modules(WAYLAND_EGL REQUIRED wayland-egl)
pkg_check_modules(FREETYPE2 REQUIRED freetype2)
pkg_check_modules(HARFBUZZ REQUIRED harfbuzz)
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
pkg_check_modules(XKBCOMMON REQUIRED xkbcommon)
pkg_check_modules(LIBPIPEWIRE REQUIRED libpipewire-0.3)
find_package(CURL REQUIRED)
find_library(PAM_LIBRARY NAMES pam REQUIRED)
# --- msdfgen (vendored) ---
set(MSDFGEN_CORE_ONLY OFF CACHE BOOL "" FORCE)
set(MSDFGEN_BUILD_STANDALONE OFF CACHE BOOL "" FORCE)
set(MSDFGEN_USE_VCPKG OFF CACHE BOOL "" FORCE)
set(MSDFGEN_USE_SKIA OFF CACHE BOOL "" FORCE)
set(MSDFGEN_DISABLE_SVG ON CACHE BOOL "" FORCE)
set(MSDFGEN_DISABLE_PNG ON CACHE BOOL "" FORCE)
set(MSDFGEN_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory(third_party/msdfgen)
pkg_get_variable(WAYLAND_PROTOCOLS_PKGDATADIR wayland-protocols pkgdatadir)
file(REAL_PATH "${WAYLAND_PROTOCOLS_PKGDATADIR}" WAYLAND_PROTOCOLS_PKGDATADIR)
find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner REQUIRED)
set(GENERATED_PROTOCOL_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
file(MAKE_DIRECTORY "${GENERATED_PROTOCOL_DIR}")
set(PROTOCOL_PREPARE_SCRIPT
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/PrepareWaylandProtocol.cmake")
set(WLR_LAYER_SHELL_SOURCE_XML
"${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml")
set(WLR_LAYER_SHELL_XML
"${GENERATED_PROTOCOL_DIR}/wlr-layer-shell-unstable-v1.scanner.xml")
set(XDG_OUTPUT_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml")
set(XDG_SHELL_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml")
set(EXT_WORKSPACE_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/staging/ext-workspace/ext-workspace-v1.xml")
set(DWL_IPC_XML
"${CMAKE_CURRENT_SOURCE_DIR}/protocols/dwl-ipc-unstable-v2.xml")
set(CURSOR_SHAPE_XML
"${CMAKE_CURRENT_SOURCE_DIR}/protocols/cursor-shape-v1.xml")
set(EXT_DATA_CONTROL_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/staging/ext-data-control/ext-data-control-v1.xml")
set(XDG_ACTIVATION_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/staging/xdg-activation/xdg-activation-v1.xml")
set(EXT_SESSION_LOCK_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/staging/ext-session-lock/ext-session-lock-v1.xml")
set(IDLE_INHIBIT_XML
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml")
set(WLR_FOREIGN_TOPLEVEL_XML
"${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-foreign-toplevel-management-unstable-v1.xml")
set(WLR_DATA_CONTROL_XML
"${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-data-control-unstable-v1.xml")
set(XDG_OUTPUT_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/xdg-output-unstable-v1-client-protocol.c")
set(XDG_OUTPUT_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/xdg-output-unstable-v1-client-protocol.h")
set(XDG_SHELL_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/xdg-shell-client-protocol.c")
set(XDG_SHELL_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/xdg-shell-client-protocol.h")
set(EXT_WORKSPACE_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/ext-workspace-v1-client-protocol.c")
set(EXT_WORKSPACE_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/ext-workspace-v1-client-protocol.h")
set(DWL_IPC_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/dwl-ipc-unstable-v2-client-protocol.c")
set(DWL_IPC_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/dwl-ipc-unstable-v2-client-protocol.h")
set(CURSOR_SHAPE_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/cursor-shape-v1-client-protocol.c")
set(CURSOR_SHAPE_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/cursor-shape-v1-client-protocol.h")
set(EXT_DATA_CONTROL_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/ext-data-control-v1-client-protocol.c")
set(EXT_DATA_CONTROL_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/ext-data-control-v1-client-protocol.h")
set(XDG_ACTIVATION_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/xdg-activation-v1-client-protocol.c")
set(XDG_ACTIVATION_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/xdg-activation-v1-client-protocol.h")
set(EXT_SESSION_LOCK_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/ext-session-lock-v1-client-protocol.c")
set(EXT_SESSION_LOCK_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/ext-session-lock-v1-client-protocol.h")
set(IDLE_INHIBIT_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/idle-inhibit-unstable-v1-client-protocol.c")
set(IDLE_INHIBIT_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/idle-inhibit-unstable-v1-client-protocol.h")
set(WLR_FOREIGN_TOPLEVEL_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/wlr-foreign-toplevel-management-unstable-v1-client-protocol.c")
set(WLR_FOREIGN_TOPLEVEL_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/wlr-foreign-toplevel-management-unstable-v1-client-protocol.h")
set(WLR_DATA_CONTROL_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/wlr-data-control-unstable-v1-client-protocol.c")
set(WLR_DATA_CONTROL_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/wlr-data-control-unstable-v1-client-protocol.h")
set(WLR_LAYER_SHELL_PROTOCOL_C
"${GENERATED_PROTOCOL_DIR}/wlr-layer-shell-unstable-v1-client-protocol.c")
set(WLR_LAYER_SHELL_PROTOCOL_H
"${GENERATED_PROTOCOL_DIR}/wlr-layer-shell-unstable-v1-client-protocol.h")
add_custom_command(
OUTPUT "${WLR_LAYER_SHELL_XML}"
COMMAND "${CMAKE_COMMAND}"
-DINPUT_XML=${WLR_LAYER_SHELL_SOURCE_XML}
-DOUTPUT_XML=${WLR_LAYER_SHELL_XML}
-P "${PROTOCOL_PREPARE_SCRIPT}"
DEPENDS
"${WLR_LAYER_SHELL_SOURCE_XML}"
"${PROTOCOL_PREPARE_SCRIPT}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_LAYER_SHELL_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${WLR_LAYER_SHELL_XML}" "${WLR_LAYER_SHELL_PROTOCOL_C}"
DEPENDS "${WLR_LAYER_SHELL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_LAYER_SHELL_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${WLR_LAYER_SHELL_XML}" "${WLR_LAYER_SHELL_PROTOCOL_H}"
DEPENDS "${WLR_LAYER_SHELL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_OUTPUT_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${XDG_OUTPUT_XML}" "${XDG_OUTPUT_PROTOCOL_C}"
DEPENDS "${XDG_OUTPUT_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_OUTPUT_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${XDG_OUTPUT_XML}" "${XDG_OUTPUT_PROTOCOL_H}"
DEPENDS "${XDG_OUTPUT_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_SHELL_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${XDG_SHELL_XML}" "${XDG_SHELL_PROTOCOL_C}"
DEPENDS "${XDG_SHELL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_SHELL_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${XDG_SHELL_XML}" "${XDG_SHELL_PROTOCOL_H}"
DEPENDS "${XDG_SHELL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_WORKSPACE_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${EXT_WORKSPACE_XML}" "${EXT_WORKSPACE_PROTOCOL_C}"
DEPENDS "${EXT_WORKSPACE_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_WORKSPACE_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${EXT_WORKSPACE_XML}" "${EXT_WORKSPACE_PROTOCOL_H}"
DEPENDS "${EXT_WORKSPACE_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${DWL_IPC_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${DWL_IPC_XML}" "${DWL_IPC_PROTOCOL_C}"
DEPENDS "${DWL_IPC_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${DWL_IPC_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${DWL_IPC_XML}" "${DWL_IPC_PROTOCOL_H}"
DEPENDS "${DWL_IPC_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${CURSOR_SHAPE_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${CURSOR_SHAPE_XML}" "${CURSOR_SHAPE_PROTOCOL_C}"
DEPENDS "${CURSOR_SHAPE_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${CURSOR_SHAPE_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${CURSOR_SHAPE_XML}" "${CURSOR_SHAPE_PROTOCOL_H}"
DEPENDS "${CURSOR_SHAPE_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_DATA_CONTROL_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${EXT_DATA_CONTROL_XML}" "${EXT_DATA_CONTROL_PROTOCOL_C}"
DEPENDS "${EXT_DATA_CONTROL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_DATA_CONTROL_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${EXT_DATA_CONTROL_XML}" "${EXT_DATA_CONTROL_PROTOCOL_H}"
DEPENDS "${EXT_DATA_CONTROL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_ACTIVATION_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${XDG_ACTIVATION_XML}" "${XDG_ACTIVATION_PROTOCOL_C}"
DEPENDS "${XDG_ACTIVATION_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${XDG_ACTIVATION_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${XDG_ACTIVATION_XML}" "${XDG_ACTIVATION_PROTOCOL_H}"
DEPENDS "${XDG_ACTIVATION_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_SESSION_LOCK_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${EXT_SESSION_LOCK_XML}" "${EXT_SESSION_LOCK_PROTOCOL_C}"
DEPENDS "${EXT_SESSION_LOCK_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${EXT_SESSION_LOCK_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${EXT_SESSION_LOCK_XML}" "${EXT_SESSION_LOCK_PROTOCOL_H}"
DEPENDS "${EXT_SESSION_LOCK_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${IDLE_INHIBIT_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${IDLE_INHIBIT_XML}" "${IDLE_INHIBIT_PROTOCOL_C}"
DEPENDS "${IDLE_INHIBIT_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${IDLE_INHIBIT_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${IDLE_INHIBIT_XML}" "${IDLE_INHIBIT_PROTOCOL_H}"
DEPENDS "${IDLE_INHIBIT_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_FOREIGN_TOPLEVEL_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${WLR_FOREIGN_TOPLEVEL_XML}" "${WLR_FOREIGN_TOPLEVEL_PROTOCOL_C}"
DEPENDS "${WLR_FOREIGN_TOPLEVEL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_FOREIGN_TOPLEVEL_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${WLR_FOREIGN_TOPLEVEL_XML}" "${WLR_FOREIGN_TOPLEVEL_PROTOCOL_H}"
DEPENDS "${WLR_FOREIGN_TOPLEVEL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_DATA_CONTROL_PROTOCOL_C}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${WLR_DATA_CONTROL_XML}" "${WLR_DATA_CONTROL_PROTOCOL_C}"
DEPENDS "${WLR_DATA_CONTROL_XML}"
VERBATIM
)
add_custom_command(
OUTPUT "${WLR_DATA_CONTROL_PROTOCOL_H}"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${WLR_DATA_CONTROL_XML}" "${WLR_DATA_CONTROL_PROTOCOL_H}"
DEPENDS "${WLR_DATA_CONTROL_XML}"
VERBATIM
)
add_custom_target(noctalia_wayland_protocols
DEPENDS
"${WLR_LAYER_SHELL_PROTOCOL_C}"
"${WLR_LAYER_SHELL_PROTOCOL_H}"
"${XDG_OUTPUT_PROTOCOL_C}"
"${XDG_OUTPUT_PROTOCOL_H}"
"${XDG_SHELL_PROTOCOL_C}"
"${XDG_SHELL_PROTOCOL_H}"
"${EXT_WORKSPACE_PROTOCOL_C}"
"${EXT_WORKSPACE_PROTOCOL_H}"
"${DWL_IPC_PROTOCOL_C}"
"${DWL_IPC_PROTOCOL_H}"
"${CURSOR_SHAPE_PROTOCOL_C}"
"${CURSOR_SHAPE_PROTOCOL_H}"
"${EXT_DATA_CONTROL_PROTOCOL_C}"
"${EXT_DATA_CONTROL_PROTOCOL_H}"
"${XDG_ACTIVATION_PROTOCOL_C}"
"${XDG_ACTIVATION_PROTOCOL_H}"
"${EXT_SESSION_LOCK_PROTOCOL_C}"
"${EXT_SESSION_LOCK_PROTOCOL_H}"
"${IDLE_INHIBIT_PROTOCOL_C}"
"${IDLE_INHIBIT_PROTOCOL_H}"
"${WLR_FOREIGN_TOPLEVEL_PROTOCOL_C}"
"${WLR_FOREIGN_TOPLEVEL_PROTOCOL_H}"
"${WLR_DATA_CONTROL_PROTOCOL_C}"
"${WLR_DATA_CONTROL_PROTOCOL_H}"
)
# --- Target ---
add_executable(noctalia
src/app/application.cpp
src/app/main_loop.cpp
src/auth/pam_authenticator.cpp
src/config/config_service.cpp
src/config/state_service.cpp
src/core/deferred_call.cpp
src/core/log.cpp
src/core/timer_manager.cpp
src/dbus/mpris/mpris_service.cpp
src/dbus/notification/notification_poll_source.cpp
src/dbus/notification/notification_service.cpp
src/dbus/power/power_profiles_service.cpp
src/dbus/session_bus.cpp
src/dbus/system_bus.cpp
src/dbus/tray/tray_service.cpp
src/dbus/upower/upower_service.cpp
src/debug/debug_service.cpp
src/font/font_service.cpp
src/idle/idle_inhibitor.cpp
src/ipc/ipc_client.cpp
src/ipc/ipc_service.cpp
src/launcher/app_provider.cpp
src/launcher/emoji_provider.cpp
src/launcher/math_provider.cpp
src/launcher/usage_tracker.cpp
src/main.cpp
src/net/http_client.cpp
src/notification/notification_manager.cpp
$<$<BOOL:${SANITIZE_ACTIVE}>:src/pipewire/pipewire_lsan.cpp>
src/pipewire/pipewire_service.cpp
src/pipewire/pipewire_spectrum.cpp
src/render/animation/animation.cpp
src/render/animation/animation_manager.cpp
src/render/core/shader_program.cpp
src/render/core/texture_manager.cpp
src/render/core/wuffs_image_decoder.cpp
src/render/image_loaders.cpp
src/render/programs/image_program.cpp
src/render/programs/linear_gradient_program.cpp
src/render/programs/msdf_text_program.cpp
src/render/programs/rounded_rect_program.cpp
src/render/programs/spinner_program.cpp
src/render/programs/blur_program.cpp
src/render/programs/wallpaper_program.cpp
src/render/render_context.cpp
src/render/render_target.cpp
src/render/scene/input_area.cpp
src/render/scene/input_dispatcher.cpp
src/render/scene/node.cpp
src/render/text/msdf_text_renderer.cpp
src/render/wallpaper_renderer.cpp
src/shell/bar/bar.cpp
src/shell/clipboard/clipboard_panel.cpp
src/shell/control_center/calendar_tab.cpp
src/shell/control_center/audio_tab.cpp
src/shell/control_center/control_center_panel.cpp
src/shell/control_center/media_tab.cpp
src/shell/control_center/network_tab.cpp
src/shell/control_center/notifications_tab.cpp
src/shell/control_center/overview_tab.cpp
src/shell/control_center/tab.cpp
src/shell/control_center/weather_tab.cpp
src/shell/launcher/launcher_panel.cpp
src/shell/lockscreen/lock_screen.cpp
src/shell/lockscreen/lock_surface.cpp
src/shell/notification/notification_popup.cpp
src/shell/osd/audio_osd.cpp
src/shell/osd/osd_overlay.cpp
src/shell/panel/panel_manager.cpp
src/shell/session/session_panel.cpp
src/shell/test/test_panel.cpp
src/shell/tray/tray_menu.cpp
src/shell/overview/overview.cpp
src/shell/overview/overview_surface.cpp
src/shell/wallpaper/wallpaper.cpp
src/shell/wallpaper/wallpaper_surface.cpp
src/shell/widget/widget.cpp
src/shell/widget/widget_factory.cpp
src/shell/widgets/active_window_widget.cpp
src/shell/widgets/battery_widget.cpp
src/shell/widgets/clock_widget.cpp
src/shell/widgets/idle_inhibitor_widget.cpp
src/shell/widgets/launcher_widget.cpp
src/shell/widgets/media_mini_widget.cpp
src/shell/widgets/notification_widget.cpp
src/shell/widgets/power_profiles_widget.cpp
src/shell/widgets/session_widget.cpp
src/shell/widgets/spacer_widget.cpp
src/shell/widgets/sysmon_widget.cpp
src/shell/widgets/test_widget.cpp
src/shell/widgets/tray_widget.cpp
src/shell/widgets/volume_widget.cpp
src/shell/widgets/weather_widget.cpp
src/shell/widgets/workspaces_widget.cpp
src/system/desktop_entry.cpp
src/system/distro_info.cpp
src/system/icon_resolver.cpp
src/system/system_monitor_service.cpp
src/system/weather_service.cpp
src/time/time_service.cpp
src/ui/controls/box.cpp
src/ui/controls/audio_spectrum.cpp
src/ui/controls/button.cpp
src/ui/controls/chip.cpp
src/ui/controls/checkbox.cpp
src/ui/controls/flex.cpp
src/ui/controls/glyph.cpp
src/ui/controls/glyph_registry.cpp
src/ui/controls/image.cpp
src/ui/controls/input.cpp
src/ui/controls/label.cpp
src/ui/controls/progress_bar.cpp
src/ui/controls/radio_button.cpp
src/ui/controls/scroll_view.cpp
src/ui/controls/select.cpp
src/ui/controls/slider.cpp
src/ui/controls/spinner.cpp
src/ui/controls/toggle.cpp
src/util/fuzzy_match.cpp
src/wayland/clipboard_service.cpp
src/wayland/compositors/ext_workspace_backend.cpp
src/wayland/layer_surface.cpp
src/wayland/compositors/mango_workspace_backend.cpp
src/wayland/surface.cpp
src/wayland/compositors/sway_workspace_backend.cpp
src/wayland/wayland_connection.cpp
src/wayland/wayland_seat.cpp
src/wayland/wayland_toplevels.cpp
src/wayland/wayland_workspaces.cpp
third_party/tinyexpr/tinyexpr.c
"${WLR_LAYER_SHELL_PROTOCOL_C}"
"${XDG_OUTPUT_PROTOCOL_C}"
"${XDG_SHELL_PROTOCOL_C}"
"${EXT_WORKSPACE_PROTOCOL_C}"
"${DWL_IPC_PROTOCOL_C}"
"${CURSOR_SHAPE_PROTOCOL_C}"
"${EXT_DATA_CONTROL_PROTOCOL_C}"
"${XDG_ACTIVATION_PROTOCOL_C}"
"${EXT_SESSION_LOCK_PROTOCOL_C}"
"${IDLE_INHIBIT_PROTOCOL_C}"
"${WLR_FOREIGN_TOPLEVEL_PROTOCOL_C}"
"${WLR_DATA_CONTROL_PROTOCOL_C}"
)
target_compile_definitions(noctalia PRIVATE
NOCTALIA_ASSETS_DIR="${CMAKE_SOURCE_DIR}/assets"
NOCTALIA_VERSION="${PROJECT_VERSION}"
)
add_dependencies(noctalia noctalia_wayland_protocols)
target_include_directories(noctalia PRIVATE
src
third_party/nanosvg
third_party/tomlplusplus
third_party/wuffs
"${GENERATED_PROTOCOL_DIR}"
${WAYLAND_CLIENT_INCLUDE_DIRS}
${EGL_INCLUDE_DIRS}
${GLES2_INCLUDE_DIRS}
${WAYLAND_EGL_INCLUDE_DIRS}
${FREETYPE2_INCLUDE_DIRS}
${HARFBUZZ_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}
${XKBCOMMON_INCLUDE_DIRS}
)
# PipeWire/SPA headers use GCC extensions (compound-literals, statement-
# expressions) that trigger -Wpedantic/-Wconversion. Mark them as system
# headers so the compiler suppresses those warnings.
target_include_directories(noctalia SYSTEM PRIVATE
${LIBPIPEWIRE_INCLUDE_DIRS}
third_party/nlohmann
third_party/tinyexpr
)
set_source_files_properties(third_party/tinyexpr/tinyexpr.c PROPERTIES
COMPILE_OPTIONS "-Wno-pedantic;-Wno-conversion"
)
target_link_libraries(noctalia PRIVATE
SDBusCpp::sdbus-c++
msdfgen::msdfgen-core
msdfgen::msdfgen-ext
${WAYLAND_CLIENT_LIBRARIES}
${EGL_LIBRARIES}
${GLES2_LIBRARIES}
${WAYLAND_EGL_LIBRARIES}
${FREETYPE2_LIBRARIES}
${HARFBUZZ_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${XKBCOMMON_LIBRARIES}
${LIBPIPEWIRE_LIBRARIES}
CURL::libcurl
${PAM_LIBRARY}
)
target_compile_options(noctalia PRIVATE
${WAYLAND_CLIENT_CFLAGS_OTHER}
${EGL_CFLAGS_OTHER}
${GLES2_CFLAGS_OTHER}
${WAYLAND_EGL_CFLAGS_OTHER}
${FREETYPE2_CFLAGS_OTHER}
${HARFBUZZ_CFLAGS_OTHER}
${FONTCONFIG_CFLAGS_OTHER}
${LIBPIPEWIRE_CFLAGS_OTHER}
)
target_compile_options(noctalia PRIVATE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wshadow
)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(noctalia PRIVATE
-O3
-march=native
-mtune=native
-flto=auto
-fomit-frame-pointer
-ffunction-sections
-fdata-sections
)
target_link_options(noctalia PRIVATE -flto=auto -Wl,--gc-sections -Wl,--as-needed)
endif()
-18
View File
@@ -1,18 +0,0 @@
if (NOT DEFINED INPUT_XML OR NOT DEFINED OUTPUT_XML)
message(FATAL_ERROR "INPUT_XML and OUTPUT_XML must be set")
endif()
file(READ "${INPUT_XML}" PROTOCOL_XML)
string(REPLACE "name=\"namespace\"" "name=\"name_space\"" PROTOCOL_XML "${PROTOCOL_XML}")
# Only write when content has changed to avoid bumping mtime on every CMake run,
# which would otherwise cause spurious rebuilds of the protocol C/H files and a
# full relink of the binary.
if(EXISTS "${OUTPUT_XML}")
file(READ "${OUTPUT_XML}" EXISTING_XML)
if(EXISTING_XML STREQUAL PROTOCOL_XML)
return()
endif()
endif()
file(WRITE "${OUTPUT_XML}" "${PROTOCOL_XML}")
+11 -4
View File
@@ -7,12 +7,19 @@ default:
@just --list
configure m=mode:
cmake -S . -B build-{{m}} \
-DCMAKE_BUILD_TYPE={{ if m == "release" { "Release" } else { "Debug" } }} \
-DSANITIZE={{ if m == "asan" { "ON" } else { "OFF" } }}
#!/usr/bin/env bash
set -euo pipefail
args=(--buildtype={{ if m == "release" { "release" } else { "debug" } }})
[[ "{{m}}" == "release" ]] && args+=(-Db_lto=true)
[[ "{{m}}" == "asan" ]] && args+=(-Db_sanitize=address,undefined)
if [[ -d "build-{{m}}" ]]; then
meson setup "build-{{m}}" "${args[@]}" --reconfigure
else
meson setup "build-{{m}}" "${args[@]}"
fi
build m=mode:
cmake --build build-{{m}} --parallel
meson compile -C build-{{m}}
run m=mode:
./build-{{m}}/noctalia
+385
View File
@@ -0,0 +1,385 @@
project('noctalia', ['c', 'cpp'],
version: '0.1.0',
default_options: [
'cpp_std=c++20',
'cpp_extensions=false',
'warning_level=0', # applied selectively to our target; avoids noise in vendored code
'b_ndebug=if-release',
],
)
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
# Sanitizers are enabled via meson's built-in -Db_sanitize=address,undefined.
# pipewire_lsan.cpp is only needed when address sanitizer is active.
sanitize = get_option('b_sanitize') != 'none'
# ── Release-only optimizations ────────────────────────────────────────────────
if get_option('buildtype') == 'release'
add_project_arguments(
'-march=native', '-mtune=native',
'-fomit-frame-pointer', '-ffunction-sections', '-fdata-sections',
language: ['c', 'cpp'],
)
add_project_link_arguments(
'-Wl,--gc-sections', '-Wl,--as-needed',
language: ['c', 'cpp'],
)
endif
# ── Dependencies ──────────────────────────────────────────────────────────────
sdbus_cpp_dep = dependency('sdbus-c++')
wayland_client_dep = dependency('wayland-client')
wayland_protos_dep = dependency('wayland-protocols')
egl_dep = dependency('egl')
glesv2_dep = dependency('glesv2')
wayland_egl_dep = dependency('wayland-egl')
freetype2_dep = dependency('freetype2')
harfbuzz_dep = dependency('harfbuzz')
fontconfig_dep = dependency('fontconfig')
xkbcommon_dep = dependency('xkbcommon')
# PipeWire/SPA headers use GCC extensions that trigger -Wpedantic/-Wconversion;
# mark as system so the compiler suppresses those warnings.
pipewire_dep = dependency('libpipewire-0.3', include_type: 'system')
curl_dep = dependency('libcurl')
pam_dep = cc.find_library('pam')
# ── Vendored: msdfgen ─────────────────────────────────────────────────────────
# Built inline (not via subdir) so no meson.build is needed inside the submodule.
_msdfgen_inc = include_directories('third_party/msdfgen')
_msdfgen_core_lib = static_library('msdfgen-core',
files(
'third_party/msdfgen/core/contour-combiners.cpp',
'third_party/msdfgen/core/Contour.cpp',
'third_party/msdfgen/core/DistanceMapping.cpp',
'third_party/msdfgen/core/edge-coloring.cpp',
'third_party/msdfgen/core/EdgeHolder.cpp',
'third_party/msdfgen/core/edge-segments.cpp',
'third_party/msdfgen/core/edge-selectors.cpp',
'third_party/msdfgen/core/equation-solver.cpp',
'third_party/msdfgen/core/export-svg.cpp',
'third_party/msdfgen/core/MSDFErrorCorrection.cpp',
'third_party/msdfgen/core/msdf-error-correction.cpp',
'third_party/msdfgen/core/msdfgen.cpp',
'third_party/msdfgen/core/Projection.cpp',
'third_party/msdfgen/core/rasterization.cpp',
'third_party/msdfgen/core/render-sdf.cpp',
'third_party/msdfgen/core/save-bmp.cpp',
'third_party/msdfgen/core/save-fl32.cpp',
'third_party/msdfgen/core/save-rgba.cpp',
'third_party/msdfgen/core/save-tiff.cpp',
'third_party/msdfgen/core/Scanline.cpp',
'third_party/msdfgen/core/sdf-error-estimation.cpp',
'third_party/msdfgen/core/Shape.cpp',
'third_party/msdfgen/core/shape-description.cpp',
),
include_directories: _msdfgen_inc,
cpp_args: ['-DMSDFGEN_PUBLIC=', '-DMSDFGEN_USE_CPP11'],
override_options: ['warning_level=0'],
)
msdfgen_core_dep = declare_dependency(
link_with: _msdfgen_core_lib,
include_directories: _msdfgen_inc,
compile_args: ['-DMSDFGEN_PUBLIC=', '-DMSDFGEN_USE_CPP11'],
)
_msdfgen_ext_lib = static_library('msdfgen-ext',
files(
'third_party/msdfgen/ext/import-font.cpp',
'third_party/msdfgen/ext/import-svg.cpp',
'third_party/msdfgen/ext/resolve-shape-geometry.cpp',
'third_party/msdfgen/ext/save-png.cpp',
),
include_directories: _msdfgen_inc,
dependencies: [msdfgen_core_dep, freetype2_dep],
cpp_args: [
'-DMSDFGEN_EXT_PUBLIC=',
'-DMSDFGEN_DISABLE_SVG',
'-DMSDFGEN_DISABLE_PNG',
],
override_options: ['warning_level=0'],
)
msdfgen_ext_dep = declare_dependency(
link_with: _msdfgen_ext_lib,
dependencies: msdfgen_core_dep,
include_directories: _msdfgen_inc,
compile_args: [
'-DMSDFGEN_EXT_PUBLIC=',
'-DMSDFGEN_EXTENSIONS',
'-DMSDFGEN_DISABLE_SVG',
'-DMSDFGEN_DISABLE_PNG',
],
)
# ── Vendored: tinyexpr (C, needs suppressed warnings) ─────────────────────────
_tinyexpr_lib = static_library('tinyexpr',
'third_party/tinyexpr/tinyexpr.c',
c_args: ['-Wno-pedantic', '-Wno-conversion'],
override_options: ['warning_level=0'],
)
tinyexpr_dep = declare_dependency(
link_with: _tinyexpr_lib,
include_directories: include_directories('third_party/tinyexpr', is_system: true),
)
# ── Wayland protocol generation ───────────────────────────────────────────────
wayland_scanner = find_program('wayland-scanner')
wayland_protos_dir = wayland_protos_dep.get_variable('pkgdatadir')
# Generates a (header, source) pair from a protocol XML path/target.
# Returns [h_target, c_target] — add c_target to sources.
# The c_target has an order-only dep on h_target so the header exists when
# the generated .c is compiled (it does #include "foo-client-protocol.h").
_protocol_sources = []
# Helper macro via foreach — each entry: [name, xml_input]
# xml_input can be a string (path) or a custom_target.
foreach _p : [
# ── wlr-layer-shell needs namespace→name_space substitution first ──────────
# Handled separately below.
# ── system wayland-protocols ──────────────────────────────────────────────
['xdg-output-unstable-v1',
wayland_protos_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
['xdg-shell',
wayland_protos_dir / 'stable/xdg-shell/xdg-shell.xml'],
['ext-workspace-v1',
wayland_protos_dir / 'staging/ext-workspace/ext-workspace-v1.xml'],
['ext-data-control-v1',
wayland_protos_dir / 'staging/ext-data-control/ext-data-control-v1.xml'],
['xdg-activation-v1',
wayland_protos_dir / 'staging/xdg-activation/xdg-activation-v1.xml'],
['ext-session-lock-v1',
wayland_protos_dir / 'staging/ext-session-lock/ext-session-lock-v1.xml'],
['idle-inhibit-unstable-v1',
wayland_protos_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
# ── project-local custom protocols ────────────────────────────────────────
['dwl-ipc-unstable-v2',
'protocols/dwl-ipc-unstable-v2.xml'],
['cursor-shape-v1',
'protocols/cursor-shape-v1.xml'],
['wlr-foreign-toplevel-management-unstable-v1',
'protocols/wlr-foreign-toplevel-management-unstable-v1.xml'],
['wlr-data-control-unstable-v1',
'protocols/wlr-data-control-unstable-v1.xml'],
]
_name = _p[0]
_xml = _p[1]
_h = custom_target(_name + '-client-header',
input: _xml,
output: _name + '-client-protocol.h',
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
)
_c = custom_target(_name + '-client-source',
input: _xml,
output: _name + '-client-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
depends: _h, # ensure .h exists before this .c is compiled (it #includes it)
)
_protocol_sources += _c
endforeach
# wlr-layer-shell: 'namespace' is a C++ keyword; rename it in the generated
# header only (private-code is compiled as C so it's fine as-is).
_wlr_ls_xml = 'protocols/wlr-layer-shell-unstable-v1.xml'
_wlr_ls_h = custom_target('wlr-layer-shell-unstable-v1-client-header',
input: _wlr_ls_xml,
output: 'wlr-layer-shell-unstable-v1-client-protocol.h',
command: [
'sh', '-c',
'"$1" client-header "$2" "$3" && sed -i s/namespace/name_space/g "$3"',
'_', wayland_scanner.full_path(), '@INPUT@', '@OUTPUT@',
],
)
_wlr_ls_c = custom_target('wlr-layer-shell-unstable-v1-client-source',
input: _wlr_ls_xml,
output: 'wlr-layer-shell-unstable-v1-client-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
depends: _wlr_ls_h,
)
_protocol_sources += _wlr_ls_c
# ── Main sources ──────────────────────────────────────────────────────────────
_noctalia_sources = files(
'src/app/application.cpp',
'src/app/main_loop.cpp',
'src/auth/pam_authenticator.cpp',
'src/config/config_service.cpp',
'src/config/state_service.cpp',
'src/core/deferred_call.cpp',
'src/core/log.cpp',
'src/core/timer_manager.cpp',
'src/dbus/mpris/mpris_service.cpp',
'src/dbus/notification/notification_poll_source.cpp',
'src/dbus/notification/notification_service.cpp',
'src/dbus/power/power_profiles_service.cpp',
'src/dbus/session_bus.cpp',
'src/dbus/system_bus.cpp',
'src/dbus/tray/tray_service.cpp',
'src/dbus/upower/upower_service.cpp',
'src/debug/debug_service.cpp',
'src/font/font_service.cpp',
'src/idle/idle_inhibitor.cpp',
'src/ipc/ipc_client.cpp',
'src/ipc/ipc_service.cpp',
'src/launcher/app_provider.cpp',
'src/launcher/emoji_provider.cpp',
'src/launcher/math_provider.cpp',
'src/launcher/usage_tracker.cpp',
'src/main.cpp',
'src/net/http_client.cpp',
'src/notification/notification_manager.cpp',
'src/pipewire/pipewire_service.cpp',
'src/pipewire/pipewire_spectrum.cpp',
'src/render/animation/animation.cpp',
'src/render/animation/animation_manager.cpp',
'src/render/core/shader_program.cpp',
'src/render/core/texture_manager.cpp',
'src/render/core/wuffs_image_decoder.cpp',
'src/render/image_loaders.cpp',
'src/render/programs/image_program.cpp',
'src/render/programs/linear_gradient_program.cpp',
'src/render/programs/msdf_text_program.cpp',
'src/render/programs/rounded_rect_program.cpp',
'src/render/programs/spinner_program.cpp',
'src/render/programs/blur_program.cpp',
'src/render/programs/wallpaper_program.cpp',
'src/render/render_context.cpp',
'src/render/render_target.cpp',
'src/render/scene/input_area.cpp',
'src/render/scene/input_dispatcher.cpp',
'src/render/scene/node.cpp',
'src/render/text/msdf_text_renderer.cpp',
'src/render/wallpaper_renderer.cpp',
'src/shell/bar/bar.cpp',
'src/shell/clipboard/clipboard_panel.cpp',
'src/shell/control_center/calendar_tab.cpp',
'src/shell/control_center/audio_tab.cpp',
'src/shell/control_center/control_center_panel.cpp',
'src/shell/control_center/media_tab.cpp',
'src/shell/control_center/network_tab.cpp',
'src/shell/control_center/notifications_tab.cpp',
'src/shell/control_center/overview_tab.cpp',
'src/shell/control_center/tab.cpp',
'src/shell/control_center/weather_tab.cpp',
'src/shell/launcher/launcher_panel.cpp',
'src/shell/lockscreen/lock_screen.cpp',
'src/shell/lockscreen/lock_surface.cpp',
'src/shell/notification/notification_popup.cpp',
'src/shell/osd/audio_osd.cpp',
'src/shell/osd/osd_overlay.cpp',
'src/shell/panel/panel_manager.cpp',
'src/shell/session/session_panel.cpp',
'src/shell/test/test_panel.cpp',
'src/shell/tray/tray_menu.cpp',
'src/shell/overview/overview.cpp',
'src/shell/overview/overview_surface.cpp',
'src/shell/wallpaper/wallpaper.cpp',
'src/shell/wallpaper/wallpaper_surface.cpp',
'src/shell/widget/widget.cpp',
'src/shell/widget/widget_factory.cpp',
'src/shell/widgets/active_window_widget.cpp',
'src/shell/widgets/battery_widget.cpp',
'src/shell/widgets/clock_widget.cpp',
'src/shell/widgets/idle_inhibitor_widget.cpp',
'src/shell/widgets/launcher_widget.cpp',
'src/shell/widgets/media_mini_widget.cpp',
'src/shell/widgets/notification_widget.cpp',
'src/shell/widgets/power_profiles_widget.cpp',
'src/shell/widgets/session_widget.cpp',
'src/shell/widgets/spacer_widget.cpp',
'src/shell/widgets/sysmon_widget.cpp',
'src/shell/widgets/test_widget.cpp',
'src/shell/widgets/tray_widget.cpp',
'src/shell/widgets/volume_widget.cpp',
'src/shell/widgets/weather_widget.cpp',
'src/shell/widgets/workspaces_widget.cpp',
'src/system/desktop_entry.cpp',
'src/system/distro_info.cpp',
'src/system/icon_resolver.cpp',
'src/system/system_monitor_service.cpp',
'src/system/weather_service.cpp',
'src/time/time_service.cpp',
'src/ui/controls/audio_spectrum.cpp',
'src/ui/controls/box.cpp',
'src/ui/controls/button.cpp',
'src/ui/controls/checkbox.cpp',
'src/ui/controls/chip.cpp',
'src/ui/controls/flex.cpp',
'src/ui/controls/glyph.cpp',
'src/ui/controls/glyph_registry.cpp',
'src/ui/controls/image.cpp',
'src/ui/controls/input.cpp',
'src/ui/controls/label.cpp',
'src/ui/controls/progress_bar.cpp',
'src/ui/controls/radio_button.cpp',
'src/ui/controls/scroll_view.cpp',
'src/ui/controls/select.cpp',
'src/ui/controls/slider.cpp',
'src/ui/controls/spinner.cpp',
'src/ui/controls/toggle.cpp',
'src/util/fuzzy_match.cpp',
'src/wayland/clipboard_service.cpp',
'src/wayland/compositors/ext_workspace_backend.cpp',
'src/wayland/compositors/mango_workspace_backend.cpp',
'src/wayland/compositors/sway_workspace_backend.cpp',
'src/wayland/layer_surface.cpp',
'src/wayland/surface.cpp',
'src/wayland/wayland_connection.cpp',
'src/wayland/wayland_seat.cpp',
'src/wayland/wayland_toplevels.cpp',
'src/wayland/wayland_workspaces.cpp',
)
if sanitize
_noctalia_sources += files('src/pipewire/pipewire_lsan.cpp')
endif
# ── Include directories ────────────────────────────────────────────────────────
_noctalia_inc = [
include_directories('src'),
include_directories('third_party/nanosvg'),
include_directories('third_party/tomlplusplus'),
include_directories('third_party/wuffs', is_system: true),
# nlohmann is header-only and uses GCC extensions in some paths; treat as system.
include_directories('third_party/nlohmann', is_system: true),
# '.' adds both the source root and the corresponding build-dir root, so
# generated protocol headers (written to the build root) are found by #include.
include_directories('.'),
]
# ── Executable ────────────────────────────────────────────────────────────────
executable('noctalia',
sources: _noctalia_sources + _protocol_sources,
dependencies: [
sdbus_cpp_dep,
msdfgen_core_dep,
msdfgen_ext_dep,
wayland_client_dep,
egl_dep,
glesv2_dep,
wayland_egl_dep,
freetype2_dep,
harfbuzz_dep,
fontconfig_dep,
xkbcommon_dep,
pipewire_dep,
curl_dep,
pam_dep,
tinyexpr_dep,
],
include_directories: _noctalia_inc,
cpp_args: [
'-Wall', '-Wextra', '-Wpedantic', '-Wconversion', '-Wshadow',
'-DNOCTALIA_ASSETS_DIR="' + meson.project_source_root() / 'assets' + '"',
'-DNOCTALIA_VERSION="' + meson.project_version() + '"',
],
install: false,
)
+3
View File
@@ -0,0 +1,3 @@
# All options are Meson built-ins:
# -Db_sanitize=address,undefined enable ASan + UBSan
# -Db_lto=true enable LTO (used for release builds)