59 lines
1.7 KiB
CMake
59 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.27)
|
|
|
|
project(hypr-chrome
|
|
DESCRIPTION "Draws a chamfered HUD-style border frame with a title bar around each window."
|
|
VERSION 0.1
|
|
)
|
|
|
|
# Match the Makefile's prior default (CXXFLAGS ?= -O2) so a bare `cmake -B
|
|
# build` still produces an optimized build; pass -DCMAKE_BUILD_TYPE=Debug to
|
|
# override.
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
|
endif()
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Lets clangd discover build/compile_commands.json automatically (it checks
|
|
# common build-dir names on its own) - no hand-rolled compile_flags.txt
|
|
# needed.
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(deps REQUIRED IMPORTED_TARGET
|
|
hyprland
|
|
libdrm
|
|
libinput
|
|
libudev
|
|
pixman-1
|
|
wayland-server
|
|
xkbcommon
|
|
)
|
|
|
|
add_library(hypr-chrome SHARED
|
|
src/Main.cpp
|
|
src/ChromeDecoration.cpp
|
|
src/ChromePassElement.cpp
|
|
)
|
|
|
|
target_link_libraries(hypr-chrome PRIVATE rt PkgConfig::deps)
|
|
|
|
set_target_properties(hypr-chrome PROPERTIES
|
|
PREFIX ""
|
|
POSITION_INDEPENDENT_CODE ON
|
|
# hyprctl plugin load/buildAndLoad.sh both expect the built .so at the
|
|
# repo root, not buried in the build tree.
|
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
)
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
# GCC emits STB_GNU_UNIQUE bindings for vague-linkage symbols (header
|
|
# inline/static globals) by default; those break repeated dlopen/dlclose
|
|
# of the same symbol names, which is exactly what reloading this plugin
|
|
# does. Clang doesn't emit them and doesn't support this flag.
|
|
target_compile_options(hypr-chrome PRIVATE --no-gnu-unique)
|
|
endif()
|
|
|
|
install(TARGETS hypr-chrome)
|