mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-11-16 18:25:58 +01:00
CMake: fmt
This commit is contained in:
parent
4efcbd36a2
commit
04cb4df80a
1 changed files with 66 additions and 34 deletions
100
CMakeLists.txt
100
CMakeLists.txt
|
@ -5,10 +5,10 @@ string(STRIP ${VER_RAW} HYPRCURSOR_VERSION)
|
||||||
|
|
||||||
add_compile_definitions(HYPRCURSOR_VERSION="${HYPRCURSOR_VERSION}")
|
add_compile_definitions(HYPRCURSOR_VERSION="${HYPRCURSOR_VERSION}")
|
||||||
|
|
||||||
project(hyprcursor
|
project(
|
||||||
VERSION ${HYPRCURSOR_VERSION}
|
hyprcursor
|
||||||
DESCRIPTION "A library and toolkit for the Hyprland cursor format"
|
VERSION ${HYPRCURSOR_VERSION}
|
||||||
)
|
DESCRIPTION "A library and toolkit for the Hyprland cursor format")
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
@ -22,46 +22,68 @@ configure_file(hyprcursor.pc.in hyprcursor.pc @ONLY)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprlang>=0.4.2 libzip cairo librsvg-2.0 tomlplusplus)
|
pkg_check_modules(
|
||||||
|
deps
|
||||||
|
REQUIRED
|
||||||
|
IMPORTED_TARGET
|
||||||
|
hyprlang>=0.4.2
|
||||||
|
libzip
|
||||||
|
cairo
|
||||||
|
librsvg-2.0
|
||||||
|
tomlplusplus)
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
message(STATUS "Configuring hyprcursor in Debug")
|
message(STATUS "Configuring hyprcursor in Debug")
|
||||||
add_compile_definitions(HYPRLAND_DEBUG)
|
add_compile_definitions(HYPRLAND_DEBUG)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-O3)
|
add_compile_options(-O3)
|
||||||
message(STATUS "Configuring hyprcursor in Release")
|
message(STATUS "Configuring hyprcursor in Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "libhyprcursor/*.cpp" "include/hyprcursor/hyprcursor.hpp" "include/hyprcursor/hyprcursor.h" "include/hyprcursor/shared.h")
|
file(
|
||||||
|
GLOB_RECURSE
|
||||||
|
SRCFILES
|
||||||
|
CONFIGURE_DEPENDS
|
||||||
|
"libhyprcursor/*.cpp"
|
||||||
|
"include/hyprcursor/hyprcursor.hpp"
|
||||||
|
"include/hyprcursor/hyprcursor.h"
|
||||||
|
"include/hyprcursor/shared.h")
|
||||||
|
|
||||||
add_library(hyprcursor SHARED ${SRCFILES})
|
add_library(hyprcursor SHARED ${SRCFILES})
|
||||||
target_include_directories( hyprcursor
|
target_include_directories(
|
||||||
PUBLIC "./include"
|
hyprcursor
|
||||||
PRIVATE "./libhyprcursor"
|
PUBLIC "./include"
|
||||||
)
|
PRIVATE "./libhyprcursor")
|
||||||
set_target_properties(hyprcursor PROPERTIES
|
set_target_properties(
|
||||||
VERSION ${hyprcursor_VERSION}
|
hyprcursor
|
||||||
SOVERSION 0
|
PROPERTIES VERSION ${hyprcursor_VERSION}
|
||||||
PUBLIC_HEADER include/hyprcursor/hyprcursor.hpp include/hyprcursor/hyprcursor.h include/hyprcursor/shared.h
|
SOVERSION 0
|
||||||
)
|
PUBLIC_HEADER include/hyprcursor/hyprcursor.hpp
|
||||||
|
include/hyprcursor/hyprcursor.h include/hyprcursor/shared.h)
|
||||||
|
|
||||||
target_link_libraries(hyprcursor PkgConfig::deps)
|
target_link_libraries(hyprcursor PkgConfig::deps)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
# for std::expected.
|
# for std::expected. probably evil. Arch's clang is very outdated tho...
|
||||||
# probably evil. Arch's clang is very outdated tho...
|
target_compile_options(
|
||||||
target_compile_options(hyprcursor PUBLIC
|
hyprcursor PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++2b
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++2b -D__cpp_concepts=202002L>
|
-D__cpp_concepts=202002L> -Wno-builtin-macro-redefined)
|
||||||
-Wno-builtin-macro-redefined)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# hyprcursor-util
|
# hyprcursor-util
|
||||||
file(GLOB_RECURSE UTILSRCFILES CONFIGURE_DEPENDS "hyprcursor-util/src/*.cpp" "include/hyprcursor/hyprcursor.hpp" "include/hyprcursor/hyprcursor.h" "include/hyprcursor/shared.h")
|
file(
|
||||||
|
GLOB_RECURSE
|
||||||
|
UTILSRCFILES
|
||||||
|
CONFIGURE_DEPENDS
|
||||||
|
"hyprcursor-util/src/*.cpp"
|
||||||
|
"include/hyprcursor/hyprcursor.hpp"
|
||||||
|
"include/hyprcursor/hyprcursor.h"
|
||||||
|
"include/hyprcursor/shared.h")
|
||||||
add_executable(hyprcursor-util ${UTILSRCFILES})
|
add_executable(hyprcursor-util ${UTILSRCFILES})
|
||||||
target_include_directories(hyprcursor-util
|
target_include_directories(
|
||||||
PUBLIC "./include"
|
hyprcursor-util
|
||||||
PRIVATE "./libhyprcursor" "./hyprcursor-util/src"
|
PUBLIC "./include"
|
||||||
)
|
PRIVATE "./libhyprcursor" "./hyprcursor-util/src")
|
||||||
target_link_libraries(hyprcursor-util PkgConfig::deps hyprcursor)
|
target_link_libraries(hyprcursor-util PkgConfig::deps hyprcursor)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
@ -69,21 +91,31 @@ add_custom_target(tests)
|
||||||
|
|
||||||
add_executable(hyprcursor_test1 "tests/full_rendering.cpp")
|
add_executable(hyprcursor_test1 "tests/full_rendering.cpp")
|
||||||
target_link_libraries(hyprcursor_test1 PRIVATE hyprcursor)
|
target_link_libraries(hyprcursor_test1 PRIVATE hyprcursor)
|
||||||
add_test(NAME "Test libhyprcursor in C++ (full rendering)" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprcursor_test1)
|
add_test(
|
||||||
|
NAME "Test libhyprcursor in C++ (full rendering)"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprcursor_test1)
|
||||||
add_dependencies(tests hyprcursor_test1)
|
add_dependencies(tests hyprcursor_test1)
|
||||||
|
|
||||||
add_executable(hyprcursor_test2 "tests/only_metadata.cpp")
|
add_executable(hyprcursor_test2 "tests/only_metadata.cpp")
|
||||||
target_link_libraries(hyprcursor_test2 PRIVATE hyprcursor)
|
target_link_libraries(hyprcursor_test2 PRIVATE hyprcursor)
|
||||||
add_test(NAME "Test libhyprcursor in C++ (only metadata)" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprcursor_test2)
|
add_test(
|
||||||
|
NAME "Test libhyprcursor in C++ (only metadata)"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprcursor_test2)
|
||||||
add_dependencies(tests hyprcursor_test2)
|
add_dependencies(tests hyprcursor_test2)
|
||||||
|
|
||||||
add_executable(hyprcursor_test_c "tests/c_test.c")
|
add_executable(hyprcursor_test_c "tests/c_test.c")
|
||||||
target_link_libraries(hyprcursor_test_c PRIVATE hyprcursor)
|
target_link_libraries(hyprcursor_test_c PRIVATE hyprcursor)
|
||||||
add_test(NAME "Test libhyprcursor in C" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprcursor_test_c)
|
add_test(
|
||||||
|
NAME "Test libhyprcursor in C"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprcursor_test_c)
|
||||||
add_dependencies(tests hyprcursor_test_c)
|
add_dependencies(tests hyprcursor_test_c)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
install(TARGETS hyprcursor)
|
install(TARGETS hyprcursor)
|
||||||
install(TARGETS hyprcursor-util)
|
install(TARGETS hyprcursor-util)
|
||||||
install(DIRECTORY "include/hyprcursor" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(DIRECTORY "include/hyprcursor" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/hyprcursor.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_BINARY_DIR}/hyprcursor.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
Loading…
Reference in a new issue