python/build/toolchain: add is_android, is_darwin
This commit is contained in:
parent
a0892b852e
commit
48cc76f114
|
@ -15,7 +15,7 @@ def __write_cmake_compiler(f: TextIO, language: str, compiler: str) -> None:
|
||||||
print(f'set(CMAKE_{language}_COMPILER {compiler})', file=f)
|
print(f'set(CMAKE_{language}_COMPILER {compiler})', file=f)
|
||||||
|
|
||||||
def __write_cmake_toolchain_file(f: TextIO, toolchain: AnyToolchain) -> None:
|
def __write_cmake_toolchain_file(f: TextIO, toolchain: AnyToolchain) -> None:
|
||||||
if '-darwin' in toolchain.actual_arch:
|
if toolchain.is_darwin:
|
||||||
cmake_system_name = 'Darwin'
|
cmake_system_name = 'Darwin'
|
||||||
elif toolchain.is_windows:
|
elif toolchain.is_windows:
|
||||||
cmake_system_name = 'Windows'
|
cmake_system_name = 'Windows'
|
||||||
|
@ -65,7 +65,7 @@ def configure(toolchain: AnyToolchain, src: str, build: str, args: list[str]=[],
|
||||||
# looking for libraries on the build host (TODO: fix this
|
# looking for libraries on the build host (TODO: fix this
|
||||||
# properly); but we must not do that on Android because the NDK
|
# properly); but we must not do that on Android because the NDK
|
||||||
# has a sysroot already
|
# has a sysroot already
|
||||||
if '-android' not in toolchain.actual_arch and '-darwin' not in toolchain.actual_arch:
|
if not toolchain.is_android and not toolchain.is_darwin:
|
||||||
cross_args.append('-DCMAKE_SYSROOT=' + toolchain.install_prefix)
|
cross_args.append('-DCMAKE_SYSROOT=' + toolchain.install_prefix)
|
||||||
|
|
||||||
os.makedirs(build, exist_ok=True)
|
os.makedirs(build, exist_ok=True)
|
||||||
|
|
|
@ -63,7 +63,7 @@ pkgconfig = '{toolchain.pkg_config}'
|
||||||
root = '{toolchain.install_prefix}'
|
root = '{toolchain.install_prefix}'
|
||||||
""")
|
""")
|
||||||
|
|
||||||
if 'android' in toolchain.arch:
|
if toolchain.is_android:
|
||||||
f.write("""
|
f.write("""
|
||||||
# Keep Meson from executing Android-x86 test binariees
|
# Keep Meson from executing Android-x86 test binariees
|
||||||
needs_exe_wrapper = true
|
needs_exe_wrapper = true
|
||||||
|
|
|
@ -91,6 +91,8 @@ class AndroidNdkToolchain:
|
||||||
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||||
self.is_aarch64 = ndk_arch == 'arm64'
|
self.is_aarch64 = ndk_arch == 'arm64'
|
||||||
self.is_windows = False
|
self.is_windows = False
|
||||||
|
self.is_android = True
|
||||||
|
self.is_darwin = False
|
||||||
|
|
||||||
libstdcxx_flags = ''
|
libstdcxx_flags = ''
|
||||||
libstdcxx_cxxflags = ''
|
libstdcxx_cxxflags = ''
|
||||||
|
@ -162,6 +164,8 @@ class MingwToolchain:
|
||||||
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
|
||||||
self.is_aarch64 = arch == 'aarch64'
|
self.is_aarch64 = arch == 'aarch64'
|
||||||
self.is_windows = 'mingw32' in arch
|
self.is_windows = 'mingw32' in arch
|
||||||
|
self.is_android = False
|
||||||
|
self.is_darwin = False
|
||||||
|
|
||||||
self.env = dict(os.environ)
|
self.env = dict(os.environ)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue