From 05b88a372f9a7c102cbe6a69ca231583049c6e1a Mon Sep 17 00:00:00 2001 From: Tyler Fox Date: Thu, 12 Sep 2024 16:27:37 -0700 Subject: [PATCH] Update to the latest maya subproject --- .github/workflows/main.yml | 4 +-- subprojects/maya/meson.build | 58 ++++++++++++++++++++++++++++------ subprojects/maya/meson.options | 23 ++++++++++++++ 3 files changed, 74 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b1f5a7d..53b42a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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" diff --git a/subprojects/maya/meson.build b/subprojects/maya/meson.build index f1a2c0c..43caa6f 100644 --- a/subprojects/maya/meson.build +++ b/subprojects/maya/meson.build @@ -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 = [] @@ -18,14 +20,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 +47,21 @@ 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) + +# Get all the maya libraries cmplr = meson.get_compiler('cpp') maya_libs = [ cmplr.find_library('Foundation', dirs : maya_lib_dir), @@ -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, @@ -64,4 +105,3 @@ maya_dep = declare_dependency( ) meson.override_dependency('maya', maya_dep) - diff --git a/subprojects/maya/meson.options b/subprojects/maya/meson.options index c23363e..c28e358 100644 --- a/subprojects/maya/meson.options +++ b/subprojects/maya/meson.options @@ -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, +)