BuildSystem: Move all userpace libraries under the userspace directory
As the number of libraries is increasing, root directory starts to expand. This adds better organization for libraries
This commit is contained in:
@@ -19,12 +19,6 @@ set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
|
||||
add_subdirectory(kernel)
|
||||
add_subdirectory(bootloader)
|
||||
add_subdirectory(BAN)
|
||||
add_subdirectory(libc)
|
||||
add_subdirectory(LibELF)
|
||||
add_subdirectory(LibFont)
|
||||
add_subdirectory(LibGUI)
|
||||
add_subdirectory(LibImage)
|
||||
add_subdirectory(LibInput)
|
||||
add_subdirectory(userspace)
|
||||
|
||||
add_custom_target(sysroot
|
||||
@@ -35,24 +29,13 @@ add_custom_target(sysroot
|
||||
add_custom_target(headers
|
||||
DEPENDS kernel-headers
|
||||
DEPENDS ban-headers
|
||||
DEPENDS libc-headers
|
||||
DEPENDS libelf-headers
|
||||
DEPENDS libfont-headers
|
||||
DEPENDS libgui-headers
|
||||
DEPENDS libimage-headers
|
||||
DEPENDS libinput-headers
|
||||
DEPENDS userspace-headers
|
||||
)
|
||||
|
||||
add_custom_target(install-sysroot
|
||||
DEPENDS kernel-install
|
||||
DEPENDS ban-install
|
||||
DEPENDS libc-install
|
||||
DEPENDS userspace-install
|
||||
DEPENDS libelf-install
|
||||
DEPENDS libfont-install
|
||||
DEPENDS libgui-install
|
||||
DEPENDS libimage-install
|
||||
DEPENDS libinput-install
|
||||
)
|
||||
|
||||
add_custom_target(package-sysroot
|
||||
|
||||
@@ -18,5 +18,5 @@ set(SOURCES
|
||||
add_executable(banan_os-bootloader-installer ${SOURCES})
|
||||
target_compile_options(banan_os-bootloader-installer PRIVATE -O2 -std=c++20)
|
||||
target_compile_definitions(banan_os-bootloader-installer PRIVATE __arch=${BANAN_ARCH})
|
||||
target_include_directories(banan_os-bootloader-installer PRIVATE ${CMAKE_SOURCE_DIR}/../../LibELF/include)
|
||||
target_include_directories(banan_os-bootloader-installer PRIVATE ${CMAKE_SOURCE_DIR}/../../userspace/libraries/LibELF/include)
|
||||
target_include_directories(banan_os-bootloader-installer PRIVATE ${CMAKE_SOURCE_DIR}/../../kernel/include)
|
||||
|
||||
@@ -148,22 +148,21 @@ set(KLIBC_SOURCES
|
||||
)
|
||||
|
||||
set(LIBELF_SOURCES
|
||||
../LibELF/LibELF/LoadableELF.cpp
|
||||
../userspace/libraries/LibELF/LibELF/LoadableELF.cpp
|
||||
)
|
||||
|
||||
set(LIBFONT_SOURCES
|
||||
../LibFont/Font.cpp
|
||||
../LibFont/PSF.cpp
|
||||
../userspace/libraries/LibFont/Font.cpp
|
||||
../userspace/libraries/LibFont/PSF.cpp
|
||||
)
|
||||
|
||||
set(LIBINPUT_SOURCE
|
||||
../LibInput/KeyboardLayout.cpp
|
||||
../LibInput/KeyEvent.cpp
|
||||
../userspace/libraries/LibInput/KeyboardLayout.cpp
|
||||
../userspace/libraries/LibInput/KeyEvent.cpp
|
||||
)
|
||||
|
||||
set(KERNEL_SOURCES
|
||||
${KERNEL_SOURCES}
|
||||
${LAI_SOURCES}
|
||||
${BAN_SOURCES}
|
||||
${KLIBC_SOURCES}
|
||||
${LIBELF_SOURCES}
|
||||
@@ -199,8 +198,6 @@ endif()
|
||||
|
||||
target_link_options(kernel PUBLIC -ffreestanding -nostdlib)
|
||||
|
||||
set_source_files_properties(${LAI_SOURCES} PROPERTIES COMPILE_FLAGS -Wno-stack-usage)
|
||||
|
||||
add_custom_target(kernel-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
|
||||
@@ -48,12 +48,15 @@ set(USERSPACE_PROJECTS
|
||||
yes
|
||||
)
|
||||
|
||||
add_subdirectory(libraries)
|
||||
|
||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||
add_subdirectory(${USERSPACE_PROJECT})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(userspace)
|
||||
add_custom_target(userspace-install DEPENDS userspace)
|
||||
add_custom_target(userspace DEPENDS libraries)
|
||||
add_custom_target(userspace-headers DEPENDS libraries-headers)
|
||||
add_custom_target(userspace-install DEPENDS userspace libraries-install)
|
||||
|
||||
add_subdirectory(aoc2023)
|
||||
|
||||
|
||||
33
userspace/libraries/CMakeLists.txt
Normal file
33
userspace/libraries/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libraries CXX)
|
||||
|
||||
set(USERSPACE_LIBRARIES
|
||||
LibC
|
||||
LibELF
|
||||
LibFont
|
||||
LibGUI
|
||||
LibImage
|
||||
LibInput
|
||||
)
|
||||
|
||||
foreach(LIBRARY ${USERSPACE_LIBRARIES})
|
||||
add_subdirectory(${LIBRARY})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(libraries)
|
||||
add_custom_target(libraries-headers)
|
||||
add_custom_target(libraries-install)
|
||||
|
||||
foreach(LIBRARY ${USERSPACE_LIBRARIES})
|
||||
string(TOLOWER ${LIBRARY} LIBRARY_LOWER)
|
||||
|
||||
if (TARGET ${LIBRARY_LOWER})
|
||||
add_dependencies(libraries ${LIBRARY_LOWER})
|
||||
# This is to allow cmake to link when libc updates
|
||||
target_link_options(${LIBRARY_LOWER} PRIVATE -nolibc)
|
||||
endif()
|
||||
|
||||
add_dependencies(libraries-headers ${LIBRARY_LOWER}-headers)
|
||||
add_dependencies(libraries-install ${LIBRARY_LOWER}-install)
|
||||
endforeach()
|
||||
@@ -32,7 +32,7 @@ set(LIBC_SOURCES
|
||||
math.cpp
|
||||
icxxabi.cpp
|
||||
|
||||
../BAN/BAN/Assert.cpp
|
||||
../../../BAN/BAN/Assert.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libc-headers
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user