Files
o3de/python/get_python.sh
T
Eric Phister 0c7605c9b6 Update minimum required CMake version to 3.20 (#1253)
* Update the minimum CMake version to 3.20

Sets the cmake_minimum_required calls to version 3.20 and updates the
README.md to point at the general CMake download page instead of a stale
link.

* Remove unnecessary cmake minimum version

It was using an old 3.0 version and can be removed.

* Additional updates to CMake 3.20, build scripts

Updates the version and remove logic to find a CMake in 3rdParty.

* Removing backup path to ninja path in the build_ninja_windows.cmd

The backup path for finding ninja was coming from the Perforce depot which isn't available for o3de builds.

* Removing reference to 3rdParty Android SDK 29 from the build and run unit test script

The Android SDK is not part of the new 3rdParty system and users are expected to install the Android SDK on their own in order to build the engine for Android.

* Update the get_python scripts and README

No longer try to append a CMake path to LY_3RDPARTY_PATH, but do still
support LY_CMAKE_PATH because there are still uses of it.  Remove
mention of an LY_3RDPARTY_PATH-relative CMake path from the README.md.

* Removing LY_NINJA_PATH from the build_ninja_windows.cmd

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
2021-06-11 12:00:55 -05:00

81 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
SOURCE="${BASH_SOURCE[0]}"
# While $SOURCE is a symlink, resolve it
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR
# Overall strategy: Run python with --version to see if its already there
# otherwise, use cmake and the new package system to download it.
# To find cmake, search the path for cmake. If not found, try a fixed known location.
# the version number below is only used if cmake isn't already on your path.
# if you update this version number, remember to update the one(s) in the other platform
# files, as well as in scripts/build/...
./python.sh --version > /dev/null
python_exitcode=$?
if [ $python_exitcode == 0 ]; then
echo get_python.sh: Python is already downloaded: $(./python.sh --version)
$DIR/pip.sh install -r $DIR/requirements.txt --quiet --disable-pip-version-check
exit 0
fi
if [[ "$OSTYPE" = *"darwin"* ]];
then
PAL=Mac
CMAKE_FOLDER_RELATIVE_TO_ROOT=CMake.app/Contents/bin
else
PAL=Linux
CMAKE_FOLDER_RELATIVE_TO_ROOT=bin
fi
if ! [ -x "$(command -v cmake)" ]; then
if [ -z ${LY_CMAKE_PATH} ]; then
echo "ERROR: Could not find cmake on the PATH and LY_CMAKE_PATH is not defined, cannot continue."
echo "Please add cmake to your PATH, or define LY_CMAKE_PATH"
exit 1
fi
export PATH=$LY_CMAKE_PATH:$PATH
if ! [ -x "$(command -v cmake)" ]; then
echo "ERROR: Could not find cmake on the PATH or at the known location: $LY_CMAKE_PATH"
echo "Please add cmake to the environment PATH or place it at the above known location."
exit 1
fi
fi
echo Using cmake located at: $(which cmake)
echo $(cmake --version)
cd ..
cmake -DPAL_PLATFORM_NAME:string=$PAL -DLY_3RDPARTY_PATH:string=$DIR -P $DIR/get_python.cmake
retVal=$?
if [ $retVal -ne 0 ]; then
echo Unable to fetch python using cmake.
echo - Is LY_PACKAGE_SERVER_URLS set?
echo - Do you have permission to access the packages?
exit $retVal
fi
echo installing via pip...
$DIR/pip.sh install -r $DIR/requirements.txt --disable-pip-version-check
exit $?