diff --git a/CMakeLists.txt b/CMakeLists.txt index 640054e..18de9ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,6 @@ include(MiscCheck) add_subdirectory(tensorpipe) -install(EXPORT TensorpipeTargets - DESTINATION share/cmake/Tensorpipe - FILE TensorpipeTargets.cmake) +install(EXPORT tensorpipeTargets + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} # share/tensorpipe + FILE tensorpipeTargets.cmake) diff --git a/tensorpipe/CMakeLists.txt b/tensorpipe/CMakeLists.txt index d8624b4..dce5c6f 100644 --- a/tensorpipe/CMakeLists.txt +++ b/tensorpipe/CMakeLists.txt @@ -168,8 +168,9 @@ set(TP_PUBLIC_HEADERS ${TP_PUBLIC_HEADERS} transport/uv/error.h transport/uv/factory.h transport/uv/utility.h) -find_package(uv REQUIRED) -target_link_libraries(tensorpipe PRIVATE uv::uv) +# `libuv` in vcpkg +find_package(unofficial-libuv CONFIG REQUIRED) +target_link_libraries(tensorpipe PUBLIC unofficial::libuv::libuv ${CMAKE_DL_LIBS}) ### shm @@ -233,11 +234,14 @@ configure_file(config.h.in config.h) ## Libnop -# We should keep libnop headers private as they should not be exposed to downstream users, -# but they're currently transitively included by tensorpipe/transport/connection.h (which -# is still unclear whether it should be a public or private header). -target_include_directories(tensorpipe PUBLIC $) - +# `libnop` in vcpkg +find_path(LIBNOP_INCLUDE_DIRS "nop/serializer.h") +if(LIBNOP_INCLUDE_DIRS-NOTFOUND) + message(FATAL_ERROR "Failed to find header of the 'libnop' package from vcpkg.") +else() + message(STATUS "Using 'libnop': ${LIBNOP_INCLUDE_DIRS}") +endif() +target_include_directories(tensorpipe PUBLIC $) ## Python bindings @@ -262,10 +266,17 @@ endif() ## Install +install(DIRECTORY channel common core transport util + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tensorpipe + FILES_MATCHING PATTERN "*.h") +install(FILES tensorpipe.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tensorpipe) + install(TARGETS tensorpipe - EXPORT TensorpipeTargets - LIBRARY DESTINATION ${TP_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${TP_INSTALL_LIBDIR}) + EXPORT tensorpipeTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) foreach(_header_file ${TP_PUBLIC_HEADERS}) get_filename_component(_TP_HEADER_SUBDIR "${_header_file}" DIRECTORY)