{android,win32}/build.py: FfmpegProject detects CPU and OS
This commit is contained in:
parent
f97ad2b2ee
commit
fbcacb590b
|
@ -93,6 +93,10 @@ class AndroidNdkToolchain:
|
||||||
self.ldflags = '--sysroot=' + self.sysroot + ' -L' + os.path.join(install_prefix, 'lib')
|
self.ldflags = '--sysroot=' + self.sysroot + ' -L' + os.path.join(install_prefix, 'lib')
|
||||||
self.libs = ''
|
self.libs = ''
|
||||||
|
|
||||||
|
self.is_arm = self.ndk_arch == 'arm'
|
||||||
|
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||||
|
self.is_windows = False
|
||||||
|
|
||||||
libstdcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/gnu-libstdc++', gcc_version)
|
libstdcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/gnu-libstdc++', gcc_version)
|
||||||
libstdcxx_cppflags = '-isystem ' + os.path.join(libstdcxx_path, 'include') + ' -isystem ' + os.path.join(libstdcxx_path, 'libs', android_abi, 'include')
|
libstdcxx_cppflags = '-isystem ' + os.path.join(libstdcxx_path, 'include') + ' -isystem ' + os.path.join(libstdcxx_path, 'libs', android_abi, 'include')
|
||||||
if use_clang:
|
if use_clang:
|
||||||
|
@ -125,6 +129,16 @@ class FfmpegProject(Project):
|
||||||
src = self.unpack(toolchain)
|
src = self.unpack(toolchain)
|
||||||
build = self.make_build_path(toolchain)
|
build = self.make_build_path(toolchain)
|
||||||
|
|
||||||
|
if toolchain.is_arm:
|
||||||
|
arch = 'arm'
|
||||||
|
else:
|
||||||
|
arch = 'x86'
|
||||||
|
|
||||||
|
if toolchain.is_windows:
|
||||||
|
target_os = 'mingw32'
|
||||||
|
else:
|
||||||
|
target_os = 'linux'
|
||||||
|
|
||||||
configure = [
|
configure = [
|
||||||
os.path.join(src, 'configure'),
|
os.path.join(src, 'configure'),
|
||||||
'--cc=' + toolchain.cc,
|
'--cc=' + toolchain.cc,
|
||||||
|
@ -136,12 +150,14 @@ class FfmpegProject(Project):
|
||||||
'--extra-libs=' + toolchain.libs,
|
'--extra-libs=' + toolchain.libs,
|
||||||
'--ar=' + toolchain.ar,
|
'--ar=' + toolchain.ar,
|
||||||
'--enable-cross-compile',
|
'--enable-cross-compile',
|
||||||
'--target-os=linux',
|
'--arch=' + arch,
|
||||||
'--arch=' + toolchain.ndk_arch,
|
'--target-os=' + target_os,
|
||||||
'--cpu=cortex-a8',
|
|
||||||
'--prefix=' + toolchain.install_prefix,
|
'--prefix=' + toolchain.install_prefix,
|
||||||
] + self.configure_args
|
] + self.configure_args
|
||||||
|
|
||||||
|
if toolchain.is_armv7:
|
||||||
|
configure.append('--cpu=cortex-a8')
|
||||||
|
|
||||||
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
||||||
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build, env=toolchain.env)
|
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build, env=toolchain.env)
|
||||||
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build, env=toolchain.env)
|
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build, env=toolchain.env)
|
||||||
|
|
|
@ -51,6 +51,10 @@ class CrossGccToolchain:
|
||||||
self.ldflags = '-L' + os.path.join(install_prefix, 'lib')
|
self.ldflags = '-L' + os.path.join(install_prefix, 'lib')
|
||||||
self.libs = ''
|
self.libs = ''
|
||||||
|
|
||||||
|
self.is_arm = arch.startswith('arm')
|
||||||
|
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||||
|
self.is_windows = 'mingw32' in arch
|
||||||
|
|
||||||
self.env = dict(os.environ)
|
self.env = dict(os.environ)
|
||||||
|
|
||||||
# redirect pkg-config to use our root directory instead of the
|
# redirect pkg-config to use our root directory instead of the
|
||||||
|
@ -92,6 +96,16 @@ class FfmpegProject(Project):
|
||||||
src = self.unpack(toolchain)
|
src = self.unpack(toolchain)
|
||||||
build = self.make_build_path(toolchain)
|
build = self.make_build_path(toolchain)
|
||||||
|
|
||||||
|
if toolchain.is_arm:
|
||||||
|
arch = 'arm'
|
||||||
|
else:
|
||||||
|
arch = 'x86'
|
||||||
|
|
||||||
|
if toolchain.is_windows:
|
||||||
|
target_os = 'mingw32'
|
||||||
|
else:
|
||||||
|
target_os = 'linux'
|
||||||
|
|
||||||
configure = [
|
configure = [
|
||||||
os.path.join(src, 'configure'),
|
os.path.join(src, 'configure'),
|
||||||
'--cc=' + toolchain.cc,
|
'--cc=' + toolchain.cc,
|
||||||
|
@ -103,12 +117,15 @@ class FfmpegProject(Project):
|
||||||
'--extra-libs=' + toolchain.libs,
|
'--extra-libs=' + toolchain.libs,
|
||||||
'--ar=' + toolchain.ar,
|
'--ar=' + toolchain.ar,
|
||||||
'--enable-cross-compile',
|
'--enable-cross-compile',
|
||||||
'--arch=x86',
|
'--arch=' + arch,
|
||||||
'--target-os=mingw32',
|
'--target-os=' + target_os,
|
||||||
'--cross-prefix=' + toolchain.arch + '-',
|
'--cross-prefix=' + toolchain.arch + '-',
|
||||||
'--prefix=' + toolchain.install_prefix,
|
'--prefix=' + toolchain.install_prefix,
|
||||||
] + self.configure_args
|
] + self.configure_args
|
||||||
|
|
||||||
|
if toolchain.is_armv7:
|
||||||
|
configure.append('--cpu=cortex-a8')
|
||||||
|
|
||||||
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
subprocess.check_call(configure, cwd=build, env=toolchain.env)
|
||||||
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'],
|
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'],
|
||||||
cwd=build, env=toolchain.env)
|
cwd=build, env=toolchain.env)
|
||||||
|
|
Loading…
Reference in New Issue