Skip to content

Commit

Permalink
JetPack 向けブランチの準備
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Aug 6, 2024
1 parent da04092 commit 9aa7198
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 35 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ elseif(TARGET_OS STREQUAL "jetson")
"$<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>"
"$<$<COMPILE_LANGUAGE:CXX>:-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)
Expand Down
20 changes: 14 additions & 6 deletions buildbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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")


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}")

Expand Down
23 changes: 0 additions & 23 deletions multistrap/ubuntu-20.04_armv8_jetson.conf

This file was deleted.

23 changes: 23 additions & 0 deletions multistrap/ubuntu-22.04_armv8_jetson.conf
Original file line number Diff line number Diff line change
@@ -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
14 changes: 11 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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}")

Expand Down Expand Up @@ -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 ファイルを生成する
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down

0 comments on commit 9aa7198

Please sign in to comment.