mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-26 19:43:36 +01:00
fxsdk: add sysroot, support for listdc++, README tutorial, LICENSE
This commit mainly introduces an almost-normal sysroot where the compiler and libs will be installed. This is done in order to properly build libstdc++-v3 from the GCC tree while also cleaning up the slightly chaotic current install system. * Add an `fxsdk --version` command * Redo the README like a translation of the French topic * Up default project to gint 2.9 to help get migrations right * Add new `fxsdk path` command reporting important folders * Add new CMake variables FXSDK_SYSROOT, FXSDK_INCLUDE, FXSDK_LIB so CMake can access the information of `fxsdk path` * fxSDK is now in charge of removing the entire sysroot including the cross-compiler * Add a LICENSE file
This commit is contained in:
parent
4296ef0872
commit
147ff08869
9 changed files with 220 additions and 133 deletions
|
@ -35,7 +35,9 @@ add_custom_target(fxg1a ALL
|
|||
|
||||
# fxsdk
|
||||
add_custom_command(OUTPUT "${BIN}/fxsdk.sh"
|
||||
COMMAND sed "'s#@FXSDK_PREFIX@#${CMAKE_INSTALL_PREFIX}#'"
|
||||
COMMAND sed
|
||||
-e "'s#@CMAKE_INSTALL_PREFIX@#${CMAKE_INSTALL_PREFIX}#'"
|
||||
-e "'s#@CMAKE_PROJECT_VERSION@#${CMAKE_PROJECT_VERSION}#'"
|
||||
"${SRC}/fxsdk/fxsdk.sh" > "${BIN}/fxsdk.sh"
|
||||
DEPENDS "${SRC}/fxsdk/fxsdk.sh")
|
||||
add_custom_target(fxsdk ALL DEPENDS "${BIN}/fxsdk.sh")
|
||||
|
|
7
LICENSE
Normal file
7
LICENSE
Normal file
|
@ -0,0 +1,7 @@
|
|||
Copyright (C) 2015-2022 gint/fxSDK contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
236
README.md
236
README.md
|
@ -1,61 +1,135 @@
|
|||
# fxSDK
|
||||
|
||||
The fxSDK is a development kit for CASIO graphing calculators in the fx-9860G
|
||||
and fx-CG 50 families. It provides command-line helper tools and build systems
|
||||
for add-ins and libraries, and is commonly used to develop add-ins running the
|
||||
[gint kernel](/Lephenixnoir/gint).
|
||||
*Topic on Planète Casio : [fxSDK, un SDK alternatif pour écrire des add-ins](https://www.planet-casio.com/Fr/forums/topic13164-last-fxsdk-un-sdk-alternatif-pour-ecrire-des-add-ins.html)*
|
||||
|
||||
The fxSDK is free software; you may use it for any purpose, share it, modify
|
||||
modify it and share your changes. No credit required, but please let me know!
|
||||
The fxSDK is a development kit for CASIO graphing calculators in the fx-9860G and fx-CG series. It provides command-line tools, build systems and a cross-compilation setup for add-ins and libraries. It's designed to be used with the [gint unikernel](/Lephenixnoir/gint) which provides a powerful base runtime to build add-ins from.
|
||||
|
||||
The fxSDK is compatible with Linux and has been successfully built on Mac OS.
|
||||
If there are compatibility issues, I am willing to try and port stuff to your
|
||||
favorite operating system. Windows users have good support with WSL.
|
||||
This repository only contains the command-line tools of the SDK; in order to program add-ins more components like a [cross-compiler](https://gitea.planet-casio.com/Lephenixnoir/sh-elf-gcc) and usually the [gint kernel](https://gitea.planet-casio.com/Lephenixnoir/gint) are required. See the [Installing](#Installing) section for details.
|
||||
|
||||
## Basic install and use
|
||||
The fxSDK is distributed under the [MIT License](LICENSE).
|
||||
|
||||
The simplest way to install the fxSDK is to use
|
||||
[GiteaPC](/Lephenixnoir/GiteaPC), an automation tool that builds and installs
|
||||
repositories from Planète Casio's Gitea forge.
|
||||
## Compatibility and support
|
||||
|
||||
**Calculators**
|
||||
|
||||
The fxSDK (more specifically gint in this case) targets most calculators of the CASIO fx-9860G series, including:
|
||||
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/g85.png) (Partial support) SH3-based fx-9860G, fx-9860G SD, similar models with OS 1.xx, and the fx-9860G SDK emulator.
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/g95.png) SH3-based fx-9750G, fx-9860G II, fx-9860G II SD, and similar models with OS 2.xx.
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/g75+.png) All SH4-based models with OS 2.xx, including the fx-9750G II and SH4 fx-9860G II.
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/g35+e2.png) The fx-9750G III and fx-9860G III.
|
||||
|
||||
It also supports the calculators of the CASIO fx-CG series:
|
||||
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/cg20.png) The original fx-CG 10/20.
|
||||
* ![](https://www.planet-casio.com/images/icones/calc/g90+e.png) The fx-CG 50.
|
||||
|
||||
**Operating systems**
|
||||
|
||||
* Linux: officially supported; any distribution should work as long as you can install the dependencies.
|
||||
* Mac OS: builds consistently but may require slight tweaking due to lack of regular testing.
|
||||
* Windows: WSL's Ubuntu is officially supported. Windows itself is not supported, but contributions towards it are welcome.
|
||||
|
||||
**Programming languages**
|
||||
|
||||
* C: Latest GCC support for the language (currently C11/C2X). The standard library is the custom-built [fxlibc](https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc/) which supports most of C99. Using another ported libc is possible.
|
||||
* C++: Latest GCC support for the language (currently C++20/C++23). The standard library is the latest [libstdc++](https://gcc.gnu.org/onlinedocs/libstdc++/).
|
||||
* Assembly: CASIO calculators run on SuperH processors (mostly the SH4AL-DSP). binutils provides the tools needed to write programs in assembler.
|
||||
* Others? Stuff that compiles to C is fine (eg. [fxtran for Fortran](https://www.planet-casio.com/Fr/forums/topic17064-1-fxtran-codez-en-fortran-pour-votre-casio.html)). Other GCC targets can work ([the D compiler builds](https://www.planet-casio.com/Fr/forums/topic17037-last-omegafail-dlang-et-gint.html) -- libphobos slightly harder). Languages that target LLVM, like Rust, are definitely out of the question for now as LLVM does not have a SuperH backend.
|
||||
|
||||
**Build systems**
|
||||
|
||||
The fxSDK uses CMake as the main build system for add-ins and libraries. An older Makefile-based project template is still available and CLI interfaces are officially maintained, but you're expected to manage your build system through updates if you stray from CMake.
|
||||
|
||||
## Installing
|
||||
|
||||
The following options are all for installing the entire fxSDK including the cross-compiler, libraries, etc. not just this repository.
|
||||
|
||||
**Method 1: Using GiteaPC (recommended for beginners)**
|
||||
|
||||
[GiteaPC](https://gitea.planet-casio.com/Lephenixnoir/GiteaPC) is a package-manager-like set of scripts to clone, build and install repositories from Planète Casio's Gitea forge. It automates basically the entire process, and is the recommended way to get the fxSDK up and running. See the instructions on the repository's README.
|
||||
|
||||
**Method 2: Using the AUR (for Arch Linux-based distributions)**
|
||||
|
||||
[Dark Storm](https://www.planet-casio.com/Fr/compte/voir_profil.php?membre=Dark%20Storm) maintains a package repository for Arch called [MiddleArch](https://www.planet-casio.com/Fr/forums/topic16790-1-middlearch-un-depot-communautaire.html) which includes consistently up-to-date versions of the fxSDK.
|
||||
|
||||
**Method 3: Manual build (for experienced users)**
|
||||
|
||||
You can build the fxSDK and its tools manually by following the instructions in each README file. Please refer to the GiteaPC tutorial for a list of what to install in what order. As a warning: there is quite a lot of stuff (SDK tools, the cross-compiler, a libm, a libc, the libstdc++, the kernel, user libraries and then some) so expect to spend some time installing and updating everything.
|
||||
|
||||
## Using the fxSDK: Command-line tools
|
||||
|
||||
When developing add-ins with the fxSDK, you mainly interact with command-line tools and the fxSDK's build system. Let's first have a look at the command-line tools. You can get the command-line help for any tool by invoking it without arguments, eg `fxsdk` or `fxgxa`.
|
||||
|
||||
*Note: A tool called `fxos` used to live here and has now moved to [its own repository](/Lephenixnoir/fxos).*
|
||||
|
||||
**Project management** with `fxsdk`
|
||||
|
||||
Use the `fxsdk` command to manage projects. You can create an empty add-in project with `fxsdk new` and a name for a new folder:
|
||||
|
||||
```bash
|
||||
% giteapc install Lephenixnoir/fxsdk
|
||||
```
|
||||
|
||||
The fxSDK depends on the [`sh-elf-gcc` compiler](/Lephenixnoir/sh-elf-gcc) so
|
||||
GiteaPC might build it too as a dependency. You will also need the PIL library
|
||||
for Python, as well as libusb and optionally UDisks2 for fxlink. Use the
|
||||
GiteaPC configuration `:noudisks2` to disable UDisks2-based features.
|
||||
|
||||
```bash
|
||||
# On Debian, Ubuntu, WSL and the like:
|
||||
% sudo apt install python3-pil libusb-dev # (Optionally) udisks2
|
||||
# On Arch Linux, Manjaro and the like:
|
||||
% sudo pacman -S python-pillow libusb # (Optionally) udisks2
|
||||
```
|
||||
|
||||
Use the `fxsdk` command to manage projects. You can create an empty add-in
|
||||
project with `fxsdk new` and a name for a new folder:
|
||||
|
||||
```bash
|
||||
% fxsdk new MyAddin
|
||||
Created a new project MyAddin (build system: CMake).
|
||||
Type 'fxsdk build-fx' or 'fxsdk build-cg' to compile the program.
|
||||
```
|
||||
|
||||
From that folder, you can build the add-in with the build commands:
|
||||
From that folder, you can build the add-in with the `fxsdk build-*` commands:
|
||||
|
||||
```bash
|
||||
# Build the add-in for fx-9860G (.g1a):
|
||||
# Build the add-in for fx-98600G-series calculators (.g1a):
|
||||
% fxsdk build-fx
|
||||
# Build the add-in for fx-CG 50 (.g3a):
|
||||
# Build the add-in for fx-CG-series calculators (.g3a):
|
||||
% fxsdk build-cg
|
||||
```
|
||||
|
||||
## Tools in the fxSDK
|
||||
You can then send the add-in through your preferred method. Some shortcuts are provided:
|
||||
|
||||
* `fxsdk send-fx` will send the g1a file with [p7](https://gitea.planet-casio.com/cake/p7utils) (which is like FA-124/xfer9860) if it's installed. This works for every fx-9860G-series models execept the fx-975G0G III and fx-9860G III.
|
||||
* `fxsdk send-cg` will send the g3a file with fxlink using UDisks2, replicating the process of copying with the file manager. See below for details about fxlink.
|
||||
|
||||
The command `fxsdk path` reports the folders in which the important files of the SDK (mainly the cross-compiler) are located.
|
||||
|
||||
**G1A/G3A file generation** with `fxgxa`
|
||||
|
||||
`fxgxa` is a versatile g1a/g3a file editor that creates, edits and dumps the header of add-ins files. The build system calls it as part of `fxsdk build-*` so you only need to use it directly when you want to inspect existing add-ins.
|
||||
|
||||
It supports using and dumping PNG icons of any formats, validating header checksums, repairing broken headers and dumping add-in details. Here are the main commands:
|
||||
|
||||
* `fxgxa --g1a|--g3a`: Generate g1a/g3a files
|
||||
* `fxgxa -e`: Edit g1a/g3a files
|
||||
* `fxgxa -d`: Dump metadata, checksum, and icon
|
||||
* `fxgxa -r`: Repair control bytes and checksums for broken files
|
||||
* `fxgxa -x`: Extract icons into PNG files
|
||||
|
||||
`fxgxa` has an alias, `fxg1a`, for compatibility with fxSDK up to 2.7.0 for which there was no g3a file editor in the fxSDK.
|
||||
|
||||
**Asset conversion** with `fxconv`
|
||||
|
||||
`fxconv` is a programmable asset converter that converts images, fonts and other common asset types into data structures usable directly in add-ins. The built-in formats include gint images and fonts, [libimg](/Lephenixnoir/libimg) images, and binary blobs.
|
||||
|
||||
Projects can extend the support to custom types for maps, dialogs, GUI descriptions, or other application-specific assets. Extensions to `fxconv` are implemented in Python within the project.
|
||||
|
||||
`fxconv` is tightly integrated into the build system. Normally you declare assets in a `CMakeLists.txt` file, set their parameters in an `fxconv-metadata.txt` file, and then let the build system do the magic.
|
||||
|
||||
**USB communication** with `fxlink`
|
||||
|
||||
`fxlink` is a USB communication tool that can be used to send files to calculators as well as to communicate with gint's USB driver from an add-in. The tool is still it its early stages but already offers two useful features.
|
||||
|
||||
Note: `fxlink` does not work within WSL machines on Windows, see [this bug](https://github.com/Microsoft/WSL/issues/2195).
|
||||
|
||||
The first feature is interactive communication with add-ins using libusb. This allows add-ins to send text, screenshots, and video captures of their output to a computer in real-time.
|
||||
|
||||
The second feature is sending files to fx-CG and G-III calculators (the ones that behave like USB drives) using UDisks2. `fxlink` can mount the calculators, copy files and unmount them from the command-line without root access.
|
||||
|
||||
## Using the fxSDK: Build systems
|
||||
|
||||
**Building add-ins with CMake**
|
||||
|
||||
The official build system is CMake since fxSDK 2.3. When creating a new project, a default `CMakeLists.txt` is generated. There are few deviations from standard CMake practices; refer to a CMake tutorial for general explanations (there is [an fxSDK-specific one in French on Planète Casio](https://www.planet-casio.com/Fr/forums/topic16647-1-tutoriel-compiler-des-add-ins-avec-cmake-fxsdk.html)). The differences are explained below.
|
||||
|
||||
Because we are using a cross-compiler, we can't just call `cmake` to configure the project; extra parameters are needed. The `fxsdk build-*` commands call CMake for you with the correct parameters.
|
||||
|
||||
A tool called *fxos* used to live here and has now moved to [its own
|
||||
repository](/Lephenixnoir/fxos).
|
||||
|
||||
**Project management** with `fxsdk`
|
||||
|
||||
`fxsdk` lets you set up projects almost instantly with a default folder
|
||||
structure and a build system for both fx-9860G and fx-CG 50. The default build
|
||||
|
@ -64,92 +138,32 @@ system is CMake since version 2.3, and a bare-bones Makefile is also supported.
|
|||
`fxsdk` only writes files at project creation time, so you keep control over
|
||||
your build system and configuration - it just helps you get started faster.
|
||||
|
||||
Summary of commands (`fxsdk --help` for details):
|
||||
**Building add-ins with make alone**
|
||||
|
||||
* `fxsdk new`: Create a new project
|
||||
* `fxsdk build/build-fx/build-cg`: Configure and compile add-ins and libraries
|
||||
* `fxsdk send/send-fx/send-cg`: Install files to the calculator (WIP)
|
||||
|
||||
**G1A/G3A file generation** with `fxgxa`
|
||||
|
||||
`fxgxa` is a versatile g1a/g3a file editor that creates, edits and dumps the
|
||||
header of fx-9860G add-ins files. It is used to build g1a/g3a files out of a
|
||||
binary program.
|
||||
|
||||
It supports PNG icons of any formats, checking the validity and checksums of
|
||||
the header, repairing broken headers and dumping both the application data and
|
||||
icons.
|
||||
|
||||
`fxgxa` is called automatically by the build system in your add-in, so you
|
||||
don't need to worry about it, but here are the main commands:
|
||||
|
||||
* `fxgxa --g1a|--g3a`: Generate g1a/g3a files
|
||||
* `fxgxa -e`: Edit g1a/g3a files
|
||||
* `fxgxa -d`: Dump metadata, checksum, and icon
|
||||
* `fxgxa -r`: Repair control bytes and checksums for broken files
|
||||
* `fxgxa -x`: Extract icons into PNG files
|
||||
|
||||
`fxgxa` has an alias, `fxg1a`, for compatibility with fxSDK up to 2.7.0 for
|
||||
which there was no g3a file editor in the fxSDK.
|
||||
|
||||
**Asset conversion** with `fxconv`
|
||||
|
||||
`fxconv` is a programmable asset converter that converts images, fonts and
|
||||
other common asset types into data structures usable directly in add-ins. The
|
||||
built-in formats include gint images and fonts, [libimg](/Lephenixnoir/libimg)
|
||||
images, and binary blobs.
|
||||
|
||||
Projects can extend the support to custom types for maps, dialogs, GUI
|
||||
descriptions, or other application-specific assets. Extensions to `fxconv` are
|
||||
implemented in Python within the project.
|
||||
|
||||
`fxconv` can be used directly on the command-line but normally you specify
|
||||
parameters in `fxconv-metadata.txt` and let the build system do the magic.
|
||||
|
||||
**USB communication** with `fxlink`
|
||||
|
||||
`fxlink` is a USB communication tool that can be used to send files to
|
||||
calculators as well as to communicate with gint's USB driver from an add-in.
|
||||
Currently, the tool is a work-in-progress, and most of the work has been spent
|
||||
in properly detecting, characterizing and filtering connected calculators.
|
||||
|
||||
The main backend is libusb. With libusb, `fxlink` can detect CASIO calculators
|
||||
connected through USB and has a test mode used to prototype interactions with
|
||||
gint.
|
||||
|
||||
`fxlink` also supports a UDisks2 backend for systems that have UDisks2; with
|
||||
this backend, `fxlink` can detect Mass Storage calculators (essentially the
|
||||
fx-CG series and the G-III series) connected through USB, mount them without
|
||||
root access, and transfer some files all from the command-line.
|
||||
The original Makefile used to build add-ins is still available. A Makefile-based project can be created with the `--makefile` option of `fxsdk new`. However that Makefile is rarely tested thus occasionally out-of-date, and in general requires you to maintain it through fxSDK updates. It is only advised to use it if you're experienced with make.
|
||||
|
||||
## Manual build instructions
|
||||
|
||||
The fxSDK is platform-agnostic; a single install will cover any target
|
||||
platforms. Here are the dependencies:
|
||||
The following instructions are part of the manual install process for the fxSDK. You should install this repository first. If you previously had an fxSDK setup, cross-compiler, etc. then you should probably remove them before installing the new one to avoid interference.
|
||||
|
||||
The dependencies for this repository are:
|
||||
|
||||
* CMake
|
||||
* libpng ≥ 1.6
|
||||
* Python ≥ 3.7 (might work in 3.6)
|
||||
* The Pillow library for Python 3
|
||||
* libusb 1.0
|
||||
* The UDisks2 library, unless disabled
|
||||
* The UDisks2 library (unless disabled)
|
||||
|
||||
First configure; usual options are:
|
||||
When configuring, you should set an install prefix that you have write access to. I suggest `$HOME/.local`. Note that the cross-compiler *must* be later installed in the path printed by `fxsdk path sysroot`, which is within said prefix.
|
||||
|
||||
* `-DCMAKE_INSTALL_PREFIX` to change the install folder;
|
||||
* `-DFXLINK_DISABLE_UDISKS2=1` to disable UDisks2 support in `fxlink`.
|
||||
* Use `-DCMAKE_INSTALL_PREFIX=...` to change the install folder;
|
||||
* Use `-DFXLINK_DISABLE_UDISKS2=1` to disable UDisks2 support in `fxlink`, if you don't have UDisks2 or you're using WSL.
|
||||
|
||||
```sh
|
||||
% cmake -B build
|
||||
```
|
||||
|
||||
Then make and install as usual.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
% cmake -B build [OPTIONS...]
|
||||
% make -C build
|
||||
% make -C build install
|
||||
```
|
||||
|
||||
If you selected an install folder for which you don't have write access (which
|
||||
apparently includes the default folder on Mac OS), you will need `sudo` to
|
||||
install.
|
||||
You can then proceed to install the cross-compiler. If in doubt about the order, refer to the [GiteaPC README](https://gitea.planet-casio.com/Lephenixnoir/GiteaPC) or check the `giteapc.make` files of each repository, where dependencies are listed.
|
||||
|
|
|
@ -7,7 +7,7 @@ project(MyAddin)
|
|||
include(GenerateG1A)
|
||||
include(GenerateG3A)
|
||||
include(Fxconv)
|
||||
find_package(Gint 2.1 REQUIRED)
|
||||
find_package(Gint 2.9 REQUIRED)
|
||||
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
|
|
|
@ -38,5 +38,18 @@ endforeach()
|
|||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} --print-file-name=.
|
||||
OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Provide fxSDK sysroot and standard install folders
|
||||
execute_process(
|
||||
COMMAND fxsdk path sysroot
|
||||
OUTPUT_VARIABLE FXSDK_SYSROOT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND fxsdk path include
|
||||
OUTPUT_VARIABLE FXSDK_INCLUDE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND fxsdk path lib
|
||||
OUTPUT_VARIABLE FXSDK_LIB
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
|
|
@ -38,5 +38,18 @@ endforeach()
|
|||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} --print-file-name=.
|
||||
OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# Provide fxSDK sysroot and standard install folders
|
||||
execute_process(
|
||||
COMMAND fxsdk path sysroot
|
||||
OUTPUT_VARIABLE FXSDK_SYSROOT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND fxsdk path include
|
||||
OUTPUT_VARIABLE FXSDK_INCLUDE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND fxsdk path lib
|
||||
OUTPUT_VARIABLE FXSDK_LIB
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
|
|
@ -3,11 +3,15 @@ function(find_simple_library _library _version_header _version_macro)
|
|||
|
||||
# Find the library path
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} "-print-file-name=${_library}"
|
||||
OUTPUT_VARIABLE LIB_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
COMMAND fxsdk path lib
|
||||
OUTPUT_VARIABLE FXSDK_LIB OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(
|
||||
COMMAND fxsdk path include
|
||||
OUTPUT_VARIABLE FXSDK_INCLUDE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if("${LIB_PATH}" STREQUAL "${_library}")
|
||||
message("lib not found")
|
||||
set(LIB_PATH "${FXSDK_LIB}/${_library}")
|
||||
if(NOT EXISTS "${LIB_PATH}")
|
||||
message(SEND_ERROR "find_simple_library: Library not found: ${LIB_PATH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
@ -16,11 +20,9 @@ function(find_simple_library _library _version_header _version_macro)
|
|||
endif()
|
||||
|
||||
# Find the version header
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} "-print-file-name=${_version_header}"
|
||||
OUTPUT_VARIABLE HEADER_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if("${HEADER_PATH}" STREQUAL "${_version_header}")
|
||||
set(HEADER_PATH "${FXSDK_INCLUDE}/${_version_header}")
|
||||
if(NOT EXISTS "${HEADER_PATH}")
|
||||
message(SEND_ERROR "find_simple_library: Header not found: ${HEADER_PATH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Note: this line is edited at compile time to insert the install folder
|
||||
PREFIX=@FXSDK_PREFIX@
|
||||
# These lines are substituted at install time
|
||||
PREFIX="@CMAKE_INSTALL_PREFIX@"
|
||||
VERSION="@CMAKE_PROJECT_VERSION@"
|
||||
|
||||
R=$(printf "\e[31;1m")
|
||||
g=$(printf "\e[32m\e[3m")
|
||||
|
@ -9,8 +10,9 @@ n=$(printf "\e[0m")
|
|||
TAG=$(printf "\e[36m<fxSDK>\e[0m")
|
||||
|
||||
usage_string=$(cat << EOF
|
||||
usage: ${R}fxsdk${n} (${R}new${n}|${R}build${n}|${R}build-fx${n}|${R}build-\
|
||||
cg${n}|${R}send${n}|${R}send-fx${n}|${R}send-cg${n}) [${g}ARGUMENTS${n}...]
|
||||
fxSDK version $VERSION
|
||||
usage: ${R}fxsdk${n} (${R}new${n}|${R}build-fx${n}|${R}build-cg${n}|\
|
||||
${R}send-fx${n}|${R}send-cg${n}|...) [${g}ARGUMENTS${n}...]
|
||||
|
||||
This program is a command-line helper for the fxSDK, a set of tools used in
|
||||
conjunction with gint to develop add-ins for CASIO fx-9860G and fx-CG 50.
|
||||
|
@ -33,8 +35,14 @@ ${R}fxsdk${n} (${R}build${n}|${R}build-fx${n}|${R}build-cg${n}) [${R}-c${n}] \
|
|||
|
||||
${R}fxsdk${n} (${R}send${n}|${R}send-fx${n}|${R}send-cg${n})
|
||||
Sends the target file to the calculator. Uses p7 (which must be installed
|
||||
externally) for fx-9860G. Currently not implemented for fx-CG 50, as it
|
||||
requires detecting and mounting the calculator (same for the Graph 35+E II).
|
||||
externally) for the fx-9860G, and fxlink for the fx-CG. For the G-III series,
|
||||
call fxlink directly instead of this command.
|
||||
|
||||
${R}fxsdk${n} ${R}path${n} (${R}sysroot${n}|${R}include${n}|${R}lib${n})
|
||||
Prints commonly-used paths in the SuperH sysroot:
|
||||
${R}sysroot${n} The root folder of the SuperH toolchain and libraries
|
||||
${R}include${n} Install folder for user's headers
|
||||
${R}lib${n} Install folder for user's library files
|
||||
EOF
|
||||
)
|
||||
|
||||
|
@ -231,6 +239,23 @@ fxsdk_send_cg() {
|
|||
fxlink -sw ${g3a_files}
|
||||
}
|
||||
|
||||
fxsdk_path() {
|
||||
case "$1" in
|
||||
"sysroot")
|
||||
echo "$PREFIX/share/fxsdk/sysroot";;
|
||||
"include")
|
||||
echo "$PREFIX/share/fxsdk/sysroot/sh3eb-elf/include";;
|
||||
"lib")
|
||||
echo "$PREFIX/share/fxsdk/sysroot/sh3eb-elf/lib";;
|
||||
"")
|
||||
echo "error: no path specified; try 'fxsdk --help'" >&2
|
||||
exit 1;;
|
||||
*)
|
||||
echo "error: unknown path '$1'; try 'fxsdk --help'" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Parse command name
|
||||
|
||||
case "$1" in
|
||||
|
@ -254,9 +279,15 @@ case "$1" in
|
|||
"send-cg"|"sc"|"scg")
|
||||
fxsdk_send_cg;;
|
||||
|
||||
# Utilities
|
||||
"path")
|
||||
fxsdk_path "${@:2}";;
|
||||
|
||||
# Misc
|
||||
-h|--help|-\?)
|
||||
usage 0;;
|
||||
--version)
|
||||
echo "fxSDK version $VERSION";;
|
||||
?*)
|
||||
error "unknown command '$1'"
|
||||
exit 1;;
|
||||
|
|
|
@ -18,8 +18,13 @@ install:
|
|||
@ make -C build install
|
||||
|
||||
uninstall:
|
||||
@ echo "<fxsdk> Removing the SuperH sysroot..."
|
||||
@ if [ -d "$(shell fxsdk path sysroot)" ]; then \
|
||||
rm -r "$(shell fxsdk path sysroot)"; \
|
||||
fi
|
||||
@ echo "<fxsdk> Uninstalling fxSDK tools..."
|
||||
@ if [ -e build/install_manifest.txt ]; then \
|
||||
xargs rm -f < build/install_manifest.txt; \
|
||||
xargs rm -f < build/install_manifest.txt; \
|
||||
fi
|
||||
|
||||
.PHONY: configure build install uninstall
|
||||
|
|
Loading…
Reference in a new issue