Building MafiaNet¶
Linux / macOS¶
# Configure
mkdir build && cd build
cmake ..
# Build
cmake --build .
# Or for release build
cmake --build . --config Release
Windows (Visual Studio)¶
# Generate Visual Studio 2022 solution
cmake -G "Visual Studio 17 2022" -A x64 -B build
# Build from command line
cmake --build build --config Release
# Or open build/MafiaNet.sln in Visual Studio
Build Options¶
Configure build options with CMake:
Option |
Default |
Description |
|---|---|---|
|
ON |
Build shared library (.dll/.so/.dylib) |
|
ON |
Build static library (.lib/.a) |
|
OFF |
Build sample applications |
|
OFF |
Build test suite |
Example with options:
cmake -DMAFIANET_BUILD_SAMPLES=ON -DMAFIANET_BUILD_TESTS=ON ..
Running Tests¶
Build with tests enabled, then run:
./build/Samples/Tests/Tests
# Run specific test
./build/Samples/Tests/Tests EightPeerTest
Linking Your Project¶
CMake (recommended):
find_package(MafiaNet REQUIRED)
target_link_libraries(your_target MafiaNet::MafiaNet)
Manual linking:
Include path:
<install_prefix>/includeLibrary path:
<install_prefix>/libLink against:
mafianet(shared) orMafiaNetStatic(static)