2023-12-22 07:01:58 +01:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
2020-01-27 09:47:42 +01:00
|
|
|
|
|
|
|
|
# set the project name
|
2024-12-31 22:00:48 +01:00
|
|
|
project(openFPGALoader VERSION "0.13.1" LANGUAGES CXX)
|
2020-12-17 13:58:30 +01:00
|
|
|
add_definitions(-DVERSION=\"v${PROJECT_VERSION}\")
|
2020-01-27 09:47:42 +01:00
|
|
|
|
2023-03-05 16:05:29 +01:00
|
|
|
option(ENABLE_OPTIM "Enable build with -O3 optimization level" ON)
|
2020-03-14 18:49:13 +01:00
|
|
|
option(BUILD_STATIC "Whether or not to build with static libraries" OFF)
|
2021-10-03 14:43:15 +02:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
2022-03-22 21:36:36 +01:00
|
|
|
set(ENABLE_UDEV OFF)
|
2021-10-03 14:43:15 +02:00
|
|
|
else()
|
2022-03-22 21:36:36 +01:00
|
|
|
option(ENABLE_UDEV "use udev to search JTAG adapter from /dev/xx" ON)
|
2021-10-03 14:43:15 +02:00
|
|
|
endif()
|
2021-06-19 17:28:48 +02:00
|
|
|
option(ENABLE_CMSISDAP "enable cmsis DAP interface (requires hidapi)" ON)
|
2024-05-20 21:10:29 +02:00
|
|
|
option(ENABLE_GOWIN_GWU2X "enable Gowin GWU2X interface" ON)
|
2022-07-22 10:26:46 +02:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
|
option(ENABLE_LIBGPIOD "enable libgpiod bitbang driver (requires libgpiod)" ON)
|
2023-02-26 20:39:12 +01:00
|
|
|
option(ENABLE_REMOTEBITBANG "enable remote bitbang driver" ON)
|
2022-07-22 10:26:46 +02:00
|
|
|
else()
|
|
|
|
|
set(ENABLE_LIBGPIOD OFF)
|
2023-02-26 20:39:12 +01:00
|
|
|
set(ENABLE_REMOTEBITBANG OFF)
|
2022-07-22 10:26:46 +02:00
|
|
|
endif()
|
2020-07-25 06:06:25 +02:00
|
|
|
option(USE_PKGCONFIG "Use pkgconfig to find libraries" ON)
|
|
|
|
|
option(LINK_CMAKE_THREADS "Use CMake find_package to link the threading library" OFF)
|
2023-03-05 23:20:16 +01:00
|
|
|
set(BLASTERII_PATH "" CACHE STRING "usbBlasterII firmware directory")
|
2021-10-06 08:46:00 +02:00
|
|
|
set(ISE_PATH "/opt/Xilinx/14.7" CACHE STRING "ise root directory (default: /opt/Xilinx/14.7)")
|
2020-03-14 18:49:13 +01:00
|
|
|
|
2020-01-27 09:47:42 +01:00
|
|
|
## specify the C++ standard
|
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
2020-07-25 06:06:25 +02:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra ${CMAKE_CXX_FLAGS_DEBUG}")
|
2023-03-05 16:05:29 +01:00
|
|
|
if (ENABLE_OPTIM)
|
|
|
|
|
set(CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS}")
|
|
|
|
|
endif()
|
2020-01-27 09:47:42 +01:00
|
|
|
|
2020-03-14 18:49:13 +01:00
|
|
|
if (BUILD_STATIC)
|
2020-07-25 06:06:25 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static ${CMAKE_EXE_LINKER_FLAGS}")
|
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
2020-03-14 18:49:13 +01:00
|
|
|
endif()
|
|
|
|
|
|
2020-02-16 13:33:38 +01:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
# By default: DATA_DIR="/usr/local/share"
|
|
|
|
|
add_definitions(-DDATA_DIR=\"${CMAKE_INSTALL_FULL_DATAROOTDIR}\")
|
|
|
|
|
|
2021-10-06 08:46:00 +02:00
|
|
|
add_definitions(-DISE_DIR=\"${ISE_PATH}\")
|
2023-03-05 23:20:16 +01:00
|
|
|
add_definitions(-DBLASTERII_DIR=\"${BLASTERII_PATH}\")
|
2021-10-06 08:46:00 +02:00
|
|
|
|
2022-03-22 21:36:36 +01:00
|
|
|
if (USE_PKGCONFIG)
|
2020-07-25 06:06:25 +02:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
|
pkg_check_modules(LIBFTDI REQUIRED libftdi1)
|
|
|
|
|
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
2024-04-14 08:57:12 +02:00
|
|
|
pkg_check_modules(HIDAPI hidapi-libusb)
|
|
|
|
|
# if libusb not found try with hidraw
|
2022-03-22 21:36:36 +01:00
|
|
|
if (NOT HIDAPI_FOUND)
|
2024-04-14 08:57:12 +02:00
|
|
|
pkg_check_modules(HIDAPI hidapi-hidraw)
|
2021-10-14 06:46:59 +02:00
|
|
|
endif()
|
2023-04-09 08:06:16 +02:00
|
|
|
if (NOT HIDAPI_FOUND)
|
|
|
|
|
pkg_check_modules(HIDAPI hidapi)
|
|
|
|
|
endif()
|
2021-12-02 07:20:58 +01:00
|
|
|
# zlib support (gzip)
|
|
|
|
|
pkg_check_modules(ZLIB zlib)
|
|
|
|
|
if (NOT ZLIB_FOUND)
|
|
|
|
|
# try zlib-ng
|
|
|
|
|
pkg_check_modules(ZLIB zlib-ng)
|
|
|
|
|
if (ZLIB_FOUND)
|
|
|
|
|
add_definitions(-DHAS_ZLIBNG)
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Could find ZLIB")
|
|
|
|
|
endif()
|
|
|
|
|
endif(NOT ZLIB_FOUND)
|
2020-07-25 06:06:25 +02:00
|
|
|
|
2022-03-22 21:36:36 +01:00
|
|
|
if (ENABLE_UDEV)
|
2020-07-25 06:06:25 +02:00
|
|
|
pkg_check_modules(LIBUDEV libudev)
|
|
|
|
|
if (LIBUDEV_FOUND)
|
|
|
|
|
add_definitions(-DUSE_UDEV)
|
|
|
|
|
else()
|
|
|
|
|
message("libudev not found, disabling udev support and -D parameter")
|
|
|
|
|
set(ENABLE_UDEV OFF)
|
|
|
|
|
endif()
|
2020-03-14 19:42:07 +01:00
|
|
|
endif()
|
2022-05-23 20:16:48 +02:00
|
|
|
|
|
|
|
|
if (ENABLE_LIBGPIOD)
|
2022-07-22 10:26:46 +02:00
|
|
|
pkg_check_modules(LIBGPIOD libgpiod)
|
2022-05-23 20:16:48 +02:00
|
|
|
if (NOT LIBGPIOD_FOUND)
|
|
|
|
|
message("libgpiod not found, disabling gpiod support")
|
|
|
|
|
set(ENABLE_LIBGPIOD OFF)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2020-03-14 19:42:07 +01:00
|
|
|
endif()
|
2020-01-27 09:47:42 +01:00
|
|
|
|
|
|
|
|
set(OPENFPGALOADER_SOURCE
|
2020-08-20 16:58:20 +02:00
|
|
|
src/anlogic.cpp
|
2020-08-21 14:01:07 +02:00
|
|
|
src/anlogicBitParser.cpp
|
2020-08-20 16:56:29 +02:00
|
|
|
src/anlogicCable.cpp
|
2021-11-06 10:33:25 +01:00
|
|
|
src/ch552_jtag.cpp
|
2023-04-17 20:55:10 +02:00
|
|
|
src/common.cpp
|
2021-06-20 10:25:49 +02:00
|
|
|
src/dfu.cpp
|
2021-02-15 07:33:58 +01:00
|
|
|
src/dfuFileParser.cpp
|
2020-06-14 15:41:00 +02:00
|
|
|
src/dirtyJtag.cpp
|
2023-05-13 22:00:23 +02:00
|
|
|
src/ch347jtag.cpp
|
2020-10-31 08:46:53 +01:00
|
|
|
src/efinix.cpp
|
|
|
|
|
src/efinixHexParser.cpp
|
2021-05-13 16:04:34 +02:00
|
|
|
src/fx2_ll.cpp
|
2020-10-31 15:02:54 +01:00
|
|
|
src/ice40.cpp
|
2021-05-13 12:14:52 +02:00
|
|
|
src/ihexParser.cpp
|
2022-11-20 16:46:51 +01:00
|
|
|
src/pofParser.cpp
|
|
|
|
|
src/rawParser.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/spiFlash.cpp
|
2021-12-22 19:01:58 +01:00
|
|
|
src/spiInterface.cpp
|
2020-08-19 15:15:13 +02:00
|
|
|
src/usbBlaster.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/epcq.cpp
|
|
|
|
|
src/svf_jtag.cpp
|
|
|
|
|
src/jedParser.cpp
|
2021-11-09 09:54:09 +01:00
|
|
|
src/feaparser.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/display.cpp
|
2020-03-06 09:22:34 +01:00
|
|
|
src/jtag.cpp
|
2020-03-07 11:43:18 +01:00
|
|
|
src/ftdiJtagBitbang.cpp
|
2020-03-06 09:22:34 +01:00
|
|
|
src/ftdiJtagMPSSE.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/configBitstreamParser.cpp
|
|
|
|
|
src/ftdipp_mpsse.cpp
|
|
|
|
|
src/main.cpp
|
|
|
|
|
src/latticeBitParser.cpp
|
2022-10-15 22:28:06 +02:00
|
|
|
src/libusb_ll.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/gowin.cpp
|
|
|
|
|
src/device.cpp
|
2022-03-12 18:46:23 +01:00
|
|
|
src/jlink.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/lattice.cpp
|
|
|
|
|
src/progressBar.cpp
|
|
|
|
|
src/fsparser.cpp
|
|
|
|
|
src/mcsParser.cpp
|
|
|
|
|
src/ftdispi.cpp
|
|
|
|
|
src/altera.cpp
|
|
|
|
|
src/bitparser.cpp
|
2021-10-03 16:25:41 +02:00
|
|
|
src/xilinx.cpp
|
|
|
|
|
src/xilinxMapParser.cpp
|
2021-12-10 12:12:32 +01:00
|
|
|
src/colognechip.cpp
|
|
|
|
|
src/colognechipCfgParser.cpp
|
2020-01-27 09:47:42 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(OPENFPGALOADER_HEADERS
|
|
|
|
|
src/altera.hpp
|
2020-08-20 16:58:20 +02:00
|
|
|
src/anlogic.hpp
|
2020-08-21 14:01:07 +02:00
|
|
|
src/anlogicBitParser.hpp
|
2020-08-20 16:56:29 +02:00
|
|
|
src/anlogicCable.hpp
|
2021-11-06 10:33:25 +01:00
|
|
|
src/ch552_jtag.hpp
|
2023-04-17 20:55:10 +02:00
|
|
|
src/common.hpp
|
2020-07-23 18:32:18 +02:00
|
|
|
src/cxxopts.hpp
|
2021-06-20 10:25:49 +02:00
|
|
|
src/dfu.hpp
|
2021-02-15 07:33:58 +01:00
|
|
|
src/dfuFileParser.hpp
|
2020-06-14 15:41:00 +02:00
|
|
|
src/dirtyJtag.hpp
|
2023-05-13 22:00:23 +02:00
|
|
|
src/ch347jtag.hpp
|
2020-10-31 08:46:53 +01:00
|
|
|
src/efinix.hpp
|
|
|
|
|
src/efinixHexParser.hpp
|
2021-05-13 16:04:34 +02:00
|
|
|
src/fx2_ll.hpp
|
2021-05-13 12:14:52 +02:00
|
|
|
src/ice40.hpp
|
|
|
|
|
src/ihexParser.hpp
|
2022-11-20 16:46:51 +01:00
|
|
|
src/pofParser.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/progressBar.hpp
|
2020-09-05 07:49:57 +02:00
|
|
|
src/rawParser.hpp
|
2020-08-19 15:15:13 +02:00
|
|
|
src/usbBlaster.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/bitparser.hpp
|
2020-03-07 11:43:18 +01:00
|
|
|
src/ftdiJtagBitbang.hpp
|
2020-03-06 09:22:34 +01:00
|
|
|
src/ftdiJtagMPSSE.hpp
|
2022-03-12 18:46:23 +01:00
|
|
|
src/jlink.hpp
|
2020-03-06 09:22:34 +01:00
|
|
|
src/jtag.hpp
|
|
|
|
|
src/jtagInterface.hpp
|
2022-10-15 22:28:06 +02:00
|
|
|
src/libusb_ll.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/fsparser.hpp
|
|
|
|
|
src/part.hpp
|
|
|
|
|
src/board.hpp
|
|
|
|
|
src/jedParser.hpp
|
2021-11-09 09:54:09 +01:00
|
|
|
src/feaparser.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/display.hpp
|
|
|
|
|
src/mcsParser.hpp
|
|
|
|
|
src/ftdipp_mpsse.hpp
|
|
|
|
|
src/spiFlash.hpp
|
2021-10-10 18:25:09 +02:00
|
|
|
src/spiFlashdb.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/epcq.hpp
|
2020-04-22 15:17:55 +02:00
|
|
|
src/spiInterface.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
src/svf_jtag.hpp
|
|
|
|
|
src/configBitstreamParser.hpp
|
|
|
|
|
src/device.hpp
|
|
|
|
|
src/gowin.hpp
|
|
|
|
|
src/cable.hpp
|
|
|
|
|
src/ftdispi.hpp
|
|
|
|
|
src/lattice.hpp
|
|
|
|
|
src/latticeBitParser.hpp
|
2021-10-03 16:25:41 +02:00
|
|
|
src/xilinx.hpp
|
|
|
|
|
src/xilinxMapParser.hpp
|
2021-12-10 12:12:32 +01:00
|
|
|
src/colognechip.hpp
|
|
|
|
|
src/colognechipCfgParser.hpp
|
2020-01-27 09:47:42 +01:00
|
|
|
)
|
|
|
|
|
|
2022-03-22 21:36:36 +01:00
|
|
|
link_directories(
|
|
|
|
|
${LIBUSB_LIBRARY_DIRS}
|
|
|
|
|
${LIBFTDI_LIBRARY_DIRS}
|
|
|
|
|
)
|
|
|
|
|
|
2023-04-09 08:06:16 +02:00
|
|
|
if (ENABLE_LIBGPIOD)
|
|
|
|
|
link_directories(${LIBGPIOD_LIBRARY_DIRS})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if (ENABLE_CMSISDAP AND HIDAPI_FOUND)
|
|
|
|
|
link_directories(${HIDAPI_LIBRARY_DIRS})
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-01-27 09:47:42 +01:00
|
|
|
add_executable(openFPGALoader
|
|
|
|
|
${OPENFPGALOADER_SOURCE}
|
|
|
|
|
${OPENFPGALOADER_HEADERS}
|
|
|
|
|
)
|
|
|
|
|
|
2020-03-14 19:42:07 +01:00
|
|
|
include_directories(
|
2020-01-27 09:47:42 +01:00
|
|
|
${LIBUSB_INCLUDE_DIRS}
|
|
|
|
|
${LIBFTDI_INCLUDE_DIRS}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_link_libraries(openFPGALoader
|
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
|
${LIBFTDI_LIBRARIES}
|
|
|
|
|
)
|
2020-03-17 07:25:26 +01:00
|
|
|
|
2024-05-20 21:10:29 +02:00
|
|
|
# Gowin GWU2X JTAG interface
|
|
|
|
|
if(ENABLE_GOWIN_GWU2X)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/gwu2x_jtag.cpp)
|
|
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/gwu2x_jtag.hpp)
|
|
|
|
|
add_definitions(-DENABLE_GOWIN_GWU2X=1)
|
|
|
|
|
message("Gowin GWU2X support enabled")
|
|
|
|
|
else()
|
|
|
|
|
message("Gowin GWU2X support disabled")
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-07-25 08:21:27 +02:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
|
# winsock provides ntohs
|
|
|
|
|
target_link_libraries(openFPGALoader ws2_32)
|
2023-04-09 08:06:16 +02:00
|
|
|
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/pathHelper.cpp)
|
2022-10-23 10:22:47 +02:00
|
|
|
list(APPEND OPENFPGALOADER_HEADERS src/pathHelper.hpp)
|
2020-07-25 08:21:27 +02:00
|
|
|
endif()
|
|
|
|
|
|
2020-03-17 07:25:26 +01:00
|
|
|
# libusb_attach_kernel_driver is only available on Linux.
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
|
add_definitions(-DATTACH_KERNEL)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-03-22 21:36:36 +01:00
|
|
|
if (ENABLE_UDEV)
|
|
|
|
|
include_directories(${LIBUDEV_INCLUDE_DIRS})
|
|
|
|
|
target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARIES})
|
2020-03-14 19:42:07 +01:00
|
|
|
endif()
|
|
|
|
|
|
2022-05-23 20:16:48 +02:00
|
|
|
if (ENABLE_LIBGPIOD)
|
|
|
|
|
include_directories(${LIBGPIOD_INCLUDE_DIRS})
|
|
|
|
|
target_link_libraries(openFPGALoader ${LIBGPIOD_LIBRARIES})
|
|
|
|
|
add_definitions(-DENABLE_LIBGPIOD=1)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/libgpiodJtagBitbang.cpp)
|
|
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/libgpiodJtagBitbang.hpp)
|
2023-04-19 22:27:09 +02:00
|
|
|
if (LIBGPIOD_VERSION VERSION_GREATER_EQUAL 2)
|
|
|
|
|
message("libgpiod v2 support enabled")
|
|
|
|
|
add_definitions(-DGPIOD_APIV2)
|
|
|
|
|
else()
|
|
|
|
|
message("libgpiod v1 support enabled")
|
|
|
|
|
endif()
|
2022-05-23 20:16:48 +02:00
|
|
|
endif(ENABLE_LIBGPIOD)
|
|
|
|
|
|
2022-10-14 11:15:02 +02:00
|
|
|
if (ENABLE_JETSONNANOGPIO)
|
|
|
|
|
add_definitions(-DENABLE_JETSONNANOGPIO=1)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/jetsonNanoJtagBitbang.cpp)
|
|
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/jetsonNanoJtagBitbang.hpp)
|
|
|
|
|
message("Jetson Nano GPIO support enabled")
|
|
|
|
|
endif(ENABLE_JETSONNANOGPIO)
|
|
|
|
|
|
|
|
|
|
if (ENABLE_UDEV OR ENABLE_LIBGPIOD OR ENABLE_JETSONNANOGPIO)
|
2022-09-17 17:33:25 +02:00
|
|
|
add_definitions(-DUSE_DEVICE_ARG)
|
2022-10-14 11:15:02 +02:00
|
|
|
endif(ENABLE_UDEV OR ENABLE_LIBGPIOD OR ENABLE_JETSONNANOGPIO)
|
2022-09-17 17:33:25 +02:00
|
|
|
|
2020-03-14 18:49:13 +01:00
|
|
|
if (BUILD_STATIC)
|
|
|
|
|
set_target_properties(openFPGALoader PROPERTIES LINK_SEARCH_END_STATIC 1)
|
|
|
|
|
endif()
|
2021-06-19 17:28:48 +02:00
|
|
|
|
|
|
|
|
if (ENABLE_CMSISDAP)
|
2022-03-22 21:36:36 +01:00
|
|
|
if (HIDAPI_FOUND)
|
|
|
|
|
include_directories(${HIDAPI_INCLUDE_DIRS})
|
|
|
|
|
target_link_libraries(openFPGALoader ${HIDAPI_LIBRARIES})
|
|
|
|
|
add_definitions(-DENABLE_CMSISDAP=1)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/cmsisDAP.cpp)
|
|
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/cmsisDAP.hpp)
|
|
|
|
|
message("cmsis_dap support enabled")
|
|
|
|
|
else()
|
|
|
|
|
message("hidapi-libusb not found: cmsis_dap support disabled")
|
|
|
|
|
endif()
|
2021-06-19 17:28:48 +02:00
|
|
|
endif(ENABLE_CMSISDAP)
|
|
|
|
|
|
2022-04-10 16:02:39 +02:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2022-07-06 22:26:00 +02:00
|
|
|
add_definitions(-DENABLE_XVC=1)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/xvc_client.cpp src/xvc_server.cpp)
|
2023-02-26 20:39:12 +01:00
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/xvc_client.hpp src/xvc_server.hpp)
|
2022-07-06 22:50:11 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
|
2022-07-06 22:26:00 +02:00
|
|
|
message("Xilinx Virtual Server support enabled")
|
2022-04-10 16:02:39 +02:00
|
|
|
else()
|
2022-07-06 21:14:25 +02:00
|
|
|
message("Xilinx Virtual Server support disabled")
|
2022-04-10 16:02:39 +02:00
|
|
|
endif()
|
|
|
|
|
|
2023-02-26 20:39:12 +01:00
|
|
|
if (ENABLE_REMOTEBITBANG)
|
|
|
|
|
add_definitions(-DENABLE_REMOTEBITBANG=1)
|
|
|
|
|
target_sources(openFPGALoader PRIVATE src/remoteBitbang_client.cpp)
|
|
|
|
|
list (APPEND OPENFPGALOADER_HEADERS src/remoteBitbang_client.hpp)
|
|
|
|
|
message("Remote bitbang client support enabled")
|
|
|
|
|
else()
|
|
|
|
|
message("Remote bitbang client support disabled")
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-11-25 08:11:50 +01:00
|
|
|
if (ZLIB_FOUND)
|
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
|
|
|
|
target_link_libraries(openFPGALoader ${ZLIB_LIBRARIES})
|
|
|
|
|
add_definitions(-DHAS_ZLIB=1)
|
|
|
|
|
else()
|
|
|
|
|
message("zlib library not found: can't flash intel/altera devices")
|
|
|
|
|
endif()
|
2020-03-15 08:22:29 +01:00
|
|
|
|
2020-07-25 06:06:25 +02:00
|
|
|
if (LINK_CMAKE_THREADS)
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
target_link_libraries(openFPGALoader Threads::Threads)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-01-27 09:47:42 +01:00
|
|
|
# libftdi < 1.4 as no usb_addr
|
2021-02-25 13:36:28 +01:00
|
|
|
# libftdi >= 1.5 as purge_buffer obsolete
|
|
|
|
|
string(REPLACE "." ";" VERSION_LIST ${LIBFTDI_VERSION})
|
|
|
|
|
list(GET VERSION_LIST 0 LIBFTDI_VERSION_MAJOR)
|
|
|
|
|
list(GET VERSION_LIST 1 LIBFTDI_VERSION_MINOR)
|
|
|
|
|
math(EXPR FTDI_VAL "${LIBFTDI_VERSION_MAJOR} * 100 + ${LIBFTDI_VERSION_MINOR}")
|
|
|
|
|
|
|
|
|
|
add_definitions(-DFTDI_VERSION=${FTDI_VAL})
|
2020-01-27 09:47:42 +01:00
|
|
|
|
|
|
|
|
install(TARGETS openFPGALoader DESTINATION bin)
|
2023-02-02 07:38:35 +01:00
|
|
|
|
2021-12-19 17:34:51 +01:00
|
|
|
file(GLOB GZ_FILES spiOverJtag/spiOverJtag_*.*.gz)
|
2023-02-02 07:38:35 +01:00
|
|
|
|
|
|
|
|
# Compress rbf and bit files present into repository
|
|
|
|
|
# TODO: test compat with Windows and MacOS
|
|
|
|
|
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
|
|
|
|
include(FindGZIP)
|
|
|
|
|
|
2024-02-23 21:41:58 +01:00
|
|
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND GZIP_PRG)
|
2023-02-02 07:38:35 +01:00
|
|
|
set(SPIOVERJTAG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spiOverJtag")
|
|
|
|
|
file(GLOB BITS_FILES RELATIVE ${SPIOVERJTAG_DIR} spiOverJtag/spiOverJtag_*.bit)
|
|
|
|
|
file(GLOB RBF_FILES RELATIVE ${SPIOVERJTAG_DIR} spiOverJtag/spiOverJtag_*.rbf)
|
|
|
|
|
|
|
|
|
|
STRING(REGEX REPLACE ".bit" ".bit.gz" BIT_GZ_FILES "${BITS_FILES}")
|
|
|
|
|
STRING(REGEX REPLACE ".rbf" ".rbf.gz" RBF_GZ_FILES "${RBF_FILES}")
|
|
|
|
|
|
|
|
|
|
FOREACH(bit ${BITS_FILES} ${RBF_FILES})
|
|
|
|
|
ADD_CUSTOM_COMMAND(OUTPUT ${bit}.gz
|
|
|
|
|
COMMAND ${GZIP_PRG} -9 -c ${bit} > ${CMAKE_CURRENT_BINARY_DIR}/${bit}.gz
|
|
|
|
|
DEPENDS ${SPIOVERJTAG_DIR}/${bit}
|
|
|
|
|
WORKING_DIRECTORY ${SPIOVERJTAG_DIR}
|
|
|
|
|
COMMENT "Building ${bit}.gz")
|
|
|
|
|
list(APPEND GZ_FILES ${CMAKE_CURRENT_BINARY_DIR}/${bit}.gz)
|
|
|
|
|
ENDFOREACH(bit)
|
|
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(bit ALL DEPENDS ${BIT_GZ_FILES} ${RBF_GZ_FILES})
|
|
|
|
|
else()
|
|
|
|
|
file(GLOB BITS_FILES spiOverJtag/spiOverJtag_*.bit)
|
|
|
|
|
file(GLOB RBF_FILES spiOverJtag/spiOverJtag_*.rbf)
|
|
|
|
|
install(FILES
|
|
|
|
|
${BITS_FILES}
|
|
|
|
|
${RBF_FILES}
|
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openFPGALoader
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-04-09 08:06:16 +02:00
|
|
|
install(FILES
|
2021-11-25 08:11:50 +01:00
|
|
|
${GZ_FILES}
|
2020-02-16 13:33:38 +01:00
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openFPGALoader
|
2020-01-27 09:47:42 +01:00
|
|
|
)
|