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
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
3 changed files with 36 additions and 3 deletions

4
.gitignore vendored
View file

@ -3,3 +3,7 @@
/prefix /prefix
*.txt *.txt
!CMakeLists.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") option(STANDARD_NAMESPACE "Use libc.a and put headers in global include folder")
set(TARGET_FOLDERS ${FXLIBC_TARGET}) set(TARGET_FOLDERS ${FXLIBC_TARGET})
# Install paths
set(LIBDIR "lib")
set(INCDIR "include")
if(FXLIBC_TARGET STREQUAL vhex-sh) if(FXLIBC_TARGET STREQUAL vhex-sh)
list(APPEND TARGET_FOLDERS vhex-generic sh-generic) list(APPEND TARGET_FOLDERS vhex-generic sh-generic)
@ -41,6 +44,13 @@ if(FXLIBC_TARGET STREQUAL gint)
list(APPEND TARGET_FOLDERS sh-generic) list(APPEND TARGET_FOLDERS sh-generic)
set(FXLIBC_ARCH sh) set(FXLIBC_ARCH sh)
add_definitions(-D__SUPPORT_GINT) 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() endif()
if(sh-generic IN_LIST TARGET_FOLDERS) if(sh-generic IN_LIST TARGET_FOLDERS)
@ -223,11 +233,11 @@ set_target_properties(fxlibc PROPERTIES
# Install # Install
install(TARGETS fxlibc DESTINATION lib/) install(TARGETS fxlibc DESTINATION ${LIBDIR})
install(DIRECTORY include/ DESTINATION include PATTERN "target" EXCLUDE) install(DIRECTORY include/ DESTINATION ${INCDIR} PATTERN "target" EXCLUDE)
foreach(FOLDER IN LISTS TARGET_FOLDERS) foreach(FOLDER IN LISTS TARGET_FOLDERS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/target/${FOLDER}") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/target/${FOLDER}")
install(DIRECTORY include/target/${FOLDER}/ DESTINATION include) install(DIRECTORY include/target/${FOLDER}/ DESTINATION ${INCDIR})
endif() endif()
endforeach() 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