ci: Make cmake toolchain file for deqp cross build setup.
authorEric Anholt <eric@anholt.net>
Thu, 14 May 2020 17:38:12 +0000 (10:38 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 18 May 2020 19:39:46 +0000 (19:39 +0000)
This adds a few more variables that we found we needed for x86-to-arm dEQP
cross builds.  Also note that we're now fixed to use ccache in the dEQP
builds.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5033>

.gitlab-ci.yml
.gitlab-ci/container/lava_arm.sh
.gitlab-ci/create-cross-file.sh

index e5fe436bdb6fc71d1d981768def989c421d47868..eb21ecddc06a968ad937310491c32997d6336720 100644 (file)
@@ -136,7 +136,7 @@ x86_build:
     - .fdo.container-build@debian
     - .container
   variables:
-    FDO_DISTRIBUTION_TAG: &x86_build "2020-05-18-baremetal"
+    FDO_DISTRIBUTION_TAG: &x86_build "2020-05-18-baremetal-2"
 
 .use-x86_build:
   variables:
@@ -177,7 +177,7 @@ arm_build:
     - .fdo.container-build@debian@arm64v8
     - .container
   variables:
-    FDO_DISTRIBUTION_TAG: &arm_build "2020-05-14-baremetal-2"
+    FDO_DISTRIBUTION_TAG: &arm_build "2020-05-14-baremetal-3"
 
 .use-arm_build:
   variables:
index 15feb76f69a914482f774e3c749796ae0ce57fc3..fcaf905241848996b5f9c3c1654ce7fc93bf2896 100644 (file)
@@ -20,6 +20,7 @@ fi
 # Determine if we're in a cross build.
 if [[ -e /cross_file-$DEBIAN_ARCH.txt ]]; then
     EXTRA_MESON_ARGS="--cross-file /cross_file-$DEBIAN_ARCH.txt"
+    EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=/toolchain-$DEBIAN_ARCH.cmake"
 
     export ARCH=${KERNEL_ARCH}
     export CROSS_COMPILE="${GCC_ARCH}-"
@@ -32,7 +33,6 @@ mv /usr/local/bin/deqp-runner /lava-files/rootfs-${DEBIAN_ARCH}/usr/bin/.
 
 
 ############### Build dEQP
-EXTRA_CMAKE_ARGS="-DCMAKE_C_COMPILER=${GCC_ARCH}-gcc -DCMAKE_CXX_COMPILER=${GCC_ARCH}-g++"
 STRIP_CMD="${GCC_ARCH}-strip"
 . .gitlab-ci/build-deqp-gl.sh
 mv /deqp /lava-files/rootfs-${DEBIAN_ARCH}/.
index de2fba5f4ddf46f3c4632542e1f4b2f8adfce72d..ba63812ca4183378959fab8414fdb6d7f1952d66 100755 (executable)
@@ -11,3 +11,24 @@ if [ "$arch" = "i386" ]; then
 fi
 # Rely on qemu-user being configured in binfmt_misc on the host
 sed -i -e '/\[properties\]/a\' -e "needs_exe_wrapper = False" "$cross_file"
+
+# Set up cmake cross compile toolchain file for dEQP builds
+toolchain_file="/toolchain-$arch.cmake"
+if [[ "$arch" = "arm64" ]]; then
+    GCC_ARCH="aarch64-linux-gnu"
+    DE_CPU="DE_CPU_ARM_64"
+    CMAKE_ARCH=arm
+elif [[ "$arch" = "armhf" ]]; then
+    GCC_ARCH="arm-linux-gnueabihf"
+    DE_CPU="DE_CPU_ARM"
+    CMAKE_ARCH=arm
+fi
+
+if [[ -n "$GCC_ARCH" ]]; then
+    echo "set(CMAKE_SYSTEM_NAME Linux)" > "$toolchain_file"
+    echo "set(CMAKE_SYSTEM_PROCESSOR arm)" >> "$toolchain_file"
+    echo "set(CMAKE_C_COMPILER /usr/lib/ccache/$GCC_ARCH-gcc)" >> "$toolchain_file"
+    echo "set(CMAKE_CXX_COMPILER /usr/lib/ccache/$GCC_ARCH-g++)" >> "$toolchain_file"
+    echo "set(ENV{PKG_CONFIG} \"/usr/bin/$GCC_ARCH-pkg-config\")" >> "$toolchain_file"
+    echo "set(DE_CPU $DE_CPU)" >> "$toolchain_file"
+fi