Update cmake according to trabucayre request https://github.com/trabucayre/openFPGALoader/pull/17
This commit is contained in:
parent
ca1329e707
commit
a86eff6b57
|
|
@ -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
|
||||
)
|
||||
|
|
@ -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)
|
||||
Loading…
Reference in New Issue