Skip to content

Commit

Permalink
Get rid of CMake in favor of meson
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Aug 22, 2024
1 parent 8168d5d commit 077000b
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 219 deletions.
46 changes: 0 additions & 46 deletions CMakeLists.txt

This file was deleted.

163 changes: 0 additions & 163 deletions cmake/FindMaya.cmake

This file was deleted.

10 changes: 0 additions & 10 deletions mayaConfigure.bat

This file was deleted.

27 changes: 27 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
project('TwistSpline', '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/pluginMain.cpp',
'src/drawOverride.cpp',
'src/twistSplineData.cpp',
'src/twistSplineNode.cpp',
'src/riderConstraint.cpp',
'src/twistTangentNode.cpp',
'src/twistMultiTangentNode.cpp',
]

harm_inc = include_directories(['src'])

outlib = shared_library(
meson.project_name(),
source_files,
install: true,
install_dir : meson.global_source_root() / 'output_Maya' + maya_version,
include_directories : harm_inc,
dependencies : maya_dep,
name_suffix : maya_name_suffix,
)
21 changes: 21 additions & 0 deletions quick_compile.bat
Original file line number Diff line number Diff line change
@@ -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 -Dmaya:maya_version=%MAYA_VERSION% --buildtype %BUILDTYPE% --vsenv %BUILDDIR% --backend %BACKEND%
)

if exist %BUILDDIR%\ (
meson compile -C %BUILDDIR%
meson install -C %BUILDDIR%
)

pause
67 changes: 67 additions & 0 deletions subprojects/maya/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
project('maya', 'cpp')

maya_version = get_option('maya_version')

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 = []

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_inc_suffix = 'devkit/include'
maya_lib_suffix = 'Maya.app/Contents/MacOS'
maya_bin_suffix = 'Maya.app/Contents/bin'
maya_plugin_ext = 'bundle'
maya_compile_args += ['-DOSMac_']
if meson.get_compiler('cpp').get_id() == 'clang'
maya_compile_args += ['-std', 'c++0x', '-stdlib', 'libstdc++']
endif
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)

maya_inc_dir = maya_install_path / maya_inc_suffix
maya_inc = include_directories(maya_inc_dir)

maya_lib_dir = maya_install_path / maya_lib_suffix
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),
]

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)

7 changes: 7 additions & 0 deletions subprojects/maya/meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
option(
'maya_version',
type : 'string',
value : '2024',
description : 'The version of Maya to compile for',
yield : true,
)

0 comments on commit 077000b

Please sign in to comment.