Build your operator using CMake
Creating an operator with CMake is a two-step process. The first call to cmake generates a Makefile or a Visual Studio project. The second call to cmake builds your operator using the Makefile or project, and creates a Bifrost pack for your operator.
To build your operator and its Bifrost pack:
On Windows, open a Visual Studio 2019 command window. On macOS and Linux, open a terminal window. Make sure that the
cmakecommand is in your path. On Linux, make sure thatgccis also in your path.Set the
BIFROST_LOCATIONenvironment variable to point to your Bifrost installation.Platform Bifrost location Windows C:\Program Files\Autodesk\Bifrost\<Maya_version>\<Bifrost_version>\bifrost\macOS /Applications/Autodesk/bifrost/<Maya_version>/<Bifrost_version>/bifrost/Linux /usr/autodesk/bifrost/<Maya_version>/<Bifrost_version>/bifrost/You can also pass the location of the Bifrost installation to
cmakeon the command line. The location passed tocmakefrom the command line will take precedence over the environment variable.Note:On Windows, the path can contain spaces, but not quotation marks of any kind.
Change directory to your project's
srcdirectory and run the following command to create a Visual Studio project or a Makefile:cmake -S <operator_directory> -B <build_location>To create an Xcode project, run:
cmake -S <operator_directory> -B <build_location> -GXcodeThe build files will be created in the
build_locationdirectory you passed tocmake.cmakewill use defaults to generate the Visual Studio project or Makefile. These can be changed on thecmakecommand line.Parameter Default Command line option to change the default C++ standard your compiler's default -DCMAKE_CXX_STANDARD=17Bifrost installation location BIFROST_LOCATIONenvironment variable-DBIFROST_LOCATION=<path_to_Bifrost_installation>Activate warnings Default is OFF-DBIFROST_WARNINGS_AS_ERRORS=<ON or OFF>Pack install directory Build directory -DCMAKE_INSTALL_PREFIX=<target_directory>On macOS with Apple Silicon chips, the target architecture will be arm64 by default. Similarly, on macOS with Intel chips, the target architecture will be Intel x86_64 by default. You can choose to build for both architectures using the CMAKE_OSX_ARCHITECTURES option:
cmake -S <operator_directory> -B build_output -DCMAKE_INSTALL_PREFIX=bifrost_packs -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64If you need to rebuild, delete the build directory first.
To build the operator and create its Bifrost pack, run:
cmake --build <build_location> --target installUse the same build location as you used in your previous command.
Note:If you are building on Windows, or if you are building using an Xcode project, you will need to specify that you are building a release version:
cmake --build <build_location> --target install --config ReleaseIf you are building directly from within Visual Studio or Xcode, modify your project to use the
installtarget withReleaseconfiguration.This will generate a Bifrost pack named
<project_name>-<project_version>as specified in the CMakeLists.txt file.If you specified a directory for
CMAKE_INSTALL_PREFIXin the previous call tocmake, the Bifrost pack will be installed in that directory. If you did not specifyCMAKE_INSTALL_PREFIX, the pack will be installed in the build directoryIf you need to rebuild, delete the build directory and restart from the previous step.
To use the nodes in your Bifrost pack, ensure that your Bifrost pack is in a location that is accessible to the application that will be using it, and add the full path to the Bifrost pack's
<project_name>Config.json, including the name of the file, to theBIFROST_LIB_CONFIG_FILESenvironment variable. The<project_name>Config.jsonfile is located at the top level of the Bifrost pack directory.For example:
BIFROST_LIB_CONFIG_FILES=$HOME/MyBifrostPacks/MyOperator-1.0.0/MyOperatorPackConfig.jsonBIFROST_LIB_CONFIG_FILEScan point to multiple json files. Separate each path with a semicolon (;) on Windows, or a colon (:) on macOS or Linux.If you will be using your nodes with the Bifrost Extension for Maya, you can also set this environment variable in the
Maya.envfile.
