meta: update build instructions

This commit is contained in:
Lephenixnoir 2022-08-21 17:11:28 +02:00
parent 4b61daa602
commit ca6c39bf56
No known key found for this signature in database
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) set(CMAKE_INSTALL_MESSAGE LAZY)
# Options # Options
# * -DFXLIBC_TARGET=<vhex-sh, vhex-x86, casiowin-fx, casiowin-cg, gint> # * -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}) set(TARGET_FOLDERS ${FXLIBC_TARGET})
# Install paths # 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` This directory contains the sources of the FxLibc Library. See `CMakeLists.txt`
to see what release version you have. to see what release version you have.
@ -13,65 +13,65 @@ system.
--- ---
## Dependencies ## Dependencies
FxLibc requires a GCC compiler toolchain the PATH to build for any calculator. 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 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 ## Building and installing FxLibc
FxLibc supports several targets: FxLibc supports several targets:
* Vhex on SH targets (`vhex-sh`) * Vhex on SH targets (`vhex-sh`)
* CASIOWIN for fx-9860G-like calculators (`casiowin-fx`) * CASIOWIN for fx-9860G-like calculators (`casiowin-fx`)
* CASIOWIN for fx-CG-series calculators (`casiowin-cg`) * 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 Each target supports different features depending on what the kernel/OS
provides. 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 Configure with CMake; specify the target with `-DFXLIBC_TARGET`. For SH
platforms, set the toolchain to `cmake/toolchain-sh.cmake`. platforms, set the toolchain to `cmake/toolchain-sh.cmake`.
The FxLibc supports shared libraries when building with Vhex (TODO); set 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.
`-DSHARED=1` to enable this behavior.
You can either install FxLibc in the compiler's `include` folder, or installl ```bash
in another location of your choice. In the second case, you will need a `-I` # Install in the compiler's include folder
option when using the library. % PREFIX="$(sh-elf-gcc -print-file-name=.)"
# Install in the fxSDK sysroot
To use the compiler, set `PREFIX` like this: % PREFIX="$(fxsdk path sysroot)"
# Custom target
```
% PREFIX=$(sh-elf-gcc -print-file-name=.)
```
To use another location, set `PREFIX` manually (recommended):
```
% PREFIX="$HOME/.sh-prefix/" % PREFIX="$HOME/.sh-prefix/"
# For gint, do not specify anything, the fxSDK will be used dynamically
``` ```
Example for a static Vhex build: 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" % 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`. Build in the directory specified in `cmake -B`.
``` ```bash
% make -C build % make -C build-X
``` % make -C build-X install
To install, run the `install` target.
```
% make -C build install
``` ```
--- ---