diff --git a/.github/actions/dep-versions/action.yml b/.github/actions/dep-versions/action.yml new file mode 100644 index 0000000000..dc2b48b59c --- /dev/null +++ b/.github/actions/dep-versions/action.yml @@ -0,0 +1,7 @@ +name: 'Set up dependency versions' +runs: + using: "composite" + steps: + - name: Set up dependency versions + shell: bash + run: cat ./build/common/versions >> $GITHUB_ENV diff --git a/.github/actions/linux-prereq/action.yml b/.github/actions/linux-prereq/action.yml new file mode 100644 index 0000000000..eb4a542a59 --- /dev/null +++ b/.github/actions/linux-prereq/action.yml @@ -0,0 +1,38 @@ +name: 'Linux Preqrequisites' +runs: + using: "composite" + steps: + - uses: ./.github/actions/dep-versions + - name: Install Linux Prerequisites + shell: bash + run: | + set -xe + # See https://askubuntu.com/questions/272248/processing-triggers-for-man-db/1476024#1476024 + echo "set man-db/auto-update false" | sudo debconf-communicate + sudo dpkg-reconfigure man-db + + # Install ninja + source ./build/common/get-ninja.sh + + # Install CMake + mkdir -p cmake + cd cmake + + sudo wget https://github.com/Kitware/CMake/releases/download/v$GITHUB_CMAKE_VERSION/cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh + sudo chmod +x ./cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh + sudo ./cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh --skip-license > /dev/null + sudo update-alternatives --install /usr/bin/cmake cmake $(pwd)/bin/cmake 1000 --force + + cd .. + + sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + sudo apt-get install clang-$GITHUB_CLANG_VERSION libc++-$GITHUB_CLANG_VERSION-dev libc++abi-$GITHUB_CLANG_VERSION-dev + sudo apt-get install mesa-common-dev libxi-dev libxxf86vm-dev + + # For dawn + sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libx11-xcb-dev + + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${GITHUB_CLANG_VERSION} 100 + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${GITHUB_CLANG_VERSION} 100 + set +xe diff --git a/.github/actions/mac-prereq/action.yml b/.github/actions/mac-prereq/action.yml new file mode 100644 index 0000000000..59a5ae5593 --- /dev/null +++ b/.github/actions/mac-prereq/action.yml @@ -0,0 +1,23 @@ +name: 'Mac Preqrequisites' +runs: + using: "composite" + steps: + - uses: ./.github/actions/dep-versions + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Cache Brew + id: brew-cache + uses: actions/cache@v4 # Use a specific version + with: + path: $HOME/Library/Caches/Homebrew + key: ${{ runner.os }}-brew-20250424 + - name: Install Mac Prerequisites + shell: bash + run: | + # Install ninja + source ./build/common/get-ninja.sh diff --git a/.github/workflows/android-continuous.yml b/.github/workflows/android-continuous.yml index 346fa6a7d7..9816478ca3 100644 --- a/.github/workflows/android-continuous.yml +++ b/.github/workflows/android-continuous.yml @@ -16,6 +16,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - name: Run Android Continuous uses: ./.github/actions/android-continuous with: diff --git a/.github/workflows/ios-continuous.yml b/.github/workflows/ios-continuous.yml index 28b2915159..45b868fa62 100644 --- a/.github/workflows/ios-continuous.yml +++ b/.github/workflows/ios-continuous.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/mac-prereq - name: Run build script run: | cd build/ios && printf "y" | ./build.sh continuous diff --git a/.github/workflows/linux-continuous.yml b/.github/workflows/linux-continuous.yml index 6763f26de8..253bf07687 100644 --- a/.github/workflows/linux-continuous.yml +++ b/.github/workflows/linux-continuous.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - name: Run build script run: | cd build/linux && printf "y" | ./build.sh continuous diff --git a/.github/workflows/mac-continuous.yml b/.github/workflows/mac-continuous.yml index e0a46ab4ba..b7c98c93b1 100644 --- a/.github/workflows/mac-continuous.yml +++ b/.github/workflows/mac-continuous.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/mac-prereq - name: Run build script run: | cd build/mac && printf "y" | ./build.sh continuous diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index f239b3b705..ca4b3e2a89 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -9,22 +9,32 @@ on: - main jobs: - build-desktop: - name: build-desktop - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [macos-14-xlarge, ubuntu-22.04-16core] - + build-desktop-mac: + name: build-mac + runs-on: macos-14-xlarge steps: - uses: actions/checkout@v4.1.6 with: fetch-depth: 0 + - uses: ./.github/actions/mac-prereq - name: Run build script run: | - WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]` - cd build/$WORKFLOW_OS && printf "y" | ./build.sh presubmit + cd build/mac && printf "y" | ./build.sh presubmit + - name: Test material parser + run: | + out/cmake-release/filament/test/test_material_parser + + build-desktop-linux: + name: build-linux + runs-on: ubuntu-22.04-16core + steps: + - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq + - name: Run build script + run: | + cd build/linux && printf "y" | ./build.sh presubmit - name: Test material parser run: | out/cmake-release/filament/test/test_material_parser @@ -35,6 +45,8 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 - name: Run build script run: | build\windows\build-github.bat presubmit @@ -48,6 +60,7 @@ jobs: - uses: actions/checkout@v4.1.6 with: fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -66,6 +79,7 @@ jobs: - uses: actions/checkout@v4.1.6 with: fetch-depth: 0 + - uses: ./.github/actions/mac-prereq - name: Run build script run: | cd build/ios && printf "y" | ./build.sh presubmit @@ -79,6 +93,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - name: Run build script run: | cd build/web && printf "y" | ./build.sh presubmit @@ -101,30 +118,20 @@ jobs: runs-on: macos-14-xlarge steps: - uses: actions/checkout@v4.1.6 - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@master - - name: Set up Python - uses: actions/setup-python@v5 with: - python-version: '3.x' + fetch-depth: 0 + - uses: ./.github/actions/mac-prereq - name: Cache Mesa and deps id: mesa-cache uses: actions/cache@v4 # Use a specific version with: - path: | - $HOME/Library/Caches/Homebrew - mesa - key: ${{ runner.os }}-mesa-deps-${{ vars.MESA_VERSION }} + path: mesa + key: ${{ runner.os }}-mesa-deps-2-${{ vars.MESA_VERSION }} - name: Get Mesa id: mesa-prereq - env: - MESA_VERSION: ${{ vars.MESA_VERSION }} - run: | - bash test/utils/get_mesa.sh + run: bash test/utils/get_mesa.sh - name: Run Test - run: | - bash test/renderdiff/test.sh + run: bash test/renderdiff/test.sh - uses: actions/upload-artifact@v4 with: name: presubmit-renderdiff-result @@ -133,11 +140,13 @@ jobs: validate-wgsl-webgpu: name: validate-wgsl-webgpu runs-on: 'ubuntu-24.04-8core' - steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - name: Run build script - run: source ./build/linux/ci-common.sh && ./build.sh -W debug test_filamat filament + run: ./build.sh -W debug test_filamat filament - name: Run test run: ./out/cmake-debug/libs/filamat/test_filamat --gtest_filter=MaterialCompiler.Wgsl* @@ -148,23 +157,16 @@ jobs: - uses: actions/checkout@v4.1.6 with: fetch-depth: 0 - - name: Set up Homebrew - id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@master - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install prerequisites + - uses: ./.github/actions/mac-prereq + - name: Install clang-tidy and deps run: | pip install pyyaml - brew install llvm - sudo ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" + brew install llvm@${GITHUB_LLVM_VERSION} + sudo ln -s "$(brew --prefix llvm)@${GITHUB_LLVM_VERSION}/bin/clang-tidy" "/usr/local/bin/clang-tidy" - name: Run build script # We need to build before clang-tidy can run analysis run: | # This will build for all three desktop backends on mac ./build.sh -p desktop debug gltf_viewer - name: Run test - run: | - bash test/code-correctness/test.sh + run: bash test/code-correctness/test.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96d91df89d..8ed2148880 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,8 +29,42 @@ on: types: [created] jobs: - build-desktop: - name: build-desktop + build-linux: + name: build-linux + runs-on: ubuntu-22.04-32core + if: github.event_name == 'release' || github.event.inputs.platform == 'desktop' + + steps: + - name: Decide Git ref + id: git_ref + run: | + REF=${RELEASE_TAG:-${GITHUB_REF}} + TAG=${REF##*/} + echo "ref=${REF}" >> $GITHUB_OUTPUT + echo "tag=${TAG}" >> $GITHUB_OUTPUT + - uses: actions/checkout@v4.1.6 + with: + ref: ${{ steps.git_ref.outputs.ref }} + - uses: ./.github/actions/linux-prereq + - name: Run build script + env: + TAG: ${{ steps.git_ref.outputs.tag }} + run: | + cd build/linux && printf "y" | ./build.sh release + cd ../.. + mv out/filament-release-linux.tgz out/filament-${TAG}-linux.tgz + - uses: actions/github-script@v6 + env: + TAG: ${{ steps.git_ref.outputs.tag }} + with: + script: | + const upload = require('./build/common/upload-release-assets'); + const { TAG } = process.env; + const globber = await glob.create('out/*.tgz'); + await upload({ github, context }, await globber.glob(), TAG); + + build-mac: + name: build-mac runs-on: ${{ matrix.os }} if: github.event_name == 'release' || github.event.inputs.platform == 'desktop' @@ -49,15 +83,14 @@ jobs: - uses: actions/checkout@v4.1.6 with: ref: ${{ steps.git_ref.outputs.ref }} + - uses: ./.github/actions/mac-prereq - name: Run build script env: TAG: ${{ steps.git_ref.outputs.tag }} run: | - WORKFLOW_OS=`echo \`uname\` | sed "s/Darwin/mac/" | tr [:upper:] [:lower:]` - cd build/$WORKFLOW_OS && printf "y" | ./build.sh release + cd build/mac && printf "y" | ./build.sh release cd ../.. - if [ -f out/filament-release-darwin.tgz ]; then mv out/filament-release-darwin.tgz out/filament-${TAG}-mac.tgz; fi; - if [ -f out/filament-release-linux.tgz ]; then mv out/filament-release-linux.tgz out/filament-${TAG}-linux.tgz; fi; + mv out/filament-release-darwin.tgz out/filament-${TAG}-mac.tgz - uses: actions/github-script@v6 env: TAG: ${{ steps.git_ref.outputs.tag }} @@ -84,6 +117,7 @@ jobs: - uses: actions/checkout@v4.1.6 with: ref: ${{ steps.git_ref.outputs.ref }} + - uses: ./.github/actions/linux-prereq - name: Run build script env: TAG: ${{ steps.git_ref.outputs.tag }} @@ -121,6 +155,7 @@ jobs: with: distribution: 'temurin' java-version: '17' + - uses: ./.github/actions/linux-prereq - name: Run build script env: TAG: ${{ steps.git_ref.outputs.tag }} @@ -171,6 +206,7 @@ jobs: - uses: actions/checkout@v4.1.6 with: ref: ${{ steps.git_ref.outputs.ref }} + - uses: ./.github/actions/mac-prereq - name: Run build script env: TAG: ${{ steps.git_ref.outputs.tag }} diff --git a/.github/workflows/web-continuous.yml b/.github/workflows/web-continuous.yml index dad91cb1d9..74aa57de5c 100644 --- a/.github/workflows/web-continuous.yml +++ b/.github/workflows/web-continuous.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v4.1.6 + with: + fetch-depth: 0 + - uses: ./.github/actions/linux-prereq - name: Run build script run: | cd build/web && printf "y" | ./build.sh continuous diff --git a/build/android/build.sh b/build/android/build.sh index c9821b8fb4..da673271e7 100755 --- a/build/android/build.sh +++ b/build/android/build.sh @@ -14,12 +14,12 @@ echo "Please refer to BUILDING.md for more information." read -r -p "Do you wish to proceed (y/n)? " choice case "${choice}" in y|Y) - echo "Build will proceed..." - ;; + echo "Build will proceed..." + ;; n|N) - exit 0 - ;; - *) + exit 0 + ;; + *) exit 0 ;; esac @@ -30,30 +30,27 @@ set -x UNAME=`echo $(uname)` LC_UNAME=`echo $UNAME | tr '[:upper:]' '[:lower:]'` -FILAMENT_ANDROID_CI_BUILD=true - # build-common.sh will generate the following variables: # $GENERATE_ARCHIVES # $BUILD_DEBUG # $BUILD_RELEASE source `dirname $0`/../common/ci-common.sh -if [[ "$LC_UNAME" == "linux" ]]; then - source `dirname $0`/../linux/ci-common.sh -elif [[ "$LC_UNAME" == "darwin" ]]; then - source `dirname $0`/../mac/ci-common.sh -fi source `dirname $0`/../common/build-common.sh if [[ "$GITHUB_WORKFLOW" ]]; then java_version=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1) if [[ "$java_version" < 17 ]]; then echo "Android builds require Java 17, found version ${java_version} instead" - exit 0 + exit 1 fi fi # Unless explicitly specified, NDK version will be set to match exactly the required one -FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION:-$(cat `dirname $0`/ndk.version)} +FILAMENT_NDK_VERSION=${GITHUB_NDK_VERSION:-27.0.11718014} + +(! grep "${FILAMENT_NDK_VERSION}" `dirname $0`/../../android/build.gradle > /dev/null) && + echo "Mismatch of NDK versions: want ${FILAMENT_NDK_VERSION} and not found in android/build.gradle" && + exit 1 # Install the required NDK version specifically (if not present) if [[ ! -d "${ANDROID_HOME}/ndk/$FILAMENT_NDK_VERSION" ]]; then diff --git a/build/android/ndk.version b/build/android/ndk.version deleted file mode 100644 index f58ef0240a..0000000000 --- a/build/android/ndk.version +++ /dev/null @@ -1 +0,0 @@ -27.0.11718014 \ No newline at end of file diff --git a/build/common/ci-common.sh b/build/common/ci-common.sh index cb36ca7cdd..2b66ec0375 100755 --- a/build/common/ci-common.sh +++ b/build/common/ci-common.sh @@ -2,5 +2,4 @@ if [[ "$GITHUB_WORKFLOW" ]]; then echo "Running workflow $GITHUB_WORKFLOW (event: $GITHUB_EVENT_NAME, action: $GITHUB_ACTION)" - CONTINUOUS_INTEGRATION=true fi diff --git a/build/common/get-ninja.sh b/build/common/get-ninja.sh new file mode 100755 index 0000000000..06ff0eb604 --- /dev/null +++ b/build/common/get-ninja.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ "$GITHUB_WORKFLOW" ]]; then + OS_NAME=$(uname -s) + NINJA_DL_DIR=/tmp/ninja-dl + NINJA_PLATFORM= + if [[ "$OS_NAME" == "Linux" ]]; then + NINJA_PLATFORM=linux + elif [[ "$OS_NAME" == "Darwin" ]]; then + NINJA_PLATFORM=mac + fi + curl -L -o /tmp/ninja-dl.zip https://github.com/ninja-build/ninja/releases/download/v${GITHUB_NINJA_VERSION}/ninja-${NINJA_PLATFORM}.zip + mkdir -p $NINJA_DL_DIR + unzip -q /tmp/ninja-dl.zip -d $NINJA_DL_DIR + chmod +x ${NINJA_DL_DIR}/ninja + # Install ninja globally for AGP + sudo cp ${NINJA_DL_DIR}/ninja /usr/local/bin/ +fi diff --git a/build/common/versions b/build/common/versions new file mode 100644 index 0000000000..49749b5231 --- /dev/null +++ b/build/common/versions @@ -0,0 +1,6 @@ +GITHUB_CLANG_VERSION=14 +GITHUB_CMAKE_VERSION=3.19.5 +GITHUB_NINJA_VERSION=1.10.2 +GITHUB_MESA_VERSION=24.2.1 +GITHUB_LLVM_VERSION=16 +GITHUB_NDK_VERSION=27.0.11718014 \ No newline at end of file diff --git a/build/ios/build.sh b/build/ios/build.sh index fcfcb42846..e43ddbb12b 100755 --- a/build/ios/build.sh +++ b/build/ios/build.sh @@ -28,7 +28,6 @@ set -e set -x source `dirname $0`/../common/ci-common.sh -source `dirname $0`/ci-common.sh source `dirname $0`/../common/build-common.sh pushd `dirname $0`/../.. > /dev/null @@ -41,4 +40,3 @@ if [[ "${GENERATE_ARCHIVES}" ]]; then fi ./build.sh -i -p ios -c $BUILD_SIMULATOR $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE - diff --git a/build/ios/ci-common.sh b/build/ios/ci-common.sh deleted file mode 100755 index da50f1b7e1..0000000000 --- a/build/ios/ci-common.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -curl -OL https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip -unzip -q ninja-mac.zip -chmod +x ninja -export PATH="$PWD:$PATH" diff --git a/build/linux/build.sh b/build/linux/build.sh index 5b624af984..021800ad13 100755 --- a/build/linux/build.sh +++ b/build/linux/build.sh @@ -32,7 +32,6 @@ set -x # $BUILD_DEBUG # $BUILD_RELEASE source `dirname $0`/../common/ci-common.sh -source `dirname $0`/ci-common.sh source `dirname $0`/../common/build-common.sh pushd `dirname $0`/../.. > /dev/null diff --git a/build/linux/ci-common.sh b/build/linux/ci-common.sh deleted file mode 100755 index 7d88065205..0000000000 --- a/build/linux/ci-common.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# version of clang we want to use -export GITHUB_CLANG_VERSION=14 -# version of CMake to use instead of the default one -export GITHUB_CMAKE_VERSION=3.19.5 -# version of ninja to use -export GITHUB_NINJA_VERSION=1.10.2 - -# Steps for GitHub Workflows -if [[ "$GITHUB_WORKFLOW" ]]; then - # Install ninja - wget -q https://github.com/ninja-build/ninja/releases/download/v$GITHUB_NINJA_VERSION/ninja-linux.zip - unzip -q ninja-linux.zip - export PATH="$PWD:$PATH" - - # Install CMake - mkdir -p cmake - cd cmake - - sudo wget https://github.com/Kitware/CMake/releases/download/v$GITHUB_CMAKE_VERSION/cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh - sudo chmod +x ./cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh - sudo ./cmake-$GITHUB_CMAKE_VERSION-Linux-x86_64.sh --skip-license > /dev/null - sudo update-alternatives --install /usr/bin/cmake cmake $(pwd)/bin/cmake 1000 --force - - cd .. - - sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-get update - sudo apt-get install clang-$GITHUB_CLANG_VERSION libc++-$GITHUB_CLANG_VERSION-dev libc++abi-$GITHUB_CLANG_VERSION-dev - sudo apt-get install mesa-common-dev libxi-dev libxxf86vm-dev - - # For dawn - sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libx11-xcb-dev - - sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${GITHUB_CLANG_VERSION} 100 - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${GITHUB_CLANG_VERSION} 100 -fi diff --git a/build/mac/build.sh b/build/mac/build.sh index b443ce7946..388316c10d 100755 --- a/build/mac/build.sh +++ b/build/mac/build.sh @@ -28,7 +28,6 @@ set -e set -x source `dirname $0`/../common/ci-common.sh -source `dirname $0`/ci-common.sh source `dirname $0`/../common/build-common.sh pushd `dirname $0`/../.. > /dev/null diff --git a/build/mac/ci-common.sh b/build/mac/ci-common.sh deleted file mode 100755 index 6d9e03e231..0000000000 --- a/build/mac/ci-common.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -curl -OL https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip -unzip -q ninja-mac.zip -chmod +x ninja -# Install ninja globally for AGP -cp ninja /usr/local/bin -export PATH="$PWD:$PATH" diff --git a/build/toolchain-aarch64-linux-android.cmake b/build/toolchain-aarch64-linux-android.cmake index ed9c0948b4..02db489341 100644 --- a/build/toolchain-aarch64-linux-android.cmake +++ b/build/toolchain-aarch64-linux-android.cmake @@ -31,10 +31,16 @@ set(DIST_ARCH arm64-v8a) string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) file(TO_CMAKE_PATH $ENV{ANDROID_HOME} ANDROID_HOME_UNIX) +message(STATUS "Try using NDK \'${FILAMENT_NDK_VERSION}\'") if (NOT FILAMENT_NDK_VERSION) - file(READ "${CMAKE_CURRENT_LIST_DIR}/android/ndk.version" FILAMENT_NDK_VERSION) - string(REGEX MATCH "^\\d+" FILAMENT_NDK_VERSION ${FILAMENT_NDK_VERSION}) + file(READ "${CMAKE_CURRENT_LIST_DIR}/common/versions" VERSIONS_STR) + string(REGEX MATCH "GITHUB_NDK_VERSION=(\\d+)" _UNUSED ${VERSIONS_STR}) + if(CMAKE_MATCH_1) + set(FILAMENT_NDK_VERSION "${CMAKE_MATCH_1}") + endif() endif() +message(STATUS "Using NDK \'${FILAMENT_NDK_VERSION}\'") + file(GLOB NDK_VERSIONS LIST_DIRECTORIES true ${ANDROID_HOME_UNIX}/ndk/${FILAMENT_NDK_VERSION}*) list(SORT NDK_VERSIONS) list(GET NDK_VERSIONS -1 NDK_VERSION) diff --git a/build/toolchain-arm7-linux-android.cmake b/build/toolchain-arm7-linux-android.cmake index a3f6036c32..6e6e4ba823 100644 --- a/build/toolchain-arm7-linux-android.cmake +++ b/build/toolchain-arm7-linux-android.cmake @@ -32,10 +32,16 @@ set(DIST_ARCH armeabi-v7a) string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) file(TO_CMAKE_PATH $ENV{ANDROID_HOME} ANDROID_HOME_UNIX) +message(STATUS "Try using NDK \'${FILAMENT_NDK_VERSION}\'") if (NOT FILAMENT_NDK_VERSION) - file(READ "${CMAKE_CURRENT_LIST_DIR}/android/ndk.version" FILAMENT_NDK_VERSION) - string(REGEX MATCH "^\\d+" FILAMENT_NDK_VERSION ${FILAMENT_NDK_VERSION}) + file(READ "${CMAKE_CURRENT_LIST_DIR}/common/versions" VERSIONS_STR) + string(REGEX MATCH "GITHUB_NDK_VERSION=(\\d+)" _UNUSED ${VERSIONS_STR}) + if(CMAKE_MATCH_1) + set(FILAMENT_NDK_VERSION "${CMAKE_MATCH_1}") + endif() endif() +message(STATUS "Using NDK \'${FILAMENT_NDK_VERSION}\'") + file(GLOB NDK_VERSIONS LIST_DIRECTORIES true ${ANDROID_HOME_UNIX}/ndk/${FILAMENT_NDK_VERSION}*) list(SORT NDK_VERSIONS) list(GET NDK_VERSIONS -1 NDK_VERSION) diff --git a/build/toolchain-x86-linux-android.cmake b/build/toolchain-x86-linux-android.cmake index 8c50712337..9ddb5473a0 100644 --- a/build/toolchain-x86-linux-android.cmake +++ b/build/toolchain-x86-linux-android.cmake @@ -31,10 +31,16 @@ set(DIST_ARCH x86) string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) file(TO_CMAKE_PATH $ENV{ANDROID_HOME} ANDROID_HOME_UNIX) +message(STATUS "Try using NDK \'${FILAMENT_NDK_VERSION}\'") if (NOT FILAMENT_NDK_VERSION) - file(READ "${CMAKE_CURRENT_LIST_DIR}/android/ndk.version" FILAMENT_NDK_VERSION) - string(REGEX MATCH "^\\d+" FILAMENT_NDK_VERSION ${FILAMENT_NDK_VERSION}) + file(READ "${CMAKE_CURRENT_LIST_DIR}/common/versions" VERSIONS_STR) + string(REGEX MATCH "GITHUB_NDK_VERSION=(\\d+)" _UNUSED ${VERSIONS_STR}) + if(CMAKE_MATCH_1) + set(FILAMENT_NDK_VERSION "${CMAKE_MATCH_1}") + endif() endif() +message(STATUS "Using NDK \'${FILAMENT_NDK_VERSION}\'") + file(GLOB NDK_VERSIONS LIST_DIRECTORIES true ${ANDROID_HOME_UNIX}/ndk/${FILAMENT_NDK_VERSION}*) list(SORT NDK_VERSIONS) list(GET NDK_VERSIONS -1 NDK_VERSION) diff --git a/build/toolchain-x86_64-linux-android.cmake b/build/toolchain-x86_64-linux-android.cmake index db273154a6..032fe4f699 100644 --- a/build/toolchain-x86_64-linux-android.cmake +++ b/build/toolchain-x86_64-linux-android.cmake @@ -31,10 +31,16 @@ set(DIST_ARCH x86_64) string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_NAME_L) file(TO_CMAKE_PATH $ENV{ANDROID_HOME} ANDROID_HOME_UNIX) +message(STATUS "Try using NDK \'${FILAMENT_NDK_VERSION}\'") if (NOT FILAMENT_NDK_VERSION) - file(READ "${CMAKE_CURRENT_LIST_DIR}/android/ndk.version" FILAMENT_NDK_VERSION) - string(REGEX MATCH "^\\d+" FILAMENT_NDK_VERSION ${FILAMENT_NDK_VERSION}) + file(READ "${CMAKE_CURRENT_LIST_DIR}/common/versions" VERSIONS_STR) + string(REGEX MATCH "GITHUB_NDK_VERSION=(\\d+)" _UNUSED ${VERSIONS_STR}) + if(CMAKE_MATCH_1) + set(FILAMENT_NDK_VERSION "${CMAKE_MATCH_1}") + endif() endif() +message(STATUS "Using NDK \'${FILAMENT_NDK_VERSION}\'") + file(GLOB NDK_VERSIONS LIST_DIRECTORIES true ${ANDROID_HOME_UNIX}/ndk/${FILAMENT_NDK_VERSION}*) list(SORT NDK_VERSIONS) list(GET NDK_VERSIONS -1 NDK_VERSION) diff --git a/build/web/ci-common.sh b/build/web/ci-common.sh index e7726a8f7c..1a5a19a4b1 100755 --- a/build/web/ci-common.sh +++ b/build/web/ci-common.sh @@ -1,16 +1,4 @@ #!/bin/bash -if [ `uname` == "Linux" ];then - source `dirname $0`/../linux/ci-common.sh -elif [ `uname` == "Darwin" ];then - curl -OL https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip - unzip -q ninja-mac.zip -else - echo "Unsupported OS" - exit 1 -fi - -chmod +x ninja -export PATH="$PWD:$PATH" # Install emscripten. curl -L https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.60.zip > emsdk.zip diff --git a/test/utils/get_mesa.sh b/test/utils/get_mesa.sh index ab2510b85e..508d5a5eb7 100755 --- a/test/utils/get_mesa.sh +++ b/test/utils/get_mesa.sh @@ -19,13 +19,13 @@ if [[ "$GITHUB_WORKFLOW" ]]; then set -e fi -os_name=$(uname -s) -LLVM_VERSION=16 -MESA_VERSION=${MESA_VERSION-24.2.1} +OS_NAME=$(uname -s) +LLVM_VERSION=${GITHUB_LLVM_VERSION-16} +MESA_VERSION=${GITHUB_MESA_VERSION-24.2.1} ORIG_DIR=$(pwd) MESA_DIR=${MESA_DIR-${ORIG_DIR}/mesa} -if [[ "$os_name" == "Linux" ]]; then +if [[ "$OS_NAME" == "Linux" ]]; then sudo apt install python3-venv fi @@ -42,7 +42,7 @@ done deactivate # Install system deps -if [[ "$os_name" == "Linux" ]]; then +if [[ "$OS_NAME" == "Linux" ]]; then if [[ "$GITHUB_WORKFLOW" ]]; then # We only want to do this if it is a CI machine. sudo apt-get -y remove llvm-* @@ -64,18 +64,17 @@ if [[ "$os_name" == "Linux" ]]; then sudo apt -y remove llvm-18 llvm-18-* llvm-19 llvm-19-* set -e CURRENT_CLANG_VERSION=$(clang --version | head -n 1 | awk '{ print $4 }' | awk 'BEGIN { FS="\\." } { print $1 }') - GITHUB_CLANG_VERSION=${GITHUB_CLANG_VERSION:-${CURRENT_CLANG_VERSION}} - GITHUB_CLANG_VERSION=${GITHUB_CLANG_VERSION:-${LLVM_VERSION}} - sudo apt-get -y install clang-${GITHUB_CLANG_VERSION} \ - libc++-${GITHUB_CLANG_VERSION}-dev \ - libc++abi-${GITHUB_CLANG_VERSION}-dev \ + CLANG_VERSION=${CURRENT_CLANG_VERSION:-${LLVM_VERSION}} + sudo apt-get -y install clang-${CLANG_VERSION} \ + libc++-${CLANG_VERSION}-dev \ + libc++abi-${CLANG_VERSION}-dev \ llvm-${LLVM_VERSION} \ llvm-${LLVM_VERSION}-{dev,tools,runtime} ! command -v clang > /dev/null 2>&1 && \ - sudo ln -s /usr/bin/clang-${GITHUB_CLANG_VERSION} /usr/bin/clang && \ - sudo ln -s /usr/bin/clang++-${GITHUB_CLANG_VERSION} /usr/bin/clang++ + sudo ln -s /usr/bin/clang-${CLANG_VERSION} /usr/bin/clang && \ + sudo ln -s /usr/bin/clang++-${CLANG_VERSION} /usr/bin/clang++ fi # [[ "$GITHUB_WORKFLOW" ]] -elif [[ "$os_name" == "Darwin" ]]; then +elif [[ "$OS_NAME" == "Darwin" ]]; then if [[ ! "$GITHUB_WORKFLOW" ]]; then if [ ! command -v brew > /dev/null 2>&1 ]; then echo "Error: need to install homebrew to continue" @@ -83,7 +82,7 @@ elif [[ "$os_name" == "Darwin" ]]; then fi fi HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true brew install autoconf automake libx11 libxext libxrandr llvm@${LLVM_VERSION} ninja meson pkg-config libxshmfence -fi # [[ "$os_name" == x ]] +fi # [[ "$OS_NAME" == x ]] LOCAL_LDFLAGS=${LDFLAGS} LOCAL_CPPFLAGS=${CPPFLAGS} @@ -122,7 +121,7 @@ mkdir -p out source ${ORIG_DIR}/venv/bin/activate -if [[ "$os_name" == "Darwin" ]]; then +if [[ "$OS_NAME" == "Darwin" ]]; then LOCAL_LDFLAGS="-L/opt/homebrew/opt/llvm@${LLVM_VERSION}/lib" LOCAL_CPPFLAGS="-I/opt/homebrew/opt/llvm@${LLVM_VERSION}/include -I/opt/homebrew/include" LOCAL_PATH=${PATH}:/opt/homebrew/opt/llvm@${LLVM_VERSION}/bin