48 Commits

Author SHA1 Message Date
Gerwin Klein
8d3313ac25 trivial: adjust style for new cmake-format
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2025-10-24 09:41:03 +11:00
Nick Spinale
d310f5f137 cmake: record all disabled options
Before this change, options that were hidden from the cmake-gui due to
unsatisfied config_choice conditions were not recorded in
gen_config.{yaml,json,h}. After this change, these hidden options are
recorded as disabled.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2025-10-24 09:41:03 +11:00
Fennelfoxxo
6a74aba245 CMake: Use output file diffing from config_gen.py
Take advantage of the new --skip-unchanged option added to the
config_gen.py header generator to skip regenerating unchanged header
files which forced a rebuild of the entire project whenever CMake was
reconfigured.

Signed-off-by: James Martin <fennelfoxxo@gmail.com>
2025-04-27 11:33:45 +10:00
julia
eca86cff19 treewide: typo fixes
Signed-off-by: julia <git.ts@trainwit.ch>
2025-04-14 12:05:16 +10:00
Peter Chubb
e7bb62d2ce Bump minimum CMake version
Compatibility with versions <3.10 is going away.
As it happens, we're not using any CMake features that have changed
between 3.7 and 3.16, so bump the lowest version to 3.16.

Also remove the minimum version statement from the platform config
files --- they're all very simple files that are version independent;
and the version is checked elsewhere anyway.

Also, Fix style issue

A commit to fix style to make the PR go through.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
2025-02-26 17:11:57 +11:00
Gerwin Klein
c5b23791ea configs: additional verified platforms
With recent proof improvements the proofs now apply to further platforms
in the ARM and AARCH64 configurations.

Refactor the verified configs to build on one include file per major
architecture which is then used for each platform with potentially
modified settings. Add path argument to `cmake_script_build_kernel`
macro to accommodate inclusion from different locations in the file
system.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2024-10-25 16:23:44 +11:00
Axel Heider
f461e0fa17 cmake: remove obsolete variable
This should not have been added in commit ad4ea6cd. And since
commit c642a398 this is handled by a python script anyway.

Signed-off-by: Axel Heider <axel.heider@codasip.com>
2024-04-10 21:13:15 +01:00
Axel Heider
600ea414e0 trivial/cmake: add missing bracket in comment
Signed-off-by: Axel Heider <axel.heider@codasip.com>
2024-04-08 15:50:34 +01:00
Nick Spinale
2c8bc584da cmake: generate config headers at config-time
Commit 6d439a4646, which added JSON configuration output, caused the
configuration headers to be generated at build-time instead of
configure-time.  This broke CAmkES build systems which depend on
configuration headers in CAmkES files at configure-time.

This commit makes the configuration headers available at configure-time.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-10-28 07:36:42 +11:00
Gerwin Klein
57c46bc8d0 bitfield_gen: comment for original source file
Add a `--form_file <file>` option to the bitfield generator for
printing a `/* generated from <file> */` message in a comment.

Use this option in cmake to provide the original source .bf file before
preprocessing so it's easier to find out where the corresponding
definitions are.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-10 15:46:00 +10:00
Nick Spinale
c642a398ba cmake: provide gen_config.json
gen_config.json provides a language-independent means of accessing the
kernel configuration. Before, gen_config.h was generated directly in
CMake.  Now, gen_config.yaml is generated directly in CMake, and
gen_config.h and gen_config.json are derived from gen_config.yaml.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-03-02 09:31:42 +11:00
Nick Spinale
acba034390 cmake: add missing dependency for autoconf
Declare that autoconf.h depends on each gen_config.h that it references.

