From 07a9090c9886c6f15f4585ebb9c3562ac21a9deb Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sun, 2 May 2021 15:05:36 +0200 Subject: [PATCH] add CMake instructions in the README --- README.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a19deea..60d6b94 100644 --- a/README.md +++ b/README.md @@ -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 `) 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( PRIVATE "${FXSDK_COMPILER_INSTALL}/include/openlibm") +target_link_libraries( -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).