Skip to content

Commit 8fe172d

Browse files
committed
Switch to meson build
1 parent ae6ac83 commit 8fe172d

12 files changed

+308
-171
lines changed

.github/workflows/main.yml

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
name: build
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
tags:
8+
- v*
9+
pull_request:
10+
branches: [ master ]
11+
12+
# matrix:
13+
# maya: [2024]
14+
# os: [macos-latest, ubuntu-latest, windows-latest]
15+
# include:
16+
# - maya: 2024
17+
# update: 2
18+
19+
jobs:
20+
compile_plugin:
21+
strategy:
22+
matrix:
23+
maya: [2022, 2023, 2024, 2025]
24+
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
25+
include:
26+
# Add the maya update versions here
27+
- maya: 2022
28+
update: 5
29+
- maya: 2023
30+
update: 3
31+
- maya: 2024
32+
update: 2
33+
- maya: 2025
34+
update: 1
35+
36+
# cross-compiling is annoying so just fall back to macos-13
37+
exclude:
38+
- os: macos-latest
39+
maya: 2022
40+
- os: macos-latest
41+
maya: 2023
42+
- os: macos-13
43+
maya: 2024
44+
- os: macos-13
45+
maya: 2025
46+
47+
fail-fast: false
48+
49+
runs-on: ${{ matrix.os }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
- run: git fetch --force --tags origin
53+
54+
- name: Get Maya Devkit
55+
id: get-devkit
56+
uses: blurstudio/mayaModuleActions/getMayaDevkit@v1
57+
with:
58+
maya: ${{ matrix.maya }}
59+
update: ${{ matrix.update }}
60+
61+
- name: Build
62+
uses: blurstudio/mayaModuleActions/mesonBuild@v1
63+
with:
64+
setup-args: >
65+
-Dmaya:maya_version=${{ matrix.maya }}
66+
-Dmaya:maya_devkit_base=${{ steps.get-devkit.outputs.devkit-path }}
67+
--buildtype release
68+
--backend ninja
69+
70+
- name: Upload Artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: ${{ runner.os }}-${{ matrix.maya }}-plugin
74+
path: build/*.${{ steps.get-devkit.outputs.plugin-ext }}
75+
if-no-files-found: error
76+
77+
upload_release:
78+
name: Upload release
79+
needs: compile_plugin
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v4
83+
- run: git fetch --force --tags origin
84+
- name: 'Get Previous tag'
85+
id: previoustag
86+
uses: "WyriHaximus/github-action-get-previous-tag@v1"
87+
with:
88+
fallback: 0.0.1
89+
90+
- name: Package
91+
uses: blurstudio/mayaModuleActions/packageMayaModule@v1
92+
with:
93+
module-name: harbieLocator
94+
folder-list: scripts icons
95+
version: ${{ steps.previoustag.outputs.tag }}
96+
97+
- name: Upload distribution
98+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
99+
uses: softprops/action-gh-release@v1
100+
with:
101+
token: "${{ secrets.GITHUB_TOKEN }}"
102+
prerelease: false
103+
files: |
104+
*.zip

CMakeLists.txt

-23
This file was deleted.

cmake/FindMaya.cmake

-127
This file was deleted.

mayaConfigure.bat

-19
This file was deleted.

meson.build

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
project('harbieLocator', 'cpp', default_options: ['cpp_std=c++20'])
2+
3+
maya_dep = dependency('maya')
4+
maya_name_suffix = maya_dep.get_variable('name_suffix')
5+
maya_version = maya_dep.get_variable('maya_version')
6+
7+
source_files = [
8+
'src/PluginMain.cpp',
9+
'src/harbieCurve.cpp',
10+
'src/harbieLocator.cpp',
11+
]
12+
13+
# If a user-built version file exists, then just use that
14+
# Otherwise grab the latest tag from git
15+
fs = import('fs')
16+
if fs.is_file('src/version.h')
17+
message('Using existing version.h')
18+
else
19+
git = find_program('git', native: true, required: true)
20+
version_h = vcs_tag(
21+
command: [git, 'describe', '--tags', '--match', 'v[0-9]*', '--dirty=+'],
22+
fallback: 'v0.0.1',
23+
input: 'src/version.h.in',
24+
output: 'version.h',
25+
)
26+
source_files = source_files + version_h
27+
endif
28+
29+
gl_dep = dependency('gl')
30+
31+
outlib = shared_library(
32+
meson.project_name(),
33+
source_files,
34+
install: true,
35+
install_dir : meson.global_source_root() / 'output_Maya' + maya_version,
36+
include_directories : include_directories(['src']),
37+
dependencies : [maya_dep, gl_dep],
38+
name_prefix : '',
39+
name_suffix : maya_name_suffix,
40+
)

quick_compile.bat

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
setlocal
2+
3+
SET MAYA_VERSION=2024
4+
REM "vs" "ninja"
5+
REM use VS for the debugger, otherwise use NINJA
6+
REM Until I figure out how to debug using nvim
7+
SET BACKEND=vs
8+
REM "debug" "debugoptimized" "release"
9+
SET BUILDTYPE=debug
10+
SET BUILDDIR=mayabuild_%BUILDTYPE%_%MAYA_VERSION%_%BACKEND%
11+
12+
if not exist %BUILDDIR%\ (
13+
meson setup %BUILDDIR% -Dmaya:maya_version=%MAYA_VERSION% --buildtype %BUILDTYPE% --vsenv --backend %BACKEND%
14+
)
15+
16+
if exist %BUILDDIR%\ (
17+
meson compile -C %BUILDDIR%
18+
meson install -C %BUILDDIR%
19+
)
20+
21+
pause

src/PluginMain.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "harbieCurve.h"
44
#include "harbieLocator.h"
5+
#include "version.h"
56

67
//---------------------------------------------------------------------------
78
//---------------------------------------------------------------------------
@@ -11,7 +12,7 @@
1112

1213
MStatus initializePlugin(MObject obj) {
1314
MStatus status;
14-
MFnPlugin plugin(obj, PLUGIN_COMPANY, "3.0", "Any");
15+
MFnPlugin plugin(obj, PLUGIN_COMPANY, VERSION_STRING, "Any");
1516
// now the curve building --------------------------
1617
status = plugin.registerNode("makeHarbieCurve", harbieCurve::id,
1718
harbieCurve::creator, harbieCurve::initialize);

src/harbieLocator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class harbieLocator : public MPxLocatorNode {
8484
virtual ~harbieLocator();
8585

8686
virtual MStatus compute(const MPlug& plug, MDataBlock& data);
87-
virtual void harbieLocator::postConstructor();
87+
virtual void postConstructor();
8888
virtual void draw(M3dView& view, const MDagPath& path,
8989
M3dView::DisplayStyle style,
9090
M3dView::DisplayStatus status);

src/version.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
#define VERSION_STRING "@VCS_TAG@"
3+

0 commit comments

Comments
 (0)