meta: replace cmake mono-build system with a custom build co-ordinator
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.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
set(pthread_source_dirs thread)
|
||||
cmake_minimum_required(VERSION 3.31)
|
||||
project(libc-pthread C ASM)
|
||||
|
||||
set(pthread_source_dirs thread mutex)
|
||||
|
||||
foreach (dir ${pthread_source_dirs})
|
||||
file(GLOB dir_sources ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.c)
|
||||
@@ -17,30 +20,27 @@ set(pthread_sources ${pthread_sources} ${pthread_sys_sources})
|
||||
set(pthread_headers ${pthread_headers} ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread.h)
|
||||
set(pthread_public_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
rosetta_add_library(STATIC
|
||||
NAME libc-pthread
|
||||
PUBLIC_INCLUDE_DIRS ${pthread_public_include_dir}
|
||||
SOURCES ${pthread_sources}
|
||||
HEADERS ${pthread_headers})
|
||||
rosetta_add_library(SHARED
|
||||
NAME libpthread
|
||||
PUBLIC_INCLUDE_DIRS ${pthread_public_include_dir}
|
||||
SOURCES ${pthread_sources}
|
||||
HEADERS ${pthread_headers})
|
||||
if (PTHREAD_STATIC)
|
||||
add_library(libc-pthread STATIC ${pthread_sources} ${pthread_headers})
|
||||
target_link_libraries(libc-pthread PRIVATE libc-io libmagenta)
|
||||
target_include_directories(libc-pthread PUBLIC
|
||||
${public_include_dirs}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
set_target_properties(libc-pthread PROPERTIES PREFIX "")
|
||||
target_compile_definitions(libc-pthread PRIVATE ENABLE_GLOBAL_HEAP=1 BUILD_STATIC=1)
|
||||
install(TARGETS libc-pthread)
|
||||
else ()
|
||||
add_library(libpthread SHARED ${pthread_sources} ${pthread_headers})
|
||||
target_link_libraries(libpthread PRIVATE magenta)
|
||||
target_link_libraries(libpthread PUBLIC c)
|
||||
target_include_directories(libpthread PUBLIC
|
||||
${public_include_dirs}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
set_target_properties(libpthread PROPERTIES PREFIX "")
|
||||
target_compile_options(libpthread PRIVATE -ffreestanding -nostdlib)
|
||||
target_link_options(libpthread PRIVATE -ffreestanding -nostdlib)
|
||||
target_compile_definitions(libpthread PRIVATE ENABLE_GLOBAL_HEAP=1 BUILD_SHARED=1)
|
||||
install(TARGETS libpthread)
|
||||
endif ()
|
||||
|
||||
sysroot_add_library(
|
||||
NAME libc-pthread
|
||||
HEADER_DIR /usr/include
|
||||
LIB_DIR /usr/lib)
|
||||
sysroot_add_library(
|
||||
NAME libpthread
|
||||
HEADER_DIR /usr/include
|
||||
LIB_DIR /usr/lib)
|
||||
|
||||
bsp_add_library(
|
||||
NAME libpthread
|
||||
LIB_DIR /usr/lib)
|
||||
|
||||
target_link_libraries(libc-pthread PRIVATE libc-io libmagenta)
|
||||
target_link_libraries(libpthread PRIVATE libmagenta)
|
||||
target_link_libraries(libpthread PUBLIC libc)
|
||||
install(FILES include/pthread.h DESTINATION include)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
[seed]
|
||||
name = 'libc-pthread'
|
||||
|
||||
[dependency]
|
||||
no_standard_dependencies = true
|
||||
seeds = [
|
||||
'libmagenta',
|
||||
'libc-io'
|
||||
]
|
||||
|
||||
[build]
|
||||
build_system = 'cmake'
|
||||
configure_args = [
|
||||
'-DPTHREAD_STATIC=TRUE'
|
||||
]
|
||||
|
||||
# vim: ft=toml
|
||||
@@ -0,0 +1,7 @@
|
||||
[seed]
|
||||
name = 'libpthread'
|
||||
|
||||
[build]
|
||||
build_system = 'cmake'
|
||||
|
||||
# vim: ft=toml
|
||||
Reference in New Issue
Block a user