diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 922ea163..b4a236aa 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -31,6 +31,14 @@ jobs: with: create-symlink: true + - uses: actions/cache@v4 + with: + key: cmake-server-${{matrix.cmake_preset}} + path: | + ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.tar.* + ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.zip + restore-keys: cmake-server- + - name: Install dependencies run: > sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev libarchive-dev @@ -48,12 +56,13 @@ jobs: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr + -DFETCHCONTENT_BASE_DIR=${{github.workspace}}/cmake-fetch --preset ${{ matrix.cmake_preset }} - name: Package build dependencies if: ${{ matrix.cmake_preset == 'server' }} # For easier packaging, build dependencies are made available as a separate archive - run: (cd ${{github.workspace}}/build/_deps/ ; tar --create --xz *-src) > ${{github.workspace}}/server-build-deps.tar.xz + run: (cd ${{github.workspace}}/cmake-fetch ; tar --create --xz *-src) > ${{github.workspace}}/server-build-deps.tar.xz - name: Build # Build your program with the given configuration @@ -273,6 +282,14 @@ jobs: distribution: 'temurin' cache: gradle + - uses: actions/cache@v4 + with: + key: cmake-android-${{matrix.buildtype}} + path: | + ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.tar.* + ${{github.workspace}}/cmake-fetch/*-subbuild/*-populate-prefix/src/*.zip + restore-keys: cmake-android- + - name: Install dependencies run: | sudo apt-get update && sudo apt-get install glslang-tools librsvg2-bin gettext @@ -340,7 +357,15 @@ jobs: echo Using stylesheet $CSS and name $APPNAME chmod +x gradlew - ./gradlew -Pwivrn_version=$VERSION -Pwivrn_versionCode=$VERSION_CODE -Psuffix=$SUFFIX -Pwivrn_css=$CSS -Pwivrn_app_name="$APPNAME" -Pwivrn_compress_glb=ON assemble${{ matrix.hmd }}${{ matrix.buildtype }} + ./gradlew \ + -Pwivrn_version=$VERSION \ + -Pwivrn_versionCode=$VERSION_CODE \ + -Psuffix=$SUFFIX \ + -Pwivrn_css=$CSS \ + -Pwivrn_app_name="$APPNAME" \ + -Pwivrn_compress_glb=ON \ + -Pfetchcontent_base_dir=${{github.workspace}}/cmake-fetch \ + assemble${{ matrix.hmd }}${{ matrix.buildtype }} - name: Upload build dir uses: actions/upload-artifact@v4 diff --git a/build.gradle b/build.gradle index af80a174..3a371c9d 100644 --- a/build.gradle +++ b/build.gradle @@ -115,12 +115,13 @@ android { def showImguiDemo = project.hasProperty('wivrn_show_imgui_demo') ? wivrn_show_imgui_demo : 'OFF' def showDebugMenu = project.hasProperty('wivrn_show_debug_menu') ? wivrn_show_debug_menu : 'OFF' def compressGlb = project.hasProperty('wivrn_compress_glb') ? wivrn_compress_glb : 'OFF' + def fetchcontentBaseDir = project.hasProperty('fetchcontent_base_dir') ? ['-DFETCHCONTENT_BASE_DIR=' + fetchcontent_base_dir] : [] externalNativeBuild { def css = project.hasProperty('wivrn_css') ? project.wivrn_css: "images/wivrn-local.css" cmake { - arguments '-DANDROID_TOOLCHAIN=clang', + arguments = ['-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static', '-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion, '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON', @@ -137,7 +138,8 @@ android { '-DWIVRN_SHOW_IMGUI_DEMO_WINDOW=' + showImguiDemo, '-DWIVRN_CLIENT_DEBUG_MENU=' + showDebugMenu, '-DWIVRN_CSS=' + css, - '-DWIVRN_COMPRESS_GLB=' + compressGlb + '-DWIVRN_COMPRESS_GLB=' + compressGlb] + + fetchcontentBaseDir resValue "string", "app_name", project.hasProperty('wivrn_app_name') ? project.wivrn_app_name : "WiVRn Local" } }