The cmake utility simplifies the build process for GTFold which originally
used a Makefile generated by running the configure script and autotools.
The core of the cmake-based build process is found in the CMakeLists.txt
configuration file in the base directory. This script will build all of the
utilities using g++ in the gtfold-mfe directory, e.g., the
following command line applications:
gtmfe, gtboltzmann, and gtsubopt.
Documentation for the usage and parameters to each of these
programs is found here.
Using the Homebrew package manager, run the following command:
$ brew install llvm@11 libomp cmakeIf any of the above commands fail due to an existing installation of the package, try running the following command instead:
$ brew upgrade llvm libomp cmakeThe versions of the brew packages used for testing are libomp (11.0.1) and
cmake (3.19.4).
The llvm package (llvm: stable 11.1.0 (bottled))
installs a more recent version of the clang compiler
toolchain than ships with current MacOS builds. It is necessary to upgrade because
the default gcc (symlinked to a dated clang binary by default) on Mojave/10.14
is not modern enough to support the C++ standards we require for the GTFold build process.
Run the following commands to install compiler tools and
the cmake utility:
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install build-essential cmakeRun the following command at your terminal of choice:
$ git clone https://github.com/gtDMMB/gtfold.git
$ cd gtfold
$ rm -rf CMakeFiles/
(On MacOS -- MacOS/10.14/Mojave Office Box)
$ cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" \
-DCMAKE_C_LINK_EXECUTABLE="/usr/local/opt/llvm/bin/ld.lld" \
-DMACOS_OFFICE_BOX=1
(On MacOS -- MacOS/10.14/Mojave Mini Desktop Box)
$ cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" \
-DCMAKE_C_LINK_EXECUTABLE="/usr/local/opt/llvm/bin/ld.lld" \
-DMAC_ISYSROOT_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr"
(On Linux/Unix)
$ cmake . -DCMAKE_BUILD_TYPE=Release -DLINUX_GCC=1
$ make clean && make VERBOSE=1Notice that we have maintained three CMakeLists.txt files for compilation on two variants of patched
MacOS 10.14/Mojave machines (using clang/clang++), and one using the gcc/g++ for Linux and other
Unix like system variants. The g++ compiler toolchain is more standard on Linux.
Using clang++ installed with the Homebrew llvm package is easier on current MacOS/10.14/Mojave builds.
Because of subtle differences in XCode and/or CommandLineTools versions on different Mojave boxes,
we have included two separate MacOS configurations that are used with cmake. If one does not work, we
recommend trying the other variant before posting a new issue about cmake related build failures.
Run the following command first if the CMakeLists.txt file has changed since the last
build/re-compile of GTFold:
$ rm -rf CMakeCache.txt Makefile cmake_install.cmake CMakeFiles/Run the following commands to put the newly built GTFold
executables in the system path (from within the base gtfold/ directory):
$ sudo cp gtfold gtmfe gtboltzmann gtsubopt /usr/local/bin
$ sudo chmod 0644 /usr/local/bin/{gtfold,gtmfe,gtboltzmann,gtsubopt}Alternately, you can configure your local (bash) shell to alias these
commands so that the binaries invoked by running the associated command name
are linked at the current working directory, e.g., so that running
$ gtmfe [options] at the command line works directly regardless of the
actual directory you are located in at runtime.
(On MacOS):
$ export gtfoldCwd="$(greadlink -f .)"
$ echo "alias gtfold='$gtfoldCwd/bin/gtfold'" >> ~/.bash_profile
$ echo "alias gtmfe='$gtfoldCwd/bin/gtmfe'" >> ~/.bash_profile
$ echo "alias gtboltzmann='$gtfoldCwd/bin/gtboltzmann'" >> ~/.bash_profile
$ echo "alias gtsubopt='$gtfoldCwd/bin/gtsubopt'" >> ~/.bash_profile
$ source ~/.bash_profileNote that if greadlink is not found, you can install it using brew by running
$ brew install greadlink(On Linux/Unix):
$ export gtfoldCwd="$(readlink -f .)"
$ echo "alias gtfold='$gtfoldCwd/bin/gtfold'" >> ~/.bashrc
$ echo "alias gtmfe='$gtfoldCwd/bin/gtmfe'" >> ~/.bashrc
$ echo "alias gtboltzmann='$gtfoldCwd/bin/gtboltzmann'" >> ~/.bashrc
$ echo "alias gtsubopt='$gtfoldCwd/bin/gtsubopt'" >> ~/.bashrc
$ source ~/.bashrc