MSCL provides language bindings for Python and C# (.NET) using SWIG.
To enable building the bindings, use the following CMake options:
| Option | Description | Default |
|---|---|---|
MSCL_BUILD_PYTHON3 |
Build Python 3 bindings. | OFF |
MSCL_BUILD_PYTHON2 |
Build Python 2 bindings (legacy). | OFF |
MSCL_BUILD_CSHARP |
Build C# bindings (Windows only). | OFF |
| Option | Description | Default |
|---|---|---|
MSCL_PYTHON3_REQUESTED_VERSION |
The requested version of Python 3 to use (e.g., "3.12"). | 3.12 |
MSCL_PYTHON2_REQUESTED_VERSION |
The requested version of Python 2 to use (e.g., "2.7"). | 2.7 |
MSCL_DOWNLOAD_PYTHON3 |
Automatically download Python 3 if not found (requires MSCL_USE_VCPKG). |
ON |
MSCL_PACKAGE_PYTHON_DEBUG |
Create a debug version of the Python packages. | OFF |
Setting MSCL_PYTHON3_REQUESTED_VERSION or MSCL_PYTHON2_REQUESTED_VERSION to
an empty value will default to all supported versions of Python for each
respective major version.
MSCL provides bindings for the latest supported version of Python in vcpkg at
the time of release. If you need a different version of Python, set the
respective MSCL_PYTHON3_REQUESTED_VERSION or MSCL_PYTHON2_REQUESTED_VERSION
to the desired version. The requested version must already be installed on
your system.
- SWIG: Required to generate the binding source code. If not already installed, CMake will attempt to download it automatically.
- Python: Required for Python bindings. If
MSCL_USE_VCPKGis enabled, CMake will attempt to download it automatically. - .NET SDK / MSVC: Required for C# bindings.
-
Enable the desired binding in your CMake configuration:
cmake -S . -B build -DMSCL_BUILD_PYTHON3:BOOL=ON -DMSCL_BUILD_CSHARP:BOOL=ON
cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release -DMSCL_BUILD_PYTHON3:BOOL=ON -
Build the project:
cmake --build build --config Release --parallel $env:NUMBER_OF_PROCESSORS
cmake --build build --parallel $(nproc)
After building, you will find MSCL.py and _MSCL.pyd (Windows) or _MSCL.so
(Linux) in the build output directory.
Building the C# bindings produces:
MSCL.dll: The C++ bridge library.MSCL_Managed.dll: The .NET managed library.
Add MSCL_Managed.dll as a reference in your .NET project and ensure MSCL.dll
is available in your executable's path.
Refer to the integration guide for details on how to use these files in your project.