build script: generalize cross-compilation with cmake

This commit is contained in:
alexey.lysiuk 2020-12-30 11:09:38 +02:00
parent 0099490350
commit 6241664404
1 changed files with 6 additions and 10 deletions

View File

@ -408,6 +408,12 @@ class CMakeTarget(Target):
'-DCMAKE_PREFIX_PATH=' + builder.prefix_path,
]
if not builder.xcode:
architecture = builder.architecture()
if architecture != machine():
args.append('-DCMAKE_SYSTEM_NAME=Darwin')
args.append('-DCMAKE_SYSTEM_PROCESSOR=' + 'aarch64' if architecture == 'arm64' else architecture)
os_version = builder.os_version()
if os_version:
args.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=' + os_version)
@ -982,16 +988,6 @@ class JpegTurboTarget(CMakeStaticDependencyTarget):
'https://downloads.sourceforge.net/project/libjpeg-turbo/2.0.6/libjpeg-turbo-2.0.6.tar.gz',
'd74b92ac33b0e3657123ddcf6728788c90dc84dcb6a52013d758af3c4af481bb')
def configure(self, builder: 'Builder'):
architecture = builder.architecture()
if architecture != machine():
opts = self.options
opts['CMAKE_SYSTEM_NAME'] = 'Darwin'
opts['CMAKE_SYSTEM_PROCESSOR'] = 'aarch64' if architecture == 'arm64' else architecture
super().configure(builder)
def detect(self, builder: 'Builder') -> bool:
return os.path.exists(builder.source_path + 'turbojpeg.h')