diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 20ca9fb..4994e94 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,15 +18,19 @@ jobs: include: - os: windows-2019 cibw_archs_windows: AMD64 + cibw_build: "*" cibw_environment: APNGASM_COMPILE_TARGET=x86_64 - os: windows-2019 cibw_archs_windows: x86 + cibw_build: "*" cibw_environment: APNGASM_COMPILE_TARGET=x86 - os: windows-2019 cibw_archs_windows: ARM64 + cibw_build: "*" cibw_environment: APNGASM_COMPILE_TARGET=armv8 - os: macos-11 cibw_archs_macos: x86_64 + cibw_build: "*" cibw_environment: > APNGASM_COMPILE_TARGET=x86_64 _PYTHON_HOST_PLATFORM=macosx-10.15-x86_64 @@ -39,54 +43,61 @@ jobs: MACOSX_DEPLOYMENT_TARGET=11.0 - os: macos-11 cibw_archs_macos: universal2 + cibw_build: "*" cibw_environment: > APNGASM_COMPILE_TARGET=universal2 _PYTHON_HOST_PLATFORM=macosx-11.0-universal2 MACOSX_DEPLOYMENT_TARGET=11.0 - os: ubuntu-20.04 cibw_archs_linux: x86_64 - cibw_skip: "*-manylinux_*" + cibw_build: "*-manylinux_*" cibw_environment: APNGASM_COMPILE_TARGET=x86_64 + cibw_before_build: yum install -y zlib-devel libpng-devel boost-devel - os: ubuntu-20.04 cibw_archs_linux: x86_64 - cibw_skip: "*-muslinux_*" + cibw_build: "*-muslinux_*" cibw_environment: APNGASM_COMPILE_TARGET=x86_64 + cibw_before_build: apk install zlib-dev libpng-dev boost-dev - os: ubuntu-20.04 cibw_archs_linux: i686 - cibw_skip: "*-manylinux_*" + cibw_build: "*-manylinux_*" cibw_environment: APNGASM_COMPILE_TARGET=x86 + cibw_before_build: yum install -y zlib-devel libpng-devel boost-devel - os: ubuntu-20.04 cibw_archs_linux: i686 - cibw_skip: "*-muslinux_*" + cibw_build: "*-muslinux_*" cibw_environment: APNGASM_COMPILE_TARGET=x86 + cibw_before_build: apk install zlib-dev libpng-dev boost-dev - os: ubuntu-20.04 cibw_archs_linux: aarch64 - cibw_skip: "*-manylinux_*" + cibw_build: "*-manylinux_*" cibw_environment: APNGASM_COMPILE_TARGET=armv8 + cibw_before_build: yum install -y zlib-devel libpng-devel boost-devel - os: ubuntu-20.04 cibw_archs_linux: aarch64 - cibw_skip: "*-musllinux_*" + cibw_build: "*-musllinux_*" cibw_environment: APNGASM_COMPILE_TARGET=armv8 - # - os: ubuntu-20.04 - # cibw_archs_linux: aarch64 - # cibw_skip: "*-muslinux_* *-multilinux_*" - # cibw_environment: APNGASM_COMPILE_TARGET=armv8 - # - os: ubuntu-20.04 - # cibw_archs_linux: ppc64le - # cibw_skip: "*-muslinux_*" - # cibw_environment: APNGASM_COMPILE_TARGET=ppc64le - # - os: ubuntu-20.04 - # cibw_archs_linux: ppc64le - # cibw_skip: "*-multilinux_*" - # cibw_environment: APNGASM_COMPILE_TARGET=ppc64le - # - os: ubuntu-20.04 - # cibw_archs_linux: s390x - # cibw_skip: "*-muslinux_*" - # cibw_environment: APNGASM_COMPILE_TARGET=s390x - # - os: ubuntu-20.04 - # cibw_archs_linux: s390x - # cibw_skip: "*-multilinux_*" - # cibw_environment: APNGASM_COMPILE_TARGET=s390x + cibw_before_build: apk install zlib-dev libpng-dev boost-dev + - os: ubuntu-20.04 + cibw_archs_linux: ppc64le + cibw_build: "*-manylinux_*" + cibw_environment: APNGASM_COMPILE_TARGET=ppc64le + cibw_before_build: yum install -y zlib-devel libpng-devel boost-devel + - os: ubuntu-20.04 + cibw_archs_linux: ppc64le + cibw_build: "*-muslinux_*" + cibw_environment: APNGASM_COMPILE_TARGET=ppc64le + cibw_before_build: apk install zlib-dev libpng-dev boost-dev + - os: ubuntu-20.04 + cibw_archs_linux: s390x + cibw_build: "*-manylinux_*" + cibw_environment: APNGASM_COMPILE_TARGET=s390x + cibw_before_build: yum install -y zlib-devel libpng-devel boost-devel + - os: ubuntu-20.04 + cibw_archs_linux: s390x + cibw_build: "*-muslinux_*" + cibw_environment: APNGASM_COMPILE_TARGET=s390x + cibw_before_build: apk install zlib-dev libpng-dev boost-dev steps: - uses: actions/checkout@v3 @@ -109,7 +120,8 @@ jobs: CIBW_BEFORE_ALL: ${{ matrix.cibw_before_all }} # CIBW_ENVIRONMENT: PY_BUILD_CMAKE_VERBOSE=1 ${{ matrix.cibw_environment }} CIBW_ENVIRONMENT: ${{ matrix.cibw_environment }} - CIBW_SKIP: cp36* cp37* pp37* ${{ matrix.cibw_skip }} + CIBW_BUILD: ${{ matrix.cibw_build }} + CIBW_SKIP: cp36* cp37* pp37* - uses: actions/upload-artifact@v3 with: diff --git a/apngasm b/apngasm index 21d52e2..526a72c 160000 --- a/apngasm +++ b/apngasm @@ -1 +1 @@ -Subproject commit 21d52e22f1142c995a00f4767bb27b3fe91a84db +Subproject commit 526a72c096724499660150b1aebf946137b73352 diff --git a/conanfile.py b/conanfile.py index 4ca8609..e2b8962 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,15 +1,93 @@ from conan import ConanFile +import os import shutil +import platform +import subprocess class ApngasmRecipe(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' + + zlib_libs = [ + 'libz.a' + ] + + zlib_headers = [ + 'zlib.h', + 'zconf.h', + ] + + libpng_libs = [ + 'libpng.a' + ] + + libpng_headers = [ + 'png.h', + 'pngconf.h', + 'pnglibconf.h' + ] + + boost_libs = [ + 'libboost_program_options.a', + 'libboost_regex.a', + 'libboost_system.a' + ] + + boost_headers = [ + 'algorithm', + 'property_tree', + 'foreach.hpp' + ] + + def check_lib_present(self, target): + if platform.system() != 'Linux': + return False + + result = subprocess.run( + ['sh', '-c', "ldconfig -p | tail -n +2 | grep -o '/.*/' | sort -u"], + stdout = subprocess.PIPE, + stderr = subprocess.PIPE + ) + lib_dirs = result.stdout.decode().split('\n') + + for lib_dir in lib_dirs: + if not os.path.exists(lib_dir): + continue + + if target in os.listdir(lib_dir): + return True + + return False + + def check_header_present(self, target): + if platform.system() != 'Linux': + return False + + if target in os.listdir('/usr/include'): + return True + + return False def requirements(self): - self.requires("zlib/1.2.13") - self.requires("libpng/1.6.40") - self.requires("boost/1.82.0") self.generators = ['CMakeToolchain', 'CMakeDeps'] + if not (platform.system() == 'Linux' and + all([self.check_lib_present(i) for i in self.zlib_libs]) and + all([self.check_header_present(i) for i in self.zlib_headers])): + + self.requires("zlib/1.2.13") + + if not (platform.system() == 'Linux' and + all([self.check_lib_present(i) for i in self.libpng_libs]) and + all([self.check_header_present(i) for i in self.libpng_headers])): + + self.requires("libpng/1.6.40") + + if not (platform.system() == 'Linux' and + all([self.check_lib_present(i) for i in self.boost_libs]) and + all([self.check_header_present(i) for i in self.boost_headers])): + + self.requires("boost/1.82.0") + def build_requirements(self): self.build_requires("b2/[>4.10]") if not shutil.which('cmake'):