#!/bin/bash

usage="$(basename "$0") [-r RootPath] [-p platform] -- program to generate xcode project for iOS device (arm64)

where:
    -r Path to ODA main source root
    -p Platform name (e.g. iOS_17.0, see platform in archive name)
    
Note: cmake command-line shall be installed in the host, e.g. 'brew install cmake'

Note: this configuration file deprecated and left for backward compatibility. Use configureiOS instead"

if [ $# -eq 0 ]
  then
  echo "$usage" >&2
  exit 1
fi

while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
   -r )
     shift; RootPath=$1
     ;;
   -p )
     shift; Platform=$1
     ;;
   \?) printf "illegal option: -%s\n" "$OPTARG" >&2
     echo "$usage" >&2
     exit 1
     ;;
   esac; shift;
done

cmake -DRootPath=$RootPath -DODA_PLATFORM=$Platform -DCMAKE_TOOLCHAIN_FILE=./ios.cmake -DIOS_PLATFORM=OS -H. -Bbuild.ios -GXcode
