#!/usr/bin/env bash ################################ #ビルド用スクリプト ################################ # # 1. common/version.h を変更する # 2. 開発実機用ビルドは build.sh UNFIXEDKEY # 製品実機用ビルドは build.sh PROD set -u set -e # バージョン取得 function getVersion { VERSION_MAJOR=$(cat common/version.h |grep VERSION_MAJOR|awk -F' ' '{print $3}'|sed 's/"//g') VERSION_MINOR=$(cat common/version.h |grep VERSION_MINOR|awk -F' ' '{print $3}'|sed 's/"//g') VERSION_MICRO=$(cat common/version.h |grep VERSION_MICRO|awk -F' ' '{print $3}'|sed 's/"//g') VERSION_STR="VERSION_MAJOR=$VERSION_MAJOR VERSION_MINOR=$VERSION_MINOR VERSION_MICRO=$VERSION_MICRO" } # フラグ判定 prodBuild=false unfixedKeyBuild=false for arg in $@ do if [ "$arg" = 'PROD' ]; then prodBuild=true fi if [ "$arg" = 'UNFIXEDKEY' ]; then unfixedKeyBuild=true fi done OPTION="" if [ $prodBuild == "true" ] ; then getVersion BUILD_TYPE=release,development OPTION="PROD_BUILD=true $VERSION_STR" elif [ $unfixedKeyBuild == "true" ] ; then getVersion BUILD_TYPE=release,development OPTION="UNFIXEDKEY_BUILD=true $VERSION_STR" else BUILD_TYPE=development fi # IncrediBuildが使えるか set +e which xgConsole > /dev/null 2>&1 if [ "$?" -eq 0 ]; then useIncrediBuild=true PARALLEL=-j16 else useIncrediBuild=false PARALLEL=-j8 fi set -e function buildCore { command="$1" if $useIncrediBuild ; then xgConsole /command="$command $PARALLEL" /profile="profile.xml" else $command $PARALLEL fi } function buildBackupAndRestore { BuildExec="omake BUILD=$BUILD_TYPE FILTER=CTR-TS.*fast $OPTION" cd ConsoleBackup export HORIZON_ROOT=$HORIZON_ROOT_BACKUP buildCore "$BuildExec" cd ../ cd ConsoleRestore export HORIZON_ROOT=$HORIZON_ROOT_RESTORE buildCore "$BuildExec" cd ../ } function buildAutoTest { testBuildExec="omake dotests-emumem BUILD=development FILTER=CTR-TS*.fast SKIP_RUN=true" cd tests cd common export HORIZON_ROOT=$HORIZON_ROOT_BACKUP buildCore "$testBuildExec" cd ../ cd ConsoleBackup export HORIZON_ROOT=$HORIZON_ROOT_BACKUP buildCore "$testBuildExec" cd ../ cd ConsoleRestore export HORIZON_ROOT=$HORIZON_ROOT_RESTORE buildCore "$testBuildExec" cd ../ cd ../ } #################### 通常ビルド #################### # ConsoleBackup、ConsoleRestoreのビルド buildBackupAndRestore #リリース用ビルドはツールのみ if $prodBuild || $unfixedKeyBuild ; then exit fi # CTR自動テストのビルド buildAutoTest # PC上のテストのビルド cd tests/googletest/ if $useIncrediBuild ; then xgConsole /command="omake $PARALLEL" /profile="../../profile.xml" else omake $PARALLEL fi cd ../../