Build Instructions
How to build the core library (for integrators, not end users).
This guide provides detailed instructions for building Plugify on Windows, Linux, and macOS. It also covers advanced customization options and troubleshooting tips.
Prerequisites
Before building Plugify, ensure you have the following tools installed:
Windows
- Visual Studio 2022 (with C++ and CMake support)
- CMake (if not using Visual Studio's built-in CMake)
- Git
Linux
macOS
- Xcode Command Line Tools
- CMake
- Ninja (optional, for faster builds)
- Git
Cloning the Repository
To get started, clone the Plugify repository with its submodules:
Building on Windows
Using Visual Studio 2022 with CMake
Install CMake Tools:
Ensure you have CMake tools installed with Visual Studio.
Open the Project:
- Open Visual Studio 2022.
- Select
File > Open > CMake
. - Navigate to the repository directory and open the
CMakeLists.txt
file.
Configure and Build:
- Visual Studio will automatically configure and generate the necessary build files.
- Choose
Release
orDebug
configuration. - Build the project by selecting
Build > Build All
from the menu.
Using Visual Studio 2022 Project
Generate Project Files:
- Open a command prompt and navigate to the repository directory.
- Create a build directory and navigate into it:
- Generate Visual Studio project files using CMake:
Build the Solution:
- Open the generated
plugify.sln
file in Visual Studio. - Choose
Release
orDebug
configuration. - Build the solution by selecting
Build > Build Solution
from the menu.
Using MinGW
Generate Makefiles:
- Open a command prompt and navigate to the repository directory.
- Create a build directory and navigate into it:
- Generate Makefiles using CMake:
Build the Project:
- Use
mingw64-make
to build the project:
Using Command Prompt
Generate Build Files:
- Open a Visual Studio command prompt and navigate to the repository directory.
- Create a build directory and navigate into it:
- Generate Makefiles using CMake:
Build the Project:
- Use
cmake
to build the project:
Building on Linux
Install Dependencies:
- Open a terminal and install the required dependencies:
Generate Makefiles:
- Navigate to the repository directory.
- Create a build directory and navigate into it:
- Generate Makefiles using CMake:
Build the Project:
- Use
cmake
to build the project:
Building on macOS
Install Dependencies:
- Open a terminal and install the required dependencies:
Generate Makefiles:
- Navigate to the repository directory.
- Create a build directory and navigate into it:
- Generate Makefiles using CMake:
Build the Project:
- Use
cmake
to build the project:
Building with CLion
CLion can be used to build the project on all platforms (Windows, Linux, macOS):
Open the Project:
- Open CLion.
- Select
File > Open
. - Navigate to the repository directory and open the
CMakeLists.txt
file.
Configure and Build:
- CLion will automatically configure and generate the necessary build files.
- Build the project by selecting
Build > Build Project
from the menu.
Upgrading
To update your local repository to the latest version:
If the build fails, try removing the build
directory and re-creating it as described above. Note that the build process makes no modifications outside the build
directory.
Build Types
Plugify supports multiple build types, which can be specified using the CMAKE_BUILD_TYPE
variable. The default build type is RelWithDebInfo
. Additionally, Plugify provides presets for Debug
and Release
builds to simplify the process.
Available Build Types
- Debug:
- Enables debugging symbols and disables optimizations.
- Ideal for development and troubleshooting.
- Use this preset for local builds when you need detailed debugging information.
- Release:
- Enables optimizations and produces a smaller, faster binary.
- Uses
RelWithDebInfo
to include debugging symbols for local builds. - Ideal for production builds where performance is critical.
- RelWithDebInfo:
- Enables optimizations while including debugging symbols.
- This is the default build type and is used by the
Release
preset.
- MinSizeRel:
- Enables optimizations for the smallest possible binary size.
- Ideal for environments where disk space or memory usage is a concern.
- Does not include debugging symbols.
Using Presets
Plugify provides two presets to simplify the build process:
- Debug Preset:
- Builds the project with the
Debug
configuration. - Use this preset for local development and debugging.
- Example:
- Builds the project with the
- Release Preset:
- Builds the project with the
Release
configuration, which usesRelWithDebInfo
to include debugging symbols for local builds. - Use this preset for production-ready builds.
- Example:
- Builds the project with the
Specifying Build Types Manually
If you prefer to specify the build type manually, you can use the CMAKE_BUILD_TYPE
variable:
Customizing Plugify
Plugify provides several CMake options for customization:
Option | Description |
---|---|
-DPLUGIFY_BUILD_TESTS=ON | Enable building tests |
-DPLUGIFY_BUILD_JIT=OFF | Build JIT object library |
-DPLUGIFY_BUILD_ASSEMBLY=OFF | Build assembly object library |
-DPLUGIFY_BUILD_DOCS=OFF | Enable building with documentation |
-DPLUGIFY_BUILD_OBJECT_LIB=OFF | Build Plugify as an object library |
-DPLUGIFY_BUILD_SHARED_LIB=ON | Build Plugify as a shared library |
-DPLUGIFY_BUILD_SHARED_ASMJIT=OFF | Build AsmJit as a shared library |
-DPLUGIFY_BUILD_SHARED_CURL=OFF | Build cURL as a shared library |
-DPLUGIFY_USE_EXTERNAL_ASMJIT=OFF | Use an external AsmJit library |
-DPLUGIFY_USE_EXTERNAL_GLAZE=OFF | Use an external Glaze library |
-DPLUGIFY_USE_EXTERNAL_CURL=ON | Use an external cURL library |
-DPLUGIFY_USE_EXTERNAL_FMT=OFF | Use an external fmt library |
-DPLUGIFY_INTERFACE=OFF | Build as a lightweight interface for language modules |
-DPLUGIFY_DOWNLOADER=ON | Enable the downloader for the package manager |
-DPLUGIFY_LOGGING=ON | Enable the logging system |
-DPLUGIFY_DEBUG=ON | Enable debugging mode (asserts) |
-DPLUGIFY_USE_LIBCPP=OFF | Use libc++ by adding -stdlib=libc++ flag if available |
-DPLUGIFY_USE_STATIC_STDLIB=OFF | Enable static standard library linkage to avoid ABI issues by adding -static-* flags if available |
-DPLUGIFY_USE_SANITIZER=OFF | Enable sanitizers by adding -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined flags if available |
-DPLUGIFY_USE_CLANG_TIDY=OFF | Enable static analysis with clang-tidy |
-DPLUGIFY_USE_ABI0=ON | Enable use of the older C++ ABI, which was the default in GCC versions before GCC 5 |
Testing the Build
Plugify includes a custom testing system designed to validate the functionality of containers (e.g., strings, variants, vectors) used in language modules and plugins. This system relies on two key components:
cross_call_worker
: A plugin that implements methods to be called by thecross_call_master
.cross_call_master
: A plugin that calls methods from thecross_call_worker
and instructs it to call methods back.
These plugins are used to test marshalling (data exchange between plugins written in different languages) and ensure compatibility across language modules.
How It Works
cross_call_master
calls methods from thecross_call_worker
of another language module.cross_call_worker
calls methods back on thecross_call_master
.- This bidirectional communication tests the marshalling system and ensures that data is correctly passed between plugins.
Running the Tests
To run the tests, you need to:
- Build the testing app (
plug
). - Build the language modules and plugins (
cross_call_worker
andcross_call_master
). - Configure the
res
directory to include the required plugins and language modules.
Build the Testing App
Follow the Installation instructions to get the plug
testing app.
Build Language Modules and Plugins
- Navigate to the repository directory and create a build folder:
- Generate build files and enable testing:
- Build the language modules and plugins individually. For example:
Note: Ensure each plugin or language module is built separately to avoid conflicts and ensure proper compilation.
Configure the res
Directory
- Create a
res
folder in the root of the repository:
- Inside the
res
folder, create two subfolders:
- Copy the built plugins and language modules to the
res
folder:
- Place
cross_call_worker
andcross_call_master
inres/plugins/
. - Place the language modules (e.g.,
cpp-module
,python-module
) inres/modules/
.
Run the Tests
- Navigate to the
build
directory and run theplug
app: - The app will load the plugins and language modules, and the tests will run automatically.
Example Test Workflow
cross_call_master
calls a method fromcross_call_worker
to pass a string.cross_call_worker
processes the string and calls a method back oncross_call_master
to return a modified string.- The test verifies that the string was correctly passed and returned.
Building Documentation
Plugify's documentation can be built locally using Doxygen. To build the documentation:
Install Doxygen:
- On Linux:
- On macOS:
- On Windows:
Download and install Doxygen from the official website.
Generate Documentation:
- Navigate to the repository directory and create a build folder:
- Enable documentation building:
- Build the documentation:
View the Documentation:
- Open the generated documentation in your browser: