Skip to content

Build McStas or McXtrace via basic CMake

Peter Willendrup edited this page Jan 19, 2026 · 2 revisions

Dependencies

Setting up for building McStas/McXtrace

We generally recommend building via either our

You may however build McStas or McXtrace using basic CMake commands, after installing basic build-dependencies yourself:

Basic required build dependencies:

  • cmake
  • A c99-capable compiler and basic build dependencies
    (Debian gcc build-essential)
  • LeX and Yacc (aka. Flex and Bison)
    (Debian flex bison)

Optional build dependencies:

  • A Fortran compiler to allow building cif2hkl
    (Debian gfortran)
  • A LaTeX system to build the manual(s)
    (Debian texlive poppler-utils texlive-latex-extra texlive-bibtex-extra texlive-pstricks texlive-science
  • Tools to build “metapackages”
    (Debian equivs)

(An updated list of dependencies can be found via our conda dependency tool or our legacy dependency scripts


Building

Proceed as normal, i.e.

  • From your repo-checkout (cd McCode) create a build directory (mkdir build) and enter that (cd build)
  • Run cmake .. -DBUILD_MCXTRACE=ON or cmake .. -DBUILD_MCSTAS=ON
  • Run cmake --build . to build
  • Run cmake --install . to install Please refer to CMake documentation for further details

Clone this wiki locally