BuildSystem: Fix crt file installation
crt files for userspace are now a dependency of libc, which means that everytime libc gets installed, crt files will also install. This fixes the problem when building libc
This commit is contained in:
parent
9e1b5cbaab
commit
22548a3f4a
|
@ -53,7 +53,6 @@ add_custom_target(userspace)
|
||||||
|
|
||||||
foreach(project ${USERSPACE_PROJECTS})
|
foreach(project ${USERSPACE_PROJECTS})
|
||||||
add_subdirectory(${project})
|
add_subdirectory(${project})
|
||||||
add_dependencies(${project} crtx-install)
|
|
||||||
add_dependencies(userspace ${project})
|
add_dependencies(userspace ${project})
|
||||||
# This is to allow cmake to link when libc updates
|
# This is to allow cmake to link when libc updates
|
||||||
target_link_options(${project} PRIVATE -nolibc)
|
target_link_options(${project} PRIVATE -nolibc)
|
||||||
|
|
|
@ -35,15 +35,15 @@ add_library(libc ${LIBC_SOURCES})
|
||||||
target_compile_options(libc PRIVATE -O2 -g -Wstack-usage=512 -fno-tree-loop-distribute-patterns -nostdlib)
|
target_compile_options(libc PRIVATE -O2 -g -Wstack-usage=512 -fno-tree-loop-distribute-patterns -nostdlib)
|
||||||
target_compile_options(libc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
|
target_compile_options(libc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
|
||||||
|
|
||||||
add_library(crt0 OBJECT arch/${BANAN_ARCH}/crt0.S)
|
function(add_crtx crtx)
|
||||||
add_library(crti OBJECT arch/${BANAN_ARCH}/crti.S)
|
add_custom_target(${crtx} COMMAND ${CMAKE_CXX_COMPILER} -c -o ${crtx}.o ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/${crtx}.S)
|
||||||
add_library(crtn OBJECT arch/${BANAN_ARCH}/crtn.S)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${crtx}.o DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
||||||
add_custom_target(crtx-install
|
add_dependencies(libc ${crtx})
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_LIBDIR}/crt0.o
|
endfunction()
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crti> ${CMAKE_INSTALL_LIBDIR}/crti.o
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crtn> ${CMAKE_INSTALL_LIBDIR}/crtn.o
|
add_crtx(crt0)
|
||||||
DEPENDS crt0 crti crtn sysroot
|
add_crtx(crti)
|
||||||
)
|
add_crtx(crtn)
|
||||||
|
|
||||||
banan_include_headers(libc ban)
|
banan_include_headers(libc ban)
|
||||||
banan_include_headers(libc kernel)
|
banan_include_headers(libc kernel)
|
||||||
|
|
Loading…
Reference in New Issue