From e12bbef3e8298bc5c2739a8a141b90cfb8058b9c Mon Sep 17 00:00:00 2001 From: Carlos Gomes Martinho Date: Mon, 6 Apr 2020 10:02:28 +0200 Subject: [PATCH 1/3] feat: add initial thread commissioner --- recipes/ot-commissioner/all/CMakeLists.txt | 7 +++ recipes/ot-commissioner/all/conandata.yml | 4 ++ recipes/ot-commissioner/all/conanfile.py | 62 +++++++++++++++++++ .../all/test_package/CMakeLists.txt | 11 ++++ .../all/test_package/conanfile.py | 17 +++++ .../all/test_package/test_package.cpp | 6 ++ recipes/ot-commissioner/config.yml | 3 + 7 files changed, 110 insertions(+) create mode 100644 recipes/ot-commissioner/all/CMakeLists.txt create mode 100644 recipes/ot-commissioner/all/conandata.yml create mode 100644 recipes/ot-commissioner/all/conanfile.py create mode 100644 recipes/ot-commissioner/all/test_package/CMakeLists.txt create mode 100644 recipes/ot-commissioner/all/test_package/conanfile.py create mode 100644 recipes/ot-commissioner/all/test_package/test_package.cpp create mode 100644 recipes/ot-commissioner/config.yml diff --git a/recipes/ot-commissioner/all/CMakeLists.txt b/recipes/ot-commissioner/all/CMakeLists.txt new file mode 100644 index 0000000000000..361b35d4c17d9 --- /dev/null +++ b/recipes/ot-commissioner/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/ot-commissioner/all/conandata.yml b/recipes/ot-commissioner/all/conandata.yml new file mode 100644 index 0000000000000..9276489ad821f --- /dev/null +++ b/recipes/ot-commissioner/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "20200404": + sha256: 8fa3f311dd612e7843357766bd6d24638a84f3f4e40c724e64139c25b11322be + url: https://giþthub.com/openthread/ot-commissioner/archive/31c82656f30e14da7ebdfe12ae5f64ffd6cf96e4.zip diff --git a/recipes/ot-commissioner/all/conanfile.py b/recipes/ot-commissioner/all/conanfile.py new file mode 100644 index 0000000000000..c45da8a163fe8 --- /dev/null +++ b/recipes/ot-commissioner/all/conanfile.py @@ -0,0 +1,62 @@ +import os +from conans import CMake, ConanFile, tools +from conans.errors import ConanInvalidConfiguration +from conans.tools import Version + + +class OtCommissionerConan(ConanFile): + name = "ot-commissioner" + description = "OpenThread Commissioner, a Thread commissioner for joining new Thread devices and managing Thread networks." + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://giþthub.com/openthread/ot-commissioner" + topics = ("conan", "thread", "commissioning") + license = "MIT" + exports_sources = ["CMakeLists.txt", "patches/*"] + generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], + "fPIC": [True, False]} + default_options = {"shared": False, + "fPIC": True} + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + # def requirements(self): + # self.requires("libevent/6.1.2") + # self.requires("mdns") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + extracted_dir = self.name + "-" + self.version + os.rename(extracted_dir, self._source_subfolder) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "lib", "spdlog", "cmake")) + + def package_info(self): + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/ot-commissioner/all/test_package/CMakeLists.txt b/recipes/ot-commissioner/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4354080150986 --- /dev/null +++ b/recipes/ot-commissioner/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.8.11) +project(test_package) + +set(CMAKE_VERBOSE_MAKEFILE TRUE) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/ot-commissioner/all/test_package/conanfile.py b/recipes/ot-commissioner/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a59a26a52c8dc --- /dev/null +++ b/recipes/ot-commissioner/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ot-commissioner/all/test_package/test_package.cpp b/recipes/ot-commissioner/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..88c4070a93b78 --- /dev/null +++ b/recipes/ot-commissioner/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main(){ + std::cout << "hello world" << std::endl; + return 0; +} \ No newline at end of file diff --git a/recipes/ot-commissioner/config.yml b/recipes/ot-commissioner/config.yml new file mode 100644 index 0000000000000..c37842aeba982 --- /dev/null +++ b/recipes/ot-commissioner/config.yml @@ -0,0 +1,3 @@ +versions: + "20200404": + folder: "all" From 7c7c46e62f3e8629fcc56daacf2acb7ee162b8fa Mon Sep 17 00:00:00 2001 From: Carlos Gomes Martinho Date: Tue, 7 Apr 2020 16:32:19 +0200 Subject: [PATCH 2/3] chore: update to fork --- recipes/ot-commissioner/all/conandata.yml | 4 ++-- recipes/ot-commissioner/all/conanfile.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/recipes/ot-commissioner/all/conandata.yml b/recipes/ot-commissioner/all/conandata.yml index 9276489ad821f..ecbb3abd63351 100644 --- a/recipes/ot-commissioner/all/conandata.yml +++ b/recipes/ot-commissioner/all/conandata.yml @@ -1,4 +1,4 @@ sources: "20200404": - sha256: 8fa3f311dd612e7843357766bd6d24638a84f3f4e40c724e64139c25b11322be - url: https://giþthub.com/openthread/ot-commissioner/archive/31c82656f30e14da7ebdfe12ae5f64ffd6cf96e4.zip + sha256: 04a8cd1b3e79ef8f42341d50c32916806e1313bbcc76292f7f57c36ade371b18 + url: https://github.com/gocarlos/ot-commissioner/archive/643e7e8cf803f3fd8daa09673d49badc43b4b385.zip diff --git a/recipes/ot-commissioner/all/conanfile.py b/recipes/ot-commissioner/all/conanfile.py index c45da8a163fe8..4055c86f56d02 100644 --- a/recipes/ot-commissioner/all/conanfile.py +++ b/recipes/ot-commissioner/all/conanfile.py @@ -29,19 +29,30 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - # def requirements(self): - # self.requires("libevent/6.1.2") - # self.requires("mdns") + def requirements(self): + self.requires("libevent/2.1.11") + self.requires("mdns/20200331") + self.requires("nlohmann_json/3.7.3") + self.requires("mbedtls/2.16.3-gpl") + self.requires("fmt/6.1.2") + # TODO: port to CCI + self.requires("cose-c/20200225@gocarlos/testing") + self.requires("cn-cbor/20200227@gocarlos/testing") def source(self): tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version + # extracted_dir = self.name + "-" + self.version + extracted_dir = self.name + "-" + os.path.basename(self.conan_data["sources"][self.version]["url"]).split(".")[0] os.rename(extracted_dir, self._source_subfolder) def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + self._cmake.definitions["OT_COMM_USE_VENDORED_LIBS"] = False + self._cmake.definitions["OT_COMM_TEST"] = False + self._cmake.definitions["OT_COMM_APP"] = False + self._cmake.definitions["OT_COMM_COVERAGE"] = False self._cmake.configure() return self._cmake From 8237cf620fa8e68b4b06febaf07e289871816d87 Mon Sep 17 00:00:00 2001 From: Carlos Gomes Martinho Date: Thu, 23 Apr 2020 11:04:47 +0200 Subject: [PATCH 3/3] chore: use cn-cbor from cci --- recipes/ot-commissioner/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ot-commissioner/all/conanfile.py b/recipes/ot-commissioner/all/conanfile.py index 4055c86f56d02..c716254064425 100644 --- a/recipes/ot-commissioner/all/conanfile.py +++ b/recipes/ot-commissioner/all/conanfile.py @@ -37,7 +37,7 @@ def requirements(self): self.requires("fmt/6.1.2") # TODO: port to CCI self.requires("cose-c/20200225@gocarlos/testing") - self.requires("cn-cbor/20200227@gocarlos/testing") + self.requires("cn-cbor/1.0.0") def source(self): tools.get(**self.conan_data["sources"][self.version])