Skip to content

Commit

Permalink
🧑‍💻 Use libhal-bootstrap/1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kammce committed Mar 13, 2024
1 parent e2eb7b5 commit 5e35d21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 71 deletions.
61 changes: 4 additions & 57 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
# limitations under the License.

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.files import copy
from conan.tools.build import check_min_cppstd
import os


required_conan_version = ">=2.0.14"
Expand All @@ -33,62 +29,13 @@ class libhal_util_conan(ConanFile):
"peripherals and devices using modern C++")
topics = ("peripherals", "hardware", "abstraction", "devices", "hal")
settings = "compiler", "build_type", "os", "arch"
exports_sources = ("include/*", "tests/*", "LICENSE",
"CMakeLists.txt", "src/*")
generators = "CMakeToolchain", "CMakeDeps"

@property
def _min_cppstd(self):
return "20"

@property
def _compilers_minimum_version(self):
return {
"gcc": "11",
"clang": "14",
"apple-clang": "14.0.0"
}

@property
def _bare_metal(self):
return self.settings.os == "baremetal"

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

def build_requirements(self):
self.tool_requires("cmake/3.27.1")
self.tool_requires("libhal-cmake-util/3.0.1")
self.test_requires("boost-ext-ut/1.1.9")
python_requires = "libhal-bootstrap/[^1.0.1]"
python_requires_extend = "libhal-bootstrap.library"

def requirements(self):
self.requires("libhal/[^3.0.0]", transitive_headers=True)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self,
"LICENSE",
dst=os.path.join(self.package_folder, "licenses"),
src=self.source_folder)
copy(self,
"*.h",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"))
copy(self,
"*.hpp",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"))

cmake = CMake(self)
cmake.install()
bootstrap = self.python_requires["libhal-bootstrap"]
bootstrap.module.add_library_requirements(self)

def package_info(self):
self.cpp_info.libs = ["libhal-util"]
Expand Down
16 changes: 2 additions & 14 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,14 @@
# limitations under the License.

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"

def build_requirements(self):
self.tool_requires("cmake/3.27.1")
python_requires = "libhal-bootstrap/[^1.0.1]"
python_requires_extend = "libhal-bootstrap.library_test_package"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
pass

0 comments on commit 5e35d21

Please sign in to comment.