This guide provides instructions on how to build MSCL from source. Building using CMake is the recommended approach as it automatically handles dependency management and platform-specific configurations.
MSCL uses modern CMake (3.23+) and vcpkg for dependency management.
- CMake: Version 3.23 or higher.
- Git: Required to download dependencies via submodules and vcpkg.
- C++ Compiler: A compiler supporting C++14.
MSCL uses submodules to manage certain dependencies.
After cloning the project, make sure the submodules are initialized
git submodule update --init --recursiveIf the project already exists, the submodules may need to be updated
periodically, but should already happen on git pull
git submodule update --recursive- Configure the project:
cmake -S . -B build -DMSCL_BUILD_CPP_EXAMPLES:BOOL=ONcmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release -DMSCL_BUILD_CPP_EXAMPLES:BOOL=ON- Build the project:
cmake --build build --config Release --parallel $env:NUMBER_OF_PROCESSORScmake --build build --parallel $(nproc)The following primary options can be passed to CMake during the configuration
step (using -D<OPTION>=<VALUE>).
| Option | Description | Default |
|---|---|---|
MSCL_USE_VCPKG |
Use vcpkg to download/install dependencies. | ON |
MSCL_WITH_SSL |
Compile with SSL support (requires OpenSSL). | ON |
MSCL_WITH_WEBSOCKETS |
Compile with WebSocket support (requires Boost.Beast). | ON |
MSCL_LINK_STATIC_DEPS |
Link dependencies (Boost, OpenSSL) statically. | ON |
BUILD_SHARED_LIBS |
Build MSCL as a shared library (.dll/.so). | OFF |
MSCL is now self-contained and can manage its own dependencies. All dependencies are included within the MSCL repository, simplifying the build process and reducing external dependencies. There are options to turn off all or some dependency management in favor of using system-installed libraries. In some cases, MSCL will try to find system-installed libraries first before fetching them.
vcpkg is the default method of dependency management for MSCL. It simplifies the process of obtaining and configuring dependencies, ensuring that the correct versions are used across different platforms. These include Boost, OpenSSL, and Python3
If MSCL_USE_VCPKG is ON, CMake will automatically:
- Initialize the vcpkg submodule in
deps/vcpkg. - Install the required dependencies based on your configuration (e.g., Boost, OpenSSL, Boost.Test, Python3).
- Configure the build to use these libraries.
| Variable | Description | Default |
|---|---|---|
MSCL_DOWNLOAD_BOOST |
Download Boost using vcpkg | ON |
MSCL_DOWNLOAD_OPENSSL |
Automatically copy dependencies to the install directory. | ON |
MSCL_DOWNLOAD_PYTHON3 |
Path to a toolchain file to use in addition to vcpkg. | ON |
If any of these options are OFF, vcpkg will not download the dependency and
instead, MSCL will expect it to be installed on the system already
The following dependencies can be managed via vcpkg features if any of the
previous MSCL_DOWNLOAD_* options are ON:
- Boost: Required.
- OpenSSL: Required if
MSCL_WITH_SSLis enabled. - Boost.Test: Required if
MSCL_BUILD_TESTSis enabled. - Python3: Required if
MSCL_BUILD_PYTHON3is enabled.
If you prefer to use libraries already installed on your system, set
MSCL_USE_VCPKG to OFF. In this case, you may need to provide the paths to
the dependencies manually:
- Boost: Set
Boost_ROOTorBoost_DIRto your Boost installation path. - OpenSSL: Set
OPENSSL_ROOT_DIRto your OpenSSL installation path.
Note: When MSCL_USE_VCPKG is OFF, the automatic download options
(MSCL_DOWNLOAD_*) are also disabled.
For any dependency not managed by vcpkg, MSCL will attempt to find it on the system first before downloading it. This includes:
- Swig: Set
SWIG_ROOTto your Swig executable path. (Required for generating all bindings) - Natural Docs: Set
NaturalDocs_ROOTto your Natural Docs executable path. (Required for generating documentation - Windows only) - Turtle: Set
Turtle_ROOTto your Turtle header include directory. (Required for building unit tests)
MSCL features such as examples, language bindings, tests, and documentation have their own sets of configuration variables. See the relevant directory READMEs for more information.
| Option | Description | Default |
|---|---|---|
MSCL_BUILD_CPP_EXAMPLES |
Enables C++ examples. | OFF |
MSCL_BUILD_PYTHON3 |
Enables Python 3 bindings. | OFF |
MSCL_BUILD_PYTHON2 |
Enables Python 2 bindings (legacy). | OFF |
MSCL_BUILD_PYTHON_EXAMPLES |
Enables Python examples. (Requires MSCL_BUILD_PYTHON3 or MSCL_BUILD_PYTHON2 |
OFF |
MSCL_BUILD_CSHARP |
ENables C# bindings (Windows only). | OFF |
MSCL_BUILD_CSHARP_EXAMPLES |
Enables C# examples. (Requires MSCL_BUILD_CSHARP) |
OFF |
MSCL_BUILD_TESTS |
Enables the unit test suite. | OFF |
MSCL_BUILD_DOCUMENTATION |
Enables documentation (Windows only). | OFF |
MSCL_BUILD_PACKAGE |
Enables packaging support (CPack). | OFF |
- For detailed Binding information, see the bindings instructions.
- For detailed Testing information, see tests instructions.
- For detailed Documentation information, see the docs instructions.
- For detailed Examples information, see the examples instructions.
If you prefer to build MSCL without CMake, follow these guidelines.
- C++14 Compiler.
- Boost Libraries (v1.70.0 or higher): Required for Asio, Filesystem, System, and more.
- OpenSSL: Required if
MSCL_WITH_SSLis defined.
Add the following directories to your compiler's include paths:
<MSCL_ROOT>/src- Your Boost include directory.
- Your OpenSSL include directory (if using SSL).
Define these macros as needed for your configuration:
| Definition | Purpose |
|---|---|
MSCL_WITH_SSL |
Enables SSL support for communication. |
MSCL_WITH_WEBSOCKETS |
Enables WebSocket support. |
_CRT_SECURE_NO_WARNINGS |
(MSVC only) Suppresses CRT warnings. |
- Boost:
system,filesystem,date_time,regex. - OpenSSL:
ssl,crypto(ifMSCL_WITH_SSLis defined).