cmake: default to compiler install with gint, and GiteaPC support

This commit is contained in:
Lephenixnoir 2021-05-25 21:51:52 +02:00
parent 412d0f5623
commit e6d2aa0638
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
3 changed files with 36 additions and 3 deletions

4
.gitignore vendored
View File

@ -3,3 +3,7 @@
/prefix
*.txt
!CMakeLists.txt
# GiteaPC config files
giteapc-config.make
giteapc-config-*.make

View File

@ -10,6 +10,9 @@ option(SHARED "Build a shared library")
option(STANDARD_NAMESPACE "Use libc.a and put headers in global include folder")
set(TARGET_FOLDERS ${FXLIBC_TARGET})
# Install paths
set(LIBDIR "lib")
set(INCDIR "include")
if(FXLIBC_TARGET STREQUAL vhex-sh)
list(APPEND TARGET_FOLDERS vhex-generic sh-generic)
@ -41,6 +44,13 @@ if(FXLIBC_TARGET STREQUAL gint)
list(APPEND TARGET_FOLDERS sh-generic)
set(FXLIBC_ARCH sh)
add_definitions(-D__SUPPORT_GINT)
# Default to fxSDK install path
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${FXSDK_COMPILER_INSTALL}" CACHE PATH "..." FORCE)
set(LIBDIR ".")
set(INCDIR "include")
endif()
endif()
if(sh-generic IN_LIST TARGET_FOLDERS)
@ -223,11 +233,11 @@ set_target_properties(fxlibc PROPERTIES
# Install
install(TARGETS fxlibc DESTINATION lib/)
install(DIRECTORY include/ DESTINATION include PATTERN "target" EXCLUDE)
install(TARGETS fxlibc DESTINATION ${LIBDIR})
install(DIRECTORY include/ DESTINATION ${INCDIR} PATTERN "target" EXCLUDE)
foreach(FOLDER IN LISTS TARGET_FOLDERS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/target/${FOLDER}")
install(DIRECTORY include/target/${FOLDER}/ DESTINATION include)
install(DIRECTORY include/target/${FOLDER}/ DESTINATION ${INCDIR})
endif()
endforeach()

19
giteapc.make Normal file
View File

@ -0,0 +1,19 @@
# giteapc: version=1 depends=Lephenixnoir/sh-elf-gcc,Lephenixnoir/OpenLibm
-include giteapc-config.make
configure:
@ cmake -B build-gint -DFXLIBC_TARGET=gint -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sh.cmake
build:
@ make -C build-gint
install:
@ make -C build-gint install
uninstall:
@ if [ -e build-gint/install_manifest.txt ]; then \
xargs rm -f < build-gint/install_manifest.txt; \
fi
.PHONY: configure build install uninstall