Skip to content

Commit

Permalink
Test using lipo and cmake toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Sep 10, 2023
1 parent f16475e commit 4644ae8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apngasm
Submodule apngasm updated 1 files
+0 −3 cli/CMakeLists.txt
11 changes: 10 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from conan import ConanFile
import shutil
import get_arch
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.apple import is_apple_os

class ApngasmRecipe(ConanFile):
settings = 'os', 'compiler', 'build_type', 'arch'
Expand All @@ -16,4 +19,10 @@ def build_requirements(self):
self.tool_requires("cmake/[>=3.27]")

def build(self):
build_type = 'Release'
build_type = 'Release'

def generate(self):
tc = CMakeToolchain(self)
if is_apple_os(self) and get_arch == 'universal2':
tc.blocks['apple_system'].values['cmake_osx_architectures'] = 'x86_64; arm64'
tc.generate()
27 changes: 11 additions & 16 deletions get_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,25 @@ def install_deps(arch):
def main():
arch = get_arch()
if arch == 'universal2':
conan_output = os.path.join('conan_output/x86_64')
if os.path.isdir(conan_output):
print('Dependencies found at:' + conan_output)
print('Skip conan install...')
return
conan_output = 'conan_output/x86_64'
else:
conan_output_1 = 'conan_output/x86_64'
conan_output_2 = 'conan_output/armv8'
if os.path.isdir(conan_output_1) and os.path.isdir(conan_output_2):
print('Dependencies (x86_64) found at:' + conan_output_1)
print('Dependencies (armv8) found at:' + conan_output_2)
print('Skip conan install...')
return
conan_output = 'conan_output/' + arch
if os.path.isdir(conan_output):
print('Dependencies found at:' + conan_output)
print('Skip conan install...')
return

conan_output = install_deps(arch)

if os.getenv('APNGASM_COMPILE_TARGET') == 'universal2':
if arch != 'universal2':
conan_output = install_deps(arch)
else:
# Repeat to install the other architecture version of libwebp
conan_output_x64 = install_deps('x86_64')
conan_output_arm = install_deps('armv8')
conan_output_universal2 = conan_output.replace('armv8', 'universal2')
shutil.rmtree(conan_output_universal2, ignore_errors=True)
subprocess.run([
'python3', 'lipo-dir-merge/lipo-dir-merge.py',
conan_output_x64, conan_output, conan_output_universal2
conan_output_x64, conan_output_arm, conan_output_universal2
])

shutil.rmtree(conan_output_x64)
Expand Down

0 comments on commit 4644ae8

Please sign in to comment.