Skip to content

Commit

Permalink
Merge branch 'master' into cpython-cmake-findpython
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahajha authored Apr 19, 2024
2 parents 5becfbc + b547df8 commit ba9ece8
Show file tree
Hide file tree
Showing 24 changed files with 317 additions and 111 deletions.
2 changes: 1 addition & 1 deletion recipes/aaf/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("expat/2.5.0")
self.requires("expat/[>=2.6.2 <3]")
self.requires("libjpeg/9e")
if self.settings.os in ("FreeBSD", "Linux"):
self.requires("util-linux-libuuid/2.39")
Expand Down
2 changes: 1 addition & 1 deletion recipes/apr-util/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def requirements(self):
if self.options.with_sqlite3:
self.requires("sqlite3/3.45.0")
if self.options.with_expat:
self.requires("expat/2.5.0")
self.requires("expat/[>=2.6.2 <3]")
if self.options.with_postgresql:
self.requires("libpq/15.4")

Expand Down
2 changes: 1 addition & 1 deletion recipes/exiv2/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def requirements(self):
self.requires("libpng/[>=1.6 <2]")
self.requires("zlib/[>=1.2.11 <2]")
if self.options.with_xmp == "bundled":
self.requires("expat/2.5.0")
self.requires("expat/[>=2.6.2 <3]")
if self.options.with_curl:
self.requires("libcurl/[>=7.78.0 <9]")
if self.options.get_safe("with_brotli"):
Expand Down
2 changes: 1 addition & 1 deletion recipes/hwloc/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def configure(self):

def requirements(self):
if self.options.with_libxml2:
self.requires("libxml2/2.12.3")
self.requires("libxml2/[>=2.12.5 <3]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down
4 changes: 4 additions & 0 deletions recipes/ipaddress/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.0.1":
url: "https://github.com/VladimirShaleev/ipaddress/archive/v1.0.1.tar.gz"
sha256: "49c16294f06fe95ffc66cae828dc08d116efb4a1ede3dddd21dcc182a2eceb03"
89 changes: 89 additions & 0 deletions recipes/ipaddress/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
import os


required_conan_version = ">=1.52.0"


class IpAddressConan(ConanFile):
name = "ipaddress"
description = "A library for working and manipulating IPv4/IPv6 addresses and networks"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/VladimirShaleev/ipaddress"
topics = ("ipv4", "ipv6", "ipaddress", "ip", "network", "header-only")
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

options = {
"exceptions": [True, False],
"overload_std": [True, False],
"ipv6_scope": [True, False],
"ipv6_scope_max_length": ["ANY"],
}
default_options = {
"exceptions": True,
"overload_std": True,
"ipv6_scope": True,
"ipv6_scope_max_length": 16,
}

@property
def _min_cppstd(self):
return 11

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "13.0",
"clang": "6.0",
"gcc": "7.5",
"msvc": "192",
"Visual Studio": "16",
}

def layout(self):
basic_layout(self, src_folder="src")

def package_id(self):
self.info.clear()

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} doesn't support {self.settings.compiler} < {minimum_version}"
)

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

def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
copy(
self,
"*.hpp",
os.path.join(self.source_folder, "include"),
os.path.join(self.package_folder, "include")
)

def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []

if not self.options.exceptions:
self.cpp_info.defines.append("IPADDRESS_NO_EXCEPTIONS")
if not self.options.overload_std:
self.cpp_info.defines.append("IPADDRESS_NO_OVERLOAD_STD")
if not self.options.ipv6_scope:
self.cpp_info.defines.append("IPADDRESS_NO_IPV6_SCOPE")
else:
self.cpp_info.defines.append(f"IPADDRESS_IPV6_SCOPE_MAX_LENGTH={int(self.options.ipv6_scope_max_length)}")
8 changes: 8 additions & 0 deletions recipes/ipaddress/all/test_package/CMakeLists.txt
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(ipaddress CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ipaddress::ipaddress)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
26 changes: 26 additions & 0 deletions recipes/ipaddress/all/test_package/conanfile.py
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 layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

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")
11 changes: 11 additions & 0 deletions recipes/ipaddress/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <cstdlib>
#include <iostream>
#include "ipaddress/ipaddress.hpp"


int main(void) {
auto ip = ipaddress::ipv6_address::parse("fec0::1ff:fe23:4567:890a%eth2");
std::cout << "Parsing ipv6: " << ip << std::endl;

return EXIT_SUCCESS;
}
3 changes: 3 additions & 0 deletions recipes/ipaddress/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.0.1":
folder: all
2 changes: 1 addition & 1 deletion recipes/jsbsim/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("expat/2.5.0")
self.requires("expat/[>=2.6.2 <3]")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
Expand Down
2 changes: 1 addition & 1 deletion recipes/libarchive/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def requirements(self):
if self.options.with_bzip2:
self.requires("bzip2/1.0.8")
if self.options.with_libxml2:
self.requires("libxml2/2.12.5")
self.requires("libxml2/[>=2.12.5 <3]")
if self.options.with_expat:
self.requires("expat/[>=2.6.2 <3]")
if self.options.with_iconv:
Expand Down
1 change: 0 additions & 1 deletion recipes/libidn/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ sources:
patches:
"1.36":
- patch_file: "patches/0001-unconditional-system-stdint-h.patch"
base_path: "source_subfolder"
Loading

0 comments on commit ba9ece8

Please sign in to comment.