MNRS-BM-BSP/libwrap/CMakeLists.txt

78 lines
1.8 KiB
CMake
Raw Normal View History

2024-12-20 14:27:45 +01:00
#cmake_minimum_required(VERSION 3.12)
2024-12-17 12:32:21 +01:00
project(libwrap)
2024-02-26 20:41:15 +01:00
2024-12-17 12:32:21 +01:00
message(STATUS " here 2 in libwrap")
2024-12-20 14:27:45 +01:00
set(LIBRARY_NAME libwrap)
set(STATIC_LIBRARY_FLAGS "rcs")
2024-12-17 12:32:21 +01:00
# Create object library for libwrap
set(LIB_SOURCES
sys/_exit.c
sys/close.c
sys/execve.c
sys/fork.c
sys/fstat.c
sys/getpid.c
sys/isatty.c
sys/kill.c
sys/link.c
sys/lseek.c
sys/open.c
sys/openat.c
sys/printf.c
sys/puts.c
sys/read.c
sys/sbrk.c
sys/stat.c
sys/times.c
sys/unlink.c
sys/wait.c
2024-12-20 14:27:45 +01:00
# sys/write.c
2024-12-17 12:32:21 +01:00
# Standard library
stdlib/malloc.c
# Miscellaneous
misc/write_hex.c
)
if(SEMIHOSTING)
list(APPEND LIB_SOURCES
semihosting/semihosting.c
semihosting/trap.c )
endif()
2024-12-20 14:27:45 +01:00
#add_library(${LIBRARY_NAME} OBJECT ${LIB_SOURCES})
add_library(${LIBRARY_NAME} STATIC ${LIB_SOURCES})
set_target_properties(${LIBRARY_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bare-metal-bsp/${PROJECT_NAME})
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
message(STATUS " CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
# Retrieve the output directory for the library
get_target_property(LIBRARY_PATH ${LIBRARY_NAME} ARCHIVE_OUTPUT_DIRECTORY)
# Print the path to the console (for debugging purposes)
message(STATUS "The library output path is: ${LIBRARY_PATH}")
2024-12-17 12:32:21 +01:00
# Include directories
2024-12-20 14:27:45 +01:00
target_include_directories(${LIBRARY_NAME} PRIVATE
2024-12-17 12:32:21 +01:00
${CMAKE_CURRENT_SOURCE_DIR}
${BSP_BASE}/include
include/
${BSP_BASE}/env
${BSP_BASE}/env/${BOARD}
${BSP_BASE}/drivers
2024-02-26 20:41:15 +01:00
)
2024-12-20 14:27:45 +01:00
2024-02-26 20:41:15 +01:00
2024-12-17 12:32:21 +01:00
#link global_compile_options to this libraries
2024-12-20 14:27:45 +01:00
#target_link_libraries(${PROJECT_NAME} PRIVATE global_compile_options)
2024-02-26 20:41:15 +01:00
2024-12-17 12:32:21 +01:00
# Compile definitions
#target_compile_definitions(libwrap_objects PRIVATE
# BOARD_${BOARD}
#)
2024-02-26 20:41:15 +01:00
2024-12-17 12:32:21 +01:00
# Export objects to parent scope
2024-12-20 14:27:45 +01:00
#set(LIBWRAP_OBJECTS $<TARGET_OBJECTS:${PROJECT_NAME}> PARENT_SCOPE)