Skip to content

Commit

Permalink
Switch to meson build
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Sep 16, 2024
1 parent ae6ac83 commit 19dab3d
Show file tree
Hide file tree
Showing 12 changed files with 308 additions and 171 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

name: build

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

# matrix:
# maya: [2024]
# os: [macos-latest, ubuntu-latest, windows-latest]
# include:
# - maya: 2024
# update: 2

jobs:
compile_plugin:
strategy:
matrix:
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

# 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

fail-fast: false

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: git fetch --force --tags origin

- name: Get Maya Devkit
id: get-devkit
uses: blurstudio/mayaModuleActions/getMayaDevkit@v1
with:
maya: ${{ matrix.maya }}
update: ${{ matrix.update }}

- name: Build
uses: blurstudio/mayaModuleActions/mesonBuild@v1
with:
setup-args: >
-Dmaya:maya_version=${{ matrix.maya }}
-Dmaya:maya_devkit_base=${{ steps.get-devkit.outputs.devkit-path }}
--buildtype release
--backend ninja
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ matrix.maya }}-plugin
path: build/*.${{ steps.get-devkit.outputs.plugin-ext }}
if-no-files-found: error

upload_release:
name: Upload release
needs: compile_plugin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --force --tags origin
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1

- name: Package
uses: blurstudio/mayaModuleActions/packageMayaModule@v1
with:
module-name: harbieLocator
folder-list: scripts icons
version: ${{ steps.previoustag.outputs.tag }}

- name: Upload distribution
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
*.zip
23 changes: 0 additions & 23 deletions CMakeLists.txt

This file was deleted.

127 changes: 0 additions & 127 deletions cmake/FindMaya.cmake

This file was deleted.

19 changes: 0 additions & 19 deletions mayaConfigure.bat

This file was deleted.

40 changes: 40 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
project('harbieLocator', 'cpp', default_options: ['cpp_std=c++20'])

maya_dep = dependency('maya')
maya_name_suffix = maya_dep.get_variable('name_suffix')
maya_version = maya_dep.get_variable('maya_version')

source_files = [
'src/PluginMain.cpp',
'src/harbieCurve.cpp',
'src/harbieLocator.cpp',
]

# If a user-built version file exists, then just use that
# Otherwise grab the latest tag from git
fs = import('fs')
if fs.is_file('src/version.h')
message('Using existing version.h')
else
git = find_program('git', native: true, required: true)
version_h = vcs_tag(
command: [git, 'describe', '--tags', '--match', 'v[0-9]*', '--dirty=+'],
fallback: 'v0.0.1',
input: 'src/version.h.in',
output: 'version.h',
)
source_files = source_files + version_h
endif

gl_dep = dependency('gl')

outlib = shared_library(
meson.project_name(),
source_files,
install: true,
install_dir : meson.global_source_root() / 'output_Maya' + maya_version,
include_directories : include_directories(['src']),
dependencies : [maya_dep, gl_dep],
name_prefix : '',
name_suffix : maya_name_suffix,
)
21 changes: 21 additions & 0 deletions quick_compile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
setlocal

SET MAYA_VERSION=2024
REM "vs" "ninja"
REM use VS for the debugger, otherwise use NINJA
REM Until I figure out how to debug using nvim
SET BACKEND=vs
REM "debug" "debugoptimized" "release"
SET BUILDTYPE=debug
SET BUILDDIR=mayabuild_%BUILDTYPE%_%MAYA_VERSION%_%BACKEND%

if not exist %BUILDDIR%\ (
meson setup %BUILDDIR% -Dmaya:maya_version=%MAYA_VERSION% --buildtype %BUILDTYPE% --vsenv --backend %BACKEND%
)

if exist %BUILDDIR%\ (
meson compile -C %BUILDDIR%
meson install -C %BUILDDIR%
)

pause
3 changes: 2 additions & 1 deletion src/PluginMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "harbieCurve.h"
#include "harbieLocator.h"
#include "version.h"

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
Expand All @@ -11,7 +12,7 @@

MStatus initializePlugin(MObject obj) {
MStatus status;
MFnPlugin plugin(obj, PLUGIN_COMPANY, "3.0", "Any");
MFnPlugin plugin(obj, PLUGIN_COMPANY, VERSION_STRING, "Any");
// now the curve building --------------------------
status = plugin.registerNode("makeHarbieCurve", harbieCurve::id,
harbieCurve::creator, harbieCurve::initialize);
Expand Down
2 changes: 1 addition & 1 deletion src/harbieLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class harbieLocator : public MPxLocatorNode {
virtual ~harbieLocator();

virtual MStatus compute(const MPlug& plug, MDataBlock& data);
virtual void harbieLocator::postConstructor();
virtual void postConstructor();
virtual void draw(M3dView& view, const MDagPath& path,
M3dView::DisplayStyle style,
M3dView::DisplayStatus status);
Expand Down
3 changes: 3 additions & 0 deletions src/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once
#define VERSION_STRING "@VCS_TAG@"

Loading

0 comments on commit 19dab3d

Please sign in to comment.