add test to check if argp is available or not. Update README

This commit is contained in:
Gwenhael Goavec-Merou 2020-03-14 16:48:40 +01:00
parent df226e16e9
commit 2554f0845b
2 changed files with 18 additions and 1 deletions

View File

@ -19,6 +19,15 @@ pkg_check_modules(LIBFTDIPP REQUIRED libftdipp1)
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
pkg_check_modules(LIBUDEV REQUIRED libudev)
# for non glibc, argp-standalone is required and must be
# explicitly linked. This code will fail for others libc
# implementations
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <argp.h>
int main(int argc, char **argv) {
argp_parse(NULL, argc, argv, 0, 0, NULL);}" HAVE_ARGP)
set(OPENFPGALOADER_SOURCE
src/spiFlash.cpp
src/epcq.cpp
@ -90,6 +99,10 @@ target_link_libraries(openFPGALoader
${LIBFTDIPP_LIBRARIES}
)
if(NOT HAVE_ARGP)
target_link_libraries(openFPGALoader /usr/lib/libargp.a)
endif()
# libftdi < 1.4 as no usb_addr
if (${LIBFTDI_VERSION} VERSION_LESS 1.4)
set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1")

View File

@ -36,7 +36,11 @@ depending of the distribution, headers too)
```bash
apt-get install libftdi1-2 libftdi1-dev libftdipp1-3 libftdipp1-dev libudev-dev cmake
```
and if not already done, install **pkg-config**, **make** and **g++**.
For distributions using non-glibc (musl, uClibc) **argp-standalone** must be
installed.
And if not already done, install **pkg-config**, **make** and **g++**.
To build the app:
```bash