Skip to content
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

[libcurl/xxx] Conan v2 migration #12956

Merged
merged 22 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions recipes/libcurl/all/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion recipes/libcurl/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ sources:
patches:
"7.79.0":
- patch_file: "patches/004-no-checksrc.patch"
base_path: "source_subfolder"
439 changes: 215 additions & 224 deletions recipes/libcurl/all/conanfile.py

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions recipes/libcurl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(CURL REQUIRED)

add_executable(${PROJECT_NAME} test_package.c)
Expand Down
44 changes: 20 additions & 24 deletions recipes/libcurl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
import subprocess
import re


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"

def build_requirements(self):
if self.settings.os == "Macos" and self.settings.arch == "armv8":
# Workaround for CMake bug with error message:
# Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being
# set. This could be because you are using a Mac OS X version less than 10.5
# or because CMake's platform configuration is corrupt.
# FIXME: Remove once CMake on macOS/M1 CI runners is upgraded.
self.build_requires("cmake/3.22.0")
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)
Expand All @@ -25,14 +24,11 @@ def build(self):

@property
def _test_executable(self):
if self.settings.os == "Windows":
return os.path.join("bin", "test_package.exe")
else:
return os.path.join("bin", "test_package")
return os.path.join(self.cpp.build.bindirs[0], "test_package")
MartinDelille marked this conversation as resolved.
Show resolved Hide resolved

def test(self):
if not cross_building(self):
self.run(self._test_executable, run_environment=True)
if can_run(self):
self.run(self._test_executable, env="conanrun")
else:
# We will dump information for the generated executable
if self.settings.os in ["Android", "iOS"]:
Expand All @@ -42,15 +38,15 @@ def test(self):
output = subprocess.check_output(["file", self._test_executable]).decode()

if self.settings.os == "Macos" and self.settings.arch == "armv8":
assert "Mach-O 64-bit executable arm64" in output, "Not found in output: {}".format(output)
assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}"

elif self.settings.os == "Linux":
if self.settings.arch == "armv8_32":
assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output)
assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}"
elif "armv8" in self.settings.arch:
assert re.search(r"Machine:\s+AArch64", output), "Not found in output: {}".format(output)
assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}"
elif "arm" in self.settings.arch:
assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output)
assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}"

elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW
assert re.search(r"PE32.*executable.*Windows", output), "Not found in output: {}".format(output)
assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}"
10 changes: 10 additions & 0 deletions recipes/libcurl/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(CURL REQUIRED)

add_executable(${PROJECT_NAME} ../test_package/test_package.c)
target_link_libraries(${PROJECT_NAME} CURL::libcurl)
43 changes: 43 additions & 0 deletions recipes/libcurl/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from conans import ConanFile, CMake, tools
import os
import subprocess
import re


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

@property
def _test_executable(self):
return os.path.join("bin", "test_package")

def test(self):
if not tools.cross_building(self):
self.run(self._test_executable, run_environment=True)
else:
# We will dump information for the generated executable
if self.settings.os in ["Android", "iOS"]:
# FIXME: Check output for these hosts
return

output = subprocess.check_output(["file", self._test_executable]).decode()

if self.settings.os == "Macos" and self.settings.arch == "armv8":
assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}"

elif self.settings.os == "Linux":
if self.settings.arch == "armv8_32":
assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}"
elif "armv8" in self.settings.arch:
assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}"
elif "arm" in self.settings.arch:
assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}"

elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW
assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}"