mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
cmake: initial support for shared vhex library
Using the previously-tested trick with `ld -shared`.
This commit is contained in:
parent
df4c13b007
commit
164b33b26d
1 changed files with 16 additions and 3 deletions
|
@ -6,7 +6,7 @@ set(CMAKE_INSTALL_MESSAGE LAZY)
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
# * -DFXLIBC_TARGET=<vhex-sh, vhex-x86, casiowin-fx, casiowin-cg, gint>
|
# * -DFXLIBC_TARGET=<vhex-sh, vhex-x86, casiowin-fx, casiowin-cg, gint>
|
||||||
# * -DSHARED
|
# * -DFXLIBC_SHARED=1
|
||||||
|
|
||||||
option(SHARED "Build a shared library")
|
option(SHARED "Build a shared library")
|
||||||
option(STANDARD_NAMESPACE "Use libc.a and put headers in global include folder")
|
option(STANDARD_NAMESPACE "Use libc.a and put headers in global include folder")
|
||||||
|
@ -20,12 +20,14 @@ if(FXLIBC_TARGET STREQUAL vhex-sh)
|
||||||
list(APPEND TARGET_FOLDERS vhex-generic sh-generic)
|
list(APPEND TARGET_FOLDERS vhex-generic sh-generic)
|
||||||
set(FXLIBC_ARCH sh)
|
set(FXLIBC_ARCH sh)
|
||||||
add_definitions(-D__SUPPORT_VHEX_KERNEL)
|
add_definitions(-D__SUPPORT_VHEX_KERNEL)
|
||||||
|
set(FXLIBC_SHARED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FXLIBC_TARGET STREQUAL vhex-x86)
|
if(FXLIBC_TARGET STREQUAL vhex-x86)
|
||||||
list(APPEND TARGET_FOLDERS vhex-generic x86-generic)
|
list(APPEND TARGET_FOLDERS vhex-generic x86-generic)
|
||||||
set(FXLIBC_ARCH x86)
|
set(FXLIBC_ARCH x86)
|
||||||
add_definitions(-D__SUPPORT_VHEX_KERNEL)
|
add_definitions(-D__SUPPORT_VHEX_KERNEL)
|
||||||
|
set(FXLIBC_SHARED ON)
|
||||||
# TODO: Maybe add -nostdinc (but that removes compiler-provided headers like
|
# TODO: Maybe add -nostdinc (but that removes compiler-provided headers like
|
||||||
# <stddef.h>), or use another compiler than the system one?
|
# <stddef.h>), or use another compiler than the system one?
|
||||||
endif()
|
endif()
|
||||||
|
@ -246,16 +248,27 @@ if(casiowin-fx IN_LIST TARGET_FOLDERS)
|
||||||
src/posix/unistd/target/casiowin-fx/close.S)
|
src/posix/unistd/target/casiowin-fx/close.S)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: All targets
|
# TODO: All targets
|
||||||
|
|
||||||
add_library(fxlibc ${SOURCES})
|
add_library(fxlibc ${SOURCES})
|
||||||
|
|
||||||
target_include_directories(fxlibc PRIVATE include/)
|
target_include_directories(fxlibc PRIVATE include/)
|
||||||
if(sh-generic IN_LIST TARGET_FOLDERS)
|
if(sh-generic IN_LIST TARGET_FOLDERS)
|
||||||
target_include_directories(fxlibc PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm")
|
target_include_directories(fxlibc PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(FXLIBC_SHARED)
|
||||||
|
target_compile_options(fxlibc PRIVATE -fPIC)
|
||||||
|
|
||||||
|
if("${FXLIBC_ARCH}" STREQUAL "sh")
|
||||||
|
# Original command: "ar qc <TARGET> <OBJECTS>; ranlib <TARGET>"
|
||||||
|
set(CMAKE_C_CREATE_STATIC_LIBRARY
|
||||||
|
"sh-elf-ld -shared <OBJECTS> -o <TARGET>")
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR "TODO: Shared vhex on non-SuperH not available yet")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(FOLDER IN LISTS TARGET_FOLDERS)
|
foreach(FOLDER IN LISTS TARGET_FOLDERS)
|
||||||
target_include_directories(fxlibc PRIVATE include/target/${FOLDER}/)
|
target_include_directories(fxlibc PRIVATE include/target/${FOLDER}/)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
Loading…
Reference in a new issue