1From 36820fbab1abeeebd99f14e368093e0e3f934ca7 Mon Sep 17 00:00:00 2001
2From: Someone Serge <sergei.kozlukov@aalto.fi>
3Date: Sat, 19 Feb 2022 02:37:54 +0200
4Subject: [PATCH 3/4] cmake: use system pybind11
5
6---
7 opensfm/src/CMakeLists.txt | 3 ++-
8 opensfm/src/bundle/CMakeLists.txt | 2 +-
9 opensfm/src/dense/CMakeLists.txt | 2 +-
10 opensfm/src/features/CMakeLists.txt | 1 -
11 opensfm/src/foundation/CMakeLists.txt | 1 -
12 opensfm/src/geo/CMakeLists.txt | 1 -
13 opensfm/src/geometry/CMakeLists.txt | 1 -
14 opensfm/src/map/CMakeLists.txt | 3 +--
15 opensfm/src/robust/CMakeLists.txt | 1 -
16 opensfm/src/sfm/CMakeLists.txt | 1 -
17 10 files changed, 5 insertions(+), 11 deletions(-)
18
19diff --git a/opensfm/src/CMakeLists.txt b/opensfm/src/CMakeLists.txt
20index 640d47a6..6e391ffa 100644
21--- a/opensfm/src/CMakeLists.txt
22+++ b/opensfm/src/CMakeLists.txt
23@@ -54,6 +54,8 @@ endif()
24
25 find_package(gflags REQUIRED)
26
27+find_package(pybind11 REQUIRED)
28+
29 find_package(LAPACK)
30 find_package(SuiteSparse)
31 find_package(Eigen3 REQUIRED)
32@@ -82,7 +84,6 @@ else()
33 endif()
34
35 ####### Third party libraries #######
36-add_subdirectory(third_party/pybind11)
37 add_subdirectory(third_party/akaze)
38 add_subdirectory(third_party/vlfeat)
39
40diff --git a/opensfm/src/bundle/CMakeLists.txt b/opensfm/src/bundle/CMakeLists.txt
41index 7cd9cf74..307e963a 100644
42--- a/opensfm/src/bundle/CMakeLists.txt
43+++ b/opensfm/src/bundle/CMakeLists.txt
44@@ -52,7 +52,7 @@ target_link_libraries(pybundle PRIVATE
45 bundle
46 geometry
47 foundation
48- pybind11)
49+)
50 set_target_properties(pybundle PROPERTIES
51 LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
52 )
53diff --git a/opensfm/src/dense/CMakeLists.txt b/opensfm/src/dense/CMakeLists.txt
54index cbebb5ea..2728749d 100644
55--- a/opensfm/src/dense/CMakeLists.txt
56+++ b/opensfm/src/dense/CMakeLists.txt
57@@ -23,7 +23,7 @@ endif()
58
59 pybind11_add_module(pydense python/pybind.cc)
60 target_include_directories(pydense PRIVATE ${GLOG_INCLUDE_DIR})
61-target_link_libraries(pydense PRIVATE dense foundation pybind11)
62+target_link_libraries(pydense PRIVATE dense foundation)
63 set_target_properties(pydense PROPERTIES
64 LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
65 )
66diff --git a/opensfm/src/features/CMakeLists.txt b/opensfm/src/features/CMakeLists.txt
67index b131d30a..6db5b3f1 100644
68--- a/opensfm/src/features/CMakeLists.txt
69+++ b/opensfm/src/features/CMakeLists.txt
70@@ -22,7 +22,6 @@ target_link_libraries(pyfeatures
71 PRIVATE
72 features
73 foundation
74- pybind11
75 akaze
76 )
77 set_target_properties(pyfeatures PROPERTIES
78diff --git a/opensfm/src/foundation/CMakeLists.txt b/opensfm/src/foundation/CMakeLists.txt
79index 40185227..9e0e45e7 100644
80--- a/opensfm/src/foundation/CMakeLists.txt
81+++ b/opensfm/src/foundation/CMakeLists.txt
82@@ -12,7 +12,6 @@ set(FOUNDATION_FILES
83 add_library(foundation ${FOUNDATION_FILES})
84 target_link_libraries(foundation
85 PUBLIC
86- pybind11
87 ${OpenCV_LIBS}
88 ${OpenMP_libomp_LIBRARY}
89 Eigen3::Eigen
90diff --git a/opensfm/src/geo/CMakeLists.txt b/opensfm/src/geo/CMakeLists.txt
91index a9cbae02..75620d06 100644
92--- a/opensfm/src/geo/CMakeLists.txt
93+++ b/opensfm/src/geo/CMakeLists.txt
94@@ -29,7 +29,6 @@ target_link_libraries(pygeo
95 PRIVATE
96 geo
97 foundation
98- pybind11
99 )
100 set_target_properties(pygeo PROPERTIES
101 LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
102diff --git a/opensfm/src/geometry/CMakeLists.txt b/opensfm/src/geometry/CMakeLists.txt
103index e6dda2c2..51bfd6c5 100644
104--- a/opensfm/src/geometry/CMakeLists.txt
105+++ b/opensfm/src/geometry/CMakeLists.txt
106@@ -48,7 +48,6 @@ target_link_libraries(pygeometry
107 PRIVATE
108 geometry
109 foundation
110- pybind11
111 )
112 set_target_properties(pygeometry PROPERTIES
113 LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
114diff --git a/opensfm/src/map/CMakeLists.txt b/opensfm/src/map/CMakeLists.txt
115index b6f67bcd..f869aa4c 100644
116--- a/opensfm/src/map/CMakeLists.txt
117+++ b/opensfm/src/map/CMakeLists.txt
118@@ -20,7 +20,7 @@ set(MAP_FILES
119 add_library(map ${MAP_FILES})
120 target_link_libraries(map
121 PUBLIC
122- pybind11
123+ pybind11::module
124 Eigen3::Eigen
125 PRIVATE
126 geo
127@@ -39,7 +39,6 @@ target_link_libraries(pymap
128 map
129 geometry
130 bundle
131- pybind11
132 )
133
134 if (OPENSFM_BUILD_TESTS)
135diff --git a/opensfm/src/robust/CMakeLists.txt b/opensfm/src/robust/CMakeLists.txt
136index ce70749f..40bdf7a4 100644
137--- a/opensfm/src/robust/CMakeLists.txt
138+++ b/opensfm/src/robust/CMakeLists.txt
139@@ -29,7 +29,6 @@ target_link_libraries(pyrobust
140 PRIVATE
141 robust
142 foundation
143- pybind11
144 )
145 set_target_properties(pyrobust PROPERTIES
146 LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
147diff --git a/opensfm/src/sfm/CMakeLists.txt b/opensfm/src/sfm/CMakeLists.txt
148index 98c28f41..7f56b791 100644
149--- a/opensfm/src/sfm/CMakeLists.txt
150+++ b/opensfm/src/sfm/CMakeLists.txt
151@@ -35,7 +35,6 @@ target_include_directories(pysfm PRIVATE ${GLOG_INCLUDE_DIR})
152 target_link_libraries(pysfm
153 PRIVATE
154 foundation
155- pybind11
156 sfm
157 )
158 set_target_properties(pysfm PROPERTIES
159--
1602.33.1
161