add CMake instructions in the README

This commit is contained in:
Lephenixnoir 2021-05-02 15:05:36 +02:00
parent 22428cc5d2
commit 07a9090c98
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

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 % 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 ## README and Licensing
See the original README file in README-OpenLibm.md. OpenLibm contains code See the original README file in [README-OpenLibm.md](README-OpenLibm.md).
covered by various licenses, see LICENSE.md. OpenLibm contains code covered by various licenses, see
[LICENSE.md](LICENSE.md).