Build Instructions
How to build the core library and its test application from source (for integrators, not end users).
This page shows how to build the Plugify core from source on Windows, Linux and macOS, which CMake options it has and how to run its tests.
Prerequisites
- A compiler with C++23 support: GCC, Clang, MSVC (Visual Studio 2022) or Apple Clang. The core is tested in CI with GCC, Clang, MSVC and MinGW (MSYS2).
- CMake 3.14 or later. The presets need CMake 3.21 or later and Ninja.
- Git.
No libraries have to be installed by hand. CMake downloads the dependencies while configuring: glaze, valijson, libsolv and asmjit, plus fmt if the standard library has no <format>. The tests also download CLI11, Tracy and Catch2.
Getting the source
Building
From the command line
The same commands work on all platforms:
This builds the core library and, because PLUGIFY_BUILD_TESTS is on by default, the plug test application and the containers tests. To build only the library, add --target plugify.
On Windows, run the commands from a Developer Command Prompt for Visual Studio. With MinGW, add -G "MinGW Makefiles" to the first command.
With presets
The repository has two presets, Debug and Release. They use Ninja and put the build into build/<system>/<preset>:
In an IDE
Visual Studio 2022 and CLion open the folder with CMakeLists.txt directly (in Visual Studio: File > Open > Folder) and pick up the presets. Choose Debug or Release and build.
Updating
If the build fails after an update, delete the build folder and configure again. The build writes nothing outside its build folder.
Build types
CMAKE_BUILD_TYPE takes Debug, Release, RelWithDebInfo or MinSizeRel. If it is not set, Release is used.
The build type matters on Windows: the core refuses to load a language module built in another configuration, so build the core and the modules the same way.
CMake options
| Option | Default | Description |
|---|---|---|
PLUGIFY_BUILD_TESTS | ON | Build the plug test application and the containers tests |
PLUGIFY_BUILD_DOCS | OFF | Build the Doxygen documentation |
PLUGIFY_BUILD_SHARED_LIB | ON | Build the core as a shared library; OFF builds a static library |
PLUGIFY_BUILD_OBJECT_LIB | OFF | Build the core as an object library to link it into your own binary |
PLUGIFY_BUILD_SHARED_ASMJIT | OFF | Build asmjit as a shared library |
PLUGIFY_USE_EXTERNAL_GLAZE | OFF | Use an installed glaze instead of downloading it |
PLUGIFY_USE_EXTERNAL_VALIJSON | OFF | Use an installed valijson |
PLUGIFY_USE_EXTERNAL_LIBSOLV | OFF | Use an installed libsolv |
PLUGIFY_USE_EXTERNAL_ASMJIT | OFF | Use an installed asmjit |
PLUGIFY_USE_EXTERNAL_FMT | OFF | Use an installed fmt |
PLUGIFY_DEFAULT_CXX_STANDARD | 23 | C++ standard; 20 is the lowest supported |
PLUGIFY_USE_LIBCPP | OFF | Use libc++ (-stdlib=libc++) if available |
PLUGIFY_USE_STATIC_STDLIB | OFF | Link the standard library statically (-static-*) if available |
PLUGIFY_USE_SANITIZER | OFF | Build with AddressSanitizer (-fsanitize=address) if available |
PLUGIFY_USE_ANALYZER | OFF | Turn on the static analyzer of the compiler. Slow |
PLUGIFY_USE_CLANG_TIDY | OFF | Run clang-tidy during the build |
PLUGIFY_USE_ABI0 | OFF | Use the old GCC C++ ABI (the default before GCC 5) |
Pass an option to the first command, for example -DPLUGIFY_BUILD_TESTS=OFF.
Testing the build
The test application
plug is a console host for the core. Run it next to an extensions folder with modules and plugins, as described in Installation.
Cross-language calls
Calls between languages are tested with two plugins from the C++ language module repository, in its test folder:
cross_call_mastercalls the methods of a worker plugin with all kinds of parameters and checks the results;cross_call_workerexports these methods. Each language module has its own worker, so the test checks how that module passes values to and from C++.
Each of them is a separate CMake project. Build them like any C++ plugin, put the master, a worker and the language modules they need into extensions, and start plug. The master runs the tests when it starts and prints how many passed.
Building the documentation
The API reference of the core is built with Doxygen:
Open build/docs/html/index.html in a browser when it is done.