-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP feat: add ot-commissioner #1285
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 2.8.11) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory(source_subfolder) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"20200404": | ||
sha256: 04a8cd1b3e79ef8f42341d50c32916806e1313bbcc76292f7f57c36ade371b18 | ||
url: https://github.com/gocarlos/ot-commissioner/archive/643e7e8cf803f3fd8daa09673d49badc43b4b385.zip | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -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" | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
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") | ||||||||||||||||||||||
Comment on lines
+33
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
# TODO: port to CCI | ||||||||||||||||||||||
self.requires("cose-c/20200225@gocarlos/testing") | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. waiting for #1314 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The wait is over.
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Hopefully, cose-c is already in CCI, so let's try to use it. |
||||||||||||||||||||||
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] | ||||||||||||||||||||||
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's worth using globbing? |
||||||||||||||||||||||
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"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,6 @@ | ||||||||
#include <iostream> | ||||||||
|
||||||||
int main(){ | ||||||||
std::cout << "hello world" << std::endl; | ||||||||
return 0; | ||||||||
} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"20200404": | ||
folder: "all" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use your fork?
Let's use the upstream and the tagged version.
https://github.com/openthread/ot-commissioner/releases/tag/v0.0.1