Skip to content

Build Guide

Michael Gardner edited this page Feb 20, 2020 · 4 revisions

Build Guide

smelt can be built on different platforms using conan and cmake version 3.0 or greater. The necessary configuration files to find external dependencies and build the library are included in the GitHub repository. Currently, smelt has been tested on the following system configurations:

  • Ubuntu 18.04 with GCC 7.3.0
  • Ubuntu 16.04
    • GCC 7.4.0
    • Clang 7.0.0
  • MacOS 10.14 with Xcode 10.2
  • MacOS 10.13 with GCC 7.4.0
  • Windows 10 with Visual Studio 19
  • Windows Server 2016 with Visual Studio 17

External Dependencies

All external dependencies in smelt are managed using conan. How to install these dependencies and build smelt is described in the Building and Testing section. smelt has several header-only dependencies, which include:

  • Boost: For random number generation, statistical distributions and functions
  • Eigen: For linear algebra and matrix operations
  • Catch2: For unit testing
  • JSON for Modern C++: For reading and writing JSON

In addition to header-only dependencies, smelt also requires the following packages:

The cmake build has been configured to discover these libraries through conan, so no additional work is required to make these dependencies available to the compiler.

Building and Testing

In order to build smelt, cmake and conan need to be installed. cmake can be downloaded and installed from the project web page. conan can be installed through pip as follows:

pip install conan

Please make sure you are using Python3 as SimCenter applications do not support Python2. Once conan has completed installation, it is necessary to add the remotes from which dependencies are pulled in. To do so, run the following commands:

conan remote add conan-community https://api.bintray.com/conan/conan-community/conan
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
conan remote add vthiery https://api.bintray.com/conan/vthiery/conan-packages
conan remote add catchorg https://api.bintray.com/conan/catchorg/Catch2
conan remote add simcenter https://api.bintray.com/conan/nheri-simcenter/simcenter 

With these remotes added, we are now ready to start building. From the root directory in the repository, run the following commands to configure and start the build:

  • Linux and MacOS
  mkdir build
  cd build
  conan install ..
  cmake .. -DCMAKE_BUILD_TYPE=Release
  make
  • Windows
  mkdir build
  cd build
  conan install ..
  cmake -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=FALSE ..
  cmake --build . --target ALL_BUILD --config Release

When the build has completed, run the suite of unit tests to make sure smelt functions correctly on your system:

  • Linux and MacOS
  ctest --verbose
  • Windows
  ctest -C Release --verbose

If all tests pass, smelt has been built successfully and is ready for use. Do not worry if the output from the tests show error messages, as some of the tests are supposed to throw exceptions. If ctest shows that 100% of tests passed, then everything is working as expected.

Clone this wiki locally