libhermit/cmake
Jonathan Klimt 7977ae3910
changed python to python3
Script is written in python3, all distros should contain python3 but python does not always correspond to python3
2020-10-22 01:08:04 +02:00
..
golang cmake: initial support for CMake build system 2017-04-03 18:14:56 +02:00
HermitCore-Application.cmake cmake: initial support for CMake build system 2017-04-03 18:14:56 +02:00
HermitCore-Configuration.cmake bump version number to 0.2.10 2019-06-01 09:33:58 +02:00
HermitCore-Paths.cmake cmake: initial support for CMake build system 2017-04-03 18:14:56 +02:00
HermitCore-Toolchain-aarch64-bootstrap.cmake aarch64 support (#84) 2018-03-23 04:04:44 -04:00
HermitCore-Toolchain-aarch64.cmake aarch64 support (#84) 2018-03-23 04:04:44 -04:00
HermitCore-Toolchain-x86_64-bootstrap.cmake determine default architecture via uname 2018-04-22 16:47:28 +00:00
HermitCore-Toolchain-x86_64.cmake determine default architecture via uname 2018-04-22 16:47:28 +00:00
HermitCore-Utils.cmake Support for forwarding command line parameters and environment variables 2017-11-07 19:51:57 -05:00
HermitCore.cmake determine default architecture via uname 2018-04-22 16:47:28 +00:00
README.md determine default architecture via uname 2018-04-22 16:47:28 +00:00
local-cmake.sh changed python to python3 2020-10-22 01:08:04 +02:00

README.md

HermitCore CMake build system

HermitCore requires at least CMake version 3.7, which (at the time of introduction) is not yet available on most Linux distributions. We therefore provide a script cmake/local-cmake.sh that fetches precompiled binaries from the CMake project and installs them locally in cmake/cmake-3.7*. Only when sourced for the first time it will download CMake, on further runs it detects the existing download and adds it to PATH automatically.

$ . cmake/local-cmake.sh
-- Downloading CMake
cmake-3.7.2-Linux-x 100%[=================>]  29,26M   837KB/s    in 19s
-- Unpacking CMake
-- Local CMake v3.7.2 installed to cmake/cmake-3.7.2-Linux-x86_64
-- Next time you source this script, no download will be neccessary
$ which cmake
/home/[...]/HermitCore/cmake/cmake-3.7.2-Linux-x86_64/bin/cmake

Directory structure

cmake/
├── golang
│   ├── CMakeDetermineGoCompiler.cmake
│   ├── CMakeGoCompiler.cmake.in
│   ├── CMakeGoInformation.cmake
│   └── CMakeTestGoCompiler.cmake
├── HermitCore-Application.cmake
├── HermitCore.cmake
├── HermitCore-Paths.cmake
├── HermitCore-Toolchain-x86_64.cmake
├── HermitCore-Utils.cmake
├── local-cmake.sh
└── README.md

Additional language support

Currently, HermitCore supports C, C++, Fortran, Go through Cmake. While the former are supported and detected by CMake out-of-the-box, Go support has been added manually for HermitCore.

Adding a new language requires you to provide CMake hints where to find the toolchain and then how to compile and link binaries. The Go support in cmake/golang may serve as an example on how to add a new language.

To finally enable the language it has to be added to CMake's module path in cmake/HermitCore.cmake:

# scripts to detect HermitCore Go compiler
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/golang/)

# scripts to detect new language
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/new-language/)

User applications

You just have to include HermitCore-Application.cmake before the project() command in your CMakeLists.txt in order to build applications for HermitCore. For configuration parameters of the project, please consult the README.md in the root of this repository.