srcML is built using cmake, www.cmake.org (version 3.28 or above), and currently supports builds for macOS, Fedora, Ubuntu, OpenSUSE, and Windows Visual Studio.
Out-of-source builds (builds outside the source directory) are required, and in-source builds are not supported.
For full configuration, use a presets for your platform: ci-ubuntu, ci-rpm, ci-macos, and ci-msvc.
To generate a makefile in your build directory:
cmake <path_to_srcml> --preset <platform_preset>For Linux, assuming a sibling build directory:
cmake ../srcML --preset ci-linuxThe following targets are supported with their usual meaning.
make
make clean
make test
make installClient tests are enabled by default, while libsrcml and parser tests are turned off by default. These tests can be turned on/off via the cmake command.
cmake . -DBUILD_CLIENT_TESTS=OFF -DBUILD_LIBSRCML_TESTS=ON -DBUILD_PARSER_TESTS=ONIf your system has not been setup for C/C++ development, you will need to install Xcode tools to provide standard library headers
sudo xcode-select --installThe main packages required may be installed via brew:
brew install cmake ninjaTo generate srcML documentation:
brew install man2html doxygenAdditional packages that may not needed but are recommended (for timing, etc.):
brew install coreutils gnu-sed gnu-time
Linux builds for Ubuntu, Fedora, and OpenSUSE are supported.
To find what is needed, it is recommended to consult these dockerfiles for the particular distribution:
Commands to install what is needed can be adapted from these.
Necessary tools include:
Building in Windows requires MSVC. Dependencies are handled via vcpkg, see the vcpkg installation directions. As with the other platforms, srcml should use an out-of-source build.
First, generate the build files in your target build directory. Using the preset sets up the use of vcpkg:
cmake [path to srcML source directory] --preset ci-msvcSecond, build. Doing so via cmake means you do not have to know the build program name or location:
cmake --build . --config releaseThe directory bin in the build folder contains the srcML executable along with all other dependencies.