Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactored cmake for proper export of the grapher library #28

Merged
merged 2 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)