-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Closed
rename co to cocoyaxi #8915
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2.0.3": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.
I've opened #8916, so just focus on cocoyaxi please