summaryrefslogtreecommitdiffstats
path: root/cmake/module
diff options
context:
space:
mode:
authorAlexey Gavrilov <alexey.gavrilov@mail.com>2026-07-03 11:52:41 +0700
committerAlexey Gavrilov <alexey.gavrilov@mail.com>2026-07-03 11:52:41 +0700
commit4b51da0ae181ded262ff7609bd0baac67a4e92ba (patch)
treeb2ed80261d7fa438ac1ca206e9e79db2fea42183 /cmake/module
parent0d1d78eb82075c9543aa06af576825902e8ec52f (diff)
File write functions changes
In `outFeaturesToFile` function toolset is appends to a resulting file (cmake toolchain file or arch, compiler if previous is not specify). Toolset mention needs to filter available features for a specific platform. FEATURE_<feature>_IS_ENABLING var also provides when <feature> already enabled. Build type is not in toolset now. That means to parse `CMAKE_BUILD_TYPE` anyway when toolset is processing even if `CMAKE_TOOLSCHAIN_FILE` is specified. Signed-off-by: Alexey Gavrilov <alexey.gavrilov@mail.com>
Diffstat (limited to 'cmake/module')
-rw-r--r--cmake/module/feature.cmake28
-rw-r--r--cmake/module/metadata.cmake8
-rw-r--r--cmake/module/runfile.cmake8
3 files changed, 35 insertions, 9 deletions
diff --git a/cmake/module/feature.cmake b/cmake/module/feature.cmake
index d350227..193df46 100644
--- a/cmake/module/feature.cmake
+++ b/cmake/module/feature.cmake
@@ -174,12 +174,29 @@ endfunction()
# <FEATURE_PROPERTY> = "<VARIABLE>"
]]
function(outFeaturesToFile)
+ get_directory_property(cacheVars CACHE_VARIABLES)
get_property(FEATURES_LIST GLOBAL PROPERTY FEATURES_LIST)
set(OUT_FILE "${CMAKE_BINARY_DIR}/${FEATURE_OUT_FILE}")
file(WRITE "${OUT_FILE}"
"# This file contains list of kernel configurable objects\n\n")
+ file(APPEND "${OUT_FILE}" "# Toolset variables\n")
+ if("CMAKE_TOOLCHAIN_FILE" IN_LIST cacheVars
+ AND NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
+ cmake_path(GET CMAKE_TOOLCHAIN_FILE FILENAME TOOLCHAIN_FILE_NAME)
+ file(APPEND "${OUT_FILE}"
+ " -DCMAKE_TOOLCHAIN_FILE="
+ "${ObjectiveProject_SOURCE_DIR}/cmake/toolchain/${TOOLCHAIN_FILE_NAME}")
+ else()
+ cmake_path(GET CMAKE_CXX_COMPILER FILENAME CXX_COMPILER_EXECUTABLE)
+ file(APPEND "${OUT_FILE}"
+ "CMAKE_CXX_COMPILER = \"${CXX_COMPILER_EXECUTABLE}\"\n")
+ file(APPEND "${OUT_FILE}"
+ "ObjectiveProject_ARCHITECTURE = "
+ "\"${ObjectiveProject_ARCHITECTURE}\"\n")
+ endif()
+ file(APPEND "${OUT_FILE}" "\n\n")
foreach(feature IN LISTS FEATURES_LIST)
get_property(FEATURE_DEPENDENCIES TARGET ${feature} PROPERTY
FEATURE_DEPENDENCIES)
@@ -194,7 +211,16 @@ function(outFeaturesToFile)
"FEATURE_${feature}_${FIELD_NAME} = \"${FEATURE_${FIELD_NAME}}\"\n")
endforeach()
+ # Check if feature is enable, and push them to file
+ if("FEATURE_${feature}" IN_LIST cacheVars
+ AND NOT "${FEATURE_${feature}}" STREQUAL "")
+ file(APPEND "${OUT_FILE}"
+ "FEATURE_${feature}_IS_ENABLING = "
+ "\"TRUE\"\n")
+ endif()
+
file(APPEND "${OUT_FILE}"
- "FEATURE_${feature}_${FIELD_NAME} = \"${FEATURE_DEPENDENCIES}\"\n\n\n")
+ "FEATURE_${feature}_DEPENDENCIES = \"${FEATURE_DEPENDENCIES}\"\n\n\n")
+
endforeach()
endfunction()
diff --git a/cmake/module/metadata.cmake b/cmake/module/metadata.cmake
index 00f7ad4..de3a65f 100644
--- a/cmake/module/metadata.cmake
+++ b/cmake/module/metadata.cmake
@@ -17,10 +17,10 @@
]]
# FIX: get elements from ObjectiveProject_ROOT/arch directory
-set(OBJECTIVE_SUPPORTED_PROCESSORS x86;arm CACHE STRING "Supported
-processors by Objective kernel")
+set(OBJECTIVE_SUPPORTED_PROCESSORS x86;arm CACHE STRING
+ "Supported processors by Objective kernel")
# FIX: get apps from docs
-set(OBJECTIVE_SUPPORTED_ISO_CREATION_APPS grub-mkrescue CACHE STRING "Supported
-apps to create an ISO image")
+set(OBJECTIVE_SUPPORTED_ISO_CREATION_APPS grub-mkrescue CACHE STRING
+ "Supported apps to create an ISO image")
diff --git a/cmake/module/runfile.cmake b/cmake/module/runfile.cmake
index af196aa..f9d1640 100644
--- a/cmake/module/runfile.cmake
+++ b/cmake/module/runfile.cmake
@@ -24,25 +24,25 @@ macro(parseFeatures vars outfile)
endmacro()
macro(parseToolset vars outfile)
+ convertCacheVarIntoArg(CMAKE_BUILD_TYPE ${vars} ${outfile})
if("CMAKE_TOOLCHAIN_FILE" IN_LIST ${vars} AND NOT ${CMAKE_TOOLCHAIN_FILE})
cmake_path(GET CMAKE_TOOLCHAIN_FILE FILENAME TOOLCHAIN_FILE_NAME)
file(APPEND ${${outfile}}
" -DCMAKE_TOOLCHAIN_FILE="
"${ObjectiveProject_SOURCE_DIR}/cmake/toolchain/${TOOLCHAIN_FILE_NAME}")
else()
- # If toolchain file isn't specifies, there are three things to pass
- # in cmake: architecture, c++ compiler and build type
+ # If toolchain file isn't specifies, there are two things to pass
+ # in cmake: architecture and c++ compiler
convertCacheVarIntoArg(ObjectiveProject_ARCHITECTURE ${vars} ${outfile})
cmake_path(GET CMAKE_CXX_COMPILER FILENAME COMPILER_EXECUTABLE)
if(NOT "${COMPILER_EXECUTABLE}" STREQUAL "")
file(APPEND ${${outfile}}
" -DCMAKE_CXX_COMPILER=${COMPILER_EXECUTABLE}")
endif()
- convertCacheVarIntoArg(CMAKE_BUILD_TYPE ${vars} ${outfile})
endif()
endmacro()
-function(confwrite)
+function(writerunfile)
set(OUT_FILE "${CMAKE_BINARY_DIR}/${CONFFILE_NAME}")
get_directory_property(cacheVars CACHE_VARIABLES)