Skip to content

Commit

Permalink
Recipe improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Feb 9, 2024
1 parent 2a0c77a commit 7841a06
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class NuRaftMesgConan(ConanFile):
'sanitize': False,
}

exports = ["LICENSE"]
exports_sources = (
"LICENSE",
"CMakeLists.txt",
"cmake/*",
"include/*",
Expand All @@ -44,6 +44,10 @@ class NuRaftMesgConan(ConanFile):
def _min_cppstd(self):
return 20

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd())

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
Expand All @@ -54,11 +58,6 @@ def configure(self):
if self.options.coverage or self.options.sanitize:
raise ConanInvalidConfiguration("Coverage/Sanitizer requires Testing!")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd())


def build_requirements(self):
if not self.conf.get("tools.build:skip_test", default=False):
self.test_requires("lz4/[>=1.9]")
Expand All @@ -67,11 +66,9 @@ def build_requirements(self):

def requirements(self):
self.requires("boost/[>=1.80]", transitive_headers=True)
self.requires("sisl/[>=11.1]@oss/master", transitive_headers=True)
self.requires("sisl/[>=11.1, include_prerelease]@oss/master", transitive_headers=True)
self.requires("nuraft/2.3.0", transitive_headers=True)

self.requires("flatbuffers/23.5.26")

def layout(self):
cmake_layout(self)

Expand Down Expand Up @@ -112,23 +109,22 @@ def package(self):
copy(self, "*.so*", self.build_folder, lib_dir, keep_path=False)

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "NuraftMesg")
self.cpp_info.set_property("cmake_target_name", "NuraftMesg::NuraftMesg")
self.cpp_info.set_property("pkg_config_name", "nuraft_mesg")
self.cpp_info.components["proto"].libs = ["nuraft_mesg", "nuraft_mesg_proto"]
self.cpp_info.components["proto"].requires = ["boost::boost", "nuraft::nuraft", "sisl::sisl"]
self.cpp_info.components["flatb"].libs = ["nuraft_mesg", "nuraft_mesg_flatb"]
self.cpp_info.components["flatb"].requires = ["boost::boost", "nuraft::nuraft", "sisl::sisl", "flatbuffers::flatbuffers"]

if self.settings.build_type == "Debug" and self.options.sanitize:
self.cpp_info.components["proto"].sharedlinkflags.append("-fsanitize=address")
self.cpp_info.components["proto"].exelinkflags.append("-fsanitize=address")
self.cpp_info.components["proto"].sharedlinkflags.append("-fsanitize=undefined")
self.cpp_info.components["proto"].exelinkflags.append("-fsanitize=undefined")
self.cpp_info.components["flatb"].sharedlinkflags.append("-fsanitize=address")
self.cpp_info.components["flatb"].exelinkflags.append("-fsanitize=address")
self.cpp_info.components["flatb"].sharedlinkflags.append("-fsanitize=undefined")
self.cpp_info.components["flatb"].exelinkflags.append("-fsanitize=undefined")
self.cpp_info.components["proto"].set_property("pkg_config_name", "libnuraft_mesg_proto")
self.cpp_info.components["proto"].requires.extend([
"nuraft::nuraft",
"boost::boost",
"sisl::sisl"
])

for component in self.cpp_info.components.values():
if self.options.get_safe("sanitize"):
component.sharedlinkflags.append("-fsanitize=address")
component.exelinkflags.append("-fsanitize=address")
component.sharedlinkflags.append("-fsanitize=undefined")
component.exelinkflags.append("-fsanitize=undefined")

self.cpp_info.set_property("cmake_file_name", "NuraftMesg")
self.cpp_info.set_property("cmake_target_name", "NuraftMesg::NuraftMesg")
self.cpp_info.names["cmake_find_package"] = "NuraftMesg"
self.cpp_info.names["cmake_find_package_multi"] = "NuraftMesg"

0 comments on commit 7841a06

Please sign in to comment.