diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1481282..a66f1a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,3 +1,4 @@ + name: build on: @@ -8,226 +9,96 @@ on: pull_request: branches: [ master ] -env: - BUILD_TYPE: Release +# matrix: +# maya: [2024] +# os: [macos-latest, ubuntu-latest, windows-latest] +# include: +# - maya: 2024 +# update: 2 jobs: - # - # Windows - # - # __ - # |\__/ \ - # | | - # | __ | - # \__/ \| - # - # - maya-win: - runs-on: windows-2019 - + compile_plugin: 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}}/BlurRelax.mll" -Destination "artifacts/plug-ins" + 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 - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: windows-${{matrix.maya}} - path: | - artifacts/plug-ins/BlurRelax.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" - + runs-on: ${{ matrix.os }} 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: actions/checkout@v4 + - run: git fetch --force --tags origin - - uses: maxim-lobanov/setup-xcode@v1 + - name: Get Maya Devkit + id: get-devkit + uses: blurstudio/mayaModuleActions/getMayaDevkit@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" + maya: ${{ matrix.maya }} + update: ${{ matrix.update }} - 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}}/BlurRelax.bundle artifacts/plug-ins - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: mac-${{matrix.maya}} - path: | - artifacts/plug-ins/BlurRelax.bundle - - maya-linux: - runs-on: ubuntu-latest - container: scottenglert/maya-build:${{matrix.maya}} - - strategy: - fail-fast: false - - matrix: - include: - - 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 + uses: blurstudio/mayaModuleActions/mesonBuild@v1 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/BlurRelax.so artifacts/plug-ins + 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@v3 + uses: actions/upload-artifact@v4 with: - name: linux-${{matrix.year}} - path: | - artifacts/plug-ins/BlurRelax.so + name: ${{ runner.os }}-${{ matrix.maya }}-plugin + path: build/*.${{ steps.get-devkit.outputs.plugin-ext }} + if-no-files-found: error -# -# Shipping -# -# _________ -# |\ _ _ _ _\ -# | \________\ -# | | | -# | | | -# \|________| -# -# upload_release: name: Upload release - needs: [maya-win, maya-linux, maya-macos] + needs: compile_plugin 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 - # /BlurRelax - # /- - # /plug-ins - # BlurRelax.mll - # /BlurRelax.mod - + - 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: - path: modules/BlurRelax - - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + fallback: 0.0.1 - - name: Create distribution - run: | - cp ./BlurRelax.mod modules/ - mkdir -p modules/BlurRelax/scripts - cp -r ./scripts modules/BlurRelax - zip -r BlurRelax-${{env.RELEASE_VERSION}}.zip modules/ + - name: Package + uses: blurstudio/mayaModuleActions/packageMayaModule@v1 + with: + module-name: BlurRelax + folder-list: scripts icons + version: ${{ steps.previoustag.outputs.tag }} - name: Upload distribution - uses: "marvinpinto/action-automatic-releases@latest" + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + uses: softprops/action-gh-release@v1 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" + token: "${{ secrets.GITHUB_TOKEN }}" prerelease: false files: | - BlurRelax-*.zip + *.zip diff --git a/BlurRelax.mod b/BlurRelax.mod deleted file mode 100644 index 58a858c..0000000 --- a/BlurRelax.mod +++ /dev/null @@ -1,44 +0,0 @@ -+ PLATFORM:win64 MAYAVERSION:2018 BlurRelax 1.0.0 BlurRelax -plug-ins: windows-2018/plug-ins - -+ PLATFORM:linux MAYAVERSION:2018 BlurRelax 1.0.0 BlurRelax -plug-ins: linux-2018/plug-ins - -+ PLATFORM:mac MAYAVERSION:2018 BlurRelax 1.0.0 BlurRelax -plug-ins: mac-2018/plug-ins - -+ PLATFORM:win64 MAYAVERSION:2019 BlurRelax 1.0.0 BlurRelax -plug-ins: windows-2019/plug-ins - -+ PLATFORM:linux MAYAVERSION:2019 BlurRelax 1.0.0 BlurRelax -plug-ins: linux-2019/plug-ins - -+ PLATFORM:mac MAYAVERSION:2019 BlurRelax 1.0.0 BlurRelax -plug-ins: mac-2019/plug-ins - -+ PLATFORM:win64 MAYAVERSION:2020 BlurRelax 1.0.0 BlurRelax -plug-ins: windows-2020/plug-ins - -+ PLATFORM:linux MAYAVERSION:2020 BlurRelax 1.0.0 BlurRelax -plug-ins: linux-2020/plug-ins - -+ PLATFORM:mac MAYAVERSION:2020 BlurRelax 1.0.0 BlurRelax -plug-ins: mac-2020/plug-ins - -+ PLATFORM:win64 MAYAVERSION:2022 BlurRelax 1.0.0 BlurRelax -plug-ins: windows-2022/plug-ins - -+ PLATFORM:linux MAYAVERSION:2022 BlurRelax 1.0.0 BlurRelax -plug-ins: linux-2022/plug-ins - -+ PLATFORM:mac MAYAVERSION:2022 BlurRelax 1.0.0 BlurRelax -plug-ins: mac-2022/plug-ins - -+ PLATFORM:win64 MAYAVERSION:2023 BlurRelax 1.0.0 BlurRelax -plug-ins: windows-2023/plug-ins - -+ PLATFORM:linux MAYAVERSION:2023 BlurRelax 1.0.0 BlurRelax -plug-ins: linux-2023/plug-ins - -+ PLATFORM:mac MAYAVERSION:2023 BlurRelax 1.0.0 BlurRelax -plug-ins: mac-2023/plug-ins diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 9d5311c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -project( - "BlurRelax" - VERSION 1.0 - DESCRIPTION "A quick smooth with border conditions" - LANGUAGES CXX -) - -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -set(CMAKE_CXX_STANDARD 14) - -# (defined in FindMaya.cmake, copied here for reference) -# set(MAYA_INSTALL_BASE_PATH "" CACHE STRING -# "Root path containing your maya installations, e.g. /usr/autodesk or /Applications/Autodesk/" -# ) -set(MAYA_VERSION 2020 CACHE STRING "Maya version") - -set(MAYA_FILES - "src/blurRelaxNode.h" - "src/fastMayaRelax.h" - "src/fastRelax.h" - "src/blurRelaxNode.cpp" - "src/fastMayaRelax.cpp" - "src/fastRelax.cpp" - "src/pluginRegister.cpp" -) - -find_package(Maya REQUIRED) -add_library(${PROJECT_NAME} SHARED ${MAYA_FILES}) -target_link_libraries(${PROJECT_NAME} PRIVATE Maya::Maya) -target_include_directories(${PROJECT_NAME} - PRIVATE Maya::Maya - PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" -) -MAYA_PLUGIN(${PROJECT_NAME}) diff --git a/cmake/FindMaya.cmake b/cmake/FindMaya.cmake deleted file mode 100644 index 1871ea6..0000000 --- a/cmake/FindMaya.cmake +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright 2017 Chad Vernon -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -# associated documentation files (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, publish, distribute, -# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or -# substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#.rst: -# FindMaya -# -------- -# -# Find Maya headers and libraries. -# -# Imported targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following :prop_tgt:`IMPORTED` target: -# -# ``Maya::Maya`` -# The Maya libraries, if found. -# -# Result variables -# ^^^^^^^^^^^^^^^^ -# -# This module will set the following variables in your project: -# -# ``Maya_FOUND`` -# Defined if a Maya installation has been detected -# ``MAYA_INCLUDE_DIR`` -# Where to find the headers (maya/MFn.h) -# ``MAYA_LIBRARIES`` -# All the Maya libraries. -# - -# Set a default Maya version if not specified -if(NOT DEFINED MAYA_VERSION) - set(MAYA_VERSION 2017 CACHE STRING "Maya version") -endif() - -# OS Specific environment setup -set(MAYA_COMPILE_DEFINITIONS "REQUIRE_IOSTREAM;_BOOL") -set(MAYA_INSTALL_BASE_SUFFIX "") -set(MAYA_TARGET_TYPE LIBRARY) -if(WIN32) - # Windows - set(MAYA_INSTALL_BASE_DEFAULT "C:/Program Files/Autodesk") - set(MAYA_COMPILE_DEFINITIONS "${MAYA_COMPILE_DEFINITIONS};NT_PLUGIN") - set(MAYA_PLUGIN_EXTENSION ".mll") - set(MAYA_TARGET_TYPE RUNTIME) -elseif(APPLE) - # Apple - set(MAYA_INSTALL_BASE_DEFAULT /Applications/Autodesk) - set(MAYA_COMPILE_DEFINITIONS "${MAYA_COMPILE_DEFINITIONS};OSMac_") - set(MAYA_PLUGIN_EXTENSION ".bundle") -else() - # Linux - set(MAYA_COMPILE_DEFINITIONS "${MAYA_COMPILE_DEFINITIONS};LINUX") - set(MAYA_INSTALL_BASE_DEFAULT /usr/autodesk) - - if(MAYA_VERSION LESS 2016) - # Pre Maya 2016 on Linux - set(MAYA_INSTALL_BASE_SUFFIX -x64) - endif() - set(MAYA_PLUGIN_EXTENSION ".so") -endif() - -set(MAYA_INSTALL_BASE_PATH ${MAYA_INSTALL_BASE_DEFAULT} CACHE STRING - "Root path containing your maya installations, e.g. /usr/autodesk or /Applications/Autodesk/") - -if(NOT DEFINED MAYA_DEVKIT_BASE) - set(MAYA_LOCATION ${MAYA_INSTALL_BASE_PATH}/maya${MAYA_VERSION}${MAYA_INSTALL_BASE_SUFFIX}) -else() - set(MAYA_LOCATION ${MAYA_DEVKIT_BASE}) -endif() - -#set(CMAKE_FIND_DEBUG_MODE TRUE) -# Maya include directory -find_path(MAYA_INCLUDE_DIR maya/MFn.h - PATHS - ${MAYA_LOCATION} - $ENV{MAYA_LOCATION} - PATH_SUFFIXES - "include/" - "devkit/include/" -) - -find_library(MAYA_LIBRARY - NAMES - OpenMaya - PATHS - ${MAYA_LOCATION} - $ENV{MAYA_LOCATION} - PATH_SUFFIXES - "lib/" - "Maya.app/Contents/MacOS/" - NO_DEFAULT_PATH -) -#set(CMAKE_FIND_DEBUG_MODE FALSE) - -set(MAYA_LIBRARIES "${MAYA_LIBRARY}") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Maya - REQUIRED_VARS MAYA_INCLUDE_DIR MAYA_LIBRARY) -mark_as_advanced(MAYA_INCLUDE_DIR MAYA_LIBRARY) - -if (NOT TARGET Maya::Maya) - add_library(Maya::Maya UNKNOWN IMPORTED) - set_target_properties(Maya::Maya PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "${MAYA_COMPILE_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${MAYA_INCLUDE_DIR}" - IMPORTED_LOCATION "${MAYA_LIBRARY}") - - if (APPLE AND ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND MAYA_VERSION LESS 2017) - # Clang and Maya 2016 and older needs to use libstdc++ - set_target_properties(Maya::Maya PROPERTIES - INTERFACE_COMPILE_OPTIONS "-std=c++0x;-stdlib=libstdc++") - endif () -endif() - -# Add the other Maya libraries into the main Maya::Maya library -set(_MAYA_LIBRARIES OpenMayaAnim OpenMayaFX OpenMayaRender OpenMayaUI Foundation clew) -foreach(MAYA_LIB ${_MAYA_LIBRARIES}) - find_library(MAYA_${MAYA_LIB}_LIBRARY - NAMES - ${MAYA_LIB} - PATHS - ${MAYA_LOCATION} - $ENV{MAYA_LOCATION} - PATH_SUFFIXES - "lib/" - "Maya.app/Contents/MacOS/" - NO_DEFAULT_PATH) - mark_as_advanced(MAYA_${MAYA_LIB}_LIBRARY) - if (MAYA_${MAYA_LIB}_LIBRARY) - add_library(Maya::${MAYA_LIB} UNKNOWN IMPORTED) - set_target_properties(Maya::${MAYA_LIB} PROPERTIES - IMPORTED_LOCATION "${MAYA_${MAYA_LIB}_LIBRARY}") - set_property(TARGET Maya::Maya APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Maya::${MAYA_LIB}) - set(MAYA_LIBRARIES ${MAYA_LIBRARIES} "${MAYA_${MAYA_LIB}_LIBRARY}") - endif() -endforeach() - -function(MAYA_PLUGIN _target) - if (WIN32) - set_target_properties(${_target} PROPERTIES - LINK_FLAGS "/export:initializePlugin /export:uninitializePlugin") - endif() - set_target_properties(${_target} PROPERTIES - PREFIX "" - SUFFIX ${MAYA_PLUGIN_EXTENSION}) -endfunction() diff --git a/mayaConfigure.bat b/mayaConfigure.bat deleted file mode 100644 index 4edc786..0000000 --- a/mayaConfigure.bat +++ /dev/null @@ -1,19 +0,0 @@ -setlocal - -SET BUILD=mayabuild -SET MAYA_VERSION=2020 -SET COMPILER=Visual Studio 16 2019 - -SET PFX=%~dp0 -cd %PFX% -rmdir %BUILD% /s /q -mkdir %BUILD% -cd %BUILD% - -cmake ^ - -DMAYA_VERSION=%MAYA_VERSION% ^ - -G "%COMPILER%" ..\ - -cmake --build . --config Release - -pause diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..d09b83c --- /dev/null +++ b/meson.build @@ -0,0 +1,39 @@ +project('BlurRelax', 'cpp') + +maya_dep = dependency('maya') +maya_name_suffix = maya_dep.get_variable('name_suffix') +maya_version = maya_dep.get_variable('maya_version') + +source_files = [ + 'src/blurRelaxNode.cpp', + 'src/fastMayaRelax.cpp', + 'src/fastRelax.cpp', + 'src/pluginRegister.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 + +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, + name_prefix : '', + name_suffix : maya_name_suffix, +) diff --git a/quick_compile.bat b/quick_compile.bat new file mode 100644 index 0000000..d7767b1 --- /dev/null +++ b/quick_compile.bat @@ -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 diff --git a/src/pluginRegister.cpp b/src/pluginRegister.cpp index 106b2e7..8e379bd 100644 --- a/src/pluginRegister.cpp +++ b/src/pluginRegister.cpp @@ -25,10 +25,11 @@ SOFTWARE. #include #include #include "blurRelaxNode.h" +#include "version.h" MStatus initializePlugin(MObject obj) { MStatus result; - MFnPlugin plugin(obj, "Blur Studio", "1.0", "Any"); + MFnPlugin plugin(obj, "Blur Studio", VERSION_STRING, "Any"); result = plugin.registerNode(DEFORMER_NAME, BlurRelax::id, BlurRelax::creator, BlurRelax::initialize, MPxNode::kDeformerNode); if (MGlobal::mayaState() == MGlobal::kInteractive) { MGlobal::executeCommand("makePaintable -attrType \"multiFloat\" -sm \"deformer\" \"" DEFORMER_NAME "\" \"weights\";"); diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 0000000..b7f88a8 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,3 @@ +#pragma once +#define VERSION_STRING "@VCS_TAG@" + diff --git a/subprojects/maya/meson.build b/subprojects/maya/meson.build new file mode 100644 index 0000000..43caa6f --- /dev/null +++ b/subprojects/maya/meson.build @@ -0,0 +1,107 @@ +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_compile_args = ['-DREQUIRE_IOSTREAM', '-D_BOOL'] +maya_link_args = [] + +if os_name == 'windows' + maya_install_base = 'c:/Program Files/Autodesk' + maya_plugin_ext = 'mll' + maya_compile_args += ['-DNT_PLUGIN'] + maya_link_args = ['/export:initializePlugin', '/export:uninitializePlugin'] +elif os_name == 'darwin' + maya_install_base = '/Applications/Autodesk' + 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++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) + +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), + cmplr.find_library('OpenMaya', dirs : maya_lib_dir), + cmplr.find_library('OpenMayaAnim', dirs : maya_lib_dir), + cmplr.find_library('OpenMayaFX', dirs : maya_lib_dir), + cmplr.find_library('OpenMayaRender', dirs : maya_lib_dir), + cmplr.find_library('OpenMayaUI', dirs : maya_lib_dir), + 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, + variables : {'name_suffix' : maya_plugin_ext, 'maya_version' : maya_version}, + compile_args : maya_compile_args, + link_args : maya_link_args, + +) + +meson.override_dependency('maya', maya_dep) diff --git a/subprojects/maya/meson.options b/subprojects/maya/meson.options new file mode 100644 index 0000000..c28e358 --- /dev/null +++ b/subprojects/maya/meson.options @@ -0,0 +1,30 @@ +option( + 'maya_version', + type : 'string', + value : '2024', + 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, +)