mirror of
https://github.com/hyprwm/hyprlang.git
synced 2024-11-16 18:25:57 +01:00
CMake: fmt
This commit is contained in:
parent
c0704455ee
commit
651c8d02cc
1 changed files with 39 additions and 32 deletions
|
@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.19)
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||||
string(STRIP ${VER_RAW} HYPRLANG_VERSION)
|
string(STRIP ${VER_RAW} HYPRLANG_VERSION)
|
||||||
|
|
||||||
project(hyprlang
|
project(
|
||||||
VERSION ${HYPRLANG_VERSION}
|
hyprlang
|
||||||
DESCRIPTION "A library to parse hypr config files"
|
VERSION ${HYPRLANG_VERSION}
|
||||||
)
|
DESCRIPTION "A library to parse hypr config files")
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
@ -18,11 +18,11 @@ set(LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||||
configure_file(hyprlang.pc.in hyprlang.pc @ONLY)
|
configure_file(hyprlang.pc.in hyprlang.pc @ONLY)
|
||||||
|
|
||||||
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 hyprlang in Debug")
|
message(STATUS "Configuring hyprlang 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 hyprlang in Release")
|
message(STATUS "Configuring hyprlang in Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_definitions(HYPRLANG_INTERNAL)
|
add_compile_definitions(HYPRLANG_INTERNAL)
|
||||||
|
@ -30,31 +30,30 @@ add_compile_definitions(HYPRLANG_INTERNAL)
|
||||||
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
|
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprutils>=0.1.1)
|
||||||
hyprutils>=0.1.1
|
|
||||||
)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/hyprlang.hpp")
|
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/hyprlang.hpp")
|
||||||
|
|
||||||
add_library(hyprlang SHARED ${SRCFILES})
|
add_library(hyprlang SHARED ${SRCFILES})
|
||||||
target_include_directories( hyprlang
|
target_include_directories(
|
||||||
PUBLIC "./include"
|
hyprlang
|
||||||
PRIVATE "./src"
|
PUBLIC "./include"
|
||||||
)
|
PRIVATE "./src")
|
||||||
set_target_properties(hyprlang PROPERTIES
|
set_target_properties(
|
||||||
VERSION ${HYPRLANG_VERSION}
|
hyprlang
|
||||||
SOVERSION 2
|
PROPERTIES VERSION ${HYPRLANG_VERSION}
|
||||||
PUBLIC_HEADER include/hyprlang.hpp)
|
SOVERSION 2
|
||||||
|
PUBLIC_HEADER include/hyprlang.hpp)
|
||||||
|
|
||||||
target_link_libraries(hyprlang PkgConfig::deps)
|
target_link_libraries(hyprlang 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(hyprlang PUBLIC -std=gnu++2b -D__cpp_concepts=202002L
|
||||||
target_compile_options(hyprlang PUBLIC -std=gnu++2b -D__cpp_concepts=202002L -Wno-macro-redefined)
|
-Wno-macro-redefined)
|
||||||
add_compile_options(-stdlib=libc++)
|
add_compile_options(-stdlib=libc++)
|
||||||
add_link_options(-stdlib=libc++)
|
add_link_options(-stdlib=libc++)
|
||||||
message(STATUS "Using clang++ to compile hyprlang")
|
message(STATUS "Using clang++ to compile hyprlang")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS hyprlang)
|
install(TARGETS hyprlang)
|
||||||
|
@ -64,16 +63,24 @@ add_custom_target(tests)
|
||||||
|
|
||||||
add_executable(hyprlang_test "tests/parse/main.cpp")
|
add_executable(hyprlang_test "tests/parse/main.cpp")
|
||||||
target_link_libraries(hyprlang_test PRIVATE hyprlang hyprutils)
|
target_link_libraries(hyprlang_test PRIVATE hyprlang hyprutils)
|
||||||
add_test(NAME "Parsing" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprlang_test "parse")
|
add_test(
|
||||||
|
NAME "Parsing"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprlang_test "parse")
|
||||||
add_dependencies(tests hyprlang_test)
|
add_dependencies(tests hyprlang_test)
|
||||||
|
|
||||||
add_executable(hyprlang_fuzz "tests/fuzz/main.cpp")
|
add_executable(hyprlang_fuzz "tests/fuzz/main.cpp")
|
||||||
target_link_libraries(hyprlang_fuzz PRIVATE hyprlang hyprutils)
|
target_link_libraries(hyprlang_fuzz PRIVATE hyprlang hyprutils)
|
||||||
add_test(NAME "Fuzz" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND hyprlang_fuzz "fuzz")
|
add_test(
|
||||||
|
NAME "Fuzz"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND hyprlang_fuzz "fuzz")
|
||||||
add_dependencies(tests hyprlang_fuzz)
|
add_dependencies(tests hyprlang_fuzz)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
install(TARGETS hyprlang
|
install(
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
TARGETS hyprlang
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/hyprlang.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/hyprlang.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
Loading…
Reference in a new issue