Signed-off-by: Nick Spinale <nick@nickspinale.com>
2023-03-02 09:31:42 +11:00
Axel Heider
ad4ea6cd08 CMake: unify config options define generation
Add disabled options from the build system as comments in the generated
header files.

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-07-01 12:05:37 +10:00
Axel Heider
9a4d3ae51d CMake/autoconf: remove unused AUTOCONF_INCLUDED
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-06-09 09:50:02 +10:00
Axel Heider
0a6e04769e autoconf: use "#pragma once" include guard
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-06 02:24:41 +01:00
Axel Heider
a5c2d51386 CMake: add include guard to auto-generated files
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-03 11:49:07 +01:00
Axel Heider
36ebac4fb4 trivial: fix typo in comment
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-03 11:47:23 +01:00
Axel Heider
f46df2ad6d CMake: remove unused macros
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-02-01 18:44:20 +01:00
Gerwin Klein
79da079239 Convert license tags to SPDX identifiers
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
2020-03-09 13:21:49 +08:00
Kent McLeod
b785b59930 cmake: Add SEL4_CONFIG_DEFAULT_ADVANCED variable
This directory-scoped varible is now used by config_option,
config_choice and config_string to set a created CMake cache variable as
advanced or not. An advanced variable is hidden by default in the CMake
configuration editors. Setting SEL4_CONFIG_DEFAULT_ADVANCED to ON will
cause variables to be advanced and not show up in the cache. Projects
can set this to limit the amount of options presented in the
config editor. Any cache variable can have this overridden by calling
mark_as_advanced(CLEAR config_name)
2019-09-13 18:42:42 +10:00
Kent McLeod
297d2b63da CMake: Invoke configuration files to build kernel
This leverages #!/usr/bin/env -S cmake -P to invoke a cmake
configuration file as a script that configures and builds a kernel in
the current directory with the configuration that was invoked. It is a
quick way for producing a kernel.elf or kernel_all_pp.c input file to
verification for a particular config.
2019-09-13 18:42:42 +10:00
Anna Lyons
bc61a7f3bd python2 --> python3
Update all scripts and build system to call python3, given python2's
upcoming doom. Use sys.maxsize instead of sys.maxint in one script
(maxint does not exist in python3).
2019-08-08 10:19:24 +10:00
Kent McLeod
82f2d1fc9c helpers.cmake: Add FORCE to all INTERNAL sets
INTERNAL implies FORCE but in some versions of CMake if a config option
has been passed in via a -D option the INTERNAL set doesn't override the
value when it should.

See: https://gitlab.kitware.com/cmake/cmake/issues/19015
  INTERNAL does not imply FORCE for CACHE
