From a6f0f3afbed18ba3ba111f14d39b195615181f1c Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Mon, 3 Aug 2020 16:10:00 +0800 Subject: [PATCH 1/6] add microsoft/bond 9.0.0 --- recipes/bond/all/conanfile.py | 53 ++++++++++++++++++++ recipes/bond/all/test_package/CMakeLists.txt | 14 ++++++ recipes/bond/all/test_package/conanfile.py | 25 +++++++++ recipes/bond/all/test_package/example.cpp | 7 +++ recipes/bond/config.yml | 3 ++ 5 files changed, 102 insertions(+) create mode 100644 recipes/bond/all/conanfile.py create mode 100644 recipes/bond/all/test_package/CMakeLists.txt create mode 100644 recipes/bond/all/test_package/conanfile.py create mode 100644 recipes/bond/all/test_package/example.cpp create mode 100644 recipes/bond/config.yml diff --git a/recipes/bond/all/conanfile.py b/recipes/bond/all/conanfile.py new file mode 100644 index 0000000000000..00aafdfaef90d --- /dev/null +++ b/recipes/bond/all/conanfile.py @@ -0,0 +1,53 @@ +from conans import ConanFile, CMake, tools +import platform, os + + +class BondConan(ConanFile): + name = "bond" + version = "9.0.0" + license = "MIT License" + author = "Lu Ye luye@microsoft.com" + url = "https://github.com/microsoft/bond.git" + 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") + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [False]} + default_options = {"shared": False} + build_requires = "boost/1.71.0@conan/stable" + generators = "cmake" + exports_sources = ["FindBond.cmake"] + + 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}")''') + + def configure_cmake(self): + if platform.system() == "Linux": + self.run("curl -sSL https://get.haskellstack.org/ | sh", ignore_errors=True) + 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): + 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') + self.copy("FindBond.cmake", ".", ".") + + def package_info(self): + self.cpp_info.includedirs = ['include'] + self.cpp_info.libdirs = ['lib/bond'] + self.cpp_info.libs = ["bond"] + diff --git a/recipes/bond/all/test_package/CMakeLists.txt b/recipes/bond/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..bab0c10855731 --- /dev/null +++ b/recipes/bond/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/bond/all/test_package/conanfile.py b/recipes/bond/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fbdb50baac4cb --- /dev/null +++ b/recipes/bond/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +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/" and CMakeLists.txt is + # in "test_package" + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + self.copy('*.so*', dst='bin', src='lib') + + def test(self): + if not tools.cross_building(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/recipes/bond/all/test_package/example.cpp b/recipes/bond/all/test_package/example.cpp new file mode 100644 index 0000000000000..69a843d58c4ea --- /dev/null +++ b/recipes/bond/all/test_package/example.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + std::cout << "bond is installed successfully" << std::endl; + return 0; +} diff --git a/recipes/bond/config.yml b/recipes/bond/config.yml new file mode 100644 index 0000000000000..d8ff7a6330f1d --- /dev/null +++ b/recipes/bond/config.yml @@ -0,0 +1,3 @@ +versions: + 9.0.0: + folder: all From a46e36bf4e8d50e3d758a0dc3dd2d5e20982737e Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Mon, 3 Aug 2020 16:21:24 +0800 Subject: [PATCH 2/6] add microsoft/bond 9.0.0 --- recipes/bond/all/FindBond.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 recipes/bond/all/FindBond.cmake diff --git a/recipes/bond/all/FindBond.cmake b/recipes/bond/all/FindBond.cmake new file mode 100644 index 0000000000000..952f900e67586 --- /dev/null +++ b/recipes/bond/all/FindBond.cmake @@ -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) \ No newline at end of file From 8edaa9564e97133f3fa210e1364918fd4a972e76 Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Mon, 3 Aug 2020 16:29:05 +0800 Subject: [PATCH 3/6] all shared and static --- recipes/bond/all/FindBond.cmake | 18 ++-- recipes/bond/all/conanfile.py | 106 +++++++++---------- recipes/bond/all/test_package/CMakeLists.txt | 28 ++--- recipes/bond/all/test_package/conanfile.py | 50 ++++----- recipes/bond/all/test_package/example.cpp | 14 +-- 5 files changed, 108 insertions(+), 108 deletions(-) diff --git a/recipes/bond/all/FindBond.cmake b/recipes/bond/all/FindBond.cmake index 952f900e67586..9fb48b21b607c 100644 --- a/recipes/bond/all/FindBond.cmake +++ b/recipes/bond/all/FindBond.cmake @@ -1,9 +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) \ No newline at end of file +# 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) diff --git a/recipes/bond/all/conanfile.py b/recipes/bond/all/conanfile.py index 00aafdfaef90d..8b43a57c1932b 100644 --- a/recipes/bond/all/conanfile.py +++ b/recipes/bond/all/conanfile.py @@ -1,53 +1,53 @@ -from conans import ConanFile, CMake, tools -import platform, os - - -class BondConan(ConanFile): - name = "bond" - version = "9.0.0" - license = "MIT License" - author = "Lu Ye luye@microsoft.com" - url = "https://github.com/microsoft/bond.git" - 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") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [False]} - default_options = {"shared": False} - build_requires = "boost/1.71.0@conan/stable" - generators = "cmake" - exports_sources = ["FindBond.cmake"] - - 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}")''') - - def configure_cmake(self): - if platform.system() == "Linux": - self.run("curl -sSL https://get.haskellstack.org/ | sh", ignore_errors=True) - 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): - 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') - self.copy("FindBond.cmake", ".", ".") - - def package_info(self): - self.cpp_info.includedirs = ['include'] - self.cpp_info.libdirs = ['lib/bond'] - self.cpp_info.libs = ["bond"] - +from conans import ConanFile, CMake, tools +import platform, os + + +class BondConan(ConanFile): + name = "bond" + version = "9.0.0" + license = "MIT License" + author = "Lu Ye luye@microsoft.com" + url = "https://github.com/microsoft/bond.git" + 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") + settings = "os", "compiler", "build_type", "arch" + # options = {"shared": [False]} + default_options = {"shared": False} + build_requires = "boost/1.71.0@conan/stable" + generators = "cmake" + exports_sources = ["FindBond.cmake"] + + 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}")''') + + def configure_cmake(self): + if platform.system() == "Linux": + self.run("curl -sSL https://get.haskellstack.org/ | sh", ignore_errors=True) + 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): + 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') + self.copy("FindBond.cmake", ".", ".") + + def package_info(self): + self.cpp_info.includedirs = ['include'] + self.cpp_info.libdirs = ['lib/bond'] + self.cpp_info.libs = ["bond"] + diff --git a/recipes/bond/all/test_package/CMakeLists.txt b/recipes/bond/all/test_package/CMakeLists.txt index bab0c10855731..ad6dc6ebd8e12 100644 --- a/recipes/bond/all/test_package/CMakeLists.txt +++ b/recipes/bond/all/test_package/CMakeLists.txt @@ -1,14 +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) +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) diff --git a/recipes/bond/all/test_package/conanfile.py b/recipes/bond/all/test_package/conanfile.py index fbdb50baac4cb..ba424aec50533 100644 --- a/recipes/bond/all/test_package/conanfile.py +++ b/recipes/bond/all/test_package/conanfile.py @@ -1,25 +1,25 @@ -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/" and CMakeLists.txt is - # in "test_package" - cmake.configure() - cmake.build() - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='bin', src='lib') - - def test(self): - if not tools.cross_building(self): - os.chdir("bin") - self.run(".%sexample" % os.sep) +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/" and CMakeLists.txt is + # in "test_package" + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + self.copy('*.so*', dst='bin', src='lib') + + def test(self): + if not tools.cross_building(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/recipes/bond/all/test_package/example.cpp b/recipes/bond/all/test_package/example.cpp index 69a843d58c4ea..fe254aff10fdf 100644 --- a/recipes/bond/all/test_package/example.cpp +++ b/recipes/bond/all/test_package/example.cpp @@ -1,7 +1,7 @@ -#include -#include - -int main() { - std::cout << "bond is installed successfully" << std::endl; - return 0; -} +#include +#include + +int main() { + std::cout << "bond is installed successfully" << std::endl; + return 0; +} From e535502cd1aa23d7e5ef09e7e0e7df8aa4fddf17 Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Mon, 3 Aug 2020 16:30:36 +0800 Subject: [PATCH 4/6] all shared and static --- recipes/bond/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/bond/all/conanfile.py b/recipes/bond/all/conanfile.py index 8b43a57c1932b..4c6d7f0caf0dc 100644 --- a/recipes/bond/all/conanfile.py +++ b/recipes/bond/all/conanfile.py @@ -11,7 +11,7 @@ class BondConan(ConanFile): 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") settings = "os", "compiler", "build_type", "arch" - # options = {"shared": [False]} + options = {"shared": [False, True]} default_options = {"shared": False} build_requires = "boost/1.71.0@conan/stable" generators = "cmake" From 01f578c194e117b4d3e8138384c997a83d29367a Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Mon, 3 Aug 2020 17:18:19 +0800 Subject: [PATCH 5/6] fix hooks errors --- recipes/bond/all/conanfile.py | 12 ++++++++---- recipes/bond/all/test_package/conanfile.py | 5 ----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/recipes/bond/all/conanfile.py b/recipes/bond/all/conanfile.py index 4c6d7f0caf0dc..b74fc8d2305c1 100644 --- a/recipes/bond/all/conanfile.py +++ b/recipes/bond/all/conanfile.py @@ -6,13 +6,17 @@ class BondConan(ConanFile): name = "bond" version = "9.0.0" license = "MIT License" - author = "Lu Ye luye@microsoft.com" - url = "https://github.com/microsoft/bond.git" + homepage = "https://github.com/microsoft/bond.git" + 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") settings = "os", "compiler", "build_type", "arch" - options = {"shared": [False, True]} - default_options = {"shared": False} + options = { + "shared": [False, True], + "fPIC": [True, False]} + default_options = { + "shared": False, + "fPIC": True} build_requires = "boost/1.71.0@conan/stable" generators = "cmake" exports_sources = ["FindBond.cmake"] diff --git a/recipes/bond/all/test_package/conanfile.py b/recipes/bond/all/test_package/conanfile.py index ba424aec50533..e4f557a22a895 100644 --- a/recipes/bond/all/test_package/conanfile.py +++ b/recipes/bond/all/test_package/conanfile.py @@ -14,11 +14,6 @@ def build(self): cmake.configure() cmake.build() - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='bin', src='lib') - def test(self): if not tools.cross_building(self): os.chdir("bin") From 8866aeeb76b00e0ecafe512f3101de29442a7679 Mon Sep 17 00:00:00 2001 From: Lu Ye Date: Tue, 4 Aug 2020 17:59:15 +0800 Subject: [PATCH 6/6] fix boost deps errors --- recipes/bond/all/conanfile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes/bond/all/conanfile.py b/recipes/bond/all/conanfile.py index b74fc8d2305c1..d443040844673 100644 --- a/recipes/bond/all/conanfile.py +++ b/recipes/bond/all/conanfile.py @@ -12,12 +12,10 @@ class BondConan(ConanFile): topics = ("bond", "microsoft") settings = "os", "compiler", "build_type", "arch" options = { - "shared": [False, True], "fPIC": [True, False]} default_options = { - "shared": False, "fPIC": True} - build_requires = "boost/1.71.0@conan/stable" + build_requires = "boost/1.71.0" generators = "cmake" exports_sources = ["FindBond.cmake"]