From 9aa7198536b650587b68d2c897af4e63cdeb5885 Mon Sep 17 00:00:00 2001 From: melpon Date: Wed, 7 Aug 2024 03:04:05 +0900 Subject: [PATCH] =?UTF-8?q?JetPack=20=E5=90=91=E3=81=91=E3=83=96=E3=83=A9?= =?UTF-8?q?=E3=83=B3=E3=83=81=E3=81=AE=E6=BA=96=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 5 ++++- buildbase.py | 20 ++++++++++++++------ multistrap/ubuntu-20.04_armv8_jetson.conf | 23 ----------------------- multistrap/ubuntu-22.04_armv8_jetson.conf | 23 +++++++++++++++++++++++ run.py | 14 +++++++++++--- setup.py | 4 ++-- 6 files changed, 54 insertions(+), 35 deletions(-) delete mode 100644 multistrap/ubuntu-20.04_armv8_jetson.conf create mode 100644 multistrap/ubuntu-22.04_armv8_jetson.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c8cfd4b..69ac7fa4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,10 @@ elseif(TARGET_OS STREQUAL "jetson") "$<$:-nostdinc++>" "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" ) - target_link_directories(sora_sdk_ext PRIVATE ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/tegra) + target_link_directories(sora_sdk_ext + PRIVATE + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/tegra + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/nvidia) elseif(TARGET_OS STREQUAL "windows") # 文字コードを utf-8 として扱うのと、シンボルテーブル数を増やす target_compile_options(sora_sdk_ext PRIVATE /utf-8 /bigobj) diff --git a/buildbase.py b/buildbase.py index b75a3ca2..42e6ce81 100644 --- a/buildbase.py +++ b/buildbase.py @@ -1630,10 +1630,11 @@ def install_spdlog(version, install_dir): class PlatformTarget(object): - def __init__(self, os, osver, arch): + def __init__(self, os, osver, arch, extra=None): self.os = os self.osver = osver self.arch = arch + self.extra = extra @property def package_name(self): @@ -1650,9 +1651,13 @@ def package_name(self): if self.os == "raspberry-pi-os": return f"raspberry-pi-os_{self.arch}" if self.os == "jetson": + if self.extra is None: + ubuntu_version = "ubuntu-20.04" + else: + ubuntu_version = self.extra if self.osver is None: - return "ubuntu-20.04_armv8_jetson" - return f"ubuntu-20.04_armv8_jetson_{self.osver}" + return f"{ubuntu_version}_armv8_jetson" + return f"{ubuntu_version}_armv8_jetson_{self.osver}" raise Exception("error") @@ -1766,9 +1771,9 @@ def _check_platform_target(self, p: PlatformTarget): else: self._check(p.arch in ("x86_64", "arm64")) - def __init__(self, target_os, target_osver, target_arch): + def __init__(self, target_os, target_osver, target_arch, target_extra=None): build = get_build_platform() - target = PlatformTarget(target_os, target_osver, target_arch) + target = PlatformTarget(target_os, target_osver, target_arch, target_extra) self._check_platform_target(build) self._check_platform_target(target) @@ -1819,7 +1824,10 @@ def get_webrtc_platform(platform: Platform) -> str: elif platform.target.os == "raspberry-pi-os": return f"raspberry-pi-os_{platform.target.arch}" elif platform.target.os == "jetson": - return "ubuntu-20.04_armv8" + if platform.target.extra is None: + return "ubuntu-20.04_armv8" + else: + return f"{platform.target.extra}_armv8" else: raise Exception(f"Unknown platform {platform.target.os}") diff --git a/multistrap/ubuntu-20.04_armv8_jetson.conf b/multistrap/ubuntu-20.04_armv8_jetson.conf deleted file mode 100644 index e8ee63a9..00000000 --- a/multistrap/ubuntu-20.04_armv8_jetson.conf +++ /dev/null @@ -1,23 +0,0 @@ -[General] -noauth=true -unpack=true -bootstrap=Ports Jetson T194 -aptsources=Ports Jetson T194 - -[Ports] -packages=libstdc++-10-dev libc6-dev libxext-dev libdbus-1-dev libdrm-dev libva-dev libpython3-dev python3 python3-pip libc-bin unzip -source=http://ports.ubuntu.com -suite=focal -components=main universe - -[Jetson] -packages= -source=https://repo.download.nvidia.com/jetson/common -suite=r35.4 -components=main - -[T194] -packages=nvidia-l4t-camera nvidia-l4t-jetson-multimedia-api -source=https://repo.download.nvidia.com/jetson/t194 -suite=r35.4 -components=main \ No newline at end of file diff --git a/multistrap/ubuntu-22.04_armv8_jetson.conf b/multistrap/ubuntu-22.04_armv8_jetson.conf new file mode 100644 index 00000000..be7ea103 --- /dev/null +++ b/multistrap/ubuntu-22.04_armv8_jetson.conf @@ -0,0 +1,23 @@ +[General] +noauth=true +unpack=true +bootstrap=Ports Jetson T234 +aptsources=Ports Jetson T234 + +[Ports] +packages=libstdc++-10-dev libc6-dev libxext-dev libdbus-1-dev +source=http://ports.ubuntu.com +suite=jammy +components=main universe + +[Jetson] +packages=nvidia-jetpack +source=https://repo.download.nvidia.com/jetson/common +suite=r36.3 +components=main + +[T234] +packages=nvidia-l4t-camera nvidia-l4t-multimedia +source=https://repo.download.nvidia.com/jetson/t234 +suite=r36.3 +components=main diff --git a/run.py b/run.py index 2331577d..17d4f814 100644 --- a/run.py +++ b/run.py @@ -169,7 +169,13 @@ def install_deps( apply_patch(patch, nanobind_include_dir, 1) -AVAILABLE_TARGETS = ["windows_x86_64", "macos_arm64", "ubuntu-22.04_x86_64", "ubuntu-24.04_x86_64"] +AVAILABLE_TARGETS = [ + "windows_x86_64", + "macos_arm64", + "ubuntu-22.04_x86_64", + "ubuntu-24.04_x86_64", + "ubuntu-22.04_armv8_jetson", +] def main(): @@ -193,6 +199,8 @@ def main(): platform = Platform("ubuntu", "22.04", "x86_64") elif args.target == "ubuntu-24.04_x86_64": platform = Platform("ubuntu", "24.04", "x86_64") + elif args.target == "ubuntu-22.04_armv8_jetson": + platform = Platform("jetson", None, "armv8", "ubuntu-22.04") else: raise Exception(f"Unknown target {args.target}") @@ -275,8 +283,8 @@ def main(): "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH", f"-DCMAKE_SYSROOT={sysroot}", f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}", - f"-DPython_ROOT_DIR={cmake_path(os.path.join(sysroot, 'usr', 'include', 'python3.9'))}", - "-DNB_SUFFIX=.cpython-38-aarch64-linux-gnu.so", + f"-DPython_ROOT_DIR={cmake_path(os.path.join(sysroot, 'usr', 'include', 'python3.10'))}", + "-DNB_SUFFIX=.cpython-310-aarch64-linux-gnu.so", ] # Windows 以外の、クロスコンパイルでない環境では pyi ファイルを生成する diff --git a/setup.py b/setup.py index c77f97af..7db2aa90 100644 --- a/setup.py +++ b/setup.py @@ -52,8 +52,8 @@ def main(): target = os.getenv("SORA_SDK_TARGET") if target is None: target_platform = build_platform - elif target == "ubuntu-20.04_armv8_jetson": - target_platform = PlatformTarget("jetson", None, "armv8") + elif target == "ubuntu-22.04_armv8_jetson": + target_platform = PlatformTarget("jetson", None, "armv8", "ubuntu-22.04") else: raise Exception(f"Unknown target {target}")