meta: update build instructions

This commit is contained in:
Lephenixnoir 2022-08-21 17:11:28 +02:00
parent 4b61daa602
commit ca6c39bf56
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 30 additions and 35 deletions

View File

@ -4,12 +4,7 @@ project(FxLibc VERSION 1.4.3 LANGUAGES C ASM)
set(CMAKE_INSTALL_MESSAGE LAZY)
# Options
# * -DFXLIBC_TARGET=<vhex-sh, vhex-x86, casiowin-fx, casiowin-cg, gint>
# * -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

View File

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