mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-06-02 09:46:34 +03:00
cmake: find & use libgpiod
This commit is contained in:
@@ -27,7 +27,7 @@ set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
||||
option(BUILD_DOC "Enable building documents" OFF)
|
||||
option(HAVE_LINUXGPIO "Enable Linux sysfs GPIO support" OFF)
|
||||
option(HAVE_LINUXGPIO "Enable Linux sysfs and libgpiod GPIO support" OFF)
|
||||
option(HAVE_LINUXSPI "Enable Linux SPI support" OFF)
|
||||
option(HAVE_PARPORT "Enable parallel port support" OFF)
|
||||
option(USE_EXTERNAL_LIBS "Use external libraries from AVRDUDE GitHub repositories" OFF)
|
||||
@@ -125,6 +125,7 @@ if(USE_STATIC_LIBS)
|
||||
set(PREFERRED_LIBFTDI libftdi.a ftdi)
|
||||
set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1)
|
||||
set(PREFERRED_LIBREADLINE libreadline.a)
|
||||
set(PREFERRED_LIBGPIOD libgpiod.a gpiod)
|
||||
else()
|
||||
set(PREFERRED_LIBELF elf)
|
||||
set(PREFERRED_LIBUSB usb)
|
||||
@@ -133,6 +134,7 @@ else()
|
||||
set(PREFERRED_LIBFTDI ftdi)
|
||||
set(PREFERRED_LIBFTDI1 ftdi1)
|
||||
set(PREFERRED_LIBREADLINE readline)
|
||||
set(PREFERRED_LIBGPIOD gpiod)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
@@ -223,6 +225,16 @@ elseif(MSVC)
|
||||
set(HAVE_LIBREADLINE 1)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libgpiod, if needed
|
||||
if(HAVE_LINUXGPIO)
|
||||
find_library(HAVE_LIBGPIOD NAMES ${PREFERRED_LIBGPIOD})
|
||||
if(HAVE_LIBGPIOD)
|
||||
set(LIB_LIBGPIOD ${HAVE_LIBGPIOD})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${LIB_LIBGPIOD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Use external libraries if requested
|
||||
# =====================================
|
||||
@@ -315,6 +327,7 @@ if (DEBUG_CMAKE)
|
||||
message(STATUS "HAVE_LIBUSB_1_0_LIBUSB_H: ${HAVE_LIBUSB_1_0_LIBUSB_H}")
|
||||
message(STATUS "HAVE_HIDAPI_HIDAPI_H: ${HAVE_HIDAPI_HIDAPI_H}")
|
||||
message(STATUS "LIBUSB_COMPAT_DIR: ${LIBUSB_COMPAT_DIR}")
|
||||
message(STATUS "HAVE_LIBGPIOD: ${HAVE_LIBGPIOD}")
|
||||
message(STATUS "----------------------")
|
||||
endif()
|
||||
|
||||
@@ -378,6 +391,11 @@ endif()
|
||||
|
||||
if(HAVE_LINUXGPIO)
|
||||
message(STATUS "ENABLED linuxgpio")
|
||||
if (HAVE_LIBGPIOD)
|
||||
message(STATUS "DO HAVE libgpiod")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libgpiod")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "DISABLED linuxgpio")
|
||||
endif()
|
||||
|
||||
@@ -272,6 +272,7 @@ target_link_libraries(libavrdude
|
||||
${LIB_LIBFTDI1}
|
||||
${LIB_LIBREADLINE}
|
||||
${LIB_NCURSES}
|
||||
${LIB_LIBGPIOD}
|
||||
${EXTRA_WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
/* Linux sysfs GPIO support enabled */
|
||||
#cmakedefine HAVE_LINUXGPIO 1
|
||||
|
||||
/* Let linuxgpio know if libgpiod is available. */
|
||||
#cmakedefine HAVE_LIBGPIOD
|
||||
|
||||
/* Linux SPI support enabled */
|
||||
#cmakedefine HAVE_LINUXSPI 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user