Skip to content
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

rename co to cocoyaxi #8915

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes/co/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sources:
"2.0.2":
url: "https://github.com/idealvin/co/archive/refs/tags/v2.0.2.tar.gz"
sha256: "b5fecc4e0556e33ae11ac2b7c80e37add6cc9d32942e48ce65593f09aa3ef35b"
sha256: "5dbb90e18627ebe563a6a437e8e28329a6bfc07f266718318bd3adf26027d156"
patches:
"2.0.2":
- patch_file: "patches/001-install-dll.patch"
Expand Down
1 change: 1 addition & 0 deletions recipes/co/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CoConan(ConanFile):
topics = ("co", "coroutine", "c++11")
exports_sources = "CMakeLists.txt", "patches/*"
generators = "cmake", "cmake_find_package"
deprecated = "cocoyaxi"
Copy link
Contributor

@SpaceIm SpaceIm Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said, this modification should live in another PR than this one. Indeed conan-center-index doesn't allow to modify 2 different recipes in the same PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #8916, so just focus on cocoyaxi please


settings = "os", "arch", "compiler", "build_type"
options = {
Expand Down
7 changes: 7 additions & 0 deletions recipes/cocoyaxi/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory("source_subfolder")
4 changes: 4 additions & 0 deletions recipes/cocoyaxi/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"2.0.3":
url: "https://github.com/idealvin/cocoyaxi/archive/refs/tags/v2.0.3.tar.gz"
sha256: "c112fafed5e45a3cac27e4b1b5b9f7483df267d510dd03c5dd8272e6405ea61f"
107 changes: 107 additions & 0 deletions recipes/cocoyaxi/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.33.0"


class CoConan(ConanFile):
name = "cocoyaxi"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/idealvin/cocoyaxi"
license = "MIT"
description = "A go-style coroutine library in C++11 and more."
topics = ("cocoyaxi", "coroutine", "c++11")
exports_sources = "CMakeLists.txt"
generators = "cmake", "cmake_find_package"

settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_libcurl": [True, False],
"with_openssl": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_libcurl": False,
"with_openssl": False,
}

_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
del self.options.fPIC

def requirements(self):
if self.options.with_libcurl:
self.requires("libcurl/7.79.1")
if self.options.with_openssl:
self.requires("openssl/1.1.1l")

def build_requirements(self):
if self.settings.os == "Macos" and self.settings.arch == "armv8":
# The OSX_ARCHITECTURES target property is now respected for the ASM language
self.build_requires("cmake/3.20.1")

def source(self):
tools.get(**self.conan_data["sources"][self.version],
strip_root=True, destination=self._source_subfolder)

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
if not self.options.shared:
self._cmake.definitions["FPIC"] = self.options.get_safe("fPIC", False)
runtime = self.settings.get_safe("compiler.runtime")
if runtime:
self._cmake.definitions["STATIC_VS_CRT"] = "MT" in runtime
self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl
self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def package(self):
self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "cocoyaxi")
self.cpp_info.set_property("cmake_target_name", "cocoyaxi::co")
self.cpp_info.names["cmake_find_package"] = "cocoyaxi"
self.cpp_info.names["cmake_find_package_multi"] = "cocoyaxi"
self.cpp_info.components["co"].names["cmake_find_package"] = "co"
self.cpp_info.components["co"].names["cmake_find_package_multi"] = "co"
self.cpp_info.components["co"].set_property("cmake_target_name", "cocoyaxi::co")
self.cpp_info.components["co"].libs = ["co"]

def validate(self):
if self.options.with_libcurl:
if not self.options.with_openssl:
raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True")
if self.options["libcurl"].with_ssl != "openssl":
raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled")
if not self.options["libcurl"].with_zlib:
raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled")
11 changes: 11 additions & 0 deletions recipes/cocoyaxi/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

set(CMAKE_CXX_STANDARD 11)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(cocoyaxi REQUIRED)

add_executable(${PROJECT_NAME} test_package.cc)
target_link_libraries(${PROJECT_NAME} cocoyaxi::co)
16 changes: 16 additions & 0 deletions recipes/cocoyaxi/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
7 changes: 7 additions & 0 deletions recipes/cocoyaxi/all/test_package/test_package.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "co/str.h"
#include <iostream>

int main() {
std::cout << str::from(123) << std::endl;
return 0;
}
3 changes: 3 additions & 0 deletions recipes/cocoyaxi/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.0.3":
folder: all