Skip to content

Compilation Guide

NhanLT edited this page Dec 6, 2024 · 3 revisions

Prerequisites

  • A C++ compiler such as GCC (version >= 5) or Clang.

  • CMake (version >= 3.14).

  • OpenMP library for using multithreading. Under Linux, OpenMP is supported by compilers (such as GCC or Clang), no further installation required. Under MacOS, one can use Homebrew - running brew install libomp - to install the OpenMP library.

Download source code

One can directly download the source code of CMAPLE from a Release.

Alternatively, one can clone the source code from CMAPLE's GitHub repo (if having git installed), with:

git clone --recursive https://github.com/iqtree/cmaple.git

Compile the source code

Please find the compilation guide for Linux, Mac OS X, and Windows.

Compile under Linux

  1. Open a Terminal and navigate to your working folder.

     cd <PATH_TO_YOUR_WORKING_FOLDER>
    
  2. Create a build folder and navigate to that folder:

     mkdir build
     cd build
    
  3. Configure source code with CMake:

     cmake <PATH_TO_EXTRACTED_SOURCE_CODE>
    

    To build a static version, please add -DCMAPLE_FLAGS=static to the above command.

    To explicitly specify a compiler, for example, GCC, one can add -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++.

  4. Compile source code with make:

     make
    

    To speedup the compilation, one can use -j option to employ all CPU cores available on your machine.

This creates two executables cmaple and cmaple-aa, for DNA and protein data, respectively.

Compile under Mac OS X

The default compiler on Mac OS X is Clang. Make sure you have the OpenMP library installed as instructed at Prerequisites.

The compilation steps are the same as compilation under Linux. Note that at step 3, you don't need to use -DCMAPLE_FLAGS=static to build a static version.

Compile under Windows

Not tested yet! Sorry!!!

Under Windows, one may need to install the Build Tools for Visual Studio. which includes CMake and Clang.

  1. Install the Ninja-build tool.

  2. Open a Command Prompt and navigate to your working folder.

     cd <PATH_TO_YOUR_WORKING_FOLDER>
    
  3. Create a build folder and navigate to that folder:

     mkdir build
     cd build
    
  4. Configure source code with CMake and Ninja:

     cmake -G Ninja <PATH_TO_EXTRACTED_SOURCE_CODE>
    

    To specify Clang compiler, one can add -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++.

  5. Compile source code with ninja:

     ninja
    
Clone this wiki locally