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, a set of presets for each platform, including ci-ubuntu, ci-rpm, macOS, and ci-msvc, should be used.
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=ONThe main packages required may be installed via brew:
brew install cmakeLibarchive greater than 3.0.0 is required. For macOS previous to Catalina (19..), libarchive.a 3.3.* must be statically included. Use brew to install a more recent version:
brew install libarchiveTo 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.