diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b60e599 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,96 @@ + +cmake_minimum_required(VERSION 3.0) + +# set the project name +project(openFPGALoader VERSION 0.1 LANGUAGES CXX) + +## specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(LIBFTDI REQUIRED libftdi1) +pkg_check_modules(LIBFTDIPP REQUIRED libftdipp1) +pkg_check_modules(LIBUSB REQUIRED libusb) +pkg_check_modules(LIBUDEV REQUIRED libudev) + +set(OPENFPGALOADER_SOURCE + src/spiFlash.cpp + src/epcq.cpp + src/svf_jtag.cpp + src/jedParser.cpp + src/display.cpp + src/ftdijtag.cpp + src/configBitstreamParser.cpp + src/ftdipp_mpsse.cpp + src/xilinx.cpp + src/main.cpp + src/latticeBitParser.cpp + src/gowin.cpp + src/device.cpp + src/lattice.cpp + src/progressBar.cpp + src/fsparser.cpp + src/mcsParser.cpp + src/ftdispi.cpp + src/altera.cpp + src/bitparser.cpp +) + +set(OPENFPGALOADER_HEADERS + src/altera.hpp + src/progressBar.hpp + src/bitparser.hpp + src/ftdijtag.hpp + src/fsparser.hpp + src/part.hpp + src/board.hpp + src/jedParser.hpp + src/display.hpp + src/mcsParser.hpp + src/ftdipp_mpsse.hpp + src/spiFlash.hpp + src/epcq.hpp + src/svf_jtag.hpp + src/xilinx.hpp + src/configBitstreamParser.hpp + src/device.hpp + src/gowin.hpp + src/cable.hpp + src/ftdispi.hpp + src/lattice.hpp + src/latticeBitParser.hpp +) + +add_executable(openFPGALoader + ${OPENFPGALOADER_SOURCE} + ${OPENFPGALOADER_HEADERS} +) + +include_directories(${LIBUDEV_INCLUDE_DIRS} + ${LIBUSB_INCLUDE_DIRS} + ${LIBFTDI_INCLUDE_DIRS} + ${LIBFTDIPP_INCLUDE_DIRS} +) + +target_link_libraries(openFPGALoader + ${LIBUDEV_LIBRARIES} + ${LIBUSB_LIBRARIES} + ${LIBFTDI_LIBRARIES} + ${LIBFTDIPP_LIBRARIES} +) + +# libftdi < 1.4 as no usb_addr +if (${LIBFTDI_VERSION} VERSION_LESS 1.4) + set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") +else() + set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=0") +endif() + +install(TARGETS openFPGALoader DESTINATION bin) +install(FILES + test_sfl.svf + spiOverJtag/spiOverJtag_xc7a35.bit + DESTINATION share/openFPGALoader +) diff --git a/openFPGALoader/CMakeLists.txt b/openFPGALoader/CMakeLists.txt deleted file mode 100644 index da0350d..0000000 --- a/openFPGALoader/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required(VERSION 3.7) - -# set the project name -project(openFPGALoader VERSION 0.1) - -file(GLOB SOURCES *.hpp *.cpp) - -# add the executable -add_executable(openFPGALoader ${SOURCES}) - -find_path(LIBUSB_INCLUDE_DIR - NAMES libusb.h - PATH_SUFFIXES "include" "libusb" "libusb-1.0") - -find_library(LIBUSB_LIBRARY - NAMES usb - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBUSB10_LIBRARY - NAMES usb-1.0 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBUDEV_LIBRARY - NAMES udev - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_path(LIBFTDI1_INCLUDE_DIR - NAMES ftdi.h - PATH_SUFFIXES "include" "ftdi" "libftdi1") - -find_library(LIBFTDI1_LIBRARY - NAMES ftdi1 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_library(LIBFTDIPP1_LIBRARY - NAMES ftdipp1 - PATH_SUFFIXES "lib" "lib32" "lib64") - -find_package(LibFTDI1) - -target_include_directories(openFPGALoader PUBLIC ${LIBUSB_INCLUDE_DIR}) -target_include_directories(openFPGALoader PUBLIC ${LIBFTDI1_INCLUDE_DIR}) -target_link_libraries(openFPGALoader ${LIBUSB_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBFTDI1_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBFTDIPP1_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBUSB10_LIBRARY}) -target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARY}) - -link_libraries(udev usb-1.0) - -#/usr/lib/x86_64-linux-gnu/libftdipp1.so -configure_file(openFPGALoader.h.in openFPGALoader.h) - -target_include_directories(openFPGALoader PUBLIC "${PROJECT_BINARY_DIR}") - -set(CMAKE_SOURCE_DIR openFPGALoader/) - - -set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") - -# specify the C++ standard -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/openFPGALoader/altera.cpp b/src/altera.cpp similarity index 100% rename from openFPGALoader/altera.cpp rename to src/altera.cpp diff --git a/openFPGALoader/altera.hpp b/src/altera.hpp similarity index 100% rename from openFPGALoader/altera.hpp rename to src/altera.hpp diff --git a/openFPGALoader/bitparser.cpp b/src/bitparser.cpp similarity index 100% rename from openFPGALoader/bitparser.cpp rename to src/bitparser.cpp diff --git a/openFPGALoader/bitparser.hpp b/src/bitparser.hpp similarity index 100% rename from openFPGALoader/bitparser.hpp rename to src/bitparser.hpp diff --git a/openFPGALoader/board.hpp b/src/board.hpp similarity index 100% rename from openFPGALoader/board.hpp rename to src/board.hpp diff --git a/openFPGALoader/cable.hpp b/src/cable.hpp similarity index 100% rename from openFPGALoader/cable.hpp rename to src/cable.hpp diff --git a/openFPGALoader/configBitstreamParser.cpp b/src/configBitstreamParser.cpp similarity index 100% rename from openFPGALoader/configBitstreamParser.cpp rename to src/configBitstreamParser.cpp diff --git a/openFPGALoader/configBitstreamParser.hpp b/src/configBitstreamParser.hpp similarity index 100% rename from openFPGALoader/configBitstreamParser.hpp rename to src/configBitstreamParser.hpp diff --git a/openFPGALoader/device.cpp b/src/device.cpp similarity index 100% rename from openFPGALoader/device.cpp rename to src/device.cpp diff --git a/openFPGALoader/device.hpp b/src/device.hpp similarity index 100% rename from openFPGALoader/device.hpp rename to src/device.hpp diff --git a/openFPGALoader/display.cpp b/src/display.cpp similarity index 100% rename from openFPGALoader/display.cpp rename to src/display.cpp diff --git a/openFPGALoader/display.hpp b/src/display.hpp similarity index 100% rename from openFPGALoader/display.hpp rename to src/display.hpp diff --git a/openFPGALoader/epcq.cpp b/src/epcq.cpp similarity index 100% rename from openFPGALoader/epcq.cpp rename to src/epcq.cpp diff --git a/openFPGALoader/epcq.hpp b/src/epcq.hpp similarity index 100% rename from openFPGALoader/epcq.hpp rename to src/epcq.hpp diff --git a/openFPGALoader/fsparser.cpp b/src/fsparser.cpp similarity index 100% rename from openFPGALoader/fsparser.cpp rename to src/fsparser.cpp diff --git a/openFPGALoader/fsparser.hpp b/src/fsparser.hpp similarity index 100% rename from openFPGALoader/fsparser.hpp rename to src/fsparser.hpp diff --git a/openFPGALoader/ftdijtag.cpp b/src/ftdijtag.cpp similarity index 100% rename from openFPGALoader/ftdijtag.cpp rename to src/ftdijtag.cpp diff --git a/openFPGALoader/ftdijtag.hpp b/src/ftdijtag.hpp similarity index 100% rename from openFPGALoader/ftdijtag.hpp rename to src/ftdijtag.hpp diff --git a/openFPGALoader/ftdipp_mpsse.cpp b/src/ftdipp_mpsse.cpp similarity index 100% rename from openFPGALoader/ftdipp_mpsse.cpp rename to src/ftdipp_mpsse.cpp diff --git a/openFPGALoader/ftdipp_mpsse.hpp b/src/ftdipp_mpsse.hpp similarity index 100% rename from openFPGALoader/ftdipp_mpsse.hpp rename to src/ftdipp_mpsse.hpp diff --git a/openFPGALoader/ftdispi.cpp b/src/ftdispi.cpp similarity index 100% rename from openFPGALoader/ftdispi.cpp rename to src/ftdispi.cpp diff --git a/openFPGALoader/ftdispi.hpp b/src/ftdispi.hpp similarity index 100% rename from openFPGALoader/ftdispi.hpp rename to src/ftdispi.hpp diff --git a/openFPGALoader/gowin.cpp b/src/gowin.cpp similarity index 100% rename from openFPGALoader/gowin.cpp rename to src/gowin.cpp diff --git a/openFPGALoader/gowin.hpp b/src/gowin.hpp similarity index 100% rename from openFPGALoader/gowin.hpp rename to src/gowin.hpp diff --git a/openFPGALoader/jedParser.cpp b/src/jedParser.cpp similarity index 100% rename from openFPGALoader/jedParser.cpp rename to src/jedParser.cpp diff --git a/openFPGALoader/jedParser.hpp b/src/jedParser.hpp similarity index 100% rename from openFPGALoader/jedParser.hpp rename to src/jedParser.hpp diff --git a/openFPGALoader/lattice.cpp b/src/lattice.cpp similarity index 100% rename from openFPGALoader/lattice.cpp rename to src/lattice.cpp diff --git a/openFPGALoader/lattice.hpp b/src/lattice.hpp similarity index 100% rename from openFPGALoader/lattice.hpp rename to src/lattice.hpp diff --git a/openFPGALoader/latticeBitParser.cpp b/src/latticeBitParser.cpp similarity index 100% rename from openFPGALoader/latticeBitParser.cpp rename to src/latticeBitParser.cpp diff --git a/openFPGALoader/latticeBitParser.hpp b/src/latticeBitParser.hpp similarity index 100% rename from openFPGALoader/latticeBitParser.hpp rename to src/latticeBitParser.hpp diff --git a/openFPGALoader/main.cpp b/src/main.cpp similarity index 100% rename from openFPGALoader/main.cpp rename to src/main.cpp diff --git a/openFPGALoader/mcsParser.cpp b/src/mcsParser.cpp similarity index 100% rename from openFPGALoader/mcsParser.cpp rename to src/mcsParser.cpp diff --git a/openFPGALoader/mcsParser.hpp b/src/mcsParser.hpp similarity index 100% rename from openFPGALoader/mcsParser.hpp rename to src/mcsParser.hpp diff --git a/openFPGALoader/openFPGALoader.h.in b/src/openFPGALoader.h.in similarity index 100% rename from openFPGALoader/openFPGALoader.h.in rename to src/openFPGALoader.h.in diff --git a/openFPGALoader/part.hpp b/src/part.hpp similarity index 100% rename from openFPGALoader/part.hpp rename to src/part.hpp diff --git a/openFPGALoader/progressBar.cpp b/src/progressBar.cpp similarity index 100% rename from openFPGALoader/progressBar.cpp rename to src/progressBar.cpp diff --git a/openFPGALoader/progressBar.hpp b/src/progressBar.hpp similarity index 100% rename from openFPGALoader/progressBar.hpp rename to src/progressBar.hpp diff --git a/openFPGALoader/spiFlash.cpp b/src/spiFlash.cpp similarity index 100% rename from openFPGALoader/spiFlash.cpp rename to src/spiFlash.cpp diff --git a/openFPGALoader/spiFlash.hpp b/src/spiFlash.hpp similarity index 100% rename from openFPGALoader/spiFlash.hpp rename to src/spiFlash.hpp diff --git a/openFPGALoader/svf_jtag.cpp b/src/svf_jtag.cpp similarity index 100% rename from openFPGALoader/svf_jtag.cpp rename to src/svf_jtag.cpp diff --git a/openFPGALoader/svf_jtag.hpp b/src/svf_jtag.hpp similarity index 100% rename from openFPGALoader/svf_jtag.hpp rename to src/svf_jtag.hpp diff --git a/openFPGALoader/xilinx.cpp b/src/xilinx.cpp similarity index 100% rename from openFPGALoader/xilinx.cpp rename to src/xilinx.cpp diff --git a/openFPGALoader/xilinx.hpp b/src/xilinx.hpp similarity index 100% rename from openFPGALoader/xilinx.hpp rename to src/xilinx.hpp