-
Notifications
You must be signed in to change notification settings - Fork 0
Building and Compilation
This page details the build prerequisites, code generation pipeline, and compilation procedures for Windows (MSVC) and Linux/macOS (GCC/Clang).
- C++ Compiler: C++20 compliant compiler (MSVC 2019+, GCC 10+, or Clang 11+).
- Build System: CMake 3.16 or higher.
- Scripting Environment: Python 3.x (used for code generation).
-
Optional:
pybind11(required only if building the nativeimport moezipextension module).
Before running CMake, execute make.py. This script processes words_final.txt and router_stateless_v4.json, chunking them into embedded_assets.hpp and writing out the complete project source files.
Windows CMD:
python make.pyLinux / macOS:
python3 make.pyNote: If words_final.txt or router_stateless_v4.json are absent, make.py uses built-in fallback vocabulary and router defaults.
Builds the standalone CLI executable (moezip.exe) and the shared library (moezip.dll):
cmake -B build
cmake --build build --config ReleaseTo compile the native Python extension (moezip.pyd), install pybind11 and pass its CMake directory:
pip install pybind11
for /f "delims=" %i in ('python -c "import pybind11; print(pybind11.get_cmake_dir())"') do for /f "delims=" %j in ('python -c "import sys; print(sys.executable)"') do cmake -B build -Dpybind11_DIR="%i" -DPYTHON_EXECUTABLE="%j"
cmake --build build --config Releasebuild/Release/
├── moezip.exe # Standalone Command Line Executable
├── moezip.dll # Dynamic Link Library (C-API Exports)
├── moezip.lib # DLL Import Library
├── moezip.exp # DLL Export File
└── moezip.pyd # Native Python Extension Module (if pybind11 enabled)
On Linux systems with python3-pybind11 installed, CMake automatically detects the library and builds all three targets in parallel:
# Ubuntu / Debian prerequisites
sudo apt-get install build-essential cmake python3-pybind11
# Configure and compile
cmake -B build_linux -DCMAKE_BUILD_TYPE=Release
cmake --build build_linux --parallelbuild_linux/
├── moezip # Standalone CLI Executable
├── libmoezip.so # C-API Shared Library
└── moezip.so # Native Python Extension Module
CMakeLists.txt defines three distinct build targets:
| Target Name | Type | Description | Primary Output |
|---|---|---|---|
moezip |
Executable | Standalone CLI tool (main.cpp) |
moezip.exe / moezip
|
moezip_dll |
Shared Library | C-API interface (api.cpp) |
moezip.dll / libmoezip.so
|
moezip_py |
Module | PyBind11 bindings (bindings.cpp) |
moezip.pyd / moezip.so
|
To compile a specific target individually:
# Example: Build only the C-API Shared Library
cmake --build build --config Release --target moezip_dllCMakeLists.txt applies platform-specific Release optimizations automatically:
-
MSVC (Windows):
/EHsc /O2 /std:c++20 -
GCC / Clang (Linux/macOS):
-O3 -march=native -std=c++20
moezip • C++20 Learning-Augmented Text Compression Engine
Released under the MIT License • Embedded MoE Router + rANS Arithmetic Coding
Main Repository • Report an Issue • Releases • Back to Top #home
- Home
- Architecture & Design
- Building & Compilation
- CLI Usage & Training
- API Reference
- Performance & Benchmarks
-
Windows (MSVC):
-
moezip.exe(CLI) -
moezip.dll(Shared Lib) -
moezip.pyd(Python)
-
-
Linux (GCC):
-
moezip(CLI) -
libmoezip.so(Shared Lib) -
moezip.so(Python)
-