Add config.h for version information

This commit is contained in:
apio 2022-12-03 17:25:25 +01:00
parent bdc9747f9e
commit 1d7b9260c3
3 changed files with 12 additions and 1 deletions

View File

@ -58,6 +58,10 @@ set_target_properties(moon PROPERTIES CXX_STANDARD 20)
target_include_directories(moon PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src)
configure_file(src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/gen/config.h @ONLY)
target_include_directories(moon PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gen)
target_link_options(moon PRIVATE LINKER:-T ${CMAKE_CURRENT_LIST_DIR}/moon.ld -nostdlib -nodefaultlibs)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/moon" DESTINATION ${LUNA_ROOT}/initrd/boot)

6
kernel/src/config.h.in Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#define MOON_VERSION "@CMAKE_PROJECT_VERSION@"
#define MOON_VERSION_MAJOR "@CMAKE_PROJECT_VERSION_MAJOR@"
#define MOON_VERSION_MINOR "@CMAKE_PROJECT_VERSION_MINOR@"
#define MOON_VERSION_PATCH "@CMAKE_PROJECT_VERSION_PATCH@"

View File

@ -4,6 +4,7 @@
#include "arch/Serial.h"
#include "arch/Timer.h"
#include "boot/Init.h"
#include "config.h"
#include "memory/Heap.h"
#include "memory/MemoryManager.h"
#include "video/TextConsole.h"
@ -11,7 +12,7 @@
Result<void> init()
{
kinfoln("Hello, world!");
kinfoln("Starting Moon %s", MOON_VERSION);
kinfoln("Current platform: %s", CPU::platform_string());