diff --git a/README.md b/README.md index 01314f3b895bc35470355b9d916c3e65fd883e9f..ebd242687272b996a37d436cfb50089202ebf99d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,112 @@ # Mandos General purpose simulator for c++ and python. -## Build +## Tools +Mandos uses standard tools for configuration and compilation. -This project is built using `CMake` and should work on Windows and Linux. To build the project one needs to have `git`. `cmake`, and a c++ compiler installed. To clone the repository and build it run the following commands: -```sh -git clone --recursive https://github.com/MagiRomanya/Mandos.git -cd Mandos -mkdir build -cd build -cmake .. -cmake --build . +| Tool | Version | OS | Description | +|---|---|---|---| +| Conan | 2.0 or above | Linux / Windows | Fetch dependencies | +| CMake | 3.27 or above | Linux / Windows | Configure project | +| clang* | 17 or above | Linux | Compiler | +| gcc* | 11 or above | Linux | Compiler | +| MSVC | 194 or above | Windows | Compiler | + + +> \* Only gcc or clang is needed, although you can have both and compile with both to ensure compatibility + +## External dependencies + +Mandos uses Conan 2 to manage its external dependencies. If you dont have Conan 2, you can install it using `pip install conan` + +Each set of dependencies can be used for several mandos compilations, but the build type of Mandos must be specified when fetching the dependencies (this is a limitation of CMake) + + +``` +conan install . --profile:build conan/profiles/x86_64-clang-17 --settings:build "&:build_type=Release" --profile:host conan/profiles/x86_64-clang-17 --settings:host "&:build_type=Release" --settings:host "*:build_type=Release" --build=missing +``` + +Lets break that line: +* `conan install .`: execute conan install with a conanfile in . +* `--profile:build conan/profiles/x86_64-clang-17`: Profile used for the build machine. It provides information on the machine that runs the compilation process +* `--settings:build "build_type=Release"`: The build tools will be compiled in Release mode +* `--profile:host conan/profiles/x86_64-clang-17`: Profile used for the host machine. It provides information on the machine that will run Mandos. +* `--settings:host "&:build_type=Release"`: Specifies the build type of our project (`&`) +* `--settings:host "*:build_type=Release"`: Specifies the build type of our dependencies (`*`) +* `--build=missing`: Compile all missing dependencies + +When running the above command, Conan will fetch the dependencies and compile them using the specified profiles and build types and generate files for configuring Mandos with CMake. You can inspect those files inside the `build///generators` directory. + +We provide several Conan profiles +* `x86_64-clang-17` +* `x86_64-clang-18` +* `x86-64-gcc-11` +* `x86_64-gcc-13` +* `x86_64-msvc-194` + +## Compiling Mandos + +We use CMake for configuring and managing Mandos build and we provide several CMakePresets to ease configuration. + +Once the external dependencies are compiled, you can configure the Mandos project using + +``` +cmake -S . --preset ``` +from the source directory. + +We provide several configuration presets + +* `dev-release`: General purpose preset which compiles Mandos in Release mode using clang-17 +* `dev-debug`: General purpose preset which compiles Mandos in Debug mode using clang-17 +* `x86_64-msvc-194`: General purpose preset for MSVC 194 + +Take into account that these presets doesn't enable the checks that are used in the CI, so even if the project compiles fine with these presets, the build may fail in the CI. + +You can check the complete list in CMakePresets.json. +We recommend your create your own presets in CMakeUserPresets.json as you need. + +Different presets may look for different set of dependencies. Architecture, compiler and build type must match between the Conan profile and the CMake preset. Check ` .x86_64-clang-17`, `.debug` and related base presets in `presets/common.json`. + +Once the project is configured using a preset, you can build the project using a build preset + +``` +cmake --build --preset +``` + +from the source directory. + + +> On Linux (technically, when using a single config generator like Ninja), the build type is a property of the configuration preset. On Windows (technically, when using a multi config generator like MSVC), the build type is defined in the build preset. Check the default presets in presets/dev.json to check what each preset is doing. + + +>Mandos developer usually work on Linux systems and Windows builds might not be as tested as Linux builds. Please, open a ticket if you find an issue. + +## Examples + +Mandos provides a high level Python API to simplify the creation of demos and examples. The Python API is compiled by default when using `dev-release` or `dev-debug` presets (check what other presets are doing if needed). + +You can find different examples in the `examples/python` directory. +To run any of them, you need several python dependencies such as meshio or polyscope. You can install them using + +``` +pip install meshio polyscope +``` + +If you prefer, you can also use a Python venv. + +To execute the examples, first, you need the specify to Python where to find Mandos bindings by setting the PYTHONPATH environment variable + +``` +export PYTHONPATH=/lib +``` + +for example, for the `dev-release` preset + +``` +export PYTHONPATH=/build/dev-release/lib +``` + +Note that if you frequently change between presets (for example, from `dev-release` to `dev-debug`), you need to update the PYTHONPATH variable to match the last build. + -## Project architecture -![](./resources/mandos.svg "A simplified high level overview of the Mandos simulator and how it is structured.") diff --git a/presets/common.json b/presets/common.json index 3dda609e005117387658a3264c049940b7add910..b05a88498a78f501d1867c3d92a74a30da288e68 100644 --- a/presets/common.json +++ b/presets/common.json @@ -171,6 +171,16 @@ "value": "ON" } } + }, + { + "name": ".no-undefined", + "hidden": true, + "cacheVariables": { + "ENABLE_NO_UNDEFINED": { + "type": "BOOL", + "value": "ON" + } + } } ], "testPresets": [ diff --git a/presets/dev.json b/presets/dev.json index 752f2401930af6fe84d007cbb54731ffae616f44..de0bce34af844d84f7e5f63db5216ad98b5f4cb8 100644 --- a/presets/dev.json +++ b/presets/dev.json @@ -33,7 +33,8 @@ ".x86_64-clang-17", ".dev-base", ".examples", - ".bindings" + ".bindings", + ".no-undefined" ] } ],