mirror of
https://github.com/hyprwm/hyprutils.git
synced 2024-12-22 16:39:48 +01:00
CMake: fmt
This commit is contained in:
parent
928d9b4ee9
commit
04697c69ab
1 changed files with 32 additions and 21 deletions
|
@ -4,10 +4,10 @@ file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||||
string(STRIP ${VER_RAW} HYPRUTILS_VERSION)
|
string(STRIP ${VER_RAW} HYPRUTILS_VERSION)
|
||||||
add_compile_definitions(HYPRUTILS_VERSION="${HYPRUTILS_VERSION}")
|
add_compile_definitions(HYPRUTILS_VERSION="${HYPRUTILS_VERSION}")
|
||||||
|
|
||||||
project(hyprutils
|
project(
|
||||||
VERSION ${HYPRUTILS_VERSION}
|
hyprutils
|
||||||
DESCRIPTION "Small C++ library for utilities used across the Hypr* ecosystem"
|
VERSION ${HYPRUTILS_VERSION}
|
||||||
)
|
DESCRIPTION "Small C++ library for utilities used across the Hypr* ecosystem")
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
@ -21,11 +21,11 @@ configure_file(hyprutils.pc.in hyprutils.pc @ONLY)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
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 hyprutils in Debug")
|
message(STATUS "Configuring hyprutils 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 hyprutils in Release")
|
message(STATUS "Configuring hyprutils in Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/*.hpp")
|
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/*.hpp")
|
||||||
|
@ -35,14 +35,12 @@ find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET pixman-1)
|
pkg_check_modules(deps REQUIRED IMPORTED_TARGET pixman-1)
|
||||||
|
|
||||||
add_library(hyprutils SHARED ${SRCFILES})
|
add_library(hyprutils SHARED ${SRCFILES})
|
||||||
target_include_directories( hyprutils
|
target_include_directories(
|
||||||
PUBLIC "./include"
|
hyprutils
|
||||||
PRIVATE "./src"
|
PUBLIC "./include"
|
||||||
)
|
PRIVATE "./src")
|
||||||
set_target_properties(hyprutils PROPERTIES
|
set_target_properties(hyprutils PROPERTIES VERSION ${hyprutils_VERSION}
|
||||||
VERSION ${hyprutils_VERSION}
|
SOVERSION 1)
|
||||||
SOVERSION 1
|
|
||||||
)
|
|
||||||
target_link_libraries(hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils PkgConfig::deps)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
@ -50,25 +48,38 @@ add_custom_target(tests)
|
||||||
|
|
||||||
add_executable(hyprutils_memory "tests/memory.cpp")
|
add_executable(hyprutils_memory "tests/memory.cpp")
|
||||||
target_link_libraries(hyprutils_memory PRIVATE hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils_memory PRIVATE hyprutils PkgConfig::deps)
|
||||||
add_test(NAME "Memory" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprutils_memory "memory")
|
add_test(
|
||||||
|
NAME "Memory"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprutils_memory "memory")
|
||||||
add_dependencies(tests hyprutils_memory)
|
add_dependencies(tests hyprutils_memory)
|
||||||
|
|
||||||
add_executable(hyprutils_string "tests/string.cpp")
|
add_executable(hyprutils_string "tests/string.cpp")
|
||||||
target_link_libraries(hyprutils_string PRIVATE hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils_string PRIVATE hyprutils PkgConfig::deps)
|
||||||
add_test(NAME "String" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprutils_string "string")
|
add_test(
|
||||||
|
NAME "String"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprutils_string "string")
|
||||||
add_dependencies(tests hyprutils_string)
|
add_dependencies(tests hyprutils_string)
|
||||||
|
|
||||||
add_executable(hyprutils_signal "tests/signal.cpp")
|
add_executable(hyprutils_signal "tests/signal.cpp")
|
||||||
target_link_libraries(hyprutils_signal PRIVATE hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils_signal PRIVATE hyprutils PkgConfig::deps)
|
||||||
add_test(NAME "Signal" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprutils_signal "signal")
|
add_test(
|
||||||
|
NAME "Signal"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprutils_signal "signal")
|
||||||
add_dependencies(tests hyprutils_signal)
|
add_dependencies(tests hyprutils_signal)
|
||||||
|
|
||||||
add_executable(hyprutils_math "tests/math.cpp")
|
add_executable(hyprutils_math "tests/math.cpp")
|
||||||
target_link_libraries(hyprutils_math PRIVATE hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils_math PRIVATE hyprutils PkgConfig::deps)
|
||||||
add_test(NAME "Math" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprutils_math "math")
|
add_test(
|
||||||
|
NAME "Math"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprutils_math "math")
|
||||||
add_dependencies(tests hyprutils_math)
|
add_dependencies(tests hyprutils_math)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
install(TARGETS hyprutils)
|
install(TARGETS hyprutils)
|
||||||
install(DIRECTORY "include/hyprutils" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(DIRECTORY "include/hyprutils" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/hyprutils.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_BINARY_DIR}/hyprutils.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
Loading…
Reference in a new issue