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..ecbb3abd63351 --- /dev/null +++ b/recipes/ot-commissioner/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "20200404": + 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 new file mode 100644 index 0000000000000..c716254064425 --- /dev/null +++ b/recipes/ot-commissioner/all/conanfile.py @@ -0,0 +1,73 @@ +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/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/1.0.0") + + def source(self): + tools.get(**self.conan_data["sources"][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 + + 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"