This project is a proof of concept of using a library dependency to enable Fusion 360 Addin and Script development using a CMake build system. This enables support of development environments other than Visual Studio and Xcode, such as CLion.
Upon the creation of a new script or add-in, Fusion 360 generates a template project with both a Visual Studio and XCode project file containing the relevant build settings. This unnecessarily complicates cross-platform C++ development and dependency management.
A straightforward solution is to support the CMake build system. Visual Studio already has built-in support for CMake and CMake can generate Xcode project files. CMake also has robust package management for including dependencies on other CMake projects.
Since Fusion 360 API does not have built-in support for the CMake package system, the approach this project takes
is to use the MODULE signature of find_package()
to import a versioned package of the Fusion 360 API.
Internally, the CMake module finds and links the headers and shared libraries into an interface library and derives the
interface library version from the version.txt
file specified in the Fusion 360 API directory. This enables the script
or add-in to specify API version requirements, a future not currently not supported by AutoDesk.
This project includes a derivation of the default project with the following differences:
- All the features previously described.
- Provides a CMake option to configure building for a script or add-in.
- Generates entry point source code based upon the build option. This is accomplished by configuring function macros inspired by Better Macros, Better Flags.
- Generates a
.manifest
JSON with project variables. This ensures that the manifest describing the project is consistent with source code. - Configures the install destination for the script or add-in shared library and
.manifest
. This allowing seamless support of either cohabiting source and install targets (Fusion 360 default) or separation of the project directory from the Fusion 360 API directory. The later is especially attractive in the context of the build option previously described. - Includes a dependency on JSON parsing library nlohmann json. This demonstrate the ease of integrating external libraries in script or add-in development.
- Entry points parse the
context
argument passed using the JSON parsing library. This provides an example for using external libraries to provide functionality not included in the Fusion 360 API.