2024-01-25 12:33:02 +00:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
2024-03-12 01:18:55 +00:00
|
|
|
project(quickshell VERSION "0.1.0" LANGUAGES CXX C)
|
2024-01-25 12:33:02 +00:00
|
|
|
|
|
|
|
set(QT_MIN_VERSION "6.6.0")
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2024-03-27 07:44:13 +00:00
|
|
|
option(BUILD_TESTING "Build tests" OFF)
|
|
|
|
option(ASAN "Enable ASAN" OFF)
|
|
|
|
option(FRAME_POINTERS "Always keep frame pointers" ${ASAN})
|
2024-03-02 13:05:45 +00:00
|
|
|
|
2024-03-27 07:44:13 +00:00
|
|
|
option(NVIDIA_COMPAT "Workarounds for nvidia gpus" OFF)
|
2024-03-02 13:05:45 +00:00
|
|
|
option(SOCKETS "Enable unix socket support" ON)
|
2024-02-20 11:12:05 +00:00
|
|
|
option(WAYLAND "Enable wayland support" ON)
|
2024-02-29 09:30:57 +00:00
|
|
|
option(WAYLAND_WLR_LAYERSHELL "Support the zwlr_layer_shell_v1 wayland protocol" ON)
|
|
|
|
option(WAYLAND_SESSION_LOCK "Support the ext_session_lock_v1 wayland protocol" ON)
|
2024-05-20 09:16:44 +00:00
|
|
|
option(X11 "Enable X11 support" ON)
|
2024-05-03 10:08:32 +00:00
|
|
|
option(HYPRLAND "Support hyprland specific features" ON)
|
2024-05-07 05:05:46 +00:00
|
|
|
option(HYPRLAND_GLOBAL_SHORTCUTS "Hyprland Global Shortcuts" ON)
|
|
|
|
option(HYPRLAND_FOCUS_GRAB "Hyprland Focus Grabbing" ON)
|
2024-04-06 09:19:40 +00:00
|
|
|
option(SERVICE_STATUS_NOTIFIER "StatusNotifierItem service" ON)
|
2024-05-19 09:23:11 +00:00
|
|
|
option(SERVICE_PIPEWIRE "PipeWire service" ON)
|
2024-05-20 01:09:16 +00:00
|
|
|
option(SERVICE_MPRIS "Mpris service" ON)
|
2024-02-29 09:30:57 +00:00
|
|
|
|
|
|
|
message(STATUS "Quickshell configuration")
|
2024-03-27 07:44:13 +00:00
|
|
|
message(STATUS " NVIDIA workarounds: ${NVIDIA_COMPAT}")
|
2024-03-04 13:04:29 +00:00
|
|
|
message(STATUS " Build tests: ${BUILD_TESTING}")
|
2024-03-02 13:05:45 +00:00
|
|
|
message(STATUS " Sockets: ${SOCKETS}")
|
2024-02-29 09:30:57 +00:00
|
|
|
message(STATUS " Wayland: ${WAYLAND}")
|
|
|
|
if (WAYLAND)
|
|
|
|
message(STATUS " Wlroots Layershell: ${WAYLAND_WLR_LAYERSHELL}")
|
|
|
|
message(STATUS " Session Lock: ${WAYLAND_SESSION_LOCK}")
|
|
|
|
endif ()
|
2024-05-20 09:16:44 +00:00
|
|
|
message(STATUS " X11: ${X11}")
|
2024-04-06 09:19:40 +00:00
|
|
|
message(STATUS " Services")
|
|
|
|
message(STATUS " StatusNotifier: ${SERVICE_STATUS_NOTIFIER}")
|
2024-05-19 09:23:11 +00:00
|
|
|
message(STATUS " PipeWire: ${SERVICE_PIPEWIRE}")
|
2024-05-21 11:05:15 +00:00
|
|
|
message(STATUS " Mpris: ${SERVICE_MPRIS}")
|
2024-05-03 10:08:32 +00:00
|
|
|
message(STATUS " Hyprland: ${HYPRLAND}")
|
2024-05-07 05:05:46 +00:00
|
|
|
if (HYPRLAND)
|
|
|
|
message(STATUS " Focus Grabbing: ${HYPRLAND_FOCUS_GRAB}")
|
|
|
|
message(STATUS " Global Shortcuts: ${HYPRLAND_GLOBAL_SHORTCUTS}")
|
|
|
|
endif()
|
2024-02-20 11:12:05 +00:00
|
|
|
|
2024-03-09 07:08:50 +00:00
|
|
|
if (NOT DEFINED GIT_REVISION)
|
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_REVISION
|
2024-04-08 06:07:05 +00:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2024-03-09 07:08:50 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-01-25 12:33:02 +00:00
|
|
|
add_compile_options(-Wall -Wextra)
|
|
|
|
|
2024-03-27 07:44:13 +00:00
|
|
|
if (FRAME_POINTERS)
|
|
|
|
add_compile_options(-fno-omit-frame-pointer)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (ASAN)
|
|
|
|
add_compile_options(-fsanitize=address)
|
|
|
|
add_link_options(-fsanitize=address)
|
|
|
|
endif()
|
|
|
|
|
2024-01-25 12:33:02 +00:00
|
|
|
# nix workaround
|
|
|
|
if (CMAKE_EXPORT_COMPILE_COMMANDS)
|
|
|
|
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
message(STATUS "CMAKE_BUILD_TYPE unset, defaulting to Debug.")
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
|
|
|
|
2024-04-08 05:30:37 +00:00
|
|
|
set(QT_DEPS Qt6::Gui Qt6::Qml Qt6::Quick Qt6::QuickControls2 Qt6::Widgets)
|
|
|
|
set(QT_FPDEPS Gui Qml Quick QuickControls2 Widgets)
|
2024-02-20 11:12:05 +00:00
|
|
|
|
2024-03-04 13:04:29 +00:00
|
|
|
if (BUILD_TESTING)
|
2024-03-02 13:05:45 +00:00
|
|
|
enable_testing()
|
2024-03-11 12:44:56 +00:00
|
|
|
add_definitions(-DQS_TEST)
|
2024-03-02 13:05:45 +00:00
|
|
|
list(APPEND QT_FPDEPS Test)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (SOCKETS)
|
|
|
|
list(APPEND QT_DEPS Qt6::Network)
|
|
|
|
list(APPEND QT_FPDEPS Network)
|
|
|
|
endif()
|
|
|
|
|
2024-02-20 11:12:05 +00:00
|
|
|
if (WAYLAND)
|
|
|
|
list(APPEND QT_DEPS Qt6::WaylandClient Qt6::WaylandClientPrivate)
|
|
|
|
list(APPEND QT_FPDEPS WaylandClient)
|
|
|
|
endif()
|
|
|
|
|
2024-05-20 01:09:16 +00:00
|
|
|
if (SERVICE_STATUS_NOTIFIER OR SERVICE_MPRIS)
|
2024-04-06 09:19:40 +00:00
|
|
|
set(DBUS ON)
|
|
|
|
endif()
|
|
|
|
|
2024-04-05 05:48:58 +00:00
|
|
|
if (DBUS)
|
|
|
|
list(APPEND QT_DEPS Qt6::DBus)
|
|
|
|
list(APPEND QT_FPDEPS DBus)
|
|
|
|
endif()
|
|
|
|
|
2024-02-20 11:12:05 +00:00
|
|
|
find_package(Qt6 REQUIRED COMPONENTS ${QT_FPDEPS})
|
2024-02-05 01:25:27 +00:00
|
|
|
|
2024-01-25 12:33:02 +00:00
|
|
|
qt_standard_project_setup(REQUIRES 6.6)
|
2024-03-09 05:07:16 +00:00
|
|
|
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules)
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-03-12 21:55:51 +00:00
|
|
|
# pch breaks clang-tidy..... somehow
|
|
|
|
if (NOT NO_PCH)
|
2024-03-13 07:57:03 +00:00
|
|
|
file(GENERATE
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pchstub.cpp
|
2024-04-08 06:07:05 +00:00
|
|
|
CONTENT "// intentionally empty"
|
2024-03-13 07:57:03 +00:00
|
|
|
)
|
|
|
|
|
2024-03-12 21:55:51 +00:00
|
|
|
add_library(qt-pch ${CMAKE_CURRENT_BINARY_DIR}/pchstub.cpp)
|
|
|
|
target_link_libraries(qt-pch PRIVATE ${QT_DEPS})
|
|
|
|
target_precompile_headers(qt-pch PUBLIC
|
|
|
|
<memory>
|
|
|
|
<qobject.h>
|
|
|
|
<qqmlengine.h>
|
|
|
|
<qlist.h>
|
|
|
|
<qcolor.h>
|
|
|
|
<qquickitem.h>
|
|
|
|
<qevent.h>
|
|
|
|
)
|
|
|
|
endif()
|
2024-03-12 01:18:55 +00:00
|
|
|
|
|
|
|
function (qs_pch target)
|
2024-03-12 21:55:51 +00:00
|
|
|
if (NOT NO_PCH)
|
|
|
|
target_precompile_headers(${target} REUSE_FROM qt-pch)
|
|
|
|
target_link_libraries(${target} PRIVATE ${QT_DEPS}) # required for gcc to accept the pch on plugin targets
|
|
|
|
endif()
|
2024-03-12 01:18:55 +00:00
|
|
|
endfunction()
|
|
|
|
|
2024-03-27 07:44:13 +00:00
|
|
|
if (NVIDIA_COMPAT)
|
|
|
|
add_compile_definitions(NVIDIA_COMPAT)
|
|
|
|
endif()
|
|
|
|
|
2024-03-12 01:34:38 +00:00
|
|
|
add_subdirectory(src)
|