MNRS-BM-BSP/libwrap/CMakeLists.txt

56 lines
1.6 KiB
CMake
Raw Normal View History

2024-02-26 20:41:15 +01:00
IF(NOT DEFINED _MK_LIBWRAP)
SET(_MK_LIBWRAP TRUE)
SET(LIBWRAP_DIR ${CMAKE_CURRENT_LIST_DIR})
SET(LIBWRAP_SRCS
${LIBWRAP_DIR}/stdlib/malloc.c
${LIBWRAP_DIR}/sys/open.c
${LIBWRAP_DIR}/sys/lseek.c
${LIBWRAP_DIR}/sys/read.c
${LIBWRAP_DIR}/sys/write.c
${LIBWRAP_DIR}/sys/fstat.c
${LIBWRAP_DIR}/sys/stat.c
${LIBWRAP_DIR}/sys/close.c
${LIBWRAP_DIR}/sys/link.c
${LIBWRAP_DIR}/sys/unlink.c
${LIBWRAP_DIR}/sys/execve.c
${LIBWRAP_DIR}/sys/fork.c
${LIBWRAP_DIR}/sys/getpid.c
${LIBWRAP_DIR}/sys/kill.c
${LIBWRAP_DIR}/sys/wait.c
${LIBWRAP_DIR}/sys/isatty.c
${LIBWRAP_DIR}/sys/times.c
${LIBWRAP_DIR}/sys/sbrk.c
${LIBWRAP_DIR}/sys/_exit.c
${LIBWRAP_DIR}/misc/write_hex.c
${LIBWRAP_DIR}/sys/printf.c
2024-04-08 14:36:22 +02:00
${LIBWRAP_DIR}/sys/puts.c
2024-02-26 20:41:15 +01:00
)
IF(${SEMIHOSTING})
SET(LIBWRAP_SRCS ${LIBWRAP_SRCS} ${LIBWRAP_DIR}/semihosting/semihosting.c ${LIBWRAP_DIR}/semihosting/trap.c)
ENDIF()
SET(LIBWRAP_SYMS malloc free open lseek read write fstat stat close link unlink execve fork getpid jukk wait isatty times sbrk _exit printf puts)
# Includes
INCLUDE_DIRECTORIES(
${LIBWRAP_DIR}
${LIBWRAP_DIR}/../include
${LIBWRAP_DIR}/../drivers
${LIBWRAP_DIR}/../env
${LIBWRAP_DIR}/../env/iss
)
ADD_LIBRARY(LIBWRAP_TGC STATIC ${LIBWRAP_SRCS})
TARGET_COMPILE_OPTIONS(LIBWRAP_TGC PRIVATE -march=${RISCV_ARCH}_zicsr_zifencei -mabi=${RISCV_ABI} "-DBOARD_${BOARD}")
FOREACH(SYM ${LIBWRAP_SYMS})
LIST(APPEND WRAP_LDFLAGS "-Wl,--wrap=${SYM}")
ENDFOREACH()
2024-04-08 14:36:22 +02:00
SET(LIBWRAP_TGC_LDFLAGS ${WRAP_LDFLAGS} "-Wl,--start-group" "-Wl,--end-group" "-L. -lLIBWRAP_TGC")
2024-02-26 20:41:15 +01:00
ENDIF(NOT DEFINED _MK_LIBWRAP)