From a5c62c6e7c998b3117d1914757716745ac316464 Mon Sep 17 00:00:00 2001 From: mccakit Date: Tue, 10 Mar 2026 02:29:16 +0300 Subject: [PATCH] pkgconf install --- CMakeLists.txt | 13 +++++++++++-- include/graaflib/algorithm/shortest_path/a_star.tpp | 7 ++++--- packaging/graaf.pc.in | 8 ++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 packaging/graaf.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index c39daed7..16fa16bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,5 +37,14 @@ endif() #Adding Interface to enable use of FetchContent add_library(${GRAAF_LIB_TARGET_NAME} INTERFACE) add_library(${PROJECT_NAME}::${GRAAF_LIB_TARGET_NAME} ALIAS ${PROJECT_NAME}) - -target_include_directories(${GRAAF_LIB_TARGET_NAME} INTERFACE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/include/") \ No newline at end of file +target_include_directories(${GRAAF_LIB_TARGET_NAME} INTERFACE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/include/") +include(GNUInstallDirs) +install( + DIRECTORY "${PROJECT_SOURCE_DIR}/include/" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +configure_file(${CMAKE_SOURCE_DIR}/packaging/graaf.pc.in graaf.pc @ONLY) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/graaf.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/include/graaflib/algorithm/shortest_path/a_star.tpp b/include/graaflib/algorithm/shortest_path/a_star.tpp index 3f8fc8e3..c39e6524 100644 --- a/include/graaflib/algorithm/shortest_path/a_star.tpp +++ b/include/graaflib/algorithm/shortest_path/a_star.tpp @@ -60,9 +60,10 @@ std::optional> a_star_search( // A* search does not work on negative edge weights. if (edge_weight < 0) { - throw std::invalid_argument{fmt::format( - "Negative edge weight [{}] between vertices [{}] -> [{}].", - edge_weight, current.id, neighbor)}; + throw std::invalid_argument{ + "Negative edge weight [" + std::to_string(edge_weight) + + "] between vertices [" + std::to_string(current.id) + "] -> [" + + std::to_string(neighbor) + "]."}; } // tentative_g_score is the distance from start to the neighbor through diff --git a/packaging/graaf.pc.in b/packaging/graaf.pc.in new file mode 100644 index 00000000..061b4917 --- /dev/null +++ b/packaging/graaf.pc.in @@ -0,0 +1,8 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: graaf +Version: @PROJECT_VERSION@ +Description: @PROJECT_DESCRIPTION@ +Cflags: -I${includedir}