-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cpython-cmake-findpython
- Loading branch information
Showing
24 changed files
with
317 additions
and
111 deletions.
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
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,4 @@ | ||
sources: | ||
"1.0.1": | ||
url: "https://github.com/VladimirShaleev/ipaddress/archive/v1.0.1.tar.gz" | ||
sha256: "49c16294f06fe95ffc66cae828dc08d116efb4a1ede3dddd21dcc182a2eceb03" |
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,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)}") |
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(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) |
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 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") |
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 <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; | ||
} |
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: | ||
"1.0.1": | ||
folder: all |
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
Oops, something went wrong.