This page helps you setup your system, install the required packages, and finally build and run SAM.
SAM depends on several packages:
- CMake (need to be installed)
- Boost (need to be installed)
- nlohmanh/json (need to be installed)
- Armadillo (need to be installed)
- mlpack (need to be installed)
- ensmallen (need to be installed)
- spdlog (need to be installed)
- fmt. (need to be installed)
- Lua (need to be installed)
- sol2 (included)
- indicators (included)
- baaraan (included as a submodule)
- effolkronium/random (included)
- rang (included)
Below you can find an instruction on how to install all these dependencies based on your operation system.
Microsoft has recently started to embrace Linux (and open-source) by offering a first party Linux environment inside the Windows. Windows Linux Subsystem, WLS, is an example of this enviroment. As Microsoft puts it, "The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup."
In our tests, this in facts works better than alternatives, e.g., Cygwin, and allows you to quickly and correctly deploy an Ubuntu instance on your system. We recommend you to give this approach a try if you are a Windows user since it offers the cleanest and most robust solutions to build and run SAM in your Windows machine. If you decide to give the WLS a try, you can simply head to the Linux (Ubuntu) section of this guide and follow the same procedure without any issues.
If you are using Windows, in order to avoid unneccessary complications and compilation issues, we recommend setting up your development enviroment by installing Anaconda. By installing Anaconda, you get a full-featured scientific enviroment that simplifies the process of building and managing SAM's dependencies tremendously.
After installing anaconda, open the Anaconda Navigator and open the CMD.exe prompt. Here you can install the required packages using the
conda command. It is advised to enter each command separately.
conda install -c conda-forge cmake conda install -c conda-forge boost-cpp conda install -c conda-forge nlohmann_json conda install -c conda-forge armadillo conda install -c conda-forge mlpack conda install -c conda-forge ensmallen conda install -c conda-forge spdlog conda install -c conda-forge fmt conda install -c conda-forge lua
You can choose to use Anaconda on macOS and Linux as well. If you go with Anaconda, then you can simply ignore the following steps.
Before you start, you need to download and install the Xcode from Mac App Store. In addition, you need to install the Command Line Tools, by running
xcode-select --install in your Terminal, after successfully installing Xcode.
Now, if you do not have Homebrew already installed, you may download and install from here, and after successful installation of Homebrew, you can run the following commands to install all the requirements. This may takes a few minutes...
brew install cmake brew install Lua brew install boost brew install armadillo brew install ensmallen brew install mlpack brew install fmt brew install spdlog brew tap nlohmann/json; brew install nlohmann-json
On Ubuntu, you can install most of the dependencies using the
sudo apt update sudo apt install build-essential sudo apt install cmake sudo apt install liblapack-dev libblas-dev sudo apt install libboost-all-dev sudo apt install libarmadillo-dev sudo apt install lua5.3 liblua5.3-dev
spdlog, you need to build and install these packages manually. This is due to the fact that sometimes there required version of them are not yet deployed in different Linux distros. Please follow the link to their homepage, and follow their instruction.
Based on your distribution and version, these commands may be different, or you may end up having different versions of these packages available to you.
In order to build SAM, you can follow the following steps:
mkdir SAM_Project cd SAM_Project git clone https://amirmasoudabdol.github.com/SAM cd SAM git submodule init; git submodule update; mkdir build cd build cmake .. make
If this process is successful, you should have a file name
SAMrun in your
build/ directory. You can test whether SAM is built correctly and completely by running this command,