diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d75536c..e96ca6d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,7 +159,6 @@ jobs: name: - ubuntu-20.04_x86_64 - ubuntu-22.04_x86_64 - - ubuntu-20.04_armv8_jetson - ubuntu-22.04_armv8_jetson - android name: Build sora-cpp-sdk for ${{ matrix.name }} @@ -249,12 +248,6 @@ jobs: with: name: ${{ matrix.name }}.env path: _package/${{ matrix.name }}/release/sora.env - - name: Move rootfs to examples - run: | - mkdir -p examples/_install/${{ matrix.name }}/release - mv _install/${{ matrix.name }}/release/rootfs/ examples/_install/${{ matrix.name }}/release/rootfs/ - mv _install/${{ matrix.name }}/release/rootfs.version examples/_install/${{ matrix.name }}/release/rootfs.version - if: matrix.name == 'ubuntu-20.04_armv8_jetson' || matrix.name == 'ubuntu-22.04_armv8_jetson' # Examples のビルド - name: Build Examples run: | @@ -264,13 +257,13 @@ jobs: python3 $app/${{ matrix.name }}/run.py --local-sora-cpp-sdk-dir .. cp _build/${{ matrix.name }}/release/$app/$app examples_${{ matrix.name }} done - if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' || matrix.name == 'ubuntu-20.04_armv8_jetson' || matrix.name == 'ubuntu-22.04_armv8_jetson' + if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' || matrix.name == 'ubuntu-22.04_armv8_jetson' - name: Upload Examples Artifact uses: actions/upload-artifact@v4 with: name: examples_${{ matrix.name }} path: examples/examples_${{ matrix.name }} - if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' || matrix.name == 'ubuntu-20.04_armv8_jetson' || matrix.name == 'ubuntu-22.04_armv8_jetson' + if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' || matrix.name == 'ubuntu-22.04_armv8_jetson' create-release: name: Create Release diff --git a/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt b/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt deleted file mode 100644 index af278586..00000000 --- a/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -cmake_minimum_required(VERSION 3.23) - -# Only interpret if() arguments as variables or keywords when unquoted. -cmake_policy(SET CMP0054 NEW) -# MSVC runtime library flags are selected by an abstraction. -cmake_policy(SET CMP0091 NEW) - -set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") -set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") -set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") -set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") -set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") -set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") - -project(sora-sdl-sample C CXX) - -list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR}) -list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) - -set(Boost_USE_STATIC_LIBS ON) - -find_package(Boost REQUIRED COMPONENTS json filesystem) -find_package(WebRTC REQUIRED) -find_package(Sora REQUIRED) -find_package(Threads REQUIRED) - -add_executable(messaging_recvonly_sample) -set_target_properties(messaging_recvonly_sample PROPERTIES CXX_STANDARD 20 C_STANDARD 20) -set_target_properties(messaging_recvonly_sample PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_sources(messaging_recvonly_sample PRIVATE ../src/messaging_recvonly_sample.cpp) - -target_compile_options(messaging_recvonly_sample - PRIVATE - "$<$:-nostdinc++>" - "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" -) -target_include_directories(messaging_recvonly_sample PRIVATE ${CLI11_DIR}/include) -target_link_libraries(messaging_recvonly_sample PRIVATE Sora::sora) -target_link_directories(messaging_recvonly_sample PRIVATE ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/tegra) -target_compile_definitions(messaging_recvonly_sample PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/run.py b/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/run.py deleted file mode 100644 index 6a2fdb2b..00000000 --- a/examples/messaging_recvonly_sample/ubuntu-20.04_armv8_jetson/run.py +++ /dev/null @@ -1,214 +0,0 @@ -import argparse -import hashlib -import multiprocessing -import os -import sys -from typing import List, Optional - -PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) -BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") -BUILDBASE_DIR = os.path.join(BASE_DIR, "..") -sys.path.insert(0, BUILDBASE_DIR) - - -from buildbase import ( # noqa: E402 - add_path, - add_sora_arguments, - add_webrtc_build_arguments, - build_sora, - build_webrtc, - cd, - cmake_path, - cmd, - get_sora_info, - get_webrtc_info, - install_cli11, - install_cmake, - install_llvm, - install_rootfs, - install_sora_and_deps, - install_webrtc, - mkdir_p, - read_version_file, -) - - -def install_deps( - source_dir, - build_dir, - install_dir, - debug, - local_webrtc_build_dir: Optional[str], - local_webrtc_build_args: List[str], - local_sora_cpp_sdk_dir: Optional[str], - local_sora_cpp_sdk_args: List[str], -): - with cd(BASE_DIR): - version = read_version_file("VERSION") - - # multistrap を使った sysroot の構築 - conf = os.path.join(BASE_DIR, "multistrap", "ubuntu-20.04_armv8_jetson.conf") - # conf ファイルのハッシュ値をバージョンとする - version_md5 = hashlib.md5(open(conf, "rb").read()).hexdigest() - install_rootfs_args = { - "version": version_md5, - "version_file": os.path.join(install_dir, "rootfs.version"), - "install_dir": install_dir, - "conf": conf, - } - install_rootfs(**install_rootfs_args) - - # WebRTC - if local_webrtc_build_dir is None: - install_webrtc_args = { - "version": version["WEBRTC_BUILD_VERSION"], - "version_file": os.path.join(install_dir, "webrtc.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "ubuntu-20.04_armv8", - } - install_webrtc(**install_webrtc_args) - else: - build_webrtc_args = { - "platform": "ubuntu-20.04_armv8", - "local_webrtc_build_dir": local_webrtc_build_dir, - "local_webrtc_build_args": local_webrtc_build_args, - "debug": debug, - } - build_webrtc(**build_webrtc_args) - - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", local_webrtc_build_dir, install_dir, debug - ) - - if local_webrtc_build_dir is None: - webrtc_version = read_version_file(webrtc_info.version_file) - - # LLVM - tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] - tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] - libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] - libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] - buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] - buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] - install_llvm_args = { - "version": f"{tools_url}.{tools_commit}." - f"{libcxx_url}.{libcxx_commit}." - f"{buildtools_url}.{buildtools_commit}", - "version_file": os.path.join(install_dir, "llvm.version"), - "install_dir": install_dir, - "tools_url": tools_url, - "tools_commit": tools_commit, - "libcxx_url": libcxx_url, - "libcxx_commit": libcxx_commit, - "buildtools_url": buildtools_url, - "buildtools_commit": buildtools_commit, - } - install_llvm(**install_llvm_args) - - # Sora C++ SDK, Boost - if local_sora_cpp_sdk_dir is None: - install_sora_and_deps("ubuntu-20.04_armv8_jetson", source_dir, install_dir) - else: - build_sora( - "ubuntu-20.04_armv8_jetson", - local_sora_cpp_sdk_dir, - local_sora_cpp_sdk_args, - debug, - local_webrtc_build_dir, - ) - - # CMake - install_cmake_args = { - "version": version["CMAKE_VERSION"], - "version_file": os.path.join(install_dir, "cmake.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "linux-x86_64", - "ext": "tar.gz", - } - install_cmake(**install_cmake_args) - add_path(os.path.join(install_dir, "cmake", "bin")) - - # CLI11 - install_cli11_args = { - "version": version["CLI11_VERSION"], - "version_file": os.path.join(install_dir, "cli11.version"), - "install_dir": install_dir, - } - install_cli11(**install_cli11_args) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--debug", action="store_true") - add_webrtc_build_arguments(parser) - add_sora_arguments(parser) - - args = parser.parse_args() - - configuration_dir = "debug" if args.debug else "release" - platform = "ubuntu-20.04_armv8_jetson" - source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) - build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) - install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) - mkdir_p(source_dir) - mkdir_p(build_dir) - mkdir_p(install_dir) - - install_deps( - source_dir, - build_dir, - install_dir, - args.debug, - args.local_webrtc_build_dir, - args.local_webrtc_build_args, - args.local_sora_cpp_sdk_dir, - args.local_sora_cpp_sdk_args, - ) - - configuration = "Debug" if args.debug else "Release" - - sample_build_dir = os.path.join(build_dir, "messaging_recvonly_sample") - mkdir_p(sample_build_dir) - with cd(sample_build_dir): - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", args.local_webrtc_build_dir, install_dir, args.debug - ) - sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) - - cmake_args = [] - cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") - cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") - cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") - cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") - cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") - cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") - - # クロスコンパイルの設定。 - # 本来は toolchain ファイルに書く内容 - sysroot = os.path.join(install_dir, "rootfs") - cmake_args += [ - "-DCMAKE_SYSTEM_NAME=Linux", - "-DCMAKE_SYSTEM_PROCESSOR=aarch64", - f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", - "-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", - "-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_FIND_ROOT_PATH={sysroot}", - "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER", - "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH", - "-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'))}", - ] - - cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) - cmd( - ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] - ) - - -if __name__ == "__main__": - main() diff --git a/examples/multistrap/ubuntu-20.04_armv8_jetson.conf b/examples/multistrap/ubuntu-20.04_armv8_jetson.conf deleted file mode 100644 index 7e1f1975..00000000 --- a/examples/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 -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 diff --git a/examples/sdl_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt b/examples/sdl_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt deleted file mode 100644 index 2863ed1b..00000000 --- a/examples/sdl_sample/ubuntu-20.04_armv8_jetson/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -cmake_minimum_required(VERSION 3.23) - -# Only interpret if() arguments as variables or keywords when unquoted. -cmake_policy(SET CMP0054 NEW) -# MSVC runtime library flags are selected by an abstraction. -cmake_policy(SET CMP0091 NEW) - -set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") -set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") -set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") -set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") -set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") -set(SDL2_DIR "" CACHE PATH "SDL2 のルートディレクトリ") -set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") - -project(sora-sdl-sample C CXX) - -list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR} ${SDL2_DIR}) -list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) - -set(Boost_USE_STATIC_LIBS ON) - -find_package(Boost REQUIRED COMPONENTS json filesystem) -find_package(WebRTC REQUIRED) -find_package(Sora REQUIRED) -find_package(SDL2 REQUIRED) -find_package(Threads REQUIRED) - -add_executable(sdl_sample) -set_target_properties(sdl_sample PROPERTIES CXX_STANDARD 20 C_STANDARD 20) -set_target_properties(sdl_sample PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_sources(sdl_sample PRIVATE ../src/sdl_sample.cpp ../src/sdl_renderer.cpp) - -target_compile_options(sdl_sample - PRIVATE - "$<$:-nostdinc++>" - "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" -) -target_include_directories(sdl_sample PRIVATE ${CLI11_DIR}/include) -target_link_libraries(sdl_sample PRIVATE Sora::sora SDL2::SDL2 SDL2::SDL2main) -target_link_directories(sdl_sample PRIVATE ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/tegra) -target_compile_definitions(sdl_sample PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/sdl_sample/ubuntu-20.04_armv8_jetson/run.py b/examples/sdl_sample/ubuntu-20.04_armv8_jetson/run.py deleted file mode 100644 index b4642b84..00000000 --- a/examples/sdl_sample/ubuntu-20.04_armv8_jetson/run.py +++ /dev/null @@ -1,243 +0,0 @@ -import argparse -import hashlib -import multiprocessing -import os -import sys -from typing import List, Optional - -PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) -BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") -BUILDBASE_DIR = os.path.join(BASE_DIR, "..") -sys.path.insert(0, BUILDBASE_DIR) - - -from buildbase import ( # noqa: E402 - add_path, - add_sora_arguments, - add_webrtc_build_arguments, - build_sora, - build_webrtc, - cd, - cmake_path, - cmd, - get_sora_info, - get_webrtc_info, - install_cli11, - install_cmake, - install_llvm, - install_rootfs, - install_sdl2, - install_sora_and_deps, - install_webrtc, - mkdir_p, - read_version_file, -) - - -def install_deps( - source_dir, - build_dir, - install_dir, - debug, - local_webrtc_build_dir: Optional[str], - local_webrtc_build_args: List[str], - local_sora_cpp_sdk_dir: Optional[str], - local_sora_cpp_sdk_args: List[str], -): - with cd(BASE_DIR): - version = read_version_file("VERSION") - - # multistrap を使った sysroot の構築 - conf = os.path.join(BASE_DIR, "multistrap", "ubuntu-20.04_armv8_jetson.conf") - # conf ファイルのハッシュ値をバージョンとする - version_md5 = hashlib.md5(open(conf, "rb").read()).hexdigest() - install_rootfs_args = { - "version": version_md5, - "version_file": os.path.join(install_dir, "rootfs.version"), - "install_dir": install_dir, - "conf": conf, - } - install_rootfs(**install_rootfs_args) - sysroot = os.path.join(install_dir, "rootfs") - - # WebRTC - if local_webrtc_build_dir is None: - install_webrtc_args = { - "version": version["WEBRTC_BUILD_VERSION"], - "version_file": os.path.join(install_dir, "webrtc.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "ubuntu-20.04_armv8", - } - install_webrtc(**install_webrtc_args) - else: - build_webrtc_args = { - "platform": "ubuntu-20.04_armv8", - "local_webrtc_build_dir": local_webrtc_build_dir, - "local_webrtc_build_args": local_webrtc_build_args, - "debug": debug, - } - build_webrtc(**build_webrtc_args) - - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", local_webrtc_build_dir, install_dir, debug - ) - - if local_webrtc_build_dir is None: - webrtc_version = read_version_file(webrtc_info.version_file) - - # LLVM - tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] - tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] - libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] - libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] - buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] - buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] - install_llvm_args = { - "version": f"{tools_url}.{tools_commit}." - f"{libcxx_url}.{libcxx_commit}." - f"{buildtools_url}.{buildtools_commit}", - "version_file": os.path.join(install_dir, "llvm.version"), - "install_dir": install_dir, - "tools_url": tools_url, - "tools_commit": tools_commit, - "libcxx_url": libcxx_url, - "libcxx_commit": libcxx_commit, - "buildtools_url": buildtools_url, - "buildtools_commit": buildtools_commit, - } - install_llvm(**install_llvm_args) - - # Sora C++ SDK, Boost - if local_sora_cpp_sdk_dir is None: - install_sora_and_deps("ubuntu-20.04_armv8_jetson", source_dir, install_dir) - else: - build_sora( - "ubuntu-20.04_armv8_jetson", - local_sora_cpp_sdk_dir, - local_sora_cpp_sdk_args, - debug, - local_webrtc_build_dir, - ) - - # CMake - install_cmake_args = { - "version": version["CMAKE_VERSION"], - "version_file": os.path.join(install_dir, "cmake.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "linux-x86_64", - "ext": "tar.gz", - } - install_cmake(**install_cmake_args) - add_path(os.path.join(install_dir, "cmake", "bin")) - - # SDL2 - install_sdl2_args = { - "version": version["SDL2_VERSION"], - "version_file": os.path.join(install_dir, "sdl2.version"), - "source_dir": source_dir, - "build_dir": build_dir, - "install_dir": install_dir, - "debug": debug, - "platform": "linux", - "cmake_args": [ - "-DCMAKE_SYSTEM_NAME=Linux", - "-DCMAKE_SYSTEM_PROCESSOR=aarch64", - f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", - "-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", - "-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_FIND_ROOT_PATH={sysroot}", - "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER", - "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH", - f"-DCMAKE_SYSROOT={sysroot}", - ], - } - install_sdl2(**install_sdl2_args) - - # CLI11 - install_cli11_args = { - "version": version["CLI11_VERSION"], - "version_file": os.path.join(install_dir, "cli11.version"), - "install_dir": install_dir, - } - install_cli11(**install_cli11_args) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--debug", action="store_true") - add_webrtc_build_arguments(parser) - add_sora_arguments(parser) - - args = parser.parse_args() - - configuration_dir = "debug" if args.debug else "release" - platform = "ubuntu-20.04_armv8_jetson" - source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) - build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) - install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) - mkdir_p(source_dir) - mkdir_p(build_dir) - mkdir_p(install_dir) - - install_deps( - source_dir, - build_dir, - install_dir, - args.debug, - args.local_webrtc_build_dir, - args.local_webrtc_build_args, - args.local_sora_cpp_sdk_dir, - args.local_sora_cpp_sdk_args, - ) - - configuration = "Debug" if args.debug else "Release" - - sample_build_dir = os.path.join(build_dir, "sdl_sample") - mkdir_p(sample_build_dir) - with cd(sample_build_dir): - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", args.local_webrtc_build_dir, install_dir, args.debug - ) - sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) - - cmake_args = [] - cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") - cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") - cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") - cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") - cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") - cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") - cmake_args.append(f"-DSDL2_DIR={cmake_path(os.path.join(install_dir, 'sdl2'))}") - - # クロスコンパイルの設定。 - # 本来は toolchain ファイルに書く内容 - sysroot = os.path.join(install_dir, "rootfs") - cmake_args += [ - "-DCMAKE_SYSTEM_NAME=Linux", - "-DCMAKE_SYSTEM_PROCESSOR=aarch64", - f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", - "-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", - "-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_FIND_ROOT_PATH={sysroot}", - "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER", - "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH", - "-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'))}", - ] - - cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) - cmd( - ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] - ) - - -if __name__ == "__main__": - main() diff --git a/examples/sumomo/ubuntu-20.04_armv8_jetson/CMakeLists.txt b/examples/sumomo/ubuntu-20.04_armv8_jetson/CMakeLists.txt deleted file mode 100644 index 88f39424..00000000 --- a/examples/sumomo/ubuntu-20.04_armv8_jetson/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -cmake_minimum_required(VERSION 3.23) - -# Only interpret if() arguments as variables or keywords when unquoted. -cmake_policy(SET CMP0054 NEW) -# MSVC runtime library flags are selected by an abstraction. -cmake_policy(SET CMP0091 NEW) - -set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") -set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") -set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") -set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") -set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") -set(SDL2_DIR "" CACHE PATH "SDL2 のルートディレクトリ") -set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") - -project(sora-sdl-sample C CXX) - -list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR} ${SDL2_DIR}) -list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) - -set(Boost_USE_STATIC_LIBS ON) - -find_package(Boost REQUIRED COMPONENTS json filesystem) -find_package(WebRTC REQUIRED) -find_package(Sora REQUIRED) -find_package(SDL2 REQUIRED) -find_package(Threads REQUIRED) - -add_executable(sumomo) -set_target_properties(sumomo PROPERTIES CXX_STANDARD 20 C_STANDARD 20) -set_target_properties(sumomo PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_sources(sumomo PRIVATE ../src/sumomo.cpp ../src/sdl_renderer.cpp) - -target_compile_options(sumomo - PRIVATE - "$<$:-nostdinc++>" - "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" -) -target_include_directories(sumomo PRIVATE ${CLI11_DIR}/include) -target_link_libraries(sumomo PRIVATE Sora::sora SDL2::SDL2 SDL2::SDL2main) -target_link_directories(sumomo PRIVATE ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-gnu/tegra) -target_compile_definitions(sumomo PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/sumomo/ubuntu-20.04_armv8_jetson/run.py b/examples/sumomo/ubuntu-20.04_armv8_jetson/run.py deleted file mode 100644 index be3b5fdb..00000000 --- a/examples/sumomo/ubuntu-20.04_armv8_jetson/run.py +++ /dev/null @@ -1,243 +0,0 @@ -import argparse -import hashlib -import multiprocessing -import os -import sys -from typing import List, Optional - -PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) -BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") -BUILDBASE_DIR = os.path.join(BASE_DIR, "..") -sys.path.insert(0, BUILDBASE_DIR) - - -from buildbase import ( # noqa: E402 - add_path, - add_sora_arguments, - add_webrtc_build_arguments, - build_sora, - build_webrtc, - cd, - cmake_path, - cmd, - get_sora_info, - get_webrtc_info, - install_cli11, - install_cmake, - install_llvm, - install_rootfs, - install_sdl2, - install_sora_and_deps, - install_webrtc, - mkdir_p, - read_version_file, -) - - -def install_deps( - source_dir, - build_dir, - install_dir, - debug, - local_webrtc_build_dir: Optional[str], - local_webrtc_build_args: List[str], - local_sora_cpp_sdk_dir: Optional[str], - local_sora_cpp_sdk_args: List[str], -): - with cd(BASE_DIR): - version = read_version_file("VERSION") - - # multistrap を使った sysroot の構築 - conf = os.path.join(BASE_DIR, "multistrap", "ubuntu-20.04_armv8_jetson.conf") - # conf ファイルのハッシュ値をバージョンとする - version_md5 = hashlib.md5(open(conf, "rb").read()).hexdigest() - install_rootfs_args = { - "version": version_md5, - "version_file": os.path.join(install_dir, "rootfs.version"), - "install_dir": install_dir, - "conf": conf, - } - install_rootfs(**install_rootfs_args) - sysroot = os.path.join(install_dir, "rootfs") - - # WebRTC - if local_webrtc_build_dir is None: - install_webrtc_args = { - "version": version["WEBRTC_BUILD_VERSION"], - "version_file": os.path.join(install_dir, "webrtc.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "ubuntu-20.04_armv8", - } - install_webrtc(**install_webrtc_args) - else: - build_webrtc_args = { - "platform": "ubuntu-20.04_armv8", - "local_webrtc_build_dir": local_webrtc_build_dir, - "local_webrtc_build_args": local_webrtc_build_args, - "debug": debug, - } - build_webrtc(**build_webrtc_args) - - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", local_webrtc_build_dir, install_dir, debug - ) - - if local_webrtc_build_dir is None: - webrtc_version = read_version_file(webrtc_info.version_file) - - # LLVM - tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] - tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] - libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] - libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] - buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] - buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] - install_llvm_args = { - "version": f"{tools_url}.{tools_commit}." - f"{libcxx_url}.{libcxx_commit}." - f"{buildtools_url}.{buildtools_commit}", - "version_file": os.path.join(install_dir, "llvm.version"), - "install_dir": install_dir, - "tools_url": tools_url, - "tools_commit": tools_commit, - "libcxx_url": libcxx_url, - "libcxx_commit": libcxx_commit, - "buildtools_url": buildtools_url, - "buildtools_commit": buildtools_commit, - } - install_llvm(**install_llvm_args) - - # Sora C++ SDK, Boost - if local_sora_cpp_sdk_dir is None: - install_sora_and_deps("ubuntu-20.04_armv8_jetson", source_dir, install_dir) - else: - build_sora( - "ubuntu-20.04_armv8_jetson", - local_sora_cpp_sdk_dir, - local_sora_cpp_sdk_args, - debug, - local_webrtc_build_dir, - ) - - # CMake - install_cmake_args = { - "version": version["CMAKE_VERSION"], - "version_file": os.path.join(install_dir, "cmake.version"), - "source_dir": source_dir, - "install_dir": install_dir, - "platform": "linux-x86_64", - "ext": "tar.gz", - } - install_cmake(**install_cmake_args) - add_path(os.path.join(install_dir, "cmake", "bin")) - - # SDL2 - install_sdl2_args = { - "version": version["SDL2_VERSION"], - "version_file": os.path.join(install_dir, "sdl2.version"), - "source_dir": source_dir, - "build_dir": build_dir, - "install_dir": install_dir, - "debug": debug, - "platform": "linux", - "cmake_args": [ - "-DCMAKE_SYSTEM_NAME=Linux", - "-DCMAKE_SYSTEM_PROCESSOR=aarch64", - f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", - "-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", - "-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_FIND_ROOT_PATH={sysroot}", - "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER", - "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH", - f"-DCMAKE_SYSROOT={sysroot}", - ], - } - install_sdl2(**install_sdl2_args) - - # CLI11 - install_cli11_args = { - "version": version["CLI11_VERSION"], - "version_file": os.path.join(install_dir, "cli11.version"), - "install_dir": install_dir, - } - install_cli11(**install_cli11_args) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--debug", action="store_true") - add_webrtc_build_arguments(parser) - add_sora_arguments(parser) - - args = parser.parse_args() - - configuration_dir = "debug" if args.debug else "release" - platform = "ubuntu-20.04_armv8_jetson" - source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) - build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) - install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) - mkdir_p(source_dir) - mkdir_p(build_dir) - mkdir_p(install_dir) - - install_deps( - source_dir, - build_dir, - install_dir, - args.debug, - args.local_webrtc_build_dir, - args.local_webrtc_build_args, - args.local_sora_cpp_sdk_dir, - args.local_sora_cpp_sdk_args, - ) - - configuration = "Debug" if args.debug else "Release" - - sample_build_dir = os.path.join(build_dir, "sumomo") - mkdir_p(sample_build_dir) - with cd(sample_build_dir): - webrtc_info = get_webrtc_info( - "ubuntu-20.04_armv8", args.local_webrtc_build_dir, install_dir, args.debug - ) - sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) - - cmake_args = [] - cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") - cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") - cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") - cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") - cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") - cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") - cmake_args.append(f"-DSDL2_DIR={cmake_path(os.path.join(install_dir, 'sdl2'))}") - - # クロスコンパイルの設定。 - # 本来は toolchain ファイルに書く内容 - sysroot = os.path.join(install_dir, "rootfs") - cmake_args += [ - "-DCMAKE_SYSTEM_NAME=Linux", - "-DCMAKE_SYSTEM_PROCESSOR=aarch64", - f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", - "-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", - "-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu", - f"-DCMAKE_FIND_ROOT_PATH={sysroot}", - "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER", - "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH", - "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH", - "-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'))}", - ] - - cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) - cmd( - ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] - ) - - -if __name__ == "__main__": - main()