Installation / Quick starting
Installation
M6Geo is hosted on GitLab. If you have git, a modern C++ compiler and CMake, you can download and install M6Geo by entering the following commands in a terminal:
git clone https://gitlab.asnr.fr/wmonange/m6geo.git
cd m6geo
mkdir build && cd build
cmake ..
make
sudo make install
This will build the library, the tools and install them (by default in /usr/local/bin).
If you only need the library you can disable the building of the tool live_plotter by setting:
cmake -DM6GEO_BUILD_LIVE_PLOTTER=OFF
If you do not have administrator privileges, the cmake command should specify an installation directory where you have write access, e.g.
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
Incorporating M6Geo in a project
There are two ways to use M6Geo as a dependency in your own CMake project.
Option 1 – FetchContent (recommended)
Use CMake’s built-in FetchContent module to download and build M6Geo automatically alongside your project.
Add the following to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
m6geo
GIT_REPOSITORY https://gitlab.asnr.fr/wmonange/m6geo.git
GIT_TAG main # or a specific tag / commit
)
# Disable optional components you do not need
set(M6GEO_BUILD_LIVE_PLOTTER OFF CACHE BOOL "" FORCE)
set(M6GEO_BUILD_TESTING OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(m6geo)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE m6geo)
With this setup CMake handles all transitive dependencies automatically and no prior installation is required.
Option 2 – After installation
If M6Geo is already installed (see the Installation section above), point CMake to it with CMAKE_PREFIX_PATH and locate the library manually:
# If installed in a non-standard prefix, tell CMake where to look:
# cmake -DCMAKE_PREFIX_PATH=$HOME/.local ..
find_path(M6GEO_INCLUDE_DIR NAMES m6geo/geometry.hxx
HINTS ${CMAKE_PREFIX_PATH}/include /usr/local/include)
find_library(M6GEO_LIBRARY NAMES m6geo
HINTS ${CMAKE_PREFIX_PATH}/lib /usr/local/lib)
if(NOT M6GEO_INCLUDE_DIR OR NOT M6GEO_LIBRARY)
message(FATAL_ERROR "M6Geo not found. Set CMAKE_PREFIX_PATH to the install prefix.")
endif()
add_executable(my_app main.cpp)
target_include_directories(my_app PRIVATE ${M6GEO_INCLUDE_DIR})
target_link_libraries(my_app PRIVATE ${M6GEO_LIBRARY})
In both cases, headers are available under the m6geo/ sub-directory, so
include them as:
#include <m6geo/geometry.hxx>
Geometry plotter
The library comes with a geometry visualization tool called live_plotter that is installed in the ${INSTALL_DIR}/bin folder.
Copy and paste the following code into live_plotter and press Ctrl+Enter to display the geometry.
GEOM
MODU 0
TYPE 1 BOX 25.0 25.0 1.0
TYPE 2 BOX 10.0 7.0 1.0
TYPE 3 BOX 5.0 5.0 1.0
TYPE 4 BOX 10.0 15.0 1.0
VOLU 1 0 1 M1 0.0 0.0 0.0
VOLU 2 4 2 M2 0.0 0.0 0.0 TRUN ( 4 )
VOLU 3 2 3 M3 0.0 0.0 0.0 TRUN ( 4 )
VOLU 4 1 4 M4 7.0 0.0 0.0
ENDM
ENDG