1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00
libhermit/cmake
Stefan Lankes 34e7895d0a
aarch64 support (#84)
- add initial support for aarch64
- SMP support is currently missing
- uhyve and kernel are tested on Libre AML-S905X-CC (https://libre.computer/products/boards/aml-s905x-cc/)
- only GICv2 support is integrated
2018-03-23 04:04:44 -04: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 aarch64 support (#84) 2018-03-23 04:04:44 -04: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-bootstrap.cmake cmake: add intermediate target hermit-bootstrap to build with bootstrap compiler 2017-04-11 16:21:46 +02:00
HermitCore-Toolchain-x86.cmake aarch64 support (#84) 2018-03-23 04:04:44 -04:00
HermitCore-Utils.cmake Support for forwarding command line parameters and environment variables 2017-11-07 19:51:57 -05:00
HermitCore.cmake aarch64 support (#84) 2018-03-23 04:04:44 -04:00
local-cmake.sh remove typo 2017-09-29 23:46:06 +02:00
README.md cmake: initial support for CMake build system 2017-04-03 18:14:56 +02:00

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.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.