From 301c0b645a74ee2f0fc6e51ee7ba794586a30abe Mon Sep 17 00:00:00 2001 From: Tyler Fox Date: Tue, 20 Aug 2024 15:13:38 -0700 Subject: [PATCH] Switch to a single compile job --- .github/workflows/main.yml | 286 ++++++++++++--------------------- meson.build | 1 + subprojects/maya/meson.build | 32 +++- subprojects/maya/meson.options | 9 ++ 4 files changed, 141 insertions(+), 187 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5a61c1..300f00f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,219 +8,147 @@ on: pull_request: branches: [ master ] -env: - BUILD_TYPE: Release - jobs: - # - # Windows - # - # __ - # |\__/ \ - # | | - # | __ | - # \__/ \| - # - # - maya-win: - runs-on: windows-latest - + compile_plugin: strategy: - # Without this, all containers stop if any fail - # That's bad, we want to know whether it's only one - # or if it happens to multiples or all. - fail-fast: false - matrix: - include: - - maya: "2022" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2022/Autodesk_Maya_2022_5_Update_DEVKIT_Windows.zip" - - maya: "2023" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2023/Autodesk_Maya_2023_3_Update_DEVKIT_Windows.zip" - - maya: "2024" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2024/Autodesk_Maya_2024_2_Update_DEVKIT_Windows.zip" - - maya: "2025" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2025/Autodesk_Maya_2025_1_Update_DEVKIT_Windows.zip" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Install devkit - run: | - Write-Host "Downloading Devkit: ${{matrix.devkit}}..." - Invoke-WebRequest -Uri ${{matrix.devkit}} -OutFile "$pwd/devkit.zip" - Write-Host "Extracting devkit.zip.." - Expand-Archive -LiteralPath devkit.zip -DestinationPath $pwd - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAYA_VERSION="${{matrix.maya}}" -DMAYA_DEVKIT_BASE="$pwd/devkitBase" - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Repath Artifacts - run: | - mkdir artifacts/plug-ins - Copy-Item "./build/${{env.BUILD_TYPE}}/TwistSpline.mll" -Destination "artifacts/plug-ins" - - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: windows-${{matrix.maya}} - path: | - artifacts/plug-ins/TwistSpline.mll + maya: [2022, 2023, 2024, 2025] + os: [macos-13, macos-latest, ubuntu-latest, windows-latest] + include: + # Add the maya update versions here + - maya: 2022 + update: 5 + - maya: 2023 + update: 3 + - maya: 2024 + update: 2 + - maya: 2025 + update: 1 + + # OS specific vars + - os: macos-latest + os_name_u: Mac + os_name: mac + ext: bundle + zip: dmg + - os: macos-13 + os_name_u: Mac + os_name: mac + ext: bundle + zip: dmg + - os: windows-latest + os_name_u: Windows + os_name: windows + ext: mll + zip: zip + - os: ubuntu-latest + os_name_u: Linux + os_name: linux + ext: so + zip: tgz + + # cross-compiling is annoying so just fall back to macos-13 + exclude: + - os: macos-latest + maya: 2022 + - os: macos-latest + maya: 2023 + - os: macos-13 + maya: 2024 + - os: macos-13 + maya: 2025 - # Splitting mac-os into two different steps, as 2024 was made compatible with new arm architecture. - maya-macos-x86_64: - runs-on: macos-latest - - strategy: fail-fast: false - matrix: - include: - - maya: "2022" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2022/Autodesk_Maya_2022_5_Update_DEVKIT_Mac.dmg" - - maya: "2023" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2023/Autodesk_Maya_2023_3_Update_DEVKIT_Mac.dmg" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Install devkit - run: | - curl -o devkit.dmg ${{matrix.devkit}} - hdiutil attach devkit.dmg - - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '14.3.1' - - - name: Configure CMake - run: | - cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAYA_VERSION=${{matrix.maya}} -DMAYA_DEVKIT_BASE="/Volumes/devkitBase" - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + runs-on: ${{ matrix.os }} - - name: Repath Artifacts - run: | - mkdir -p artifacts/plug-ins - cp ./build/${{env.BUILD_TYPE}}/TwistSpline.bundle artifacts/plug-ins - - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: mac-${{matrix.maya}} - path: | - artifacts/plug-ins/TwistSpline.bundle - - # This will be compiled for both x86_64 and arm64 architectures, as arm support has been added starting from Maya 2024. - maya-macos-arm64: - runs-on: macos-latest - - strategy: - fail-fast: false - - matrix: - include: - - maya: "2024" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2024/Autodesk_Maya_2024_2_Update_DEVKIT_Mac.dmg" - - maya: "2025" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2025/Autodesk_Maya_2025_1_Update_DEVKIT_Mac.dmg" + env: + DEVKIT_URL: https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+${{ matrix.maya }}/Autodesk_Maya_${{ matrix.maya }}_${{ matrix.update }}_Update_DEVKIT_${{ matrix.os_name_u }}.${{ matrix.zip }} steps: - - name: Checkout code + + - name: Checkout uses: actions/checkout@v4 with: submodules: true - - name: Install devkit - run: | - curl -o devkit.dmg ${{matrix.devkit}} - hdiutil attach devkit.dmg + - name : Install ninja + uses: seanmiddleditch/gha-setup-ninja@v5 - - uses: maxim-lobanov/setup-xcode@v1 + - name : Install Python + uses: actions/setup-python@v5 with: - xcode-version: '14.3.1' + python-version: '3.10' - - name: Configure CMake - run: | - cmake -G Xcode -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAYA_VERSION=${{matrix.maya}} -DMAYA_DEVKIT_BASE="/Volumes/devkitBase" - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Repath Artifacts - run: | - mkdir -p artifacts/plug-ins - cp ./build/${{env.BUILD_TYPE}}/TwistSpline.bundle artifacts/plug-ins + - name : install meson + run : pip install meson - - name: Upload Artifacts - uses: actions/upload-artifact@v4 + - name: Restore Devkit Cache + id: cache-devkit + uses: actions/cache/restore@v4 with: - name: mac-${{matrix.maya}} - path: | - artifacts/plug-ins/TwistSpline.bundle - - maya-linux: - runs-on: ubuntu-latest + path: ${{ runner.temp }}/devkit/devkit.${{ matrix.zip }} + key: ${{ matrix.os }}-Maya${{ matrix.maya }}-Update${{ matrix.update }} - strategy: - fail-fast: false - - matrix: - include: - - maya: "2022" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2022/Autodesk_Maya_2022_5_Update_DEVKIT_Linux.tgz" - - maya: "2023" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2023/Autodesk_Maya_2023_3_Update_DEVKIT_Linux.tgz" - - maya: "2024" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2024/Autodesk_Maya_2024_2_Update_DEVKIT_Linux.tgz" - - maya: "2025" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2025/Autodesk_Maya_2025_1_Update_DEVKIT_Linux.tgz" + - name: Download Devkit + if: ${{ steps.cache-devkit.outputs.cache-hit != 'true' }} + run: | + mkdir ${{ runner.temp }}/devkit + curl -o ${{ runner.temp }}/devkit/devkit.${{ matrix.zip }} ${{ env.DEVKIT_URL }} - steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Save Devkit Cache + if: ${{ steps.cache-devkit.outputs.cache-hit != 'true' }} + id: cache-devkit-save + uses: actions/cache/save@v4 with: - submodules: true + path: ${{ runner.temp }}/devkit/devkit.${{ matrix.zip }} + key: ${{ matrix.os }}-Maya${{ matrix.maya }}-Update${{ matrix.update }} - - name: Install OpenGL libraries + - name: Install OpenGL libraries Linux + if: ${{ matrix.os_name == 'linux' }} run: | sudo apt install libglu1-mesa-dev - - name: Install devkit + - name : Unpack Devkit Windows + if: ${{ matrix.os_name == 'windows' }} + run: Expand-Archive -LiteralPath "${{ runner.temp }}/devkit/devkit.zip" -DestinationPath "${{ runner.temp }}/devkit" + - name : Unpack Devkit Mac + if: ${{ matrix.os_name == 'mac' }} + run: hdiutil attach ${{ runner.temp }}/devkit/devkit.dmg -mountroot ${{ runner.temp }}/devkit + - name : Unpack Devkit Linux + if: ${{ matrix.os_name == 'linux' }} + run: tar xvzf ${{ runner.temp }}/devkit/devkit.tgz -C ${{ runner.temp }}/devkit + + - name: Setup + run: > + meson + setup + -Dmaya:maya_version="${{ matrix.maya }}" + -Dmaya:maya_devkit_base="${{ runner.temp }}/devkit/devkitBase" + --buildtype debugoptimized + --vsenv + --backend ninja + ${{ github.workspace }}/build + + - name: Compile run: | - curl -o devkit.tgz ${{matrix.devkit}} - tar xvzf devkit.tgz - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAYA_VERSION="${{matrix.maya}}" -DMAYA_DEVKIT_BASE="$PWD/devkitBase" + meson compile -C ${{ github.workspace }}/build - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Repath Artifacts + - name: Package run: | - mkdir -p artifacts/plug-ins - cp "./build/TwistSpline.so" "artifacts/plug-ins" + mkdir artifacts + mkdir artifacts/plug-ins + cp ${{ github.workspace }}/build/TwistSpline.${{ matrix.ext }} artifacts/plug-ins - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: linux-${{matrix.maya}} + name: ${{ matrix.os_name }}-${{ matrix.maya }} path: | - artifacts/plug-ins/TwistSpline.so + artifacts/plug-ins/TwistSpline.${{ matrix.ext }} + -# # Shipping # # _________ @@ -233,7 +161,7 @@ jobs: # upload_release: name: Upload release - needs: [maya-win, maya-linux, maya-macos-x86_64, maya-macos-arm64] + needs: compile_plugin runs-on: ubuntu-latest steps: diff --git a/meson.build b/meson.build index d03e85e..852de80 100644 --- a/meson.build +++ b/meson.build @@ -23,5 +23,6 @@ outlib = shared_library( install_dir : meson.global_source_root() / 'output_Maya' + maya_version, include_directories : harm_inc, dependencies : maya_dep, + name_prefix : '', name_suffix : maya_name_suffix, ) diff --git a/subprojects/maya/meson.build b/subprojects/maya/meson.build index f1a2c0c..4515228 100644 --- a/subprojects/maya/meson.build +++ b/subprojects/maya/meson.build @@ -1,12 +1,12 @@ project('maya', 'cpp') maya_version = get_option('maya_version') +maya_devkit_base = get_option('maya_devkit_base') os_name = build_machine.system() maya_inc_suffix = 'include' maya_lib_suffix = 'lib' -maya_bin_suffix = 'bin' maya_compile_args = ['-DREQUIRE_IOSTREAM', '-D_BOOL'] maya_link_args = [] @@ -18,14 +18,26 @@ if os_name == 'windows' maya_link_args = ['/export:initializePlugin', '/export:uninitializePlugin'] elif os_name == 'darwin' maya_install_base = '/Applications/Autodesk' - maya_inc_suffix = 'devkit/include' - maya_lib_suffix = 'Maya.app/Contents/MacOS' - maya_bin_suffix = 'Maya.app/Contents/bin' maya_plugin_ext = 'bundle' + if maya_devkit_base == '' + maya_lib_suffix = 'Maya.app/Contents/MacOS' + maya_bin_suffix = 'Maya.app/Contents/bin' + endif maya_compile_args += ['-DOSMac_'] if meson.get_compiler('cpp').get_id() == 'clang' - maya_compile_args += ['-std', 'c++0x', '-stdlib', 'libstdc++'] + maya_compile_args += ['--std', 'c++17', '--stdlib', 'libc++'] + maya_compile_args += ['-arch', 'x86_64'] + maya_link_args += ['-arch', 'x86_64'] + if maya_version.version_compare('>=2024') + # build both the arm and x86 plugins when compiling for mac + maya_compile_args += ['-arch', 'arm64'] + maya_link_args += ['-arch', 'arm64'] + else + endif endif + + # ignore this warning that comes from maya's headers + maya_compile_args += ['-Wno-inconsistent-missing-override'] elif os_name == 'linux' maya_install_base = '/usr/autodesk' maya_plugin_ext = 'so' @@ -33,16 +45,20 @@ elif os_name == 'linux' else error('Incompatible operating system') endif - maya_install_path = maya_install_base / ('Maya' + maya_version) -maya_bin_dir = maya_install_path / maya_bin_suffix -maya_bin = find_program('maya', dirs : maya_bin_dir) +if maya_devkit_base != '' + message('Using Maya Devkit:', maya_devkit_base) + maya_install_path = maya_devkit_base +endif maya_inc_dir = maya_install_path / maya_inc_suffix +message('Searching Maya Include directory:', maya_inc_dir) maya_inc = include_directories(maya_inc_dir) maya_lib_dir = maya_install_path / maya_lib_suffix +message('Searching Maya lib directory:', maya_lib_dir) + cmplr = meson.get_compiler('cpp') maya_libs = [ cmplr.find_library('Foundation', dirs : maya_lib_dir), diff --git a/subprojects/maya/meson.options b/subprojects/maya/meson.options index c23363e..e2bdf0c 100644 --- a/subprojects/maya/meson.options +++ b/subprojects/maya/meson.options @@ -5,3 +5,12 @@ option( description : 'The version of Maya to compile for', yield : true, ) + +option( + 'maya_devkit_base', + type : 'string', + description : 'Optional path to the maya devkit', + yield : true, +) + +