2019-06-27 18:29:55 +10:00
Kent McLeod
3707f65c6f CMake: Refactor DTS compilation step in CMake
- Minimise calls to external_process as this is more expensive than
using built-in CMake file operations.
- Update check_outfile_stale to also save the list of files it checks
for stale checks so if a config changes the list of files then the
output file will still be stale even if the input list of files are
older than it.
2019-05-07 10:15:54 +10:00
Kent McLeod
9db06db088 CMake: Remove unused cmake module import
While some functionality in helpers.cmake is based on
CMakeDependentOption, this module isn't actually used.
2019-05-07 10:00:08 +10:00
Anna Lyons
ffa9fda8f0 style: use consistent styling for all cmake files
Add .cmake-format.yaml which defines custom functions with kwargs to
style nicely
2019-03-22 11:52:06 +11:00
Anna Lyons
86ed25b8c0 cmake: use snake_case for RegisterDriver & CPPFile
Our upcoming cmake styling tool requires any custom functions you want
styled nicely to be lower case. We only need to style these two nicely,
as they have kwargs we would like aligned.
2019-03-22 11:50:04 +11:00
Kent McLeod
0cc4997a16 cmake: add check_outfile_stale macro
This checks if a file is older than other files during CMake configure
phase. This is to prevent unnecessary long running execute_process
calls.
2019-03-12 08:55:05 +11:00
Anna Lyons
eceefa883d cmake: add kernel platform helpers.
Add kernel_platforms_string and kernel_platforms_list to tools/helpers.cmake.
kernel_platforms_string: concatenates all platform strings together into a
newline separated string.
kernel_platforms_list: returns a list of all kernel platforms.
2018-12-10 16:36:22 +11:00
Kent McLeod
02c9895f66 CMake: Add missing dependency to CPPFile function 2018-09-03 11:11:51 +10:00
Adam Felizzi
43b7bca872 CMake: CPPFile EXACT_NAME creates a temp copy
Modified the behaviour of the EXACT_INPUT option within the
CPPFile helper function. Now named EXACT_NAME, the option
copies the input file to a temporary file. The name of the
temporary file is also passed in by the caller. This
step in necessary in getting the CPP step to correctly
depend on the targets given by the caller
(through EXTRA_DEPS). Also updated the CPP generation of the
kernel_all.i file to reflect the change.
2018-08-27 10:18:10 +10:00
Kent McLeod
639b7fbd37 CMake: Add get_absolute_list_source_or_binary
This function checks CMAKE_CURRENT_LIST_DIR and then calls
get_absolute_source_or_binary if the file wasn't found
2018-07-24 15:00:21 +10:00
Corey Lewis
b50c6a86df cmake: Use ABSOLUTE instead of REALPATH
REALPATH was unnecessary and results in resolving symlinks in the target, although
the working directory will not have its symlink resolved. This results in very strange
paths from the base directory (which is the working directory) to the target.
2018-04-04 15:51:45 +10:00
Adrian Danis
ccac858da8 cmake: Remove GenCPPCommand
This helper was ugly when written and simply should not be used over the CPPFile helper.
2018-02-22 14:51:48 +11:00
Adrian Danis
a19a2b3b8d cmake: CPPFile New helper for just pre-processing files
This is a new version of GenCPPCommand that uses an OBJECT library intermediate to get
cmake to do 'arbitrary' compilation (by adding the -E flag) where the result does not
need to be linkable. The advantage of this over the GenCPPCommand version is there is
no need for trying to manually invoke GCC with all the correct arguments lists.
2018-02-22 14:51:48 +11:00
Adrian Danis
118a7869f4 cmake: get_absolute_source_or_binary is a function
As a macro this helper would not operate as expected if output and input were defined
as the same variable. Making a function and explicitly writing into the PARENT_SCOPE
fixes this and also makes the code simpler
2018-02-22 14:51:48 +11:00
Adrian Danis
4b8a3e24d2 config: Reset options to default when enabled
This change makes values take on more intuitive and expected defaults when gradually
configuring the kernel, either programatically or through the graphic interfaces
2018-02-07 11:49:28 +11:00
Kent McLeod
33192cd8ae cmake config_choice: save options in cache var
This is to make it possible to enumerate all config options instead of
just the 'valid' ones that are saved as the STRINGS property.
2018-02-01 15:11:43 +11:00
Adrian Danis
9a89cbe4c6 cmake: TOPLEVELTYPES declared as target property
TOPLEVELTYPES is not intended to be configurable by the user, rather is a reflection
on the types defined by the source. This changes the TOPLEVELTYPES argument to be
a property, allowing it to be constructed as a generator expression when generating
BF files. By being a property, and not something like a global property, it removes
the need to ensure that additions to TOPLEVELTYPES are done prior to any bitfield
target definitions.
2017-11-15 17:33:13 +11:00
Adrian Danis
a2c8462efb cmake: Expand lists in BF generation
Uses the COMMAND_EXPAND_LISTS flag to allow for generator expressions in parameters
to GenBFCommand. As lists are now being expanded the 'args' variable must also be
quoted.
2017-11-15 17:33:13 +11:00
Adrian Danis
aa3fc06c79 cmake: Make variables show up if previously hidden
Previously if a variable had unmet dependencies and had been hidden, by being made
an internal variable, it would not have been unhidden by the use of `option`. This
emulates the behaviour of `option` that we were wanting, but additionally using `FORCE`
to override the `INTERNAL` setting
2017-11-03 16:39:45 +11:00
Adrian Danis
24a69963e7 cmake: Directly generate configuration files
Uses file(GENERATE) to directly create the contents of generated configuration files instead of
awkwardly using custom commands to echo the contents of multi line strings into files.
2017-11-03 13:49:37 +11:00
Adrian Danis
89fb678db8 cmake: Invoke compilations without echo and xargs
Newer versions of cmake provide a COMMAND_EXPAND_LISTS option that allows a quoted string,
such as "a;b" to be given to a COMMAND parameter and have it expand into multiple arguments.
Using this we can much more nicely generate some of our COMMAND invocations, at the cost of
requiring a more recent cmake version
2017-11-03 13:49:37 +11:00
Gerwin Klein
38cc67e821 slightly more Mac friendly cmake commands
Mac has BSD sed, not GNU sed; tr seems to be more portable.
2017-11-02 13:39:13 +11:00
Adrian Danis
3a48b9fa33 cmake: Unset CACHE variables from the CACHE
These variables were meant to be removed from the cache
2017-10-27 14:13:31 +11:00
Adrian Danis
777f19645b cmake: Correctly set options to their DEFAULT_DISABLED values
The config_option helper was previously using cmake_dependent_option, which supposedly took
a value to set the option to in the case where it was disabled. However, this only sets
the value in the current function context, and not the cache. I do not understand why this
is the case and it seems to make that functionality completely useless. This commit simply
does the dependency checking itself and correctly sets the disabled value.
2017-10-27 14:13:05 +11:00
Adrian Danis
eac4f6bfa2 proof: Defer theory dependencies to isabelle
Instead of explicitly depending on Kernel_C.thy prior to generating proofs, this removes
the dependency check and leaves isabelle to check the dependency upon import.
2017-09-20 14:22:14 +10:00
Adrian Danis
0b73072016 Add a CMake based build system
This commit adds an alternate build system using CMake that operates indepenently of
the existing Kconfig+Kbuild+make based build system
2017-08-22 13:56:26 +10:00