Browse Source

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

master 1.0.0
Lephenixnoir 8 months ago
parent
commit
e6d2aa0638
Signed by: Lephenixnoir GPG Key ID: 1BBA026E13FC0495
  1. 4
      .gitignore
  2. 16
      CMakeLists.txt
  3. 19
      giteapc.make

4
.gitignore

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

16
CMakeLists.txt

@ -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

@ -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
Loading…
Cancel
Save