Add CMake, Ninja, and Conan build system support

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 20:03:54 +00:00
parent 6684776a90
commit 05027725c7
8 changed files with 907 additions and 9 deletions

47
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,47 @@
# MetalOS Tests CMakeLists.txt
# Builds and runs unit tests
cmake_minimum_required(VERSION 3.16)
project(MetalOS_Tests C)
# Find all test source files
file(GLOB TEST_SOURCES "unit/*.c")
# Include directories
include_directories(
include
../bootloader/include
../kernel/include
)
# Create a test executable for each test file
foreach(test_source ${TEST_SOURCES})
# Get the test name from the file name
get_filename_component(test_name ${test_source} NAME_WE)
# Create test executable
add_executable(${test_name} ${test_source})
# Set compiler flags
target_compile_options(${test_name} PRIVATE
-Wall
-Wextra
-std=c11
)
# Add as a test
add_test(NAME ${test_name} COMMAND ${test_name})
endforeach()
# Custom target to run all tests
add_custom_target(run_tests
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
DEPENDS ${TEST_SOURCES}
COMMENT "Running all tests"
VERBATIM
)
# Print status
message(STATUS "Tests configuration:")
message(STATUS " Test sources: ${TEST_SOURCES}")