add shared lib generation support for Vhex

This commit is contained in:
Yann MAGNIN 2023-01-08 16:07:43 +01:00 committed by Lephenixnoir
parent c85182d07e
commit 7eb2a6e8ab
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 30 additions and 9 deletions

View File

@ -261,22 +261,43 @@ if(gint IN_LIST TARGET_FOLDERS)
src/time/target/gint/time.c)
endif()
# TODO: All targets
add_library(fxlibc ${SOURCES})
target_include_directories(fxlibc PRIVATE include/)
foreach(FOLDER IN LISTS TARGET_FOLDERS)
target_include_directories(fxlibc PRIVATE include/target/${FOLDER}/)
#---
# Handle "target-specific" fxlibc output format
#---
if(FXLIBC_TARGET STREQUAL vhex-sh)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
add_library(fxlibcStatic STATIC ${SOURCES})
add_library(fxlibcShared SHARED ${SOURCES})
set(FXLIBC_TARGET_LIBS "fxlibcStatic;fxlibcShared")
else()
add_library(fxlibcStatic STATIC ${SOURCES})
set(FXLIBC_TARGET_LIBS "fxlibcStatic")
endif()
foreach(FXLIBC_LIB IN LISTS FXLIBC_TARGET_LIBS)
target_include_directories(${FXLIBC_LIB} PRIVATE include/)
foreach(FOLDER IN LISTS TARGET_FOLDERS)
target_include_directories(${FXLIBC_LIB} PRIVATE include/target/${FOLDER}/)
endforeach()
set_target_properties(${FXLIBC_LIB} PROPERTIES OUTPUT_NAME "c")
install(TARGETS ${FXLIBC_LIB} DESTINATION ${LIBDIR})
endforeach()
set_target_properties(fxlibc PROPERTIES
OUTPUT_NAME "c") # libc.a
# Install
install(TARGETS fxlibc DESTINATION ${LIBDIR})
#---
# Do not forget to install headers
#---
install(DIRECTORY include/ DESTINATION ${INCDIR} PATTERN "target" EXCLUDE)
foreach(FOLDER IN LISTS TARGET_FOLDERS)