From ca6c39bf560a3d0b4170ee1f8071024085723352 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sun, 21 Aug 2022 17:11:28 +0200 Subject: [PATCH] meta: update build instructions --- CMakeLists.txt | 5 ----- README.md | 60 +++++++++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f19d45c..e589013 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,7 @@ project(FxLibc VERSION 1.4.3 LANGUAGES C ASM) set(CMAKE_INSTALL_MESSAGE LAZY) # Options - # * -DFXLIBC_TARGET= -# * -DFXLIBC_SHARED=1 - -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 diff --git a/README.md b/README.md index 5113433..e2c5e66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# The FX C Library +# fxlibc: The FX C Library This directory contains the sources of the FxLibc Library. See `CMakeLists.txt` to see what release version you have. @@ -13,65 +13,65 @@ system. --- ## Dependencies + FxLibc requires a GCC compiler toolchain the PATH to build for any calculator. You cannot build with your system compiler! The tutorial on Planète Casio -builds an `sh-elf` toolchain that supports all models using multilib. +builds an `sh-elf` toolchain that supports all models using multilib. See also +[Lephenixnoir/sh-elf-gcc](/Lephenixnoir/sh-elf-gcc). -For Vhex and gint targets, the headers of the kernel are also required. +For Vhex targets, the headers of the kernel are also required (but not for gint; the fxlibc is installed before gint). --- ## Building and installing FxLibc + FxLibc supports several targets: * Vhex on SH targets (`vhex-sh`) * CASIOWIN for fx-9860G-like calculators (`casiowin-fx`) * CASIOWIN for fx-CG-series calculators (`casiowin-cg`) -* gint for all targets (`gint`) +* gint for all calculators (`gint`) Each target supports different features depending on what the kernel/OS provides. -#### Configuration and support +For automated gint/fxSDK setups using [GiteaPC](/Lephenixnoir/GiteaPC) is recommended. The instructions below are for manual installs. + +#### Configuration Configure with CMake; specify the target with `-DFXLIBC_TARGET`. For SH platforms, set the toolchain to `cmake/toolchain-sh.cmake`. -The FxLibc supports shared libraries when building with Vhex (TODO); set -`-DSHARED=1` to enable this behavior. +You can either install FxLibc in the compiler's `include` folder (for Vhex), or another folder of your choice (eg. the fxSDK sysroot). If you choose non-standard folders you might need `-I` and `-L` options to use the library. -You can either install FxLibc in the compiler's `include` folder, or installl -in another location of your choice. In the second case, you will need a `-I` -option when using the library. - -To use the compiler, set `PREFIX` like this: - -``` -% PREFIX=$(sh-elf-gcc -print-file-name=.) -``` - -To use another location, set `PREFIX` manually (recommended): - -``` +```bash +# Install in the compiler's include folder +% PREFIX="$(sh-elf-gcc -print-file-name=.)" +# Install in the fxSDK sysroot +% PREFIX="$(fxsdk path sysroot)" +# Custom target % PREFIX="$HOME/.sh-prefix/" +# For gint, do not specify anything, the fxSDK will be used dynamically ``` Example for a static Vhex build: -``` +```bash % cmake -B build-vhex-sh -DFXLIBC_TARGET=vhex-sh -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sh.cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" ``` -#### Building +Or for a traditional gint/fxSDK build: + +```bash +% cmake -B build-gint -DFXLIBC_TARGET=gint -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sh.cmake +``` + +#### Build and install + Build in the directory specified in `cmake -B`. -``` -% make -C build -``` - -To install, run the `install` target. - -``` -% make -C build install +```bash +% make -C build-X +% make -C build-X install ``` ---