Skip to content

Commit

Permalink
Update to the latest maya subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Sep 12, 2024
1 parent be1acb1 commit 05b88a3
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: git fetch --tags origin
- run: git fetch --force --tags origin

- name: Get Maya Devkit
id: get-devkit
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --tags origin
- run: git fetch --force --tags origin
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
Expand Down
58 changes: 49 additions & 9 deletions subprojects/maya/meson.build
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
project('maya', 'cpp')

maya_version = get_option('maya_version')
maya_devkit_base = get_option('maya_devkit_base')
maya_link_qt = get_option('maya_link_qt')
maya_qt_extra_includes = get_option('maya_qt_extra_includes')

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 = []
Expand All @@ -18,31 +20,48 @@ 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'
maya_compile_args += ['-DLINUX', '-fPIC']
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)

# Get all the maya libraries
cmplr = meson.get_compiler('cpp')
maya_libs = [
cmplr.find_library('Foundation', dirs : maya_lib_dir),
Expand All @@ -54,6 +73,28 @@ maya_libs = [
cmplr.find_library('clew', dirs : maya_lib_dir),
]

# Link to maya's qt libs if required
# This doesn't do MOC stuff ... yet
if maya_link_qt
fs = import('fs')
if not fs.is_dir(maya_inc_dir / 'QtCore')
error(
'Could not find Maya QT headers with `maya_link_qt` defined\n',
'You probably need to unzip `include/qt_*-include.zip`\n',
'Checking in folder: ', maya_inc_dir,
)
endif

maya_qt_lib_names = ['Qt5Core', 'Qt5Gui', 'Qt5Widgets']
if maya_qt_extra_includes != ''
maya_qt_lib_names += maya_qt_extra_includes.split(';')
endif

foreach lib_name : maya_qt_lib_names
maya_libs += cmplr.find_library(lib_name, dirs : maya_lib_dir)
endforeach
endif

maya_dep = declare_dependency(
dependencies : maya_libs,
include_directories : maya_inc,
Expand All @@ -64,4 +105,3 @@ maya_dep = declare_dependency(
)

meson.override_dependency('maya', maya_dep)

23 changes: 23 additions & 0 deletions subprojects/maya/meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,26 @@ 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,
)

option(
'maya_link_qt',
type : 'boolean',
description : 'Whether to link to the Qt libraries that maya provides in their devkit/install',
value: false,
yield : true,
)

option(
'maya_qt_extra_includes',
type : 'string',
description : 'Any qt headers other than QtCore, QtGui, or QtWidgets that you need to include, separated by semicolons',
value: '',
yield : true,
)

0 comments on commit 05b88a3

Please sign in to comment.