-
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 package cpplogging #14043
Add package cpplogging #14043
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Build currently fails because version 1.0.3.0 requires cppcommon/1.0.3.0 to be merged (PR #14038) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
This is amazing work but it's a touch behind our best practices and current recommendations -- i'd like to encourage you to look at the cmake template we have to maybe update this so it's not using deprecated features
Also we typically dont add older point releases unless they are specific required.
Id suggest keeping on the latest -- they are very similar so I would not imagine you need an older point release
@@ -0,0 +1,100 @@ | |||
from conans import CMake |
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.
Given this is a new recipe I would be really appreciated if you used the newer build helpers
This is deprecated and will be removed soon... you can see the template for a good example
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout |
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.
Thanks for the template, I'll look at it.
I left that one line because I struggled a bit when I tried to remove it and could not make the recipe to work.
del self.options.fPIC | ||
|
||
if self.settings.compiler.get_safe("cppstd"): | ||
build.check_min_cppstd(self, "17") |
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.
Looking over the project is does not say this and the GitHub actions build without it so I am surprsed to see this here 🤔
Can you share why you are adding this?
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.
The project uses std::string_view which was added to the stl in C++17.
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.
fair enough, but it should be pointed by the upstream, there is no reference about C++ standard there.
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 just created the PR chronoxor/CppLogging#5 to enforce the standard as requirement.
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
Thanks for the compliment, but the credit goes to the one that made the cppcommon and cppserver recipes. |
Conan v1 pipelineAll green in build 7 (
|
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.
Thank you for your contributions, please, consider ConanCenterIndex templates in the future, they are more aligned with new features and will save your time when writing a new recipe from scratch.
"1.0.1.0": | ||
url: "https://github.com/chronoxor/CppLogging/archive/refs/tags/1.0.1.0.tar.gz" | ||
sha256: "46247873f8137ff1511222a85f34a8d54d5f804a93e3f04c6476bf61d8db7113" | ||
"1.0.3.0": |
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.
Do you really need all these three versions? Otherwise, please, keep only the latest. We want to avoid more and more versions which are outdated and not downloaded. They cost CI time, resources and storage.
del self.options.fPIC | ||
|
||
if self.settings.compiler.get_safe("cppstd"): | ||
build.check_min_cppstd(self, "17") |
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.
fair enough, but it should be pointed by the upstream, there is no reference about C++ standard there.
def _configure_cmake(self): | ||
if not self._cmake: | ||
self._cmake = CMake(self) | ||
self._cmake.definitions["CPPLOGGING_MODULE"] = "OFF" |
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.
self._cmake.definitions["CPPLOGGING_MODULE"] = "OFF" | |
self._cmake.definitions["CPPLOGGING_MODULE"] = False | |
self._cmake.definitions["BUILD_TESTING"] = False |
Enforce disabling tests
del self.options.fPIC | ||
|
||
if self.settings.compiler.get_safe("cppstd"): | ||
build.check_min_cppstd(self, "17") |
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 just created the PR chronoxor/CppLogging#5 to enforce the standard as requirement.
files.get(self, **self.conan_data["sources"][self.version]) | ||
extracted_dir = glob.glob("CppLogging-*")[0] | ||
os.rename(extracted_dir, self._source_subfolder) |
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.
files.get(self, **self.conan_data["sources"][self.version]) | |
extracted_dir = glob.glob("CppLogging-*")[0] | |
os.rename(extracted_dir, self._source_subfolder) | |
files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) |
# VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined | ||
# (it will be defined in Conan 2.0) | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" | ||
apply_env = False |
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.
# VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined | |
# (it will be defined in Conan 2.0) | |
generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" | |
apply_env = False | |
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" |
You are not testing a build tool
cmake_layout(self) | ||
|
||
def test(self): | ||
if not cross_building(self): |
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.
if not cross_building(self): | |
if can_run(self): |
|
||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.build import cross_building | ||
|
||
|
||
class CpploggingTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
# VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined | ||
# (it will be defined in Conan 2.0) | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" | ||
apply_env = False | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def test(self): | ||
if not cross_building(self): | ||
cmd = os.path.join(self.cpp.build.bindirs[0], "console") | ||
self.run(cmd, env="conanrun") |
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.
from conan import ConanFile | |
from conan.tools.cmake import CMake, cmake_layout | |
from conan.tools.build import cross_building | |
class CpploggingTestConan(ConanFile): | |
settings = "os", "compiler", "build_type", "arch" | |
# VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined | |
# (it will be defined in Conan 2.0) | |
generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" | |
apply_env = False | |
test_type = "explicit" | |
def requirements(self): | |
self.requires(self.tested_reference_str) | |
def build(self): | |
cmake = CMake(self) | |
cmake.configure() | |
cmake.build() | |
def layout(self): | |
cmake_layout(self) | |
def test(self): | |
if not cross_building(self): | |
cmd = os.path.join(self.cpp.build.bindirs[0], "console") | |
self.run(cmd, env="conanrun") | |
from conans import ConanFile, CMake | |
from conan.tools.build import cross_building | |
class TestPackageV1Conan(ConanFile): | |
settings = "os", "arch", "compiler", "build_type" | |
generators = "cmake", "cmake_find_package_multi" | |
def build(self): | |
cmake = CMake(self) | |
cmake.configure() | |
cmake.build() | |
def test(self): | |
if not cross_building(self): | |
bin_path = os.path.join("bin", "console") | |
self.run(bin_path, run_environment=True) |
Keep test v1 only with legacy tools, so we can prove that the recipe is cross-compatible.
@@ -0,0 +1,42 @@ | |||
/*! |
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.
Delete this file, you can re-use directly from test_package.
cmake_minimum_required(VERSION 3.15) | ||
project(PackageTest CXX) | ||
|
||
find_package(cpplogging CONFIG REQUIRED) | ||
|
||
add_executable(console src/console.cpp) | ||
target_link_libraries(console cpplogging::cpplogging) | ||
|
||
target_compile_features(console PRIVATE cxx_std_17) |
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.
cmake_minimum_required(VERSION 3.15) | |
project(PackageTest CXX) | |
find_package(cpplogging CONFIG REQUIRED) | |
add_executable(console src/console.cpp) | |
target_link_libraries(console cpplogging::cpplogging) | |
target_compile_features(console PRIVATE cxx_std_17) | |
cmake_minimum_required(VERSION 3.1) | |
project(test_package) | |
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | |
conan_basic_setup(TARGETS) | |
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | |
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
Re-use the implementation from test_package/CMakeLists.txt, but conserve conan_basic_setup()
It's deprecated due CMakeDeps, so it's only useful here.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
A little message to say I have not forsaken the subject. I just could not find time to do it. |
This pull request has been automatically closed because it has not had recent activity. Thank you for your contributions. |
Specify library name and version: cpplogging/1.0.3.0
requires cppcommon/1.0.3.0
the previous versions (cpplogging/1.0.0.0 and cpplogging/1.0.1.0) require cppcommon/1.0.2.0