code: def _main():
      args_parser = argparse.ArgumentParser(allow_abbrev=False)
      args_parser.add_argument(
          "--build-system", choices=["CMAKE", "YA"], default="CMAKE"
      )
      args_parser.add_argument(
          "--only-postprocessing",
          help="Don't re-run native build if artifacts have already been built in build-output-root-dir",
          action="store_true",
      )
      args_parser.add_argument(
          "--base-dir",
          required=True,
          help="Maven package base dir (that contains pom.xml)",
      )
      args_parser.add_argument("--lib-name", required=True)
      args_parser.add_argument(
          "--build-output-root-dir",
          help="Root of the build output dir",
          required=True,
      )
      args_parser.add_argument(
          "--build-type",
          help="build type (Debug,Release,RelWithDebInfo,MinSizeRel)",
          default="Release",
      )
      args_parser.add_argument(
          "--verbose", help="Verbose output", action="store_true"
      )
      args_parser.add_argument(
          "--have-cuda", help="Enable CUDA support", action="store_true"
      )
      args_parser.add_argument(
          "--cuda-root-dir",
          help="CUDA root dir (taken from CUDA_PATH or CUDA_ROOT by default)",
      )
      args_parser.add_argument(
          "--macos-universal-binaries",
          help="Build macOS universal binaries",
          action="store_true",
      )
      args_parser.add_argument(
          "--target-platform",
          help='Target platform to build for (like "linux-aarch64"), same as host platform by default',
      )
      parsed_args, extra_args = args_parser.parse_known_args()
  
      top_src_root_dir = _get_arcadia_root()
  
      package_src_sub_path = os.path.relpath(
          parsed_args.base_dir, top_src_root_dir
      )
  
      resources_dir = _get_package_resources_dir(parsed_args.base_dir)
      os.makedirs(resources_dir, exist_ok=True)
      shared_lib_dir = os.path.join(
          resources_dir, _get_platform_resources_dir(parsed_args), "lib"
      )
      os.makedirs(shared_lib_dir, exist_ok=True)
  
      native_lib_build_dir = _get_native_lib_dir(
          parsed_args.build_output_root_dir, package_src_sub_path
      )
  
      if parsed_args.build_system == "YA":
          if not parsed_args.only_postprocessing:
              build_shared_lib_with_ya(
                  parsed_args,
                  top_src_root_dir,
                  package_src_sub_path,
                  extra_args,
              )
          postprocess_after_ya(
              native_lib_build_dir,
              parsed_args.lib_name,
              resources_dir,
              parsed_args.base_dir,
          )
      else:  # CMAKE
          if not parsed_args.only_postprocessing:
              sys.path = [
                  os.path.join(top_src_root_dir, "build")
              ] + sys.path
  
              import build_native
  
              build_native.build(
                  build_root_dir=parsed_args.build_output_root_dir,
                  targets=[parsed_args.lib_name],
                  build_type=parsed_args.build_type,
                  verbose=parsed_args.verbose,
                  have_cuda=parsed_args.have_cuda,
                  cuda_root_dir=parsed_args.cuda_root_dir,
                  target_platform=parsed_args.target_platform,
                  macos_universal_binaries=parsed_args.macos_universal_binaries,
                  cmake_extra_args=extra_args,
              )
  
          postprocess_after_cmake(
              parsed_args, top_src_root_dir, resources_dir
          )
  
      native_lib_name = {
          "darwin": "lib{}.dylib",
          "win32": "{}.dll",
          "linux": "lib{}.so",
      }[_get_platform()].format(parsed_args.lib_name)
  
      print("copying dynamic library to resources/lib", file=sys.stderr)
      shutil.copy(
          os.path.join(native_lib_build_dir, native_lib_name),
          shared_lib_dir,
      )
  
imports: from __future__ import absolute_import, print_function
  import argparse
  import errno
  import os
  import platform
  import re
  import shutil
  import subprocess
  import sys
  import zipfile
label_desc: Use image node_id 16 for calling a global function with example usage: _main() without return types