Skip to content

Commit

Permalink
sumomo パッケージを作る
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Nov 16, 2023
1 parent 0420b97 commit f4c1696
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/actions/download/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ runs:
sed -i 's/\r//g' ${{ inputs.platform }}.env/sorac.env
source ${{ inputs.platform }}.env/sorac.env
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "sumomo_package_name=$sumomo_PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "$PACKAGE_NAME/$PACKAGE_NAME" >> package_paths.env
echo "$SUMOMO_PACKAGE_NAME/$SUMOMO_PACKAGE_NAME" >> package_paths.env
id: env
- uses: actions/download-artifact@v3
with:
name: ${{ steps.env.outputs.package_name }}
path: ${{ steps.env.outputs.package_name }}
- uses: actions/download-artifact@v3
with:
name: ${{ steps.env.outputs.sumomo_package_name }}
path: ${{ steps.env.outputs.sumomo_package_name }}
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ jobs:
run: |
source _package/${{ matrix.m.name }}/release/sorac.env
echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT
echo "sumomo_name=${SUMOMO_PACKAGE_NAME}" >> $GITHUB_OUTPUT
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ matrix.m.name }}/release/${{ steps.package_name.outputs.name }}
- name: Upload Sumomo Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.sumomo_name }}
path: _package/${{ matrix.m.name }}/release/${{ steps.package_name.outputs.sumomo_name }}
- name: Upload Environment
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions examples/sumomo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ target_link_libraries(sumomo PRIVATE Sorac::sorac)
# FindLibYUV.cmake を書くのが面倒なので直接インクルードとリンクする
target_include_directories(sumomo PRIVATE ${LIBYUV_DIR}/include)
target_link_libraries(sumomo PRIVATE ${LIBYUV_DIR}/lib/libyuv.a libjpeg-turbo::jpeg-static)

install(TARGETS sumomo RUNTIME DESTINATION bin)
14 changes: 13 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import subprocess
import logging
import os
Expand Down Expand Up @@ -639,6 +640,10 @@ def main():
args = parser.parse_args()
target_platform = args.target

if args.package and not args.sumomo:
print('You must specify --package together with --sumomo.')
sys.exit(1)

arch = platform.machine()
if arch in ('AMD64', 'x86_64'):
arch = 'x86_64'
Expand Down Expand Up @@ -796,6 +801,7 @@ def main():
with cd(sumomo_build_dir):
cmake_args = []
cmake_args.append(f'-DCMAKE_BUILD_TYPE={configuration}')
cmake_args.append(f"-DCMAKE_INSTALL_PREFIX={cmake_path(os.path.join(install_dir, 'sumomo'))}")
cmake_args.append(f"-DSORAC_DIR={cmake_path(os.path.join(install_dir, 'sorac'))}")
cmake_args.append(f"-DSUMOMO_TARGET={target_platform}")
cmake_args.append(f"-DLIBJPEG_TURBO_DIR={cmake_path(os.path.join(install_dir, 'libjpeg-turbo'))}")
Expand All @@ -813,6 +819,7 @@ def main():

cmd(['cmake', os.path.join(BASE_DIR, 'examples', 'sumomo')] + cmake_args)
cmd(['cmake', '--build', '.', f'-j{multiprocessing.cpu_count()}', '--config', configuration])
cmd(['cmake', '--install', '.'])

if args.package:
mkdir_p(package_dir)
Expand All @@ -838,13 +845,18 @@ def archive(archive_path, files, is_windows):
content_type = 'application/zip' if is_windows else 'application/gzip'

with cd(install_dir):
archive_name = f'sora-cpp-sdk-{sora_c_sdk_version}_{target_platform}.{ext}'
archive_name = f'sora-c-sdk-{sora_c_sdk_version}_{target_platform}.{ext}'
archive_path = os.path.join(package_dir, archive_name)
archive(archive_path, enum_all_files('sorac', '.'), is_windows)

sumomo_archive_name = f'sumomo-{sora_c_sdk_version}_{target_platform}.{ext}'
sumomo_archive_path = os.path.join(package_dir, sumomo_archive_name)
archive(sumomo_archive_path, enum_all_files('sumomo', '.'), is_windows)

with open(os.path.join(package_dir, 'sorac.env'), 'w') as f:
f.write(f'CONTENT_TYPE={content_type}\n')
f.write(f'PACKAGE_NAME={archive_name}\n')
f.write(f'SUMOMO_PACKAGE_NAME={sumomo_archive_name}\n')


if __name__ == '__main__':
Expand Down

0 comments on commit f4c1696

Please sign in to comment.