-
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
add microsoft/bond 9.0.0 #2379
add microsoft/bond 9.0.0 #2379
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,9 @@ | ||
# find_path(BOND_INCLUDE_DIR NAMES bond PATHS ${CONAN_INCLUDE_DIRS_BOND}) | ||
find_library(BOND_LIBRARY NAMES ${CONAN_LIBS_BOND} PATHS ${CONAN_LIB_DIRS_BOND}) | ||
find_file(BOND_GBC NAMES gbc.exe gbc PATHS ${CONAN_BIN_DIRS_BOND}) | ||
|
||
set(BOND_FOUND TRUE) | ||
set(BOND_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_BOND}) | ||
set(BOND_LIBRARIES ${BOND_LIBRARY}) | ||
set(BOND_GBC ${BOND_GBC}) | ||
mark_as_advanced(BOND_LIBRARY BOND_INCLUDE_DIR) |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||||||
from conans import ConanFile, CMake, tools | ||||||||||
import platform, os | ||||||||||
|
||||||||||
|
||||||||||
class BondConan(ConanFile): | ||||||||||
name = "bond" | ||||||||||
version = "9.0.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
The version should be consumed from conandata.yml: https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html |
||||||||||
license = "MIT License" | ||||||||||
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
Use the short-name form https://spdx.org/licenses/MIT |
||||||||||
homepage = "https://github.com/microsoft/bond.git" | ||||||||||
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
|
||||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||||
description = "Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services." | ||||||||||
topics = ("bond", "microsoft") | ||||||||||
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
|
||||||||||
settings = "os", "compiler", "build_type", "arch" | ||||||||||
options = { | ||||||||||
"fPIC": [True, False]} | ||||||||||
default_options = { | ||||||||||
"fPIC": True} | ||||||||||
build_requires = "boost/1.71.0" | ||||||||||
generators = "cmake" | ||||||||||
exports_sources = ["FindBond.cmake"] | ||||||||||
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. Please remove this file (and export a conan wrapper As a consumer of this recipe, when using the |
||||||||||
|
||||||||||
def source(self): | ||||||||||
self.run("git clone https://github.com/microsoft/bond.git") | ||||||||||
self.run("git checkout fe6f582ce4beb65644d9338536066e07d80a0289", cwd='bond') | ||||||||||
self.run("git submodule update --init --recursive", cwd='bond') | ||||||||||
tools.replace_in_file("bond/CMakeLists.txt", | ||||||||||
"project (bond)", | ||||||||||
'''project (bond) | ||||||||||
message("BOOST_ROOT=$ENV{BOOST_ROOT}")''') | ||||||||||
Comment on lines
+22
to
+29
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. Can you please package release 9.0.1: https://github.com/microsoft/bond/releases/tag/9.0.1 |
||||||||||
|
||||||||||
def configure_cmake(self): | ||||||||||
if platform.system() == "Linux": | ||||||||||
Comment on lines
+31
to
+32
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
You can't add public methods, use protected instead. |
||||||||||
self.run("curl -sSL https://get.haskellstack.org/ | sh", ignore_errors=True) | ||||||||||
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. Why do you need haskell? Downloading here is not allowed, but instead you can have a Conan package for haskell. |
||||||||||
cmake = CMake(self) | ||||||||||
cmake.definitions["BOND_ENABLE_GRPC"] = 'FALSE' | ||||||||||
cmake.configure(source_folder="bond") | ||||||||||
return cmake | ||||||||||
|
||||||||||
def build(self): | ||||||||||
cmake = self.configure_cmake() | ||||||||||
cmake.build() | ||||||||||
|
||||||||||
def package(self): | ||||||||||
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
Don't forget the license |
||||||||||
cmake = self.configure_cmake() | ||||||||||
# CMAKE_INSTALL_PREFIX is set to self.package_folder | ||||||||||
cmake.install() | ||||||||||
if platform.system() == 'Linux': | ||||||||||
self.run("chmod +rx *", cwd=f'{self.package_folder}/bin') | ||||||||||
Comment on lines
+47
to
+48
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
Use os.chmod instead. Is there an executable here? |
||||||||||
self.copy("FindBond.cmake", ".", ".") | ||||||||||
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
Not allowed. Use |
||||||||||
|
||||||||||
def package_info(self): | ||||||||||
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. Apply this change only if bond creates
Suggested change
|
||||||||||
self.cpp_info.includedirs = ['include'] | ||||||||||
self.cpp_info.libdirs = ['lib/bond'] | ||||||||||
Comment on lines
+52
to
+53
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. Isn't the library installed in the
Suggested change
|
||||||||||
self.cpp_info.libs = ["bond"] | ||||||||||
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
The cmake file offered by author contains some macros. Conan can't re-create it, so the best approach is copying it to your package. https://github.com/microsoft/bond/blob/master/cmake/Bond.cmake |
||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,14 @@ | ||||||||||||||||||
cmake_minimum_required(VERSION 2.8.12) | ||||||||||||||||||
project(PackageTest CXX) | ||||||||||||||||||
|
||||||||||||||||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||||||||||||||||||
conan_basic_setup() | ||||||||||||||||||
|
||||||||||||||||||
add_executable(example example.cpp) | ||||||||||||||||||
target_link_libraries(example ${CONAN_LIBS}) | ||||||||||||||||||
|
||||||||||||||||||
# CTest is a testing tool that can be used to test your project. | ||||||||||||||||||
# enable_testing() | ||||||||||||||||||
# add_test(NAME example | ||||||||||||||||||
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin | ||||||||||||||||||
# COMMAND example) | ||||||||||||||||||
Comment on lines
+8
to
+14
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,20 @@ | ||||||||||||||
import os | ||||||||||||||
|
||||||||||||||
from conans import ConanFile, CMake, tools | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
class BondTestConan(ConanFile): | ||||||||||||||
settings = "os", "compiler", "build_type", "arch" | ||||||||||||||
generators = "cmake" | ||||||||||||||
|
||||||||||||||
def build(self): | ||||||||||||||
cmake = CMake(self) | ||||||||||||||
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is | ||||||||||||||
# in "test_package" | ||||||||||||||
Comment on lines
+12
to
+13
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
|
||||||||||||||
cmake.configure() | ||||||||||||||
cmake.build() | ||||||||||||||
|
||||||||||||||
def test(self): | ||||||||||||||
if not tools.cross_building(self): | ||||||||||||||
os.chdir("bin") | ||||||||||||||
self.run(".%sexample" % os.sep) | ||||||||||||||
Comment on lines
+18
to
+20
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,7 @@ | ||
#include <iostream> | ||
#include <bond/core/bond_const_enum.h> | ||
|
||
int main() { | ||
std::cout << "bond is installed successfully" << std::endl; | ||
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. Please call at least one bond function (not using a define or header-only function). |
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
9.0.0: | ||
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.
Please, remove this file. Conan should be able to generate the file by https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_find_package_generator.html