Skip to content

Commit

Permalink
modernize more
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Nov 19, 2022
1 parent a71d803 commit 7222c8d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 33 deletions.
20 changes: 7 additions & 13 deletions recipes/zlib-ng/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conan.tools.scm import Version
import os

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.53.0"


class ZlibNgConan(ConanFile):
Expand Down Expand Up @@ -43,23 +43,17 @@ def config_options(self):

def configure(self):
if self.options.shared:
del self.options.fPIC
try:
del self.settings.compiler.libcxx
except Exception:
pass
try:
del self.settings.compiler.cppstd
except Exception:
pass
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

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

def validate(self):
if self.info.options.zlib_compat and not self.info.options.with_gzfileop:
raise ConanInvalidConfiguration("The option 'with_gzfileop' must be True when 'zlib_compat' is True.")

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

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
Expand Down
16 changes: 8 additions & 8 deletions recipes/zlib-ng/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import os

from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import cross_building
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
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)
Expand All @@ -17,10 +20,7 @@ def build(self):
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if not cross_building(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(cmd, env="conanrun")
9 changes: 0 additions & 9 deletions recipes/zlib-ng/all/test_package_v1/CMakeLists.txt

This file was deleted.

8 changes: 8 additions & 0 deletions recipes/zlib-ng/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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)
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# pylint: skip-file
import os
from conans import ConanFile, CMake, tools
import os


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

def build(self):
Expand Down

0 comments on commit 7222c8d

Please sign in to comment.