Skip to content

Commit f2679b0

Browse files
committed
Allow building XVC client without libftdi.
Unlike the XVC server, the XVC client does not depend on libftdi, so building it just depends on having separate flags for enabling it.
1 parent 3ae5e5e commit f2679b0

6 files changed

Lines changed: 37 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ endif()
6666
6767
# XVC and RemoteBitbang are not available on Windows OS.
6868
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
69-
option(ENABLE_REMOTEBITBANG "enable remote bitbang driver" ${ENABLE_CABLE_ALL})
70-
option(ENABLE_XILINX_VIRTUAL_CABLE "enable Xilinx Virtual Cable (XVC) support" ${ENABLE_CABLE_ALL})
69+
option(ENABLE_REMOTEBITBANG "enable remote bitbang driver" ${ENABLE_CABLE_ALL})
70+
option(ENABLE_XILINX_VIRTUAL_CABLE_CLIENT "enable Xilinx Virtual Cable (XVC) client support" ${ENABLE_CABLE_ALL})
71+
option(ENABLE_XILINX_VIRTUAL_CABLE_SERVER "enable Xilinx Virtual Cable (XVC) server support" ${ENABLE_CABLE_ALL})
7172
else()
72-
set(ENABLE_REMOTEBITBANG OFF)
73-
set(ENABLE_XILINX_VIRTUAL_CABLE OFF)
73+
set(ENABLE_REMOTEBITBANG OFF)
74+
set(ENABLE_XILINX_VIRTUAL_CABLE_CLIENT OFF)
75+
set(ENABLE_XILINX_VIRTUAL_CABLE_SERVER OFF)
7476
endif()
7577
7678
####################################################################################################
@@ -102,11 +104,11 @@ set(USE_LIBUSB_LL OFF)
102104
103105
# Only adds libftdi as dependency when a cable
104106
# need this library.
105-
if (ENABLE_FTDI_BASED_CABLE OR ENABLE_USB_BLASTERI OR ENABLE_XILINX_VIRTUAL_CABLE)
107+
if (ENABLE_FTDI_BASED_CABLE OR ENABLE_USB_BLASTERI OR ENABLE_XILINX_VIRTUAL_CABLE_SERVER)
106108
set(USE_LIBFTDI ON)
107109
else()
108110
message("disabled all cables based on FTDI devices")
109-
endif(ENABLE_FTDI_BASED_CABLE OR ENABLE_USB_BLASTERI OR ENABLE_XILINX_VIRTUAL_CABLE)
111+
endif(ENABLE_FTDI_BASED_CABLE OR ENABLE_USB_BLASTERI OR ENABLE_XILINX_VIRTUAL_CABLE_SERVER)
110112
111113
# Only adds libusb as dependency when a cable need this library
112114
if (ENABLE_DFU OR ENABLE_ANLOGIC_CABLE OR ENABLE_CH347 OR ENABLE_DIRTYJTAG
@@ -591,9 +593,13 @@ add_definitions(-DENABLE_SVF_JTAG)
591593
endif()
592594
593595
# Xilinx Virtual Cable
594-
if (ENABLE_XILINX_VIRTUAL_CABLE)
595-
list (APPEND OPENFPGALOADER_SOURCE src/xvc_client.cpp src/xvc_server.cpp)
596-
list (APPEND OPENFPGALOADER_HEADERS src/xvc_client.hpp src/xvc_server.hpp)
596+
if (ENABLE_XILINX_VIRTUAL_CABLE_CLIENT)
597+
list (APPEND OPENFPGALOADER_SOURCE src/xvc_client.cpp)
598+
list (APPEND OPENFPGALOADER_HEADERS src/xvc_client.hpp)
599+
endif()
600+
if (ENABLE_XILINX_VIRTUAL_CABLE_SERVER)
601+
list (APPEND OPENFPGALOADER_SOURCE src/xvc_server.cpp)
602+
list (APPEND OPENFPGALOADER_HEADERS src/xvc_server.hpp)
597603
endif()
598604
599605
# Altera USB Blaster (I & II).
@@ -772,8 +778,16 @@ else()
772778
message("Remote bitbang client support disabled")
773779
endif()
774780
775-
if (ENABLE_XILINX_VIRTUAL_CABLE)
776-
add_definitions(-DENABLE_XVC=1)
781+
if (ENABLE_XILINX_VIRTUAL_CABLE_CLIENT)
782+
add_definitions(-DENABLE_XVC_CLIENT=1)
783+
set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
784+
message("Xilinx Virtual Client support enabled")
785+
else()
786+
message("Xilinx Virtual Client support disabled")
787+
endif()
788+
789+
if (ENABLE_XILINX_VIRTUAL_CABLE_SERVER)
790+
add_definitions(-DENABLE_XVC_SERVER=1)
777791
set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
778792
message("Xilinx Virtual Server support enabled")
779793
else()

cmake/Toolchain-x86_64-w64-mingw32-clang.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ set(CMAKE_EXE_LINKER_FLAGS_INIT "-static -static-libgcc -static-libstdc++")
4848
set(ENABLE_UDEV OFF CACHE BOOL "" FORCE)
4949
set(ENABLE_LIBGPIOD OFF CACHE BOOL "" FORCE)
5050
set(ENABLE_REMOTEBITBANG OFF CACHE BOOL "" FORCE)
51-
set(ENABLE_XILINX_VIRTUAL_CABLE OFF CACHE BOOL "" FORCE)
51+
set(ENABLE_XILINX_VIRTUAL_CABLE_CLIENT OFF CACHE BOOL "" FORCE)
52+
set(ENABLE_XILINX_VIRTUAL_CABLE_SERVER OFF CACHE BOOL "" FORCE)
5253
set(BUILD_STATIC ON CACHE BOOL "" FORCE)

cmake/Toolchain-x86_64-w64-mingw32.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ set(CMAKE_EXE_LINKER_FLAGS_INIT "-static -static-libgcc -static-libstdc++")
3535
set(ENABLE_UDEV OFF CACHE BOOL "" FORCE)
3636
set(ENABLE_LIBGPIOD OFF CACHE BOOL "" FORCE)
3737
set(ENABLE_REMOTEBITBANG OFF CACHE BOOL "" FORCE)
38-
set(ENABLE_XILINX_VIRTUAL_CABLE OFF CACHE BOOL "" FORCE)
38+
set(ENABLE_XILINX_VIRTUAL_CABLE_CLIENT OFF CACHE BOOL "" FORCE)
39+
set(ENABLE_XILINX_VIRTUAL_CABLE_SERVER OFF CACHE BOOL "" FORCE)
3940
set(BUILD_STATIC ON CACHE BOOL "" FORCE)

doc/guide/install.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ Example (enable FTDI-based cables and Xilinx devices only):
385385
- ``ENABLE_USB_BLASTERII``: Enable Altera USB-Blaster II support.
386386
- ``ENABLE_LIBGPIOD``: Enable libgpiod bitbang driver support (Linux only).
387387
- ``ENABLE_REMOTEBITBANG``: Enable remote-bitbang driver support.
388-
- ``ENABLE_XILINX_VIRTUAL_CABLE``: Enable Xilinx Virtual Cable (XVC) support.
388+
- ``ENABLE_XILINX_VIRTUAL_CABLE_CLIENT``: Enable Xilinx Virtual Cable (XVC) client support.
389+
- ``ENABLE_XILINX_VIRTUAL_CABLE_SERVER``: Enable Xilinx Virtual Cable (XVC) server support.
389390
390391
**Vendor options**
391392

src/jtag.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#ifdef ENABLE_USBBLASTER
5656
#include "usbBlaster.hpp"
5757
#endif
58-
#ifdef ENABLE_XVC
58+
#ifdef ENABLE_XVC_CLIENT
5959
#include "xvc_client.hpp"
6060
#endif
6161

@@ -186,7 +186,7 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf,
186186
throw std::exception();
187187
#endif
188188
case MODE_XVC_CLIENT:
189-
#ifdef ENABLE_XVC
189+
#ifdef ENABLE_XVC_CLIENT
190190
_jtag = new XVC_client(ip_adr, port, clkHZ, verbose);
191191
break;
192192
#else

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#ifdef ENABLE_SVF_JTAG
6363
#include "svf_jtag.hpp"
6464
#endif
65-
#ifdef ENABLE_XVC
65+
#ifdef ENABLE_XVC_SERVER
6666
#include "xvc_server.hpp"
6767
#endif
6868

@@ -517,7 +517,7 @@ int main(int argc, char **argv)
517517
#endif
518518
}
519519

520-
#ifdef ENABLE_XVC
520+
#ifdef ENABLE_XVC_SERVER
521521
/* ------------------- */
522522
/* XVC server */
523523
/* ------------------- */
@@ -809,7 +809,7 @@ int main(int argc, char **argv)
809809
delete(jtag);
810810
}
811811

812-
#ifdef ENABLE_XVC
812+
#ifdef ENABLE_XVC_SERVER
813813
int run_xvc_server(const struct arguments &args, const cable_t &cable,
814814
const jtag_pins_conf_t *pins_config)
815815
{
@@ -988,7 +988,7 @@ int parse_opt(int argc, char **argv, struct arguments *args,
988988
("h,help", "Give this help list")
989989
("verify", "Verify write operation (SPI Flash only)",
990990
cxxopts::value<bool>(args->verify))
991-
#ifdef ENABLE_XVC
991+
#ifdef ENABLE_XVC_SERVER
992992
("xvc", "Xilinx Virtual Cable Functions",
993993
cxxopts::value<bool>(args->xvc))
994994
#endif

0 commit comments

Comments
 (0)