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

git clone https://github.com/untrustedmodders/plugify.git
cd plugify

Building

From the command line

The same commands work on all platforms:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

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>:

cmake --preset Release
cmake --build --preset Release

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

git pull

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

OptionDefaultDescription
PLUGIFY_BUILD_TESTSONBuild the plug test application and the containers tests
PLUGIFY_BUILD_DOCSOFFBuild the Doxygen documentation
PLUGIFY_BUILD_SHARED_LIBONBuild the core as a shared library; OFF builds a static library
PLUGIFY_BUILD_OBJECT_LIBOFFBuild the core as an object library to link it into your own binary
PLUGIFY_BUILD_SHARED_ASMJITOFFBuild asmjit as a shared library
PLUGIFY_USE_EXTERNAL_GLAZEOFFUse an installed glaze instead of downloading it
PLUGIFY_USE_EXTERNAL_VALIJSONOFFUse an installed valijson
PLUGIFY_USE_EXTERNAL_LIBSOLVOFFUse an installed libsolv
PLUGIFY_USE_EXTERNAL_ASMJITOFFUse an installed asmjit
PLUGIFY_USE_EXTERNAL_FMTOFFUse an installed fmt
PLUGIFY_DEFAULT_CXX_STANDARD23C++ standard; 20 is the lowest supported
PLUGIFY_USE_LIBCPPOFFUse libc++ (-stdlib=libc++) if available
PLUGIFY_USE_STATIC_STDLIBOFFLink the standard library statically (-static-*) if available
PLUGIFY_USE_SANITIZEROFFBuild with AddressSanitizer (-fsanitize=address) if available
PLUGIFY_USE_ANALYZEROFFTurn on the static analyzer of the compiler. Slow
PLUGIFY_USE_CLANG_TIDYOFFRun clang-tidy during the build
PLUGIFY_USE_ABI0OFFUse 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_master calls the methods of a worker plugin with all kinds of parameters and checks the results;
  • cross_call_worker exports 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:

cmake -S . -B build -DPLUGIFY_BUILD_DOCS=ON
cmake --build build --target docs

Open build/docs/html/index.html in a browser when it is done.