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
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -261,22 +261,43 @@ if(gint IN_LIST TARGET_FOLDERS)
src/time/target/gint/time.c) src/time/target/gint/time.c)
endif() 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() 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) install(DIRECTORY include/ DESTINATION ${INCDIR} PATTERN "target" EXCLUDE)
foreach(FOLDER IN LISTS TARGET_FOLDERS) foreach(FOLDER IN LISTS TARGET_FOLDERS)