The Max Software Development Kit (SDK) contains the headers, source, and libraries for building external objects (plug-ins) in C or C++ for Max. It additionally includes documentation of the API, example projects, and CMake scripts for generating Xcode and Visual Studio project files.
The Max SDK depends on max-sdk-base, which provides the low-level bindings to the Max application and CMake scripts for creating your own projects. This dependency is fetched automatically by CMake at configure time.
The Max SDK uses CMake to generate Xcode and Visual Studio
project files. CMake replaced the .xcodeproj and .sln files that previously
shipped in the repo. The change was driven by the need to support Apple silicon
in Max 8.2. You still open Xcode or Visual Studio to build; CMake is the
one-time step that generates those project files. There is an
overview video which walks through
the updates for supporting Max 8.2, and a legacy guide
for those migrating from pre-8.2 projects.
Pre-requisites:
- CMake version >= 3.25
- Xcode (macOS) or Visual Studio (Windows)
- Clone or download
max-sdkfrom GitHub and put it in your Max Package folder or somewhere on Max's search path.
mkdir build
cd buildYou can run cmake --help to get a list of generators available for your
platform. On macOS, the typical choice is Xcode, and on Windows, it is usually
Visual Studio.
On macOS:
cmake -G Xcode ..Note: you can add the
-j4option tocmakewhere "4" is the number of cores to use. This can help to speed up your builds, though sometimes the error output is interleaved in such a way as to make troubleshooting more difficult.
On Windows:
cmake -G "Visual Studio 17 2022" ..You can open the IDE projects and build from the Xcode or Visual Studio interface.
Alternatively, you can build from the command line, passing cmake the path to
the /build directory after --build.
cmake --build . --config Debug
cmake --build . --config ReleaseNote: If you are running on a Mac with Apple silicon, you may see an error
cannot be loaded due to system security policy when loading your externals in
Max. To resolve this, you can ad-hoc codesign your external with
codesign --force --deep -s - myobject.mxo.
Each external has its own CMakeLists.txt. The minimal form looks like this:
set_property(DIRECTORY PROPERTY max::external YES)
set_property(DIRECTORY PROPERTY max::glob ON)
project(myexternal)max::external YEStells the SDK build machinery to treat this directory as a Max external.max::glob ONautomatically includes all.cand.cppfiles in the directory as source files.project(myexternal)names the external and triggers target creation. The output will bemyexternal.mxo(macOS) ormyexternal.mxe64(Windows).
If you want explicit control over which files are compiled, omit max::glob and
list them yourself after project():
set_property(DIRECTORY PROPERTY max::external YES)
project(myexternal)
target_sources(myexternal PRIVATE myexternal.cpp helper.cpp)After project(), the target named ${PROJECT_NAME} exists and can be
customized with standard CMake commands such as target_link_libraries,
target_include_directories, and target_compile_definitions.
If you are interested in using Modern C++ to write external objects, please take a look at the Min DevKit.
It is highly recommended that you test your code thoroughly. One option is use the max-test package.
For support, please use the developer forums at: http://cycling74.com/forums/