Skip to content

Kryczkal/cmake modularization 04 - #170

Merged
kryczkal merged 35 commits into
devfrom
kryczkal/cmake-modularization-04
Aug 10, 2025
Merged

kryczkal merged 35 commits into
devfrom
kryczkal/cmake-modularization-04

Conversation

@kryczkal

@kryczkal kryczkal commented Aug 7, 2025 •

Copy link
Copy Markdown
Member

Summary

Refactored the passing of a ton of arguments from arch to top level cmake
using a function to register arch. This is cleaner because it makes abi explicit while removing any magic "data flows" from bottom cmake to top down. Also moved linker flags to .conf file, making targets inherit them instead of repeating for each exe.

Note

The scripts are becomming a mess. I don't care. The scripts are next to be shot after cmake.

#159 Prev

kryczkal and others added 30 commits August 6, 2025 00:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… file detection, and update .gitignore with common patterns
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kryczkal
kryczkal marked this pull request as ready for review August 7, 2025 12:22
@kryczkal
kryczkal requested a review from Jlisowskyy August 7, 2025 12:22
@kryczkal kryczkal added the improvement Improvement to existing code label Aug 7, 2025
@kryczkal kryczkal linked an issue Aug 9, 2025 that may be closed by this pull request
@kryczkal kryczkal linked an issue Aug 9, 2025 that may be closed by this pull request

@Jlisowskyy Jlisowskyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reimplement using argparse

Base automatically changed from kryczkal/cmake-modularization-03 to dev August 10, 2025 20:45
Copilot AI review requested due to automatic review settings August 10, 2025 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors CMake build system by centralizing architecture-specific configuration through a new alkos_register_runtime_environment function, eliminating the previous approach of passing configuration data from arch-level CMake to top-level via target properties. Also consolidates linker flags into toolchain configuration files.

  • Introduces alkos_register_runtime_environment function to replace property-based data flow
  • Moves common linker flags from individual CMakeLists.txt to toolchain configuration
  • Creates architecture-specific build targets with proper aliases

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/install/run_alkos.bash Adds validation for unimplemented --mount and --tests flags
scripts/actions/build_alkos.bash Updates build script to pass build directory instead of nested path
alkos/toolchains/x86_64-conf.cmake Centralizes linker flags in toolchain configuration
alkos/kernel/arch/x86_64/loader64/CMakeLists.txt Removes duplicated linker flags now inherited from toolchain
alkos/kernel/arch/x86_64/loader32/CMakeLists.txt Removes duplicated linker flags now inherited from toolchain
alkos/kernel/arch/x86_64/kernel/CMakeLists.txt Removes duplicated linker flags and cleans up comments
alkos/kernel/arch/x86_64/CMakeLists.txt Replaces property-based configuration with function call
alkos/kernel/CMakeLists.txt Updates comments and removes unused comment lines
alkos/cmake/ValidationHelpers.cmake Adds path existence validation helper function
alkos/cmake/RuntimeHelpers.cmake Implements new runtime environment registration system
alkos/CMakeLists.txt Replaces property-based system with function-based architecture registration

Comment thread alkos/CMakeLists.txt Outdated
file(APPEND "${BASH_CONF_FILE}" "export CONF_KERNEL_MODULES=\"${KERNEL_MODULES_FORMATTED}\"\n")
file(APPEND "${BASH_CONF_FILE}" "export CONF_KERNEL_COMMANDS=\"${KERNEL_COMMANDS_FORMATTED}\"\n")
file(APPEND "${BASH_CONF_FILE}" "export CONF_BUILD_DIR=\"${CMAKE_BINARY_DIR}\"\n")
file(APPEND "${BASH_CONF_FILE}" "export CONF_TOOL_DIR=\"${TOOL_BINARIES_DIR}\"\n")

Copilot AI Aug 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable TOOL_BINARIES_DIR is used but not defined in this function. This will likely result in an empty value being written to the config file, which could cause runtime failures.

Suggested change
file(APPEND "${BASH_CONF_FILE}" "export CONF_TOOL_DIR=\"${TOOL_BINARIES_DIR}\"\n")
file(APPEND "${BASH_CONF_FILE}" "export CONF_TOOL_DIR=\"${ARG_TOOL_BINARIES_DIR}\"\n")

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works anyway and worrying about it is part of the configuration refactor. Out of scope of this PR

Comment thread alkos/CMakeLists.txt
@kryczkal
kryczkal merged commit fc88e13 into dev Aug 10, 2025
@kryczkal
kryczkal deleted the kryczkal/cmake-modularization-04 branch August 10, 2025 21:54
kryczkal added a commit that referenced this pull request Oct 22, 2025
# Summary
Refactored the passing of a ton of arguments from arch to top level
cmake
using a function to register arch. This is cleaner because it makes abi
explicit while removing any magic "data flows" from bottom cmake to top
down. Also moved linker flags to .conf file, making targets inherit them
instead of repeating for each exe.

# Note
The scripts are becomming a mess. I don't care. The scripts are next to
be shot after cmake.

#159 Prev

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement to existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I found some weird stuff in the cmakes that are most likely bugs Somehow simplify the linker command

3 participants