SGM is a highly portable geometric modeling library written in C++. SGM supports multi-threaded execution on modern CPUs and input from standard formats like STEP and STL files. SGM fulfills the need for a robust and efficient geometry kernel — a need in all types of computational modeling and simulation of engineering systems.
We expect SGM to enhance collaboration across government laboratories and universities. We hope to improve quality and robustness of SGM by reducing defects across many use cases.
BSD. Specifically the "new/modified BSD" license, also called the "BSD three clause license". See license file.
API documentation coming soon.
- A reduced topological model geometric kernel for B-reps (boundary representations).
- Many operations including find closest point, ray-firing, intersections, Booleans, facetting.
- Support for the standard geometry format STEP and STL files.
- A lightweight geometry viewer based on QT.
- Optimized multithreaded processing.
- Written in standard C++11 for portability, builds on compilers including Windows MSVC, GCC, Clang, and Intel.
- Around 95% unit test coverage of all library code.
The sgm library can be built with a C++11 standard compliant compiler and has no dependencies on external libraries.
The lightweight viewer application requires the QT library and OpenGL.
Using the SGM build scripts requires CMake.
The sgm package uses a CMake build. Here are the optional variables that may be passed to cmake for configuration,
and if the variable has one, its default value.
CMAKE_INSTALL_PREFIX, set a path to the location you wish to install the library after buildingBUILD_SHARED_LIBS [OFF], set toONto build shared as opposed to static librariesBUILD_MULTITHREADED [OFF], set toONto build with multithreading supportBUILD_MODEL_VIEWER [OFF], set toONto build the QT based lightweight viewer applicationQt5_DIR, set a path to the install location of the QT library (required ifBUILD_MODEL_VIEWER=ON)
-
Ensure you have XCode and the XCode Command Line Tools (Apple Developer ID required).
-
Ensure you have CMake, or install CMake (using Homebrew for example).
brew install cmake -
Ensure you have a compiler, preferably either:
-
Clang (from your XCode install, or llvm Homebrew),
-
If you do use llvm from Homebrew and MacOS Mojave with XCode 10.14 or later, you must complete this additional step to install standard C/C++ headers:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
-
-
GCC (we recommend version 7.0+, from Homebrew for example).
brew install gcc@7
-
-
Optionally, if you would like to build the viewer application, install QT (download from QT web page or Homebrew).
brew install qt -
To use the GDB debugger on Mac you may need to install gdb with Homebrew and add a certificate.
- Ensure you have CMake.
- Ensure you have a recent compiler with good support for C++11, we recommend GCC 7 or newer.
- To build the viewer application, ensure you have QT installed.
-
Clone the sgm git repository and make a build directory (name of your choice).
cd sgm mkdir build; cd build -
Run and configure CMake, for example, on the command line,
cmake .. -DCMAKE_INSTALL_PREFIX=~/sgm_install -DBUILD_SHARED_LIBS=ON -DBUILD_MODEL_VIEWER=ON -DQt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5 -
Run the
maketool (orninja, or whatever makefile generator you used to configure CMake above) to build all targets and install.make make install -
Optionally build and run unit tests:
make sgm_tests cd bin ./sgm_tests
- If you do not have it already, download and install Microsoft Visual Studio 2017 (or later), the Community Edition is free.
- Download and install a version of QT (choose the open source version if suitable).
-
Clone the sgm git repository and make a build directory (name of your choice).
-
Later versions Visual Studio support CMake projects from the "Add New Project" dialog. Use the dialog to setup the CMake build.
a. Set relevant values for the CMake variables above, under CMake Configuration.
b. The build targets include SGM (library),
sgm_viewer, andsgm_tests.
The SGM product includes a version of the Google Test (gtest) source.
The CMake target for running the main set of unit tests is sgm_tests.
Once the sgm_tests target is built per instructions above,
it can be executed on the command line, or in your favorite IDE. Most recent versions of C++ IDE's have support for
discovery and running of google tests. For example, in Microsoft Visual Studio versions 2017 and later, Google Tests in
a CMake project are automatically discovered and listed in the Test Explorer.