Selaa lähdekoodia

Script updates for googlebenchmark-1.7.0-rev1-linux-aarch64 on Linux aarch64 (ARM64)

- Update script to use Docker (#191)
- Update to use Ninja instead of Unix Makefiles
- Update to include install artifacts instead of cherry picking files

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 2 vuotta sitten
vanhempi
commit
9e3766427e

+ 53 - 0
package-system/googlebenchmark/Dockerfile

@@ -0,0 +1,53 @@
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# This docker file uses ubuntu 20.04 as the base image so that the AWS Native C++ libraries will use OpenSSL 3 as the base
+# for its dependencies
+#
+
+FROM public.ecr.aws/ubuntu/ubuntu:20.04_stable
+ 
+WORKDIR /data/workspace
+
+ARG DOCKER_BUILD_SCRIPT
+
+# Initilize apt cache
+RUN apt-get clean && apt-get update
+
+# Setup time zone and locale data (necessary for SSL and HTTPS packages)
+RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata locales keyboard-configuration wget gpg
+
+RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
+    dpkg-reconfigure --frontend=noninteractive locales && \
+    update-locale LANG=en_US.UTF-8
+
+ENV LANG=en_US.UTF-8
+
+RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
+    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
+    apt-get update
+
+# Install the development packages needed to build Qt from source
+RUN apt-get install -y build-essential \
+                       cmake \
+                       ninja-build \
+                       libpcre3-dev 
+
+
+RUN apt upgrade -y
+
+# Prepare a target folder within the container to install the build artifacts tp
+RUN mkdir -p /data/workspace/build && \
+    mkdir -p /data/workspace/src
+
+
+ARG CACHEBUST=1
+
+# Copy the build script specific to this Docker script in order to execute the build
+COPY ${DOCKER_BUILD_SCRIPT} /data/workspace/
+COPY src /data/workspace/src/
+

+ 99 - 0
package-system/googlebenchmark/build-linux.sh

@@ -0,0 +1,99 @@
+#!/bin/bash
+
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script
+
+# Make sure docker is installed
+DOCKER_VERSION=$(docker --version)
+if [ $? -ne 0 ]
+then
+    echo "Required package docker is not installed"
+    echo "Follow instructions on https://docs.docker.com/engine/install/ubuntu/ to install docker properly"
+    exit 1
+fi
+echo "Detected Docker Version $DOCKER_VERSION"
+
+DOCKER_BUILD_SCRIPT=docker_build_googlebenchmark_linux.sh
+DOCKER_IMAGE_NAME=google_benchmark_linux_3p
+
+if [ ! -f $DOCKER_BUILD_SCRIPT ]
+then
+    echo "Invalid docker build script ${DOCKER_BUILD_SCRIPT}"
+    exit 1
+fi
+
+# Prepare the docker file and use the temp folder as the context root
+cp -f ${DOCKER_BUILD_SCRIPT} temp/
+
+pushd temp
+
+# Build the Docker Image
+echo "Building the docker build script for ${DOCKER_IMAGE_NAME}"
+
+docker build --build-arg DOCKER_BUILD_SCRIPT=$DOCKER_BUILD_SCRIPT -f ../Dockerfile -t ${DOCKER_IMAGE_NAME}:latest . 
+if [ $? -ne 0 ]
+then
+    echo "Error occurred creating Docker image ${DOCKER_IMAGE_NAME}:latest." 
+    exit 1
+fi
+
+
+# Capture the Docker Image ID
+IMAGE_ID=$(docker images -q ${DOCKER_IMAGE_NAME}:latest)
+if [ -z $IMAGE_ID ]
+then
+    echo "Error: Cannot find Image ID for ${DOCKER_IMAGE_NAME}"
+    exit 1
+fi
+
+
+# Run the Docker Image
+echo "Running build script in the docker image"
+echo docker run -v $TEMP_FOLDER/src:/data/workspace/src --tty ${DOCKER_IMAGE_NAME}:latest /data/workspace/${DOCKER_BUILD_SCRIPT}
+docker run -v $TEMP_FOLDER/src:/data/workspace/src --tty ${DOCKER_IMAGE_NAME}:latest /data/workspace/${DOCKER_BUILD_SCRIPT}
+if [ $? -ne 0 ]
+then
+    echo Failed to build from docker image ${DOCKER_IMAGE_NAME}:latest
+    exit 1
+fi
+
+
+# Capture the container ID
+echo "Capturing the Container ID"
+CONTAINER_ID=$(docker container ls -l -q --filter "ancestor=${DOCKER_IMAGE_NAME}:latest")
+if [ -z $CONTAINER_ID ]
+then
+    echo "Error: Cannot find Container ID for Image ${DOCKER_IMAGE_NAME}"
+    exit 1
+fi
+
+
+# Copy the build artifacts from the Docker Container
+echo "Copying the built contents from the docker container for image ${DOCKER_IMAGE_NAME}"
+
+mkdir -p build
+docker cp --quiet $CONTAINER_ID:/data/workspace/package/. build  
+if [ $? -ne 0 ]
+then
+    echo "Error occurred copying build artifacts from Docker image ${DOCKER_IMAGE_NAME}:latest." 
+    exit 1
+fi
+
+
+# Clean up the docker image and container
+echo "Cleaning up container"
+docker container rm $CONTAINER_ID || (echo "Warning: unable to clean up container for image ${DOCKER_IMAGE_NAME}")
+
+echo "Cleaning up image"
+docker rmi --force $IMAGE_ID  || (echo "Warning: unable to clean up image ${DOCKER_IMAGE_NAME}")
+
+popd
+
+exit 0
+

+ 5 - 19
package-system/googlebenchmark/build_config.json

@@ -131,25 +131,11 @@
       },
       },
       "Linux":{
       "Linux":{
          "Linux":{
          "Linux":{
-            "cmake_generate_args_debug":[
-               "-G",
-               "Unix\\ Makefiles",
-               "-DCMAKE_CXX_STANDARD=17",
-               "-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
-               "-DHAVE_STD_REGEX=TRUE",
-               "-DBENCHMARK_ENABLE_TESTING=OFF",
-               "-DCMAKE_INSTALL_LIBDIR=\"lib/Debug\"",
-               "-DCMAKE_BUILD_TYPE=Debug"
-            ],
-            "cmake_generate_args_release":[
-               "-G",
-               "Unix\\ Makefiles",
-               "-DCMAKE_CXX_STANDARD=17",
-               "-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
-               "-DHAVE_STD_REGEX=TRUE",
-               "-DBENCHMARK_ENABLE_TESTING=OFF",
-               "-DCMAKE_INSTALL_LIBDIR=\"lib/Release\"",
-               "-DCMAKE_BUILD_TYPE=Release"
+               "custom_build_cmd": [
+                    "./build-linux.sh"
+                ],
+                "custom_install_cmd": [
+                    "./package-linux.sh"
             ]
             ]
          },
          },
 	 "Linux-aarch64": "@Linux"
 	 "Linux-aarch64": "@Linux"

+ 51 - 0
package-system/googlebenchmark/docker_build_googlebenchmark_linux.sh

@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+
+# Build both debug and release variants
+build_configs=(Debug Release)
+for build_config in "${build_configs[@]}"
+do
+    echo 
+    cmake -S src -B build/${build_config} -G Ninja -DCMAKE_BUILD_TYPE=${build_config} -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DHAVE_STD_REGEX=TRUE -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/data/workspace/install/${build_config}
+
+    if [ $? -ne 0 ]
+    then
+        echo "Error configuring cmake for google benchmark (${build_config})"
+        exit 1
+    fi
+
+    cmake --build build/${build_config}
+    if [ $? -ne 0 ]
+    then
+        echo "Failed to build google benchmark for Linux (${build_config})"
+        exit 1
+    fi
+
+    cmake --install build/${build_config}
+    if [ $? -ne 0 ]
+    then
+        echo "Failed to package google benchmark for Linux (${build_config})"
+        exit 1
+    fi
+
+done
+
+# Create a combined package with debug and release libs
+mkdir -p package
+cp -r install/Release/include package/
+cp -r install/Release/share package/
+
+mkdir -p package/lib/Debug
+cp -r install/Debug/lib/* package/lib/Debug/
+
+mkdir -p package/lib/Release
+cp -r install/Release/lib/* package/lib/Release/
+
+
+exit 0
+
+

+ 14 - 0
package-system/googlebenchmark/package-linux.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+
+
+
+cp -r temp/build/include $TARGET_INSTALL_ROOT
+cp -r temp/build/share $TARGET_INSTALL_ROOT
+cp -r temp/build/lib $TARGET_INSTALL_ROOT
+
+exit 0 

+ 2 - 2
package_build_list_host_linux-aarch64.json

@@ -15,7 +15,7 @@
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean",
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux-aarch64 --clean",
         "expat-2.4.2-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux-aarch64 --clean",
         "expat-2.4.2-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/expat --platform-name Linux-aarch64 --clean",
         "freetype-2.11.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Linux-aarch64 --clean",
         "freetype-2.11.1-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/freetype --platform-name Linux-aarch64 --clean",
-        "googlebenchmark-1.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Linux-aarch64 --clean",
+        "googlebenchmark-1.7.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googlebenchmark --platform-name Linux-aarch64 --clean",
         "googletest-1.8.1-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Linux-aarch64 --clean",
         "googletest-1.8.1-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/googletest --platform-name Linux-aarch64 --clean",
         "ISPCTexComp-36b80aa-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/ISPCTexComp --platform-name Linux-aarch64 --clean",
         "ISPCTexComp-36b80aa-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/ISPCTexComp --platform-name Linux-aarch64 --clean",
         "libsamplerate-0.2.1-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Linux-aarch64 --clean",
         "libsamplerate-0.2.1-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libsamplerate --platform-name Linux-aarch64 --clean",
@@ -54,7 +54,7 @@
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64",
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-linux-aarch64": "package-system/DirectXShaderCompiler/temp/DirectXShaderCompilerDxc-linux-aarch64",
         "expat-2.4.2-rev2-linux-aarch64": "package-system/expat/temp/expat-linux-aarch64",
         "expat-2.4.2-rev2-linux-aarch64": "package-system/expat/temp/expat-linux-aarch64",
         "freetype-2.11.1-rev1-linux-aarch64": "package-system/freetype/temp/freetype-linux-aarch64",
         "freetype-2.11.1-rev1-linux-aarch64": "package-system/freetype/temp/freetype-linux-aarch64",
-        "googlebenchmark-1.5.0-rev2-linux-aarch64": "package-system/googlebenchmark/temp/googlebenchmark-linux-aarch64",
+        "googlebenchmark-1.7.0-rev1-linux-aarch64": "package-system/googlebenchmark/temp/googlebenchmark-linux-aarch64",
         "googletest-1.8.1-rev4-linux-aarch64": "package-system/googletest/temp/googletest-linux-aarch64",
         "googletest-1.8.1-rev4-linux-aarch64": "package-system/googletest/temp/googletest-linux-aarch64",
         "ISPCTexComp-36b80aa-rev2-linux-aarch64": "package-system/ISPCTexComp/temp/ISPCTexComp-linux-aarch64", 
         "ISPCTexComp-36b80aa-rev2-linux-aarch64": "package-system/ISPCTexComp/temp/ISPCTexComp-linux-aarch64", 
         "libsamplerate-0.2.1-rev2-linux-aarch64": "package-system/libsamplerate/temp/libsamplerate-linux-aarch64",
         "libsamplerate-0.2.1-rev2-linux-aarch64": "package-system/libsamplerate/temp/libsamplerate-linux-aarch64",