File 0001-adds-an-option-to-build-without-wiringpi.patch of Package xc3sprog

From 357c420bcc4ffa49b9e26b4c5435e7580245d3d9 Mon Sep 17 00:00:00 2001
From: Nicolas Robin <13021796+nicolas-robin@users.noreply.github.com>
Date: Sun, 12 Jan 2020 20:17:26 +0100
Subject: [PATCH] adds an option to build without wiringpi

---
 CMakeLists.txt | 12 ++++++++++--
 utilities.cpp  |  2 ++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a6455c..96e410d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,9 +130,15 @@ ADD_CUSTOM_COMMAND(OUTPUT cables.h
 
 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
 
+option(USE_WIRINGPI "Use WiringPi" ON)
+
+if(USE_WIRINGPI)
+    set (CONDITIONAL_FILES ${CONDITIONAL_FILES} "iomatrixcreator.cpp" "iomatrixvoice.cpp" "iowiringpi.cpp")
+    add_definitions( -DUSE_WIRINGPI )
+endif(USE_WIRINGPI)
+
 add_library(xc3sproglib  STATIC sysfs.cpp sysfscreator.cpp sysfsvoice.cpp ioftdi.cpp 
                         iofx2.cpp devicedb.cpp jtag.cpp jedecfile.cpp bitfile.cpp 
-                        iomatrixcreator.cpp iomatrixvoice.cpp iowiringpi.cpp
 			iobase.cpp  progalgxc95x.cpp utilities.cpp
 			progalgxcf.cpp progalgxcfp.cpp progalgxc3s.cpp
 			progalgavr.cpp progalgxc2c.cpp  mapfile_xc2c.cpp
@@ -140,7 +146,9 @@ add_library(xc3sproglib  STATIC sysfs.cpp sysfscreator.cpp sysfsvoice.cpp ioftdi
                         cabledb.cpp pdioverjtag.cpp xmega_pdi_nvm.cpp
                         ${CONDITIONAL_FILES} devices.h cables.h)
 
-set(LIBS ${LIBS} wiringPiDev wiringPi)
+if(USE_WIRINGPI)
+  set(LIBS ${LIBS} wiringPiDev wiringPi)
+endif(USE_WIRINGPI)
 
 add_executable(xc2c_warp xc2c_warp.cpp)
 target_link_libraries(xc2c_warp xc3sproglib ${CONDITIONAL_LIBS})
diff --git a/utilities.cpp b/utilities.cpp
index eabc7e9..cd093dd 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -100,6 +100,7 @@ int  getIO( std::auto_ptr<IOBase> *io, struct cable_t * cable, char const *dev,
       io->get()->setVerbose(verbose);
       res = io->get()->Init(cable, serial, use_freq);
   }
+#ifdef USE_WIRINGPI
   else if(cable->cabletype == CABLE_MATRIX_CREATOR)
   {
       io->reset(new IOMatrixCreator());
@@ -112,6 +113,7 @@ int  getIO( std::auto_ptr<IOBase> *io, struct cable_t * cable, char const *dev,
       io->get()->setVerbose(verbose);
       res = io->get()->Init(cable, serial, use_freq);
   }
+#endif /*USE_WIRINGPI*/
   else
   {
       fprintf(stderr, "Unknown Cable \"%s\" \n", getCableName(cable->cabletype));
-- 
2.37.3

openSUSE Build Service is sponsored by