2023-12-28 20:38:01 +01:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
2023-12-31 14:41:22 +01:00
|
|
|
|
2024-01-02 23:10:42 +01:00
|
|
|
set(HYPRLANG_VERSION "0.2.1")
|
2023-12-31 14:41:22 +01:00
|
|
|
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
2024-01-02 22:13:20 +01:00
|
|
|
set(INCLUDE ${CMAKE_INSTALL_INCLUDEDIR})
|
2023-12-31 14:41:22 +01:00
|
|
|
|
2023-12-28 20:38:01 +01:00
|
|
|
project(hyprlang
|
2023-12-31 14:41:22 +01:00
|
|
|
VERSION ${HYPRLANG_VERSION}
|
2023-12-28 20:38:01 +01:00
|
|
|
DESCRIPTION "A library to parse hypr config files"
|
|
|
|
)
|
|
|
|
|
2023-12-31 14:41:22 +01:00
|
|
|
configure_file(hyprlang.pc.in hyprlang.pc @ONLY)
|
|
|
|
|
2023-12-28 20:38:01 +01:00
|
|
|
include(CTest)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/hyprlang.hpp")
|
|
|
|
|
2023-12-28 21:26:25 +01:00
|
|
|
add_library(hyprlang SHARED ${SRCFILES})
|
2023-12-28 20:38:01 +01:00
|
|
|
target_include_directories( hyprlang
|
|
|
|
PUBLIC "./include"
|
|
|
|
PRIVATE "./src"
|
|
|
|
)
|
2023-12-29 20:04:23 +01:00
|
|
|
set_target_properties(hyprlang PROPERTIES PUBLIC_HEADER include/hyprlang.hpp)
|
2023-12-28 20:38:01 +01:00
|
|
|
|
2023-12-28 22:11:27 +01:00
|
|
|
install(TARGETS hyprlang)
|
2023-12-28 20:38:01 +01:00
|
|
|
|
2023-12-31 16:51:50 +01:00
|
|
|
# tests
|
|
|
|
add_custom_target(tests)
|
|
|
|
|
|
|
|
add_executable(hyprlang_test "tests/parse/main.cpp")
|
2023-12-28 20:38:01 +01:00
|
|
|
target_link_libraries(hyprlang_test PRIVATE hyprlang)
|
2024-01-03 14:13:49 +01:00
|
|
|
add_test(NAME "Parsing" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprlang_test "parse")
|
2023-12-31 16:51:50 +01:00
|
|
|
add_dependencies(tests hyprlang_test)
|
|
|
|
|
|
|
|
add_executable(hyprlang_fuzz "tests/fuzz/main.cpp")
|
|
|
|
target_link_libraries(hyprlang_fuzz PRIVATE hyprlang)
|
2024-01-03 14:13:49 +01:00
|
|
|
add_test(NAME "Fuzz" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprlang_fuzz "fuzz")
|
2023-12-31 16:51:50 +01:00
|
|
|
add_dependencies(tests hyprlang_fuzz)
|
2023-12-29 20:04:23 +01:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
install(TARGETS hyprlang
|
|
|
|
PUBLIC_HEADER DESTINATION include
|
|
|
|
LIBRARY DESTINATION lib)
|
2024-01-03 13:59:09 +01:00
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/hyprlang.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)
|