-
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
curlpp: add recipe #25244
Merged
Merged
curlpp: add recipe #25244
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3b80f1e
curlpp: add recipe
toge 939c1a1
make transitive headers
toge d5b117e
disable C++11
toge 4a5e477
link curl in static build
toge 77be663
Add missing transitive_libs too
AbrilRBS 328491e
set CMP0091
toge 894ccb1
switch positions between project() and cmake_minimum_required()
toge ab3b714
drop support 5.x without cppstd
toge 1ba79a4
drop support apple-clang 13
toge c13a362
fix static library name on msvc
toge 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sources: | ||
"0.8.1.cci.20240530": | ||
url: "https://github.com/jpbarrette/curlpp/archive/8840ec806a75a6def9ed07845a620f6d170e5821.tar.gz" | ||
sha256: "1260326d966ec75a50feccb5411268f9aeca667d97f8132973bdb0783ecceb3c" | ||
patches: | ||
"0.8.1.cci.20240530": | ||
- patch_file: "patches/0001-disable-static-on-shared.patch" | ||
patch_description: "disable building static library on shared=True" | ||
patch_type: "conan" |
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,81 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm | ||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
class CurlppConan(ConanFile): | ||
name = "curlpp" | ||
description = "C++ wrapper around libcURL" | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/jpbarrette/curlpp" | ||
topics = ("curl", "libcurl") | ||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
} | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 11 | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("libcurl/8.9.1") | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["CURLPP_BUILD_SHARED_LIBS"] = self.options.shared | ||
AbrilRBS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tc.generate() | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", os.path.join(self.source_folder, "doc"), os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rm(self, "curlpp-config", os.path.join(self.package_folder, "bin")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["curlpp"] | ||
|
||
self.cpp_info.set_property("cmake_file_name", "curlpp") | ||
self.cpp_info.set_property("cmake_target_name", "curlpp::curlpp") |
33 changes: 33 additions & 0 deletions
33
recipes/curlpp/all/patches/0001-disable-static-on-shared.patch
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,33 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 4f550b5..ca97e64 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -108,7 +108,7 @@ if(CURLPP_BUILD_SHARED_LIBS) | ||
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC CURL::libcurl ${CONAN_LIBS}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1 VERSION 1.0.0) | ||
-endif() | ||
+else() | ||
|
||
add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList}) | ||
add_library(${PROJECT_NAME}::${PROJECT_NAME}_static ALIAS ${PROJECT_NAME}_static) | ||
@@ -126,16 +126,16 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NA | ||
# so we add a "lib" prefix (which is default on other platforms anyway): | ||
SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES PREFIX "lib") | ||
target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES} ${CONAN_LIBS}) | ||
- | ||
+endif() | ||
# install headers | ||
install(FILES "${PROJECT_SOURCE_DIR}/cmake/curlppConfig.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/curlpp") | ||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
if(CURLPP_BUILD_SHARED_LIBS) | ||
install(TARGETS curlpp EXPORT curlppTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
-endif() | ||
+else() | ||
install(TARGETS curlpp_static EXPORT curlppTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
- | ||
+endif() | ||
install( | ||
EXPORT curlppTargets | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/curlpp" |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(curlpp REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE curlpp::curlpp) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
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,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
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 @@ | ||
|
||
#include <curlpp/cURLpp.hpp> | ||
#include <curlpp/Easy.hpp> | ||
#include <curlpp/Options.hpp> | ||
|
||
using namespace curlpp::options; | ||
|
||
int main(int, char **) { | ||
curlpp::Easy myRequest; | ||
myRequest.setOpt<curlpp::options::Url>("http://example.com"); | ||
} |
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: | ||
"0.8.1.cci.20240530": | ||
folder: all |
Oops, something went wrong.
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.
curlpp/cURLpp.hpp
includescurl.h
, so this needs to be transitive tooThere 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.
Fixed.
Thank a lot!