Implemented runtime files and tests

This commit is contained in:
Max Wash
2020-03-31 12:55:52 +01:00
parent 4cc8e52052
commit 28256512c9
8 changed files with 59 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(photon)
project(photon C ASM-ATT)
macro(subdirlist result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
@@ -36,18 +36,37 @@ endif ()
message(STATUS "Target platform: ${PLATFORM}")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -ffreestanding -nostdlib -lgcc")
set(photon_libc_sources "")
set(generic_dirs string include)
set(generic_dirs string)
foreach (dir ${generic_dirs})
file(GLOB_RECURSE dir_sources ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/${dir}/*.c)
file(GLOB dir_sources ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/${dir}/*.c)
set(photon_libc_sources ${photon_libc_sources} ${dir_sources})
endforeach (dir)
file(GLOB_RECURSE platform_sources ${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM})
file(GLOB_RECURSE photon_libc_includes ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/include/*.h)
file(GLOB photon_libc_crt
${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${PLATFORM}/machine/${MACHINE}/crt*.s)
add_library(crt OBJECT ${photon_libc_crt})
message(STATUS "CRT sources: ${photon_libc_crt}")
file(GLOB platform_sources
${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM}/*.c
${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM}/machine/${MACHINE}/*.c
${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM}/machine/${MACHINE}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/photon/sys/${PLATFORM}/machine/${MACHINE}/*.s)
set(photon_libc_sources ${photon_libc_sources} ${platform_sources})
add_library(c STATIC ${photon_libc_sources})
add_library(c STATIC ${photon_libc_sources} ${photon_libc_includes})
target_compile_options(c PRIVATE -ffreestanding -nostdlib -nostdinc)
target_link_libraries(c crt)
target_include_directories(c PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/include)
add_subdirectory(tests)