aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/tensorpipe/support-find-package.patch
blob: 85278a26ab9cae921f7586c4d71be50c26138be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77df76d..bebb8c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,5 +24,17 @@ include(MiscCheck)
 add_subdirectory(tensorpipe)
 
 install(EXPORT TensorpipeTargets
-        DESTINATION share/cmake/Tensorpipe
-        FILE TensorpipeTargets.cmake)
+        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe
+        NAMESPACE unofficial::tensorpipe::
+        FILE unofficial-tensorpipe-targets.cmake)
+
+# Create TensorpipeConfig.cmake for find_package(unofficial-tensorpipe CONFIG)
+include(CMakePackageConfigHelpers)
+get_filename_component(CONFIG_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/unofficial-tensorpipe-config.cmake ABSOLUTE)
+configure_package_config_file(
+  cmake/unofficial-tensorpipe-config.cmake.in ${CONFIG_FILE_PATH}
+  INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe)
+
+# Install the generated config file
+install(FILES ${CONFIG_FILE_PATH}
+        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/unofficial-tensorpipe)
diff --git a/cmake/unofficial-tensorpipe-config.cmake.in b/cmake/unofficial-tensorpipe-config.cmake.in
new file mode 100644
index 000000000..f2ea8ce47
--- /dev/null
+++ b/cmake/unofficial-tensorpipe-config.cmake.in
@@ -0,0 +1,15 @@
+@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+
+find_dependency(libuv REQUIRED)
+
+get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+file(GLOB CONFIG_FILES "${_DIR}/unofficial-tensorpipe-config-*.cmake")
+foreach(f ${CONFIG_FILES})
+  include(${f})
+endforeach()
+
+# import targets 
+include("${_DIR}/unofficial-tensorpipe-targets.cmake")
+
+check_required_components(@PROJECT_NAME@)
diff --git a/tensorpipe/python/CMakeLists.txt b/tensorpipe/python/CMakeLists.txt
index ce494722f..b722381f8 100644
--- a/tensorpipe/python/CMakeLists.txt
+++ b/tensorpipe/python/CMakeLists.txt
@@ -14,3 +14,8 @@ endif()
 set(PYBIND11_CPP_STANDARD -std=c++14)
 pybind11_add_module(pytensorpipe tensorpipe.cc)
 target_link_libraries(pytensorpipe PRIVATE tensorpipe)
+
+install(TARGETS pytensorpipe
+        EXPORT TensorpipeTargets
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})