add CMake instructions in the README

This commit is contained in:
Lephenixnoir 2021-05-02 15:05:36 +02:00
parent 22428cc5d2
commit 07a9090c98
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 21 additions and 4 deletions

View File

@ -30,11 +30,28 @@ You can then build and install the static `libopenlibm.a` archive and the header
% make USEGCC=1 TOOLPREFIX=sh-elf- libdir="$PREFIX" includedir="$PREFIX/include" install-static install-headers
```
## Using in a program
## Using in a Makefile-based add-in
Simply link with `-lopenlibm` as you would do with `-lm`.
Link with `-lopenlibm` as you would do with `-lm`. Since OpenLibm headers
reference themselves by file name (`#include <openlibm_complex.h>`) even though
they are installed in a subfolder, you need a `-I` flag:
```
CFLAGS += -I $(shell sh-elf-gcc -print-file-name=include/openlibm)
LDFLAGS += -lopenlibm
```
## Using in a CMake-based add-in
When using CMake with the fxSDK, add the include folder and library like this.
```
target_include_directories(<TARGET> PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm")
target_link_libraries(<TARGET> -lopenlibm)
```
## README and Licensing
See the original README file in README-OpenLibm.md. OpenLibm contains code
covered by various licenses, see LICENSE.md.
See the original README file in [README-OpenLibm.md](README-OpenLibm.md).
OpenLibm contains code covered by various licenses, see
[LICENSE.md](LICENSE.md).