chadmv / cmt

Various maya tools that I write for my personal projects.
MIT License
253 stars 77 forks source link

[Macos] compile issue #3

Open grigorovich opened 4 years ago

grigorovich commented 4 years ago

Cmake could not "find package" - issue was in this lines 34,35 of 'src/CMakeLists.txt'

CMake Error at src/CMakeLists.txt:34 (find_package): By not providing "FindMaya.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Maya", but CMake did not find one.

Could not find a package configuration file provided by "Maya" with any of the following names:

MayaConfig.cmake
maya-config.cmake

Add the installation prefix of "Maya" to CMAKE_PREFIX_PATH or set "Maya_DIR" to a directory containing one of the above files. If "Maya" provides a separate development package or SDK, be sure it has been installed.

and

CMake Error at src/CMakeLists.txt:35 (find_package): By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Eigen3", but CMake did not find one.

Could not find a package configuration file provided by "Eigen3" with any of the following names:

Eigen3Config.cmake eigen3-config.cmake

Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3" provides a separate development package or SDK, be sure it has been installed.

cmake version 3.16.2. Eigen extracted to third-party/Eigen Maya 2020. All dev environment vars sets up - path of maya, devkitBase (Autodesk link). Examples compiles and works on 2020 (Autodesk link).

Im not pro in cmake configuration... Could you help? What need to dig?

chadmv commented 4 years ago

You probably need to make sure you get the submodules. The CMake modules are included with the cgcmake submodule. Did you clone or download the repo?

grigorovich commented 4 years ago

Thanks for hint. I clone 'cgcmake' repo to 'cgcmake' folder.

$cmake -H. -Bbuild -G "Unix Makefiles" or $cmake -H. -Bbuild -G Xcode for xcode. Output:

-- Found OpenMP_CXX: -Xclang -fopenmp (found version "3.1") 
-- Found OpenMP: TRUE (found version "3.1")  
-- Found Maya: /Users/antongrigorovich/Applications/Autodesk/maya2020/include  
-- Found Eigen3: /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt-master2/third-party/Eigen (Required is at least version "2.91.0") 
-- Configuring done
-- Generating done

Ok. But on compiling has another issue with types in "maya2020/include/maya/MTypes.h" $cmake --build build Output:

/Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/third-party/Eigen/Eigen/Core:266:10: fatal error: 
      'omp.h' file not found
#include <omp.h>
         ^~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/cmt.dir/pluginMain.cpp.o] Error 1

I no have idea what is and where is that "omp.h".

BTW. $ brew info libomp

libomp: stable 9.0.1 (bottled) LLVM's OpenMP runtime library https://openmp.llvm.org/ /usr/local/Cellar/libomp/9.0.1 (9 files, 1.3MB) * Poured from bottle on 2020-02-08 at 01:09:59 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libomp.rb ==> Dependencies Build: cmake ✔ ==> Requirements Required: macOS >= 10.10 ✔

grigorovich commented 4 years ago

So. I found next step issue with OpenMP vs maya's ThreadsUtils... OpenMP doesn't shared in MacOS by default, and doesn't works out of the box even does installed by 'brew install libomp'. So i just force 'header' and 'dlyb' folders by flags on build configuration step:

$ cmake -H. -Bbuild -G "Unix Makefiles" -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" -DOpenMP_CXX_LIB_NAMES="omp" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib

and try to compile: $ cmake --build build

Output:

[ 14%] Building CXX object src/CMakeFiles/cmt.dir/pluginMain.cpp.o In file included from /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/pluginMain.cpp:3: In file included from /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/demBonesCmd.h:4: /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/DemBones/DemBonesExt.h:108:3: error: 'DemBones' is not a class, namespace, or enumeration DemBones::clear(); ^ /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/DemBones/DemBones.h:65:7: note: 'DemBones' declared here class DemBones { ^ In file included from /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/pluginMain.cpp:4: /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/rbfNode.h:80:3: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const double operator()(const double& x) const { return exp(-(x x) / (2.0 r r)); } ^~ /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/rbfNode.h:86:3: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const double operator()(const double& x) const { ^~ /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/rbfNode.h:95:3: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const double operator()(const double& x) const { return sqrt((x x) + (r r)); } ^~ /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/rbfNode.h:101:3: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const double operator()(const double& x) const { return 1.0 / sqrt((x x) + (r * r)); } ^~ /Users/antongrigorovich/Documents/UE/Platformer/Import/Maya_Rig/zDevelop/devkitBase/devkit/plug-ins/cmt_test/src/rbfNode.h:107:3: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] const double operator()(const double& x) const { ^~ 5 warnings and 1 error generated. make[2]: [src/CMakeFiles/cmt.dir/pluginMain.cpp.o] Error 1 make[1]: [src/CMakeFiles/cmt.dir/all] Error 2

Looks like 1 error in src/DemBones/DemBonesExt.h:108:3 by clear().

numbs questions:

  1. DemBonesExt inherit something from DemBones ? // clear() is not virtual?
  2. Is it ok if code in headers only?

PS: For macOS with new user's bash profile of zsh

create newone $ touch ~/.zshrc if absent and add these:

export MAYA_LOCATION=/Applications/Autodesk/maya2020/Maya.app/Contents
export DYLD_LIBRARY_PATH=$MAYA_LOCATION/MacOS
export DYLD_FRAMEWORK_PATH=$MAYA_LOCATION/Frameworks
export DEVKIT_LOCATION=<path to folder with devkit>/devkitBase

to ~/.zshrc

but if you have some maya vars in old bash profile just add legacy bash profile to ~/.zshrc: source ~/.bash_profile