diff options
author | AlexSm <alex@ydb.tech> | 2023-12-27 23:31:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 23:31:58 +0100 |
commit | d67bfb4b4b7549081543e87a31bc6cb5c46ac973 (patch) | |
tree | 8674f2f1570877cb653e7ddcff37ba00288de15a /build/ymake_conf.py | |
parent | 1f6bef05ed441c3aa2d565ac792b26cded704ac7 (diff) | |
download | ydb-d67bfb4b4b7549081543e87a31bc6cb5c46ac973.tar.gz |
Import libs 4 (#758)
Diffstat (limited to 'build/ymake_conf.py')
-rwxr-xr-x | build/ymake_conf.py | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py index fd6b6f01f9..0db0575d74 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -1044,7 +1044,14 @@ class GnuToolchainOptions(ToolchainOptions): self.sys_lib = self.target.find_in_dict(self.sys_lib, []) self.os_sdk = preset('OS_SDK') or self._default_os_sdk() - self.os_sdk_local = self.os_sdk == 'local' + + self.os_sdk_local = False + + if build.target.is_apple and to_bool(preset('APPLE_SDK_LOCAL'), default=False): + self.os_sdk_local = True + + if self.os_sdk == 'local': + self.os_sdk_local = True def _default_os_sdk(self): if self.target.is_linux: @@ -1265,15 +1272,10 @@ class GnuToolchain(Toolchain): if target.is_ios: self.c_flags_platform.append('-D__IOS__=1') - if self.tc.is_from_arcadia or self.tc.is_system_cxx: - if target.is_apple: - if target.is_ios: - self.setup_xcode_sdk(project='build/platform/ios_sdk', var='${IOS_SDK_ROOT_RESOURCE_GLOBAL}') - self.platform_projects.append('build/internal/platform/macos_system_stl') - if target.is_macos: - self.setup_xcode_sdk(project='build/internal/platform/macos_sdk', var='${MACOS_SDK_RESOURCE_GLOBAL}') - self.platform_projects.append('build/internal/platform/macos_system_stl') + if target.is_apple: + self.setup_apple_sdk(target) + if self.tc.is_from_arcadia or self.tc.is_system_cxx: if target.is_linux: if not tc.os_sdk_local: self.setup_sdk(project='build/platform/linux_sdk', var='$OS_SDK_ROOT_RESOURCE_GLOBAL') @@ -1290,22 +1292,42 @@ class GnuToolchain(Toolchain): if target.is_yocto: self.setup_sdk(project='build/platform/yocto_sdk/yocto_sdk', var='${YOCTO_SDK_ROOT_RESOURCE_GLOBAL}') - elif self.tc.params.get('local'): - if target.is_apple: - if not tc.os_sdk_local: - if target.is_ios: - self.setup_xcode_sdk(project='build/platform/ios_sdk', var='${IOS_SDK_ROOT_RESOURCE_GLOBAL}') - self.platform_projects.append('build/internal/platform/macos_system_stl') - if target.is_macos: - self.setup_xcode_sdk(project='build/internal/platform/macos_sdk', var='${MACOS_SDK_RESOURCE_GLOBAL}') - self.platform_projects.append('build/internal/platform/macos_system_stl') - else: - if target.is_iossim: - self.env.setdefault('SDKROOT', subprocess.check_output(['xcrun', '-sdk', 'iphonesimulator', '--show-sdk-path']).strip()) - elif target.is_ios: - self.env.setdefault('SDKROOT', subprocess.check_output(['xcrun', '-sdk', 'iphoneos', '--show-sdk-path']).strip()) - elif target.is_macos: - self.env.setdefault('SDKROOT', subprocess.check_output(['xcrun', '-sdk', 'macosx', '--show-sdk-path']).strip()) + + def setup_apple_sdk(self, target): + if not self.tc.os_sdk_local: + self.setup_apple_arcadia_sdk(target) + else: + self.setup_apple_local_sdk(target) + + def setup_apple_arcadia_sdk(self, target): + if target.is_ios: + self.setup_xcode_sdk(project='build/platform/ios_sdk', var='${IOS_SDK_ROOT_RESOURCE_GLOBAL}') + self.platform_projects.append('build/internal/platform/macos_system_stl') + if target.is_macos: + self.setup_xcode_sdk(project='build/internal/platform/macos_sdk', var='${MACOS_SDK_RESOURCE_GLOBAL}') + self.platform_projects.append('build/internal/platform/macos_system_stl') + + def setup_apple_local_sdk(self, target): + def get_output(*args): + return six.ensure_str(subprocess.check_output(tuple(args))).strip() + + def get_sdk_root(sdk): + root = self.env.get('SDKROOT') + if root not in (None, '', ['']): + return root + + root = os.environ.get('SDKROOT') + if root: + return root + + return get_output('xcrun', '-sdk', sdk, '--show-sdk-path') + + if target.is_iossim: + self.env['SDKROOT'] = get_sdk_root('iphonesimulator') + elif target.is_ios: + self.env['SDKROOT'] = get_sdk_root('iphoneos') + elif target.is_macos: + self.env['SDKROOT'] = get_sdk_root('macosx') def setup_sdk(self, project, var): self.platform_projects.append(project) |