Skip to content

Commit

Permalink
Merge pull request #28 from JPenuchot/vcpkg-compatibility
Browse files Browse the repository at this point in the history
refactored cmake for proper export of the grapher library
  • Loading branch information
JPenuchot authored May 29, 2023
2 parents a98763b + 7809dfc commit fa4ead5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
28 changes: 21 additions & 7 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ include(CMakePackageConfigHelpers)

set(ConfigPackageLocation lib/cmake/${PROJECT_NAME})

install(TARGETS ctbench-grapher-plot ctbench-grapher-utils ctbench-compiler-launcher
EXPORT ctbench-targets)
install(
DIRECTORY grapher/include/grapher
TYPE INCLUDE)

install(
TARGETS
grapher
ctbench-compile-opts
ctbench-grapher-plot
ctbench-grapher-utils
ctbench-compiler-launcher
EXPORT ctbench-targets)

export(EXPORT ctbench-targets FILE ctbench-targets.cmake)

Expand All @@ -16,14 +26,18 @@ install(FILES cmake/ctbench-api.cmake DESTINATION ${ConfigPackageLocation})

# CMake package config files

configure_package_config_file(cmake/ctbench-config.cmake.in ctbench-config.cmake
INSTALL_DESTINATION ${ConfigPackageLocation})
configure_package_config_file(
cmake/ctbench-config.cmake.in
ctbench-config.cmake
INSTALL_DESTINATION ${ConfigPackageLocation})

write_basic_package_version_file(
ctbench-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)

install(FILES ${CMAKE_BINARY_DIR}/ctbench-config.cmake
${CMAKE_BINARY_DIR}/ctbench-config-version.cmake
DESTINATION ${ConfigPackageLocation})
install(
FILES
${CMAKE_BINARY_DIR}/ctbench-config.cmake
${CMAKE_BINARY_DIR}/ctbench-config-version.cmake
DESTINATION ${ConfigPackageLocation})
18 changes: 14 additions & 4 deletions grapher/cmake/grapher-target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
file(GLOB_RECURSE GRAPHER_SOURCES lib/*.cpp)
add_library(grapher STATIC ${GRAPHER_SOURCES})

target_include_directories(grapher PUBLIC include)
target_include_directories(grapher
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

llvm_map_components_to_libnames(llvm_libs support)

target_link_libraries(
grapher PUBLIC ctbench-compile-opts nlohmann_json::nlohmann_json
sciplot::sciplot fmt::fmt stdc++fs tbb ${llvm_libs})
target_link_libraries(grapher
PUBLIC
ctbench-compile-opts
nlohmann_json::nlohmann_json
sciplot::sciplot
fmt::fmt
stdc++fs
tbb
${llvm_libs})

target_compile_options(grapher PUBLIC -DJSON_NOEXCEPTION)

0 comments on commit fa4ead5

Please sign in to comment.