From ccb9dbd3f78d9f06826560bd54519bab3477947a Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Thu, 23 Jul 2026 14:37:44 +0700 Subject: Include cmake feature module in the build routine Add predicate `ifFeatureEnables` that checks feature is define or not, and return accordingly boolean value. Consider some cmake objective targets as features. Populate information to these targets, and provides in particular file `CMakeFeatures.txt`. Cpuid, MSR, ACPI and driver VGA in text mode they are. Signed-off-by: Alexey Gavrilov --- arch/x86/io/CMakeLists.txt | 55 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'arch/x86/io/CMakeLists.txt') diff --git a/arch/x86/io/CMakeLists.txt b/arch/x86/io/CMakeLists.txt index 0686529..b63c4eb 100644 --- a/arch/x86/io/CMakeLists.txt +++ b/arch/x86/io/CMakeLists.txt @@ -16,19 +16,42 @@ * ObjectiveOS. If not, see . ]] -add_library(IO STATIC) -target_link_libraries(IO PUBLIC CXX_COMPILER_REQUIREMENTS) - -target_sources(IO PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/VGADisplay.cpp -) - -target_sources(IO - PUBLIC - FILE_SET HEADERS - FILES - ${CMAKE_CURRENT_LIST_DIR}/VGADisplay.h - ${CMAKE_CURRENT_LIST_DIR}/VGADisplayInfo.h -) - -target_link_libraries(Architecture INTERFACE IO) +set(IS_DISPLAY_DEFINES TRUE) +ifFeatureEnables(DISPLAY IS_DISPLAY_DEFINES) + +if(NOT IS_DISPLAY_DEFINES) + add_library(DISPLAY INTERFACE) +else() + target_compile_definitions(CXX_COMPILER_REQUIREMENTS INTERFACE + FEATURE_DISPLAY + ) + + add_library(DISPLAY STATIC) + target_link_libraries(DISPLAY PUBLIC CXX_COMPILER_REQUIREMENTS) + + target_sources(DISPLAY PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/VGADisplay.cpp + ) + + target_sources(DISPLAY + PUBLIC + FILE_SET HEADERS + FILES + ${CMAKE_CURRENT_LIST_DIR}/VGADisplay.h + ${CMAKE_CURRENT_LIST_DIR}/VGADisplayInfo.h + ) + + target_link_libraries(Architecture INTERFACE DISPLAY) +endif() + +startFeatureRecording(DISPLAY) + +setFeatureField(NAME "VGA driver for x86 processors") +setFeatureField(HASHCOMMIT "b82ccebd3a0cce28177b5fac046139e2de7737fa") +setFeatureField(DESCRIPTION "Add ability to write into framebuffer" + "under the x86 processorҕ") +setFeatureField(TAGS "NEW") +setFeatureField(AUTHORSHIP "Alexey Gavrilov ") +setFeatureDependencies(x86) + +saveFeatureRecording() -- cgit v1.2.3