@@ -32,14 +32,15 @@ def set_version(self):
3232 self .version = re .search ("set\(CMAKE_PROJECT_VERSION (.+)\)" , content ).group (1 ).strip ()
3333
3434 def configure (self ):
35- # If we're building static then build the world as static, otherwise
36- # stuff will probably break.
37- # If you want your shared build to also build the world as shared, you
38- # can invoke conan with -o "&:shared=False" -o "*:shared=False",
39- # possibly with --build=missing or --build=cascade as desired,
40- # but this is probably not necessary.
41- if not self .options .shared :
42- self .options ["*" ].shared = False
35+ if self .options .shared :
36+ # See https://github.com/conan-io/conan-center-index/issues/25107
37+ self .options ["grpc" ].secure = True
38+
39+ # From some experiments it seems that the shared-ness of these packages
40+ # should match that of the SDK recipe. Failure to do so can cause linker
41+ # errors while compiling, or static initialization errors at runtime for modules.
42+ for lib in ["grpc" , "protobuf" , "abseil" ]:
43+ self .options [lib ].shared = True
4344
4445 def requirements (self ):
4546 self .requires ('boost/[>=1.74.0]' , transitive_headers = True )
@@ -49,8 +50,8 @@ def requirements(self):
4950 self .requires ('grpc/[>=1.48.4]' , transitive_headers = True )
5051 self .requires ('protobuf/[>=3.17.1]' , transitive_headers = True )
5152
52- self .requires ('xtensor/[>=0.24.3]' , transitive_headers = True )
53- self .requires ('abseil/[>=20230125.3]' )
53+ self .requires ('xtensor/[>=0.24.3]' )
54+ self .requires ('abseil/[>=20230125.3]' , transitive_libs = True )
5455
5556 def build_requirements (self ):
5657 if self .options .offline_proto_generation :
@@ -83,13 +84,13 @@ def package(self):
8384
8485 def package_info (self ):
8586 self .cpp_info .components ["viam_rust_utils" ].libs = ["viam_rust_utils" ]
86-
87+
8788 self .cpp_info .components ["viamsdk" ].libs = ["viamsdk" ]
8889
8990 for component in ["viamsdk" , "viamapi" ]:
9091 self .cpp_info .components [component ].set_property ("cmake_target_name" , "viam-cpp-sdk::{}" .format (component ))
9192 self .cpp_info .components [component ].set_property ("pkg_config_name" , "viam-cpp-sdk-lib{}" .format (component ))
92- self .cpp_info .components [component ].requires = ["grpc::grpc++" , "protobuf::libprotobuf" ]
93+ self .cpp_info .components [component ].requires = ["grpc::grpc++" ]
9394 if self .settings .os in ["Linux" , "FreeBSD" ]:
9495 self .cpp_info .components [component ].system_libs = ["pthread" ]
9596
@@ -114,11 +115,12 @@ def package_info(self):
114115 "viamapi" ,
115116 "boost::headers" ,
116117 "boost::log" ,
118+ "grpc::grpc++_reflection" ,
119+ "protobuf::libprotobuf" ,
117120 "xtensor::xtensor" ,
118121
119122 "viam_rust_utils" ,
120123 "abseil::absl_strings" ,
121- "grpc::grpc++_reflection"
122124 ])
123125
124126 self .cpp_info .components ["viamsdk" ].frameworks = ["Security" ]
0 commit comments