Skip to content

Commit

Permalink
cleanup cmakey stuff, and add the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Jan 2, 2023
1 parent 8bac7fa commit e4f3192
Show file tree
Hide file tree
Showing 6 changed files with 431 additions and 223 deletions.
236 changes: 236 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
name: build

on:
push:
branches: [ master ]
tags:
- v*
pull_request:
branches: [ master ]

env:
BUILD_TYPE: Release

jobs:
#
# Windows
#
# __
# |\__/ \
# | |
# | __ |
# \__/ \|
#
#
maya-win:
runs-on: windows-2019

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: "2018"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2018/Autodesk_Maya_2018_7_Update_DEVKIT_Windows.zip"
#- maya: "2019"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2019/Autodesk_Maya_2019_3_Update_DEVKIT_Windows.zip"
- maya: "2020"
devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2020/Autodesk_Maya_2020_4_Update_DEVKIT_Windows.zip"
#- maya: "2022"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2022/Autodesk_Maya_2022_3_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_DEVKIT_Windows.zip"

steps:
- name: Checkout code
uses: actions/checkout@v3
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@v3
with:
name: windows-${{matrix.maya}}
path: |
artifacts/plug-ins/TwistSpline.mll
maya-macos:
runs-on: macos-10.15

strategy:
fail-fast: false

matrix:
include:
#- maya: "2018"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2018/Autodesk_Maya_2018_7_Update_DEVKIT_Mac.dmg"
#- maya: "2019"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2019/Autodesk_Maya_2019_3_Update_DEVKIT_Mac.dmg"
- maya: "2020"
devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2020/Autodesk_Maya_2020_4_Update_DEVKIT_Mac.dmg"
#- maya: "2022"
# devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2022/Autodesk_Maya_2022_3_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_DEVKIT_Mac.dmg"

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Install devkit
run: |
curl -o devkit.dmg ${{matrix.devkit}}
7z x devkit.dmg
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '10.3'

- name: Configure CMake
run: |
cmake -G Xcode -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 -p artifacts/plug-ins
cp ./build/${{env.BUILD_TYPE}}/TwistSpline.bundle artifacts/plug-ins
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: mac-${{matrix.maya}}
path: |
artifacts/plug-ins/TwistSpline.bundle
maya-linux:
runs-on: ubuntu-latest
container: scottenglert/maya-build:${{matrix.maya}}

strategy:
fail-fast: false

matrix:
include:
# The 2018 and 2019 containers use cmake 3.9, and I'm using functions introduced in 3.16
#- maya: "2018.7"
# year: "2018"
#- maya: "2019.3"
# year: "2019"
- maya: "2020.4"
year: "2020"
#- maya: "2022.3"
# year: "2022"
#- maya: "2023"
# year: "2023"

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DMAYA_VERSION=${{matrix.maya}} -DMAYA_DEVKIT_BASE="/usr/autodesk/devkitBase" ..
- name: Build
run: cmake --build ./build --config ${{env.BUILD_TYPE}}

- name: Repath Artifacts
run: |
mkdir -p artifacts/plug-ins
cp ./build/TwistSpline.so artifacts/plug-ins
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: linux-${{matrix.year}}
path: |
artifacts/plug-ins/TwistSpline.so
#
# Shipping
#
# _________
# |\ _ _ _ _\
# | \________\
# | | |
# | | |
# \|________|
#
#
upload_release:
name: Upload release
needs: [maya-win, maya-linux, maya-macos]
runs-on: ubuntu-latest

# Only run on e.g. v0.1.0
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3

# Omitting name: means "download all artifacts"
# Destination directory structure:
# ~/modules
# /TwistSpline
# /<os_name>-<maya_major_version>
# /plug-ins
# TwistSpline.mll
# /scripts
# *.py
# /TwistSpline.mod

with:
path: modules/TwistSpline

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Create distribution
run: |
cp ./TwistSpline.mod modules/
mkdir -p modules/TwistSpline/scripts
cp -r ./scripts/TwistSpline modules/TwistSpline/scripts
zip -r TwistSpline-${{env.RELEASE_VERSION}}.zip modules/
- name: Upload distribution
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
files: |
TwistSpline-*.zip
51 changes: 27 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.9)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(TwistSpline)

set(CMAKE_CXX_STANDARD 14)
cmake_policy(SET CMP0072 NEW)

set(MAYA_VERSION 2020 CACHE STRING "Maya version")

find_package(Maya REQUIRED)
find_package(OpenGL REQUIRED)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/../output/Maya${MAYA_VERSION})

set(SOURCE_FILES
"mpkdtree.h"

"twistSpline.h"
"twistSpline_maya.h"
"twistSplineData.h"
"twistSplineNode.h"
"twistSplineUtils.h"
"riderConstraint.h"
"decomposeRotation.h"
"twistTangentNode.h"

"pluginMain.cpp"
"twistSplineData.cpp"
"twistSplineNode.cpp"
"riderConstraint.cpp"
"twistTangentNode.cpp"
"src/twistSpline.h"
"src/twistSpline_maya.h"
"src/twistSplineData.h"
"src/twistSplineNode.h"
"src/twistSplineUtils.h"
"src/riderConstraint.h"
"src/decomposeRotation.h"
"src/twistTangentNode.h"

"src/pluginMain.cpp"
"src/twistSplineData.cpp"
"src/twistSplineNode.cpp"
"src/riderConstraint.cpp"
"src/twistTangentNode.cpp"
)

include_directories(${MAYA_INCLUDE_DIR})
link_directories(${MAYA_LIBRARY_DIR})
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${MAYA_LIBRARIES} ${OPENGL_LIBRARY})

target_include_directories(${PROJECT_NAME}
PRIVATE Maya::Maya
PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
target_link_libraries(${PROJECT_NAME} PRIVATE Maya::Maya OpenGL::GL)
MAYA_PLUGIN(${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} ${MAYA_TARGET_TYPE} DESTINATION plug-ins)

Loading

0 comments on commit e4f3192

Please sign in to comment.