diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 731b3b4..cba223e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,298 +1,104 @@ + name: build on: push: + branches: [ main ] tags: - v* pull_request: branches: [ main ] -env: - BUILD_TYPE: Release +# matrix: +# maya: [2024] +# os: [macos-latest, ubuntu-latest, windows-latest] +# include: +# - maya: 2024 +# update: 2 jobs: - maya-win: - runs-on: windows-latest - + 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" - - maya: "2024" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2024/Autodesk_Maya_2024_1_Update_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" + 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: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Repath Artifacts - run: | - mkdir artifacts/blurdeform/win64-${{matrix.maya}}/plug-ins - Copy-Item "./build/${{env.BUILD_TYPE}}/blurPostDeform.mll" -Destination "artifacts/blurdeform/win64-${{matrix.maya}}/plug-ins" - New-Item -Name artifacts/blurdeform.mod -ItemType File - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: blurdeform - path: | - artifacts/blurdeform/win64-${{matrix.maya}}/plug-ins/blurPostDeform.mll - artifacts/blurdeform.mod - - maya-macos-11: - runs-on: macos-11 - - 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: '11.7' - - - 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/blurdeform/mac-${{matrix.maya}}/plug-ins - cp ./build/${{env.BUILD_TYPE}}/blurPostDeform.bundle artifacts/blurdeform/mac-${{matrix.maya}}/plug-ins - touch artifacts/blurdeform.mod - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: blurdeform - path: | - artifacts/blurdeform/mac-${{matrix.maya}}/plug-ins/blurPostDeform.bundle - artifacts/blurdeform.mod - - maya-macos-12: - runs-on: macos-12 - - strategy: - fail-fast: false - - matrix: - include: - - maya: "2024" - devkit: "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2024/Autodesk_Maya_2024_1_Update_DEVKIT_Mac.dmg" - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: true - - - name: Install devkit - run: | - curl -o devkit.dmg ${{matrix.devkit}} - MOUNTDIR=$(hdiutil mount devkit.dmg | awk 'END {$1=$2=""; print $0}') - cp -r $MOUNTDIR . - - - uses: maxim-lobanov/setup-xcode@v1 + uses: blurstudio/mayaModuleActions/mesonBuild@v1 with: - xcode-version: '14' - - - 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" - - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Repath Artifacts - run: | - mkdir -p artifacts/blurdeform/mac-${{matrix.maya}}/plug-ins - cp ./build/${{env.BUILD_TYPE}}/blurPostDeform.bundle artifacts/blurdeform/mac-${{matrix.maya}}/plug-ins - touch artifacts/blurdeform.mod + 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: blurdeform - path: | - artifacts/blurdeform/mac-${{matrix.maya}}/plug-ins/blurPostDeform.bundle - artifacts/blurdeform.mod - - maya-linux: - runs-on: ubuntu-latest - container: scottenglert/maya-build:${{matrix.maya}} + name: ${{ runner.os }}-${{ matrix.maya }}-plugin + path: build/*.${{ steps.get-devkit.outputs.plugin-ext }} + if-no-files-found: error - strategy: - fail-fast: false - - matrix: - include: - # The 2018 and 2019 containers use cmake 3.9, and I'm using functions introduced in 3.16 - #- maya: "2018.7" - # year: "2018" - #- maya: "2019.3" - # year: "2019" - - maya: "2020.4" - year: "2020" - - maya: "2022.3" - year: "2022" - - maya: "2023" - year: "2023" - - maya: "2024" - year: "2024" - - steps: - - name: Checkout code - uses: actions/checkout@v3 - 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/blurdeform/linux-${{matrix.year}}/plug-ins - cp ./build/blurPostDeform.so artifacts/blurdeform/linux-${{matrix.year}}/plug-ins - touch artifacts/blurdeform.mod - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: blurdeform - path: | - artifacts/blurdeform/linux-${{matrix.year}}/plug-ins/blurPostDeform.so - artifacts/blurdeform.mod - - - build_modfile: - name: Package release - needs: [maya-win, maya-linux, maya-macos-11, maya-macos-12] - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - - name: Build Modfile - run: | - python buildmodfile.py artifacts/blurdeform/blurdeform.mod --name blurdeform --path artifacts/blurdeform/blurdeform - - - name: Create distribution - run: | - mkdir -p artifacts/blurdeform/blurdeform/scripts - cp -r ./scripts/blurdeform artifacts/blurdeform/blurdeform/scripts - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: blurdeform - path: | - artifacts/blurdeform/blurdeform/scripts - artifacts/blurdeform/blurdeform.mod - - -# -# Shipping -# -# _________ -# |\ _ _ _ _\ -# | \________\ -# | | | -# | | | -# \|________| -# -# upload_release: name: Upload release - needs: [maya-win, maya-linux, maya-macos-11, maya-macos-12, build_modfile] + needs: compile_plugin runs-on: ubuntu-latest - - # Only run on e.g. v0.1.0 - if: startsWith(github.ref, 'refs/tags/v') - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 + - 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: artifacts - - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + fallback: 0.0.1 - - name: Create zipfile - run: | - cd artifacts/blurdeform - zip -r blurPostDeform-${{env.RELEASE_VERSION}}.zip . - cd ../.. + - name: Package + uses: blurstudio/mayaModuleActions/packageMayaModule@v1 + with: + module-name: blurdeform + 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 }}" + token: "${{ secrets.GITHUB_TOKEN }}" prerelease: false - files: artifacts/blurdeform/blurPostDeform-*.zip + files: | + *.zip diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index f4e0087..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -project(blurPostDeform) - -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -set(CMAKE_CXX_STANDARD 14) -set(MAYA_VERSION 2020 CACHE STRING "Maya version") - -set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) -find_package(Maya REQUIRED) -find_package(OpenGL REQUIRED) - -if (WIN32) - set(COMPILE_FLAGS "/arch:AVX") -else() - set(COMPILE_FLAGS "-mavx") -endif() - -set(SOURCE_FILES - "src/blurPostDeformPlugin.cpp" - "src/blurPostDeformNode.cpp" - "src/blurPostDeformNode.h" - "src/blurPostDeformCmd.cpp" - "src/blurPostDeformCmd.h" - "src/common.cpp" - "src/common.h" - "src/setOverloads.h" -) - -add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PRIVATE Maya::Maya) -target_include_directories(${PROJECT_NAME} PRIVATE Maya::Maya) -target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_FLAGS}) - -MAYA_PLUGIN(${PROJECT_NAME}) diff --git a/buildmodfile.py b/buildmodfile.py deleted file mode 100644 index 0fcf855..0000000 --- a/buildmodfile.py +++ /dev/null @@ -1,47 +0,0 @@ -import re -import argparse -from pathlib import Path, PurePosixPath - - -def main(outpath, modname, modver, modpath): - outpath = Path(outpath).absolute() - - basepath = outpath.parent - modpath = Path(modpath).absolute() - modrel = modpath.relative_to(basepath) - - plugPaths = list(modpath.glob(str(Path('**') / 'plug-ins'))) - - lines = [] - for pp in plugPaths: - rel = PurePosixPath(pp.relative_to(modpath)) - match = re.search(r"(?Pwin64|linux|mac)-(?P\d+)", str(rel)) - if not match: - continue - plat, year = match['platform'], match['year'] - lines.append(f"+ PLATFORM:{plat} MAYAVERSION:{year} {modname} {modver} {modrel}") - lines.append(f"plug-ins: {rel}") - lines.append("") - - with open(outpath, 'w') as f: - f.write('\n'.join(lines)) - - -def parse(): - parser = argparse.ArgumentParser( - prog='buildmodfile', - description='builds a mod file ensuring that plugins are loaded for the proper maya versions', - ) - parser.add_argument('outpath', help="The output filepath") - parser.add_argument('-n', '--name', help="The name of the module", required=True) - parser.add_argument('-v', '--version', help="The version of the module", default="1.0.0") - parser.add_argument('-p', '--path', help="The path to the module folder", required=True) - args = parser.parse_args() - - main(args.outpath, args.name, args.version, args.path) - - -if __name__ == "__main__": - parse() - - diff --git a/cmake/FindMaya.cmake b/cmake/FindMaya.cmake deleted file mode 100644 index 679bd94..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/src/blurPostDeformCmd.h b/include/blurPostDeformCmd.h similarity index 100% rename from src/blurPostDeformCmd.h rename to include/blurPostDeformCmd.h diff --git a/src/blurPostDeformNode.h b/include/blurPostDeformNode.h similarity index 100% rename from src/blurPostDeformNode.h rename to include/blurPostDeformNode.h diff --git a/src/common.h b/include/common.h similarity index 83% rename from src/common.h rename to include/common.h index be4ad4a..729e2fd 100644 --- a/src/common.h +++ b/include/common.h @@ -224,54 +224,6 @@ void GetValidUp( MVector &up ); -template struct ThreadData { - unsigned int start; - unsigned int end; - unsigned int numTasks; - double *alignedStorage; - T *pData; - - ThreadData() - { - alignedStorage = (double *)_mm_malloc(4 * sizeof(double), 256); - } - ~ThreadData() { _mm_free(alignedStorage); } -}; - -/** - Creates the data stuctures that will be sent to each thread. Divides the - vertices into discrete chunks to be evaluated in the threads. - @param[in] taskCount The number of individual tasks we want to divide the - calculation into. - @param[in] elementCount The number of vertices or elements to be divided up. - @param[in] taskData The TaskData or BindData object. - @param[out] threadData The array of ThreadData objects. It is assumed the - array is of size taskCount. -*/ -template -void CreateThreadData( - int taskCount, unsigned int elementCount, T *taskData, - ThreadData *threadData -) -{ - unsigned int taskLength = (elementCount + taskCount - 1) / taskCount; - unsigned int start = 0; - unsigned int end = taskLength; - int lastTask = taskCount - 1; - for (int i = 0; i < taskCount; i++) { - if (i == lastTask) { - end = elementCount; - } - threadData[i].start = start; - threadData[i].end = end; - threadData[i].numTasks = taskCount; - threadData[i].pData = taskData; - - start += taskLength; - end += taskLength; - } -} - #ifdef __AVX__ /** Calculates 4 dot products at once. diff --git a/src/setOverloads.h b/include/setOverloads.h similarity index 100% rename from src/setOverloads.h rename to include/setOverloads.h diff --git a/mayaConfigure.bat b/mayaConfigure.bat deleted file mode 100644 index c0c536e..0000000 --- a/mayaConfigure.bat +++ /dev/null @@ -1,19 +0,0 @@ -setlocal - -SET MAYA_VERSION=2023 -SET BUILD=mayabuild_%MAYA_VERSION% -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 RelWithDebInfo - -pause diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..e1c9f45 --- /dev/null +++ b/meson.build @@ -0,0 +1,48 @@ +project('blurdeform', '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 = files([ + 'src/blurPostDeformCmd.cpp', + 'src/blurPostDeformNode.cpp', + 'src/blurPostDeformPlugin.cpp', + 'src/common.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 + +cc = meson.get_compiler('cpp') +if cc.get_argument_syntax() == 'gcc' + avx = ['-mavx', '-mfma'] +else + avx = ['/arch:AVX'] +endif +add_project_arguments(avx, language: 'cpp') + + +outlib = shared_library( + meson.project_name(), + source_files, + install: true, + install_dir : meson.global_source_root() / 'output_Maya' + maya_version, + include_directories : include_directories(['include']), + 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..95550f7 --- /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=release +SET BUILDDIR=mayabuild_%BUILDTYPE%_%MAYA_VERSION%_%BACKEND% + +if not exist %BUILDDIR%\ ( + meson setup -Dmaya:maya_version=%MAYA_VERSION% --buildtype %BUILDTYPE% --vsenv %BUILDDIR% --backend %BACKEND% +) + +if exist %BUILDDIR%\ ( + meson compile -C %BUILDDIR% + meson install -C %BUILDDIR% +) + +pause diff --git a/src/blurPostDeformPlugin.cpp b/src/blurPostDeformPlugin.cpp index a5556cf..ad36577 100644 --- a/src/blurPostDeformPlugin.cpp +++ b/src/blurPostDeformPlugin.cpp @@ -2,6 +2,7 @@ #include "blurPostDeformNode.h" #include +#include "version.h" //- // ========================================================================== @@ -49,7 +50,7 @@ MStatus initializePlugin(MObject obj) { MStatus result; - MFnPlugin plugin(obj, "blur studios", "1.0", "Any"); + MFnPlugin plugin(obj, "Blur Studio", VERSION_STRING, "Any"); result = plugin.registerNode( "blurSculpt", blurSculpt::id, blurSculpt::creator, blurSculpt::initialize, MPxNode::kDeformerNode 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, +)