Started working on Magenta support

This commit is contained in:
Max Wash
2020-04-30 17:44:54 +01:00
parent 23e6519090
commit bb1f32f334
14 changed files with 376 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(photon C ASM-ATT)
#project(photon C ASM-ATT)
macro(subdirlist result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
@@ -13,7 +13,7 @@ macro(subdirlist result curdir)
endmacro()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platform.cmake)
platform_config(${TARGET})
platform_config(${PHOTON_TARGET})
message(STATUS "Target: ${machine}-${platform}")
@@ -40,6 +40,7 @@ file(GLOB photon_libc_crt
${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/machine/${machine}/crt*.s)
add_library(crt OBJECT ${photon_libc_crt})
target_compile_options(crt PRIVATE -c)
file(GLOB platform_sources
${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/*.c
@@ -57,7 +58,12 @@ file(GLOB platform_headers
set(photon_libc_sources ${photon_libc_sources} ${malloc_sources} ${platform_sources})
set(photon_libc_headers ${photon_libc_headers} ${platform_headers})
add_library(c SHARED ${photon_libc_sources} ${photon_libc_headers})
if (PHOTON_STATIC EQUAL 1)
add_library(c STATIC ${photon_libc_sources} ${photon_libc_headers})
else ()
add_library(c SHARED ${photon_libc_sources} ${photon_libc_headers})
endif ()
target_compile_options(c PRIVATE -ffreestanding -nostdlib)
target_link_libraries(c crt)
@@ -65,17 +71,19 @@ target_include_directories(c PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/inc
target_include_directories(c PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/photon/libc/sys/${platform}/)
target_include_directories(c PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/sysroot/usr/include)
add_custom_target(sysroot
add_custom_target(local-root
DEPENDS ${photon_libc_headers}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/create-sysroot.sh
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${platform} ${machine})
add_dependencies(c sysroot)
add_dependencies(c local-root)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(c gcc)
endif ()
add_subdirectory(tests)
if (PHOTON_TESTS EQUAL 1)
add_subdirectory(tests)
endif ()