2023-04-02 04:07:27 +03:00
|
|
|
cmake_minimum_required(VERSION 3.26)
|
|
|
|
|
2023-10-23 13:27:23 +03:00
|
|
|
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "banan-os")
|
|
|
|
message(FATAL_ERROR "CMAKE_SYSTEM_NAME is not banan-os")
|
|
|
|
endif ()
|
2023-10-16 01:37:57 +03:00
|
|
|
|
2024-08-09 15:16:49 +03:00
|
|
|
set(BANAN_ENABLE_SSE 1)
|
2023-09-23 02:28:25 +03:00
|
|
|
|
2023-10-23 13:27:23 +03:00
|
|
|
project(banan-os CXX C ASM)
|
2023-04-02 04:48:56 +03:00
|
|
|
|
2023-08-23 10:35:16 +03:00
|
|
|
set(BANAN_BASE_SYSROOT ${CMAKE_SOURCE_DIR}/base-sysroot.tar.gz)
|
2024-06-19 04:20:23 +03:00
|
|
|
|
2023-04-02 04:07:27 +03:00
|
|
|
set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include)
|
2024-06-19 04:20:23 +03:00
|
|
|
set(BANAN_LIB ${BANAN_SYSROOT}/usr/lib)
|
|
|
|
set(BANAN_BIN ${BANAN_SYSROOT}/usr/bin)
|
|
|
|
set(BANAN_ETC ${BANAN_SYSROOT}/usr/etc)
|
|
|
|
set(BANAN_SHARE ${BANAN_SYSROOT}/usr/share)
|
|
|
|
set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
|
|
|
|
|
|
|
|
set(CMAKE_INSTALL_BINDIR ${BANAN_BIN})
|
|
|
|
set(CMAKE_INSTALL_SBINDIR ${BANAN_BIN})
|
|
|
|
set(CMAKE_INSTALL_LIBDIR ${BANAN_LIB})
|
|
|
|
set(CMAKE_INSTALL_INCLUDEDIR ${BANAN_INCLUDE})
|
|
|
|
set(CMAKE_INSTALL_SYSCONF ${BANAN_ETC})
|
|
|
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
2024-06-20 14:32:05 +03:00
|
|
|
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY True)
|
2024-06-19 04:20:23 +03:00
|
|
|
|
|
|
|
# include headers of ${library} to ${target}
|
|
|
|
function(banan_include_headers target library)
|
|
|
|
target_include_directories(${target} PRIVATE $<TARGET_PROPERTY:${library},SOURCE_DIR>/include)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# include headers and link ${library} to ${target}
|
|
|
|
function(banan_link_library target library)
|
|
|
|
target_link_libraries(${target} PRIVATE ${library})
|
|
|
|
banan_include_headers(${target} ${library})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# add install step for all header files of target
|
|
|
|
function(banan_install_headers target)
|
2024-06-20 14:32:05 +03:00
|
|
|
file(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include *.h)
|
2024-06-19 04:20:23 +03:00
|
|
|
foreach(header ${headers})
|
|
|
|
get_filename_component(subdirectory ${header} DIRECTORY)
|
2024-06-20 14:32:05 +03:00
|
|
|
install(FILES include/${header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory})
|
2024-06-19 04:20:23 +03:00
|
|
|
endforeach()
|
2024-06-20 14:32:05 +03:00
|
|
|
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
2024-06-19 04:20:23 +03:00
|
|
|
endfunction()
|
2023-10-20 04:59:08 +03:00
|
|
|
|
2023-04-02 04:07:27 +03:00
|
|
|
add_subdirectory(kernel)
|
2023-11-14 03:44:47 +02:00
|
|
|
add_subdirectory(bootloader)
|
2023-04-02 04:07:27 +03:00
|
|
|
add_subdirectory(BAN)
|
2023-05-11 16:19:53 +03:00
|
|
|
add_subdirectory(userspace)
|
2023-04-02 04:07:27 +03:00
|
|
|
|
|
|
|
add_custom_target(sysroot
|
2023-10-25 19:45:18 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_SYSROOT}
|
2023-11-04 17:50:43 +02:00
|
|
|
COMMAND cd ${BANAN_SYSROOT} && tar xf ${BANAN_BASE_SYSROOT}
|
2023-04-02 04:07:27 +03:00
|
|
|
)
|