build: add real version numbering
This commit is contained in:
+16
-1
@@ -16,6 +16,21 @@ set(generic_src_dirs ds init kernel libc sched util vm syscall)
|
||||
set(kernel_sources "")
|
||||
set(kernel_headers "")
|
||||
|
||||
set(version_args --arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
|
||||
if (CMAKE_BUILD_TYPE AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(version_args ${version_args} "--release")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/magenta.buildid
|
||||
${version_args}
|
||||
OUTPUT_VARIABLE kernel_version
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
message(STATUS "Magenta kernel version: ${kernel_version}")
|
||||
|
||||
foreach (dir ${generic_src_dirs})
|
||||
file(GLOB_RECURSE dir_sources ${dir}/*.c)
|
||||
file(GLOB_RECURSE dir_headers ${dir}/*.h)
|
||||
@@ -52,7 +67,7 @@ add_custom_command(
|
||||
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:${kernel_exe_name}>)
|
||||
|
||||
target_link_libraries(${kernel_exe_name} -nostdlib -ffreestanding -lgcc)
|
||||
target_compile_definitions(${kernel_exe_name} PRIVATE BUILD_ID="0")
|
||||
target_compile_definitions(${kernel_exe_name} PRIVATE KERNEL_VERSION="${kernel_version}")
|
||||
|
||||
include(arch/${kernel_arch}/config.cmake)
|
||||
include(arch/${kernel_arch}/targets.cmake)
|
||||
|
||||
Reference in New Issue
Block a user