Skip to content

Compiling Alpine3D

Once you have the source code of Alpine3D on your computer (either from downloading a source package or from performing a git clone, see the instructions given in Getting MeteoIO), you can compile it.

Compiling Alpine3D

You need to download and install (or download/compile and install) the previously listed packages so they can be automatically found. If you don't want to install either MeteoIO or Snowpack on your system, you have to keep the following directory structure:

                💻
                ┣━━╾ 📂 snowpack trunk
                ┣━━╾ 📂 meteoio trunk
                ┗━━╾ 📂 alpine3d trunk
and then Alpine3D would still find MeteoIO and snowpack automatically.

Please note that for Alpine3D-3.0.0, at least MeteoIO-2.5.1 is needed (there is a source-only package specially for this reason on MeteoIO's page).

You need to have the following tools on your system:

  • cmake (it is highly recommended to also install cmake-curses or cmake-gui);
  • a c++ compiler, for example g++;
  • if you want to generate the documentation, doxygen;
  • if you have latex, this is a plus since it will be able to render some equations in the documentation.

Then, you are ready to compile Alpine3D:

  • open a terminal and change into the trunk folder of alpine3d
  • "ccmake ."
  • Press [c] to configure, it will then populate the screen with configurable options
  • choose the relevant options (toggle ON/OFF by pressing Enter)
  • Press [c] to configure
  • Switch "Openmp" to ON if you want to run Alpine3D in parallel using openmp
  • Switch "MPI" to ON if you want to run Alpine3D in parallel using MPI (note that you must install MPI before)
  • Press [g] to generate and exit the interface (you might have to press [c] a few times for it to have everything finally setup)
  • "make" to compile the code

Once Alpine3D has been compiled, you can install it. There are several options:

In this case, you need system rights, either through sudo or as root but then all users of the system can use your compiled version of Alpine3D.

  • sudo make install

In this case, you don't need special permissions but only your user can use your compiled version of Alpine3D.

  • make install
  • export DYLD_FALLBACK_LIBRARY_PATH={your install prefix path}/lib:$DYLD_FALLBACK_LIBRARY_PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com).
  • export PATH={your install prefix path}/bin:$PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com). By default, Alpine3D will be searched for in ${HOME}/usr so this could be a good location to install it.

Sometimes, it makes sense to keep Alpine3D very close to the simulation data, for example copying the binary files directly in the simulation folder (so everything remains tightly grouped).

  • make deploy to copy all the necessary files for a run in the "bin" subdirectory
  • you currently have to manually copy the "bin" subdirectory to your simulation folder (see Running-a-simulation)

You need to have the following tools on your system:

  • cmake. It is highly recommended to check the box to install both the GUI and the command line tools and to click on "yes" to have it in your path (if this is not done automatically, you will have to add it to your path manually, see below);
  • a c++ compiler, either XCode command line tools (recommended) or the full XCode (you can get a version for free after registering at http://connect.apple.com or directly with a list of versions and operating system versions combinations at https://xcodereleases.com/) or Clang (available through macports);
  • Launch a terminal;
  • type the following command: xcode-select --install
  • in the dialogue window that opens, select "Install", do not select "get Xcode". This is a relatively small install, it should download and install quite quickly.
  • Run it once and select "install" in Preferences > Downloads > Components > Command Line Tools;
  • open a terminal and type the following commands;
    • install clang: sudo port install clang;
    • set mac ports clang as clang compiler: sudo port select --set clang mp-clang-5.0 (you can get a list of all installed versions by typing: sudo port select --list clang);
    • check that the right clang is found: clang --version and clang++ --version (the output should start with clang version XXX and not with Apple LLVM version XXX. If it doesn't work, try run export PATH=/opt/local/bin:/opt/local/sbin:$PATH. You can add it to ~.bash_profile to have it permanently);
    • set it as default compiler: export CC=clang and export CXX=clang++ (You can add it to ~.bash_profile to have it permanently);
    • If you've already compiled the project with XCode, run rm -r CMakeFiles CMakeCache.txt from the trunk directory;

Then, you are ready to compile Alpine3D:

  • open a terminal and change into the trunk folder of alpine3d
  • ccmake . (or cmake-gui .)
  • Press [c] to configure, it will then populate the screen with configurable options
  • choose the relevant options (toggle ON/OFF by pressing Enter). Please note that openmp is currently not supported by MacOS's XCode.
  • Press [c] to configure
  • Do not forget to configure the install path (either system wide if you have access to system rights or in a local directory where you have write permission)
  • Press [g] to generate and exit the interface (you might have to press [c] a few times for it to have everything finally setup)
  • make

Once Alpine3D has been compiled, you can install it. There are several options:

In this case, you need system rights, either through sudo or as root but then all users of the system can use your compiled version of Alpine3D.

  • sudo make install

In this case, you don't need special permissions but only your user can use your compiled version of Alpine3D.

  • make install
  • export DYLD_FALLBACK_LIBRARY_PATH={your install prefix path}/lib:$DYLD_FALLBACK_LIBRARY_PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com).
  • export PATH={your install prefix path}/bin:$PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com). By default, Alpine3D will be searched for in ${HOME}/usr so this could be a good location to install it.

Sometimes, it makes sense to keep Alpine3D very close to the simulation data, for example copying the binary files directly in the simulation folder (so everything remains tightly grouped).

  • make deploy to copy all the necessary files for a run in the "bin" subdirectory
  • you currently have to manually copy the "bin" subdirectory to your simulation folder (see Running-a-simulation)

You need to have the following tools on your system:

  • cmake;
  • a c++ compiler, among others, you can use Code::Blocks, MinGW, Visual C++. See links and detailed instructions below.
  • if you want to generate the documentation, doxygen;
  • if you have latex, this is a plus since it will be able to render some equations in the documentation.

Then, you are ready to compile Alpine3D:

  • Start CMake and set the source path to your local Alpine3D trunk and set the trunk directory as build directory. Click on "Configure" and select the appropriate compiler according to what you have. If you want to build the documentation (see at the bottom of this page), you need to have installed doxygen before running cmake (or you have to run it again once doxygen has been installed).
  • Then, depending on you compiler (either Code::Blocks, MinGW or Visual C++):
  • It can be downloaded free at www.codeblocks.org. We highly recommend to download the full package (ie: the one containing MinGW)
  • when installing Code::Blocks, the MinGW installation might have to be tweaked as explained below in the MinGW section (if the package has not been fixed)
  • In CMake, select "Code::Blocks - MinGW Makefiles" as the generator
  • Click on "Configure" to populate the screen with configurable options
  • You can switch "Openmp" to ON if you want to run Alpine3D in parallel using openmp but MPI is not supported on Windows
  • Click on "Generate"
  • Open the project file (ending in .cbp) with Code::Blocks and compile it
  • It can be downloaded free at MinGW
  • IMPORTANT: When installing MinGW make sure that you install MinGW together with MinGW make and add the MinGW bin directory to your PATH environment variable
  • create a shortcut (or simply a copy) named make.exe in the MinGW bin directory pointing to mingw-make.exe in the same directory
  • In CMake, select "MinGW Makefiles"
  • Click on "Configure" to populate the screen with configurable options
  • You can switch "Openmp" to ON if you want to run Alpine3D in parallel using openmp but MPI is not supported on Windows
  • in CMake, click on "Generate"
  • Run cmd.exe, change into the build directory as specified for CMake (e.g. trunk) and run "mingw32-make"
  • It can be downloaded free at Microsoft, after registration (this is not open source software!)
  • In CMake, select "Visual Studio XX" where XX is your version
  • Click on "Configure" to populate the screen with configurable options
  • For Visual C++, you currently can not enable openmp nor MPI
  • in CMake, click on "Generate"
  • open the project file (ending in .sln) with Visual C++ and compile
  • Once Alpine3D has been compiled, you can copy its binary files and DLLs (libmeteoio, libsnowpack and libalpine3d) into the folder where you want to run it from.