1ec33767ab
every system component now has its own self-contained build system, and a seed file describing the component and its build system and dependencies. a new tool, meadow, collects and uses these seed files to build the components into a full system. meadow also manages the target system root and a host prefix where toolchain tools are installed to. the build system has also been updated to use a new $ARCH-rosetta-gcc compiler, and the patches files necessary to build it have been added to toolchain/cross-compiler.
33 lines
1.1 KiB
CMake
33 lines
1.1 KiB
CMake
if (LIBC_STANDALONE)
|
|
cmake_minimum_required(VERSION 3.31)
|
|
project(libc-core C ASM)
|
|
endif ()
|
|
|
|
set(source_dirs assert stdio stdlib string errno ctype wctype unistd)
|
|
|
|
foreach (dir ${source_dirs})
|
|
file(GLOB dir_sources ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.c)
|
|
file(GLOB dir_headers ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.h)
|
|
|
|
set(sources ${sources} ${dir_sources})
|
|
set(headers ${headers} ${dir_headers})
|
|
endforeach (dir)
|
|
|
|
file(GLOB sys_sources
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sys/${CMAKE_SYSTEM_PROCESSOR}/*.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/sys/${CMAKE_SYSTEM_PROCESSOR}/*.S)
|
|
|
|
if (NOT LIBC_STANDALONE)
|
|
set(component_sources ${sources} ${sys_sources} PARENT_SCOPE)
|
|
set(component_headers ${headers} PARENT_SCOPE)
|
|
return ()
|
|
endif ()
|
|
|
|
add_library(libc-core STATIC ${sources} ${sys_sources} ${headers})
|
|
target_include_directories(libc-core PUBLIC ${public_include_dirs})
|
|
target_link_libraries(libc-core PRIVATE libmagenta librosetta)
|
|
target_compile_definitions(libc-core PRIVATE ENABLE_GLOBAL_HEAP=1 BUILD_STATIC=1)
|
|
set_target_properties(libc-core PROPERTIES
|
|
PREFIX "")
|
|
install(TARGETS libc-core)
|