first attempt to build external libraries with cmake

This commit is contained in:
Davide Gerhard 2019-05-02 21:34:25 +02:00
parent 588283a08d
commit 078012a88f
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
37 changed files with 194 additions and 365307 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1.0)
# just to be sure that c++11 if fully supported
# just to be sure that c++11 is fully supported
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
message(FATAL_ERROR "SDRangel requires GCC version 4.9 or higher!")
endif()
@ -9,6 +9,9 @@ project(sdrangel)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# For some external project macros
include(ExternalProject)
# configure version
set(SDRANGEL_VERSION_MAJOR "4")
set(SDRANGEL_VERSION_MINOR "5")
@ -42,6 +45,11 @@ set(CPACK_PACKAGE_VERSION_PATCH ${SDRANGEL_VERSION_PATCH})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# quite unfair with *BSD/...
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
# SDRAngel cmake options
option(DEBUG_OUTPUT "Print debug messages" OFF)
option(SANITIZE_ADDRESS "Activate memory address sanitization" OFF)
@ -50,7 +58,7 @@ option(BUILD_SERVER "Build Server" ON)
option(BUILD_GUI "Build GUI" ON)
option(FORCE_SSSE3 "Compile with SSSE3 instruction only" OFF)
option(FORCE_SSE41 "Compile with SSE4.1 instruction only" OFF)
option(BUILD_EXTERNAL_LIBRARIES "Build external libraries" OFF)
option(ENABLE_EXTERNAL_LIBRARIES "Build external libraries" OFF)
option(ENABLE_AIRSPY "Enable AirSpy support" ON)
option(ENABLE_AIRSPYHF "Enable AirSpyHF support" ON)
option(ENABLE_BLADERF "Enable bladeRF support" ON)
@ -92,6 +100,8 @@ set(INSTALL_BIN_DIR "bin/")
set(INSTALL_LIB_DIR "lib/${PROJECT_NAME}")
set(INSTALL_PLUGINS_DIR ${INSTALL_LIB_DIR}/plugins)
set(INSTALL_PLUGINSSRV_DIR ${INSTALL_LIB_DIR}/pluginssrv)
set(EXTERNAL_BUILD_LIBRARIES "${CMAKE_BINARY_DIR}/external_build")
set(EXTERNAL_INSTALL_LIBRARIES "${CMAKE_BINARY_DIR}/external")
if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH
@ -125,6 +135,35 @@ if (WIN32)
set(OpenCV_LIBS="${EXTERNAL_LIBRARY_FOLDER}/opencv/opencv_ffmpeg410_64.dll")
endif()
# enable 24 bit receiving path
if (RX_SAMPLE_24BIT)
message(STATUS "Compiling for 24 bit Rx DSP chain")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_RX_SAMPLE_24BIT")
else()
message(STATUS "Compiling for 16 bit Rx DSP chain")
endif()
if (SANITIZE_ADDRESS)
message(STATUS "Activate address sanitization")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -fsanitize=address")
endif()
if (C_CLANG OR C_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
elseif (C_MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3 -MP ${EXTRA_FLAGS}")
endif()
if (C_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ferror-limit=1")
elseif (C_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1")
endif()
# set compiler
include(FindCompiler)
@ -160,23 +199,26 @@ endif()
find_package(PkgConfig REQUIRED)
find_package(Boost REQUIRED)
find_package(FFTW3F REQUIRED)
find_package(Codec2)
find_package(LibUSB)
find_package(LibUSB REQUIRED) # used by so many packages
find_package(OpenCV) # channeltx/modatv
# !! TODO think how to manage build/link external libraries
if (NOT BUILD_EXTERNAL_LIBRARIES)
find_package(LibDSDcc)
find_package(LibMbe)
find_package(SerialDV)
find_package(CM256cc)
endif()
# macOS compatibility
if(APPLE)
find_package(ICONV)
endif()
# include external cmake if needed
if(ENABLE_EXTERNAL_LIBRARIES)
add_subdirectory(external)
endif()
# after external libraries
find_package(LibDSDcc)
find_package(LibMbe)
find_package(SerialDV)
find_package(CM256cc)
find_package(Codec2)
# Devices
if(ENABLE_AIRSPY)
find_package(LibAIRSPY)
@ -212,53 +254,6 @@ if(ENABLE_XTRX)
find_package(LibXTRX)
endif()
# enable 24 bit receiving path
if (RX_SAMPLE_24BIT)
message(STATUS "Compiling for 24 bit Rx DSP chain")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_RX_SAMPLE_24BIT")
else()
message(STATUS "Compiling for 16 bit Rx DSP chain")
endif()
if (SANITIZE_ADDRESS)
message(STATUS "Activate address sanitization")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -fsanitize=address")
endif()
if (C_CLANG OR C_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
elseif (C_MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3 -MP ${EXTRA_FLAGS}")
endif()
if (C_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ferror-limit=1")
elseif (C_GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1")
endif()
########### include sub-projects ############
if(BUILD_EXTERNAL_LIBRARIES)
add_subdirectory(external/cm256cc)
add_subdirectory(external/mbelib)
add_subdirectory(external/serialdv)
add_subdirectory(external/dsdcc)
add_subdirectory(external/libairspy)
add_subdirectory(external/libairspyhf)
add_subdirectory(external/libhackrf)
add_subdirectory(external/librtlsdr)
add_subdirectory(external/libbladerf)
add_subdirectory(external/liblimesuite)
add_subdirectory(external/libmirisdr)
add_subdirectory(external/libperseus)
add_subdirectory(external/libiio)
add_subdirectory(external/libsoapysdr)
endif()
if (CODEC2_FOUND)
add_subdirectory(libfreedv)
endif(CODEC2_FOUND)

140
external/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,140 @@
# TODO:
# we need a way to build at compile time and the find_package
# - use git submodules and add_subdirectory with "EXCLUDE_FROM_ALL" but probably useless
# - try https://stackoverflow.com/questions/17446981/cmake-externalproject-add-and-findpackage/23570741#23570741
# add the install path to cmake
# TODO need reload after externalproject build
list(APPEND CMAKE_PREFIX_PATH "${EXTERNAL_INSTALL_LIBRARIES}")
# needs boost
ExternalProject_Add(cm256cc
GIT_REPOSITORY https://github.com/f4exb/cm256cc.git
GIT_TAG v1.0.5
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/cm256cc"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
ExternalProject_Add(mbelib
GIT_REPOSITORY https://github.com/szechyjs/mbelib.git
GIT_TAG "debian/1.3.0"
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mbelib"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
if(WIN32 OR LINUX)
ExternalProject_Add(serialdv
GIT_REPOSITORY https://github.com/f4exb/serialDV.git
GIT_TAG v1.0.6
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/serialDV"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
endif()
# could use mbelib
ExternalProject_Add(dsdcc
GIT_REPOSITORY https://github.com/f4exb/dsdcc.git
GIT_TAG v1.8.4
DEPENDS mbelib
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dsdcc"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# needs pkgconfig, libusb
ExternalProject_Add(perseus
GIT_REPOSITORY https://github.com/f4exb/libperseus-sdr.git
GIT_TAG afefa23e3140ac79d845acb68cf0beeb86d09028
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/perseus"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# already on the respository
# TODO decide what to do
if(OFF)
# apt install libcodec2-dev
# needs speexdsp
ExternalProject_Add(codec2
GIT_REPOSITORY https://github.com/drowe67/codec2.git
GIT_TAG ff5841a18bfd9df0e8a250dc57fb7388cabccda1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/codec2"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DCMAKE_BUILD_TYPE=Release -DUNITTEST=OFF
)
# apt install libairspy-dev
# needs libusb and pkgconfig
ExternalProject_Add(airspy
GIT_REPOSITORY https://github.com/airspy/airspyone_host.git
GIT_TAG bfb667080936ca5c2d23b3282f5893931ec38d3f
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspy"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libairspyhf-dev (only on ubuntu 18.04)
# needs libusb and pkgconfig
ExternalProject_Add(airspyhf
GIT_REPOSITORY https://github.com/airspy/airspyhf.git
GIT_TAG 1.1.5
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspyhf"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libhackrf-dev
# needs pkgconfig, libusb and fftw-3
ExternalProject_Add(hackrf
GIT_REPOSITORY https://github.com/mossmann/hackrf.git
GIT_TAG v2018.01.1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/hackrf"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
SOURCE_SUBDIR host/
)
# apt install librtlsdr-dev
# needs pkgconfig and libusb
ExternalProject_Add(rtlsdr
GIT_REPOSITORY https://github.com/osmocom/rtl-sdr.git
GIT_TAG f68bb2fa772ad94f58c59babd78353667570630b
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/rtlsdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libbladerf-dev
# needs pkgconfig and libusb
ExternalProject_Add(bladerf
GIT_REPOSITORY https://github.com/Nuand/bladeRF.git
GIT_TAG 1da130cb5ac9e9f722737e9aee141ecccebef00d
GIT_SUBMODULES
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/bladerf"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install liblimesuite-dev (only on ubuntu 18.04)
# needs pkgconfig, libusb and sqlite3
ExternalProject_Add(limesuite
GIT_REPOSITORY https://github.com/myriadrf/LimeSuite.git
GIT_TAG v19.01.0
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/limesuite"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DLIME_SUITE_EXTVER=release -DENABLE_GUI=OFF -DENABLE_NOVENARF7=OFF -DENABLE_SOAPY_LMS7=OFF -DENABLE_OCTAVE=OFF
)
# apt install libmirisdr-dev
# needs pkgconfig and libusb
ExternalProject_Add(mirisdr
GIT_REPOSITORY https://github.com/f4exb/libmirisdr-4.git
GIT_TAG v1.1.2
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mirisdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libiio-dev
# needs pkgconfig, libusb, libxml2, lzma, xz, libiconv
ExternalProject_Add(libiio
GIT_REPOSITORY https://github.com/analogdevicesinc/libiio.git
GIT_TAG 826563e41b5ce9890b75506f672017de8d76d52d
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libiio"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DOSX_PACKAGE=OFF -DWITH_DOC=OFF
)
# apt install libsoapysdr-dev (only on ubuntu 18.04)
ExternalProject_Add(soapysdr
GIT_REPOSITORY https://github.com/pothosware/SoapySDR.git
GIT_TAG soapy-sdr-0.7.1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/soapysdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF
)
# TODO: sdrplay is binary only!
# needs soapysdr, sdrplay
ExternalProject_Add(soapysdrplay
GIT_REPOSITORY https://github.com/pothosware/SoapySDRPlay.git
GIT_TAG soapy-sdrplay-0.2.0
DEPENDS soapysdr
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/soapysdrplay"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DCMAKE_BUILD_TYPE=Release
)
endif(OFF)

View File

@ -1,34 +0,0 @@
project(cm256cc)
if (HAS_SSSE3)
message(STATUS "RemoteFEC: use SSSE3 SIMD" )
elseif (HAS_NEON)
message(STATUS "RemoteFEC: use Neon SIMD" )
else()
message(STATUS "RemoteFEC: Unsupported architecture")
return()
endif()
set(cm256cc_SOURCES
${LIBCM256CCSRC}/gf256.cpp
${LIBCM256CCSRC}/cm256.cpp
)
set(cm256cc_HEADERS
${LIBCM256CCSRC}/gf256.h
${LIBCM256CCSRC}/cm256.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBCM256CCSRC}
)
add_definitions(-DQT_SHARED)
add_library(cm256cc SHARED
${cm256cc_SOURCES}
)
install(TARGETS cm256cc DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,87 +0,0 @@
project(dsdcc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(dsdcc_SOURCES
${LIBDSDCCSRC}/descramble.cpp
${LIBDSDCCSRC}/dmr.cpp
${LIBDSDCCSRC}/dsd_decoder.cpp
${LIBDSDCCSRC}/dsd_filters.cpp
${LIBDSDCCSRC}/dsd_logger.cpp
${LIBDSDCCSRC}/dsd_mbe.cpp
${LIBDSDCCSRC}/dsd_opts.cpp
${LIBDSDCCSRC}/dsd_state.cpp
${LIBDSDCCSRC}/dsd_symbol.cpp
${LIBDSDCCSRC}/dstar.cpp
${LIBDSDCCSRC}/ysf.cpp
${LIBDSDCCSRC}/dpmr.cpp
${LIBDSDCCSRC}/nxdn.cpp
${LIBDSDCCSRC}/nxdnconvolution.cpp
${LIBDSDCCSRC}/nxdncrc.cpp
${LIBDSDCCSRC}/nxdnmessage.cpp
${LIBDSDCCSRC}/p25p1_heuristics.cpp
${LIBDSDCCSRC}/fec.cpp
${LIBDSDCCSRC}/crc.cpp
${LIBDSDCCSRC}/viterbi.cpp
${LIBDSDCCSRC}/viterbi3.cpp
${LIBDSDCCSRC}/viterbi5.cpp
${LIBDSDCCSRC}/pn.cpp
${LIBDSDCCSRC}/mbefec.cpp
${LIBDSDCCSRC}/locator.cpp
${LIBDSDCCSRC}/phaselock.cpp
${LIBDSDCCSRC}/timeutil.cpp
)
set(dsdcc_HEADERS
${LIBDSDCCSRC}/descramble.h
${LIBDSDCCSRC}/dmr.h
${LIBDSDCCSRC}/dsd_decoder.h
${LIBDSDCCSRC}/dsd_filters.h
${LIBDSDCCSRC}/dsd_logger.h
${LIBDSDCCSRC}/dsd_mbe.h
${LIBDSDCCSRC}/dsd_mbelib.h
${LIBDSDCCSRC}/dsd_opts.h
${LIBDSDCCSRC}/dsd_state.h
${LIBDSDCCSRC}/dsd_symbol.h
${LIBDSDCCSRC}/dstar.h
${LIBDSDCCSRC}/ysf.h
${LIBDSDCCSRC}/dpmr.h
${LIBDSDCCSRC}/nxdn.h
${LIBDSDCCSRC}/nxdnconvolution.h
${LIBDSDCCSRC}/nxdncrc.h
${LIBDSDCCSRC}/nxdnmessage.h
${LIBDSDCCSRC}/p25p1_heuristics.h
${LIBDSDCCSRC}/runningmaxmin.h
${LIBDSDCCSRC}/doublebuffer.h
${LIBDSDCCSRC}/fec.h
${LIBDSDCCSRC}/crc.h
${LIBDSDCCSRC}/viterbi.h
${LIBDSDCCSRC}/viterbi3.h
${LIBDSDCCSRC}/viterbi5.h
${LIBDSDCCSRC}/pn.h
${LIBDSDCCSRC}/mbefec.h
${LIBDSDCCSRC}/locator.h
${LIBDSDCCSRC}/phaselock.h
${LIBDSDCCSRC}/timeutil.h
)
add_definitions(-DDSD_USE_MBELIB)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBDSDCCSRC}
${LIBMBELIBSRC}
)
add_definitions(-DQT_SHARED)
add_library(dsdcc SHARED
${dsdcc_SOURCES}
)
target_link_libraries(dsdcc
mbelib
)
install(TARGETS dsdcc DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,40 +0,0 @@
project(airspy)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
remove_definitions(-DUSE_SSE2)
set(airspy_SOURCES
${LIBAIRSPYSRC}/libairspy/src/airspy.c
${LIBAIRSPYSRC}/libairspy/src/iqconverter_float.c
${LIBAIRSPYSRC}/libairspy/src/iqconverter_int16.c
)
set(airspy_HEADERS
${LIBAIRSPYSRC}/libairspy/src/airspy.h
${LIBAIRSPYSRC}/libairspy/src/airspy_commands.h
${LIBAIRSPYSRC}/libairspy/src/iqconverter_float.h
${LIBAIRSPYSRC}/libairspy/src/iqconverter_int16.h
${LIBAIRSPYSRC}/libairspy/src/filters.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBAIRSPYSRC}/libairspy/src
)
add_definitions(-DQT_SHARED)
add_library(airspy SHARED
${airspy_SOURCES}
)
target_link_libraries(airspy
${LIBUSB_LIBRARIES}
)
install(TARGETS airspy DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,35 +0,0 @@
project(airspyhf)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
set(airspyhf_SOURCES
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf.c
${LIBAIRSPYHFSRC}/libairspyhf/src/iqbalancer.c
)
set(airspyhf_HEADERS
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf.h
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf_commands.h
${LIBAIRSPYHFSRC}/libairspyhf/src/iqbalancer.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBAIRSPYHFSRC}/libairspyhf/src
)
add_definitions(-DQT_SHARED)
add_library(airspyhf SHARED
${airspyhf_SOURCES}
)
target_link_libraries(airspyhf
${LIBUSB_LIBRARIES}
)
install(TARGETS airspyhf DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,158 +0,0 @@
project(bladerf)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
add_definitions(-DBLADERF_OS_LINUX)
set(bladerf_SOURCES
${LIBBLADERFCOMMONSRC}/src/sha256.c
${LIBBLADERFCOMMONSRC}/src/dc_calibration.c
${LIBBLADERFCOMMONSRC}/src/parse.c
${LIBBLADERFCOMMONSRC}/src/devcfg.c
${LIBBLADERFCOMMONSRC}/src/conversions.c
${LIBBLADERFCOMMONSRC}/src/log.c
${LIBBLADERFCOMMONSRC}/src/str_queue.c
${LIBBLADERFSRC}/host/misc/dev/lms_freqsel/freqsel.c
${LIBBLADERFSRC}/fpga_common/src/lms.c
${LIBBLADERFSRC}/fpga_common/src/band_select.c
${LIBBLADERFLIBSRC}/src/helpers/interleave.c
${LIBBLADERFLIBSRC}/src/helpers/timeout.c
${LIBBLADERFLIBSRC}/src/helpers/wallclock.c
${LIBBLADERFLIBSRC}/src/helpers/configfile.c
${LIBBLADERFLIBSRC}/src/helpers/file.c
${LIBBLADERFLIBSRC}/src/helpers/version.c
${LIBBLADERFLIBSRC}/src/driver/fpga_trigger.c
${LIBBLADERFLIBSRC}/src/driver/si5338.c
${LIBBLADERFLIBSRC}/src/driver/dac161s055.c
${LIBBLADERFLIBSRC}/src/driver/fx3_fw.c
${LIBBLADERFLIBSRC}/src/driver/smb_clock.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/dac_core.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/ad9361.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/util.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/platform.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/ad9361_api.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/adc_core.c
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/ad9361_conv.c
${LIBBLADERFLIBSRC}/src/driver/spi_flash.c
${LIBBLADERFLIBSRC}/src/driver/ina219.c
${LIBBLADERFLIBSRC}/src/board/bladerf2/compatibility.c
${LIBBLADERFLIBSRC}/src/board/bladerf2/capabilities.c
${LIBBLADERFLIBSRC}/src/board/bladerf2/params.c
${LIBBLADERFLIBSRC}/src/board/bladerf2/bladerf2.c
${LIBBLADERFLIBSRC}/src/board/board.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/flash.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/bladerf1.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/image.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/compatibility.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/calibration.c
${LIBBLADERFLIBSRC}/src/board/bladerf1/capabilities.c
${LIBBLADERFLIBSRC}/src/expansion/xb100.c
${LIBBLADERFLIBSRC}/src/expansion/xb200.c
${LIBBLADERFLIBSRC}/src/expansion/xb300.c
${LIBBLADERFLIBSRC}/src/streaming/async.c
${LIBBLADERFLIBSRC}/src/streaming/sync_worker.c
${LIBBLADERFLIBSRC}/src/streaming/sync.c
${LIBBLADERFLIBSRC}/src/bladerf.c
${LIBBLADERFLIBSRC}/src/init_fini.c
${LIBBLADERFLIBSRC}/src/backend/dummy/dummy.c
${LIBBLADERFLIBSRC}/src/backend/backend.c
${LIBBLADERFLIBSRC}/src/backend/usb/usb.c
${LIBBLADERFLIBSRC}/src/backend/usb/libusb.c
${LIBBLADERFLIBSRC}/src/backend/usb/nios_access.c
${LIBBLADERFLIBSRC}/src/backend/usb/nios_legacy_access.c
${LIBBLADERFLIBSRC}/src/devinfo.c
)
set(bladerf_HEADERS
./common/include/host_config.h
./libraries/libbladeRF/src/version.h
./libraries/libbladeRF/src/backend/backend_config.h
${LIBBLADERFCOMMONSRC}/include/thread.h
${LIBBLADERFCOMMONSRC}/include/parse.h
${LIBBLADERFCOMMONSRC}/include/minmax.h
${LIBBLADERFCOMMONSRC}/include/rel_assert.h
${LIBBLADERFCOMMONSRC}/include/devcfg.h
${LIBBLADERFCOMMONSRC}/include/str_queue.h
${LIBBLADERFCOMMONSRC}/include/log.h
${LIBBLADERFCOMMONSRC}/include/dc_calibration.h
${LIBBLADERFCOMMONSRC}/include/sha256.h
${LIBBLADERFCOMMONSRC}/include/conversions.h
${LIBBLADERFSRC}/fpga_common/include/lms.h
${LIBBLADERFSRC}/fpga_common/include/band_select.h
${LIBBLADERFLIBSRC}/src/helpers/interleave.h
${LIBBLADERFLIBSRC}/src/helpers/wallclock.h
${LIBBLADERFLIBSRC}/src/helpers/timeout.h
${LIBBLADERFLIBSRC}/src/helpers/version.h
${LIBBLADERFLIBSRC}/src/helpers/configfile.h
${LIBBLADERFLIBSRC}/src/helpers/file.h
${LIBBLADERFLIBSRC}/src/driver/dac161s055.h
${LIBBLADERFLIBSRC}/src/driver/fpga_trigger.h
${LIBBLADERFLIBSRC}/src/driver/si5338.h
${LIBBLADERFLIBSRC}/src/driver/ina219.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/platform.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/util.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/dac_core.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/config.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/adc_core.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/common.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/ad9361.h
${LIBBLADERFLIBSRC}/src/driver/thirdparty/adi/ad9361_api.h
${LIBBLADERFLIBSRC}/src/driver/spi_flash.h
${LIBBLADERFLIBSRC}/src/driver/fx3_fw.h
${LIBBLADERFLIBSRC}/src/driver/smb_clock.h
${LIBBLADERFLIBSRC}/src/board/bladerf2/capabilities.h
${LIBBLADERFLIBSRC}/src/board/bladerf2/compatibility.h
${LIBBLADERFLIBSRC}/src/board/board.h
${LIBBLADERFLIBSRC}/src/board/bladerf1/calibration.h
${LIBBLADERFLIBSRC}/src/board/bladerf1/capabilities.h
${LIBBLADERFLIBSRC}/src/board/bladerf1/compatibility.h
${LIBBLADERFLIBSRC}/src/board/bladerf1/flash.h
${LIBBLADERFLIBSRC}/src/expansion/xb300.h
${LIBBLADERFLIBSRC}/src/expansion/xb100.h
${LIBBLADERFLIBSRC}/src/expansion/xb200.h
${LIBBLADERFLIBSRC}/src/streaming/sync.h
${LIBBLADERFLIBSRC}/src/streaming/sync_worker.h
${LIBBLADERFLIBSRC}/src/streaming/metadata.h
${LIBBLADERFLIBSRC}/src/streaming/format.h
${LIBBLADERFLIBSRC}/src/streaming/async.h
${LIBBLADERFLIBSRC}/src/backend/backend.h
${LIBBLADERFLIBSRC}/src/backend/dummy/dummy.h
${LIBBLADERFLIBSRC}/src/backend/usb/nios_legacy_access.h
${LIBBLADERFLIBSRC}/src/backend/usb/nios_access.h
${LIBBLADERFLIBSRC}/src/backend/usb/usb.h
${LIBBLADERFLIBSRC}/src/devinfo.h
${LIBBLADERFLIBSRC}/include/bladeRF2.h
${LIBBLADERFLIBSRC}/include/libbladeRF.h
${LIBBLADERFLIBSRC}/include/bladeRF1.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBBLADERFLIBSRC}/include
${LIBBLADERFLIBSRC}/src
${LIBBLADERFSRC}/firmware_common
${LIBBLADERFSRC}/fpga_common/include
${LIBBLADERFCOMMONSRC}/include
${LIBBLADERFCOMMONSRC}/include/windows
./include
./common/include
./libraries/libbladeRF/src
./libraries/libbladeRF/src/backend
)
add_definitions(-DQT_SHARED)
add_library(bladerf SHARED
${bladerf_SOURCES}
)
target_link_libraries(bladerf
${LIBUSB_LIBRARIES}
)
install(TARGETS bladerf DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,334 +0,0 @@
/**
* @file host_config.h.in
*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (c) 2013-2018 Nuand LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef HOST_CONFIG_H__
#define HOST_CONFIG_H__
#define BLADERF_OS_LINUX 1
#define BLADERF_OS_FREEBSD 0
#define BLADERF_OS_OSX 0
#define BLADERF_OS_WINDOWS 0
#define BLADERF_BIG_ENDIAN 0
#define LIBBLADERF_SEARCH_PREFIX "/opt/install/libbladeRF"
#if !(BLADERF_OS_LINUX || BLADERF_OS_OSX || BLADERF_OS_WINDOWS || BLADERF_OS_FREEBSD)
# error "Build not configured for any supported operating systems"
#endif
#if 1 < (BLADERF_OS_LINUX + BLADERF_OS_OSX + BLADERF_OS_WINDOWS + BLADERF_OS_FREEBSD)
#error "Build configured for multiple operating systems"
#endif
#define HAVE_CLOCK_GETTIME 1
/*******************************************************************************
* Endianness conversions
*
* HOST_TO_LE16 16-bit host endianness to little endian conversion
* LE16_TO_HOST 16-bit little endian to host endianness conversion
* HOST_TO_BE16 16-bit host endianness to big endian conversion
* BE16_TO_HOST 16-bit big endian to host endianness conversion
* HOST_TO_LE32 32-bit host endianness to little endian conversion
* LE32_TO_HOST 32-bit little endian to host endianness conversion
* HOST_TO_BE32 32-bit host endianness to big endian conversion
* BE32_TO_HOST 32-bit big endian to host endianness conversion
* HOST_TO_BE64 64-bit host endianness to big endian conversion
* BE64_TO_HOST 64-bit big endian to host endianness conversion
******************************************************************************/
/*-----------------------
* Linux
*---------------------*/
#if BLADERF_OS_LINUX
#include <endian.h>
#define HOST_TO_LE16(val) htole16(val)
#define LE16_TO_HOST(val) le16toh(val)
#define HOST_TO_BE16(val) htobe16(val)
#define BE16_TO_HOST(val) be16toh(val)
#define HOST_TO_LE32(val) htole32(val)
#define LE32_TO_HOST(val) le32toh(val)
#define HOST_TO_BE32(val) htobe32(val)
#define BE32_TO_HOST(val) be32toh(val)
#define HOST_TO_LE64(val) htole64(val)
#define LE64_TO_HOST(val) le64toh(val)
#define HOST_TO_BE64(val) be64toh(val)
#define BE64_TO_HOST(val) be64toh(val)
/*-----------------------
* FREEBSD
*---------------------*/
#elif BLADERF_OS_FREEBSD
#include <sys/endian.h>
#define HOST_TO_LE16(val) htole16(val)
#define LE16_TO_HOST(val) le16toh(val)
#define HOST_TO_BE16(val) htobe16(val)
#define BE16_TO_HOST(val) be16toh(val)
#define HOST_TO_LE32(val) htole32(val)
#define LE32_TO_HOST(val) le32toh(val)
#define HOST_TO_BE32(val) htobe32(val)
#define BE32_TO_HOST(val) be32toh(val)
#define HOST_TO_LE64(val) htole64(val)
#define LE64_TO_HOST(val) le64toh(val)
#define HOST_TO_BE64(val) be64toh(val)
#define BE64_TO_HOST(val) be64toh(val)
/*-----------------------
* Apple OSX
*---------------------*/
#elif BLADERF_OS_OSX
#include <libkern/OSByteOrder.h>
#define HOST_TO_LE16(val) OSSwapHostToLittleInt16(val)
#define LE16_TO_HOST(val) OSSwapLittleToHostInt16(val)
#define HOST_TO_BE16(val) OSSwapHostToBigInt16(val)
#define BE16_TO_HOST(val) OSSwapBigToHostInt16(val)
#define HOST_TO_LE32(val) OSSwapHostToLittleInt32(val)
#define LE32_TO_HOST(val) OSSwapLittleToHostInt32(val)
#define HOST_TO_BE32(val) OSSwapHostToBigInt32(val)
#define BE32_TO_HOST(val) OSSwapBigToHostInt32(val)
#define HOST_TO_LE64(val) OSSwapHostToLittleInt64(val)
#define LE64_TO_HOST(val) OSSwapLittleToHostInt64(val)
#define HOST_TO_BE64(val) OSSwapHostToBigInt64(val)
#define BE64_TO_HOST(val) OSSwapBigToHostInt64(val)
/*-----------------------
* Windows
*---------------------*/
#elif BLADERF_OS_WINDOWS
#include <intrin.h>
/* We'll assume little endian for Windows platforms:
* http://blogs.msdn.com/b/larryosterman/archive/2005/06/07/426334.aspx
*/
#define HOST_TO_LE16(val) (val)
#define LE16_TO_HOST(val) (val)
#define HOST_TO_BE16(val) _byteswap_ushort(val)
#define BE16_TO_HOST(val) _byteswap_ushort(val)
#define HOST_TO_LE32(val) (val)
#define LE32_TO_HOST(val) (val)
#define HOST_TO_BE32(val) _byteswap_ulong(val)
#define BE32_TO_HOST(val) _byteswap_ulong(val)
#define HOST_TO_LE64(val) (val)
#define LE64_TO_HOST(val) (val)
#define HOST_TO_BE64(val) _byteswap_uint64(val)
#define BE64_TO_HOST(val) _byteswap_uint64(val)
/*-----------------------
* Unsupported or bug
*---------------------*/
#else
#error "Encountered an OS that we do not have endian wrappers for?"
#endif
/*******************************************************************************
* Endianness conversions for constants
*
* We shouldn't be using the above items for assigning constants because the
* implementations may be functions [1].
*
* [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17679#c7
******************************************************************************/
#define BLADERF_BYTESWAP16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
#define BLADERF_BYTESWAP32(x) ((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24) )
#define BLADERF_BYTESWAP64(x) ((((x) & 0xff00000000000000llu) >> 56) | \
(((x) & 0x00ff000000000000llu) >> 40) | \
(((x) & 0x0000ff0000000000llu) >> 24) | \
(((x) & 0x000000ff00000000llu) >> 8) | \
(((x) & 0x00000000ff000000llu) << 8) | \
(((x) & 0x0000000000ff0000llu) << 24) | \
(((x) & 0x000000000000ff00llu) << 40) | \
(((x) & 0x00000000000000ffllu) << 56) | \
#if BLADERF_BIG_ENDIAN
# define HOST_TO_LE16_CONST(x) (BLADERF_BYTESWAP16(x))
# define LE16_TO_HOST_CONST(x) (BLADERF_BYTESWAP16(x))
# define HOST_TO_BE16_CONST(x) (x)
# define BE16_TO_HOST_CONST(x) (x)
# define HOST_TO_LE32_CONST(x) (BLADERF_BYTESWAP32(x))
# define LE32_TO_HOST_CONST(x) (BLADERF_BYTESWAP32(x))
# define HOST_TO_BE32_CONST(x) (x)
# define BE32_TO_HOST_CONST(x) (x)
# define HOST_TO_LE64_CONST(x) (BLADERF_BYTESWAP64(x))
# define LE64_TO_HOST_CONST(x) (BLADERF_BYTESWAP64(x))
# define HOST_TO_BE64_CONST(x) (x)
# define BE64_TO_HOST_CONST(x) (x)
#else
# define HOST_TO_LE16_CONST(x) (x)
# define LE16_TO_HOST_CONST(x) (x)
# define HOST_TO_BE16_CONST(x) (BLADERF_BYTESWAP16(x))
# define BE16_TO_HOST_CONST(x) (BLADERF_BYTESWAP16(x))
# define HOST_TO_LE32_CONST(x) (x)
# define LE32_TO_HOST_CONST(x) (x)
# define HOST_TO_BE32_CONST(x) (BLADERF_BYTESWAP32(x))
# define BE32_TO_HOST_CONST(x) (BLADERF_BYTESWAP32(x))
# define HOST_TO_LE64_CONST(x) (x)
# define LE64_TO_HOST_CONST(x) (x)
# define HOST_TO_BE64_CONST(x) (BLADERF_BYTESWAP64(x))
# define BE64_TO_HOST_CONST(x) (BLADERF_BYTESWAP64(x))
#endif
/*******************************************************************************
* Miscellaneous Linux fixups
******************************************************************************/
#if BLADERF_OS_LINUX
/* Added here just to keep this out of the other source files. We'll have
* a few Windows replacements for unistd.h items. */
#include <unistd.h>
#include <pwd.h>
/*******************************************************************************
* Miscellaneous FREEBSD fixups
******************************************************************************/
#elif BLADERF_OS_FREEBSD
#include <unistd.h>
#include <pwd.h>
#include <sys/sysctl.h>
/*******************************************************************************
* Miscellaneous OSX fixups
******************************************************************************/
#elif BLADERF_OS_OSX
#include <unistd.h>
#include <pwd.h>
/*******************************************************************************
* Miscellaneous Windows fixups
******************************************************************************/
#elif BLADERF_OS_WINDOWS
/* Rename a few functions and types */
#include <windows.h>
#include <io.h>
#include <direct.h>
#define usleep(x) Sleep((x+999)/1000)
/* Changes specific to Microsoft Visual Studio and its C89-compliant ways */
#if _MSC_VER
# define strtok_r strtok_s
# define strtoull _strtoui64
#if _MSC_VER < 1900
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#else
#define STDC99
#endif
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
# define fileno _fileno
# define strdup _strdup
# define access _access
# define chdir _chdir
# define getcwd _getcwd
# define rmdir _rmdir
# define unlink _unlink
# define mkdir(n, m) _mkdir(n)
/* ssize_t lives elsewhere */
# include <BaseTsd.h>
# define ssize_t SSIZE_T
/* With msvc, inline is only available for C++. Otherwise we need to use __inline:
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx */
# if !defined(__cplusplus)
# define inline __inline
# endif
/* Visual studio 2012 compiler (v17.00.XX) doesn't have round functions */
# if _MSC_VER <= 1700
# include <math.h>
static inline float roundf(float x)
{
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
}
static inline double round(double x)
{
return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5);
}
# endif
#endif // _MSC_VER
#endif
/* Windows (msvc) does not support C99 designated initializers.
*
* Therefore, the following macro should be used. However, note that you'll
* need to be sure to keep your elements in order to avoid breaking Windows
* portability!
*
* http://stackoverflow.com/questions/5440611/how-to-rewrite-c-struct-designated-initializers-to-c89-resp-msvc-c-compiler
*
* Here's a sample regexep you could use in vim to clean these up in your code:
* @\(\s\+\)\(\.[a-zA-Z0-9_]\+\)\s*=\s*\([a-zA-Z0-9_]\+\)\(,\)\?@\1FIELD_INIT(\2,\3)\4@gc
*/
#if _MSC_VER
# define FIELD_INIT(field, ...) __VA_ARGS__
#else
# define FIELD_INIT(field, ...) field = __VA_ARGS__
#endif // _MSC_VER
/*******************************************************************************
* Miscellaneous utility macros
******************************************************************************/
#define ARRAY_SIZE(n) (sizeof(n) / sizeof(n[0]))
/**
* GCC 7+ warns on implicit fallthroughs in switch statements
* (-Wimplicit-fallthrough), which we use in a couple places for simplicity.
* The statement attribute syntax used to suppress this warning is not
* supported by anything else.
*/
#if __GNUC__ >= 7
#define EXPLICIT_FALLTHROUGH __attribute__((fallthrough))
#else
#define EXPLICIT_FALLTHROUGH
#endif // __GNUC__ >= 7
#endif

View File

@ -1,88 +0,0 @@
/**
* @file backend_config.h
*
* @brief Compile-time backend selection
*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (C) 2013 Nuand LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef BACKEND_BACKEND_CONFIG_H_
#define BACKEND_BACKEND_CONFIG_H_
#define ENABLE_BACKEND_USB
#define ENABLE_BACKEND_LIBUSB
/* #undef ENABLE_BACKEND_CYAPI */
/* #undef ENABLE_BACKEND_DUMMY */
/* #undef ENABLE_BACKEND_LINUX_DRIVER */
#include "backend/backend.h"
#include "backend/usb/usb.h"
#ifdef ENABLE_BACKEND_DUMMY
extern const struct backend_fns backend_fns_dummy;
#define BACKEND_DUMMY &backend_fns_dummy,
#else
#define BACKEND_DUMMY
#endif
#ifdef ENABLE_BACKEND_USB
extern const struct backend_fns backend_fns_usb;
#define BACKEND_USB &backend_fns_usb,
#ifdef ENABLE_BACKEND_LIBUSB
extern const struct usb_driver usb_driver_libusb;
#define BACKEND_USB_LIBUSB &usb_driver_libusb,
#else
#define BACKEND_USB_LIBUSB
#endif
#ifdef ENABLE_BACKEND_CYAPI
extern const struct usb_driver usb_driver_cypress;
#define BACKEND_USB_CYAPI &usb_driver_cypress,
#else
#define BACKEND_USB_CYAPI
#endif
#define BLADERF_USB_BACKEND_LIST \
{ \
BACKEND_USB_LIBUSB \
BACKEND_USB_CYAPI \
}
#if !defined(ENABLE_BACKEND_LIBUSB) && !defined(ENABLE_BACKEND_CYAPI)
#error "No USB backends are enabled. One or more must be enabled."
#endif
#else
#define BACKEND_USB
#endif
#if !defined(ENABLE_BACKEND_USB) && !defined(ENABLE_BACKEND_DUMMY)
#error "No backends are enabled. One more more must be enabled."
#endif
/* This list should be ordered by preference (highest first) */
#define BLADERF_BACKEND_LIST \
{ \
BACKEND_USB \
BACKEND_DUMMY \
}
#endif

View File

@ -1,12 +0,0 @@
#ifndef VERSION_H_
#define VERSION_H_
#define LIBBLADERF_VERSION "2.0.2-git-32058c4"
// clang-format off
#define LIBBLADERF_VERSION_MAJOR 2
#define LIBBLADERF_VERSION_MINOR 0
#define LIBBLADERF_VERSION_PATCH 2
// clang-format on
#endif

View File

@ -1,333 +0,0 @@
/**
* @file host_config.h.in
*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (c) 2013-2018 Nuand LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef HOST_CONFIG_H__
#define HOST_CONFIG_H__
#define BLADERF_OS_LINUX 0
#define BLADERF_OS_FREEBSD 0
#define BLADERF_OS_OSX 0
#define BLADERF_OS_WINDOWS 1
#define BLADERF_BIG_ENDIAN 0
#if !(BLADERF_OS_LINUX || BLADERF_OS_OSX || BLADERF_OS_WINDOWS || BLADERF_OS_FREEBSD)
# error "Build not configured for any supported operating systems"
#endif
#if 1 < (BLADERF_OS_LINUX + BLADERF_OS_OSX + BLADERF_OS_WINDOWS + BLADERF_OS_FREEBSD)
#error "Build configured for multiple operating systems"
#endif
#define HAVE_CLOCK_GETTIME 0
/*******************************************************************************
* Endianness conversions
*
* HOST_TO_LE16 16-bit host endianness to little endian conversion
* LE16_TO_HOST 16-bit little endian to host endianness conversion
* HOST_TO_BE16 16-bit host endianness to big endian conversion
* BE16_TO_HOST 16-bit big endian to host endianness conversion
* HOST_TO_LE32 32-bit host endianness to little endian conversion
* LE32_TO_HOST 32-bit little endian to host endianness conversion
* HOST_TO_BE32 32-bit host endianness to big endian conversion
* BE32_TO_HOST 32-bit big endian to host endianness conversion
* HOST_TO_BE64 64-bit host endianness to big endian conversion
* BE64_TO_HOST 64-bit big endian to host endianness conversion
******************************************************************************/
/*-----------------------
* Linux
*---------------------*/
#if BLADERF_OS_LINUX
#include <endian.h>
#define HOST_TO_LE16(val) htole16(val)
#define LE16_TO_HOST(val) le16toh(val)
#define HOST_TO_BE16(val) htobe16(val)
#define BE16_TO_HOST(val) be16toh(val)
#define HOST_TO_LE32(val) htole32(val)
#define LE32_TO_HOST(val) le32toh(val)
#define HOST_TO_BE32(val) htobe32(val)
#define BE32_TO_HOST(val) be32toh(val)
#define HOST_TO_LE64(val) htole64(val)
#define LE64_TO_HOST(val) le64toh(val)
#define HOST_TO_BE64(val) be64toh(val)
#define BE64_TO_HOST(val) be64toh(val)
/*-----------------------
* FREEBSD
*---------------------*/
#elif BLADERF_OS_FREEBSD
#include <sys/endian.h>
#define HOST_TO_LE16(val) htole16(val)
#define LE16_TO_HOST(val) le16toh(val)
#define HOST_TO_BE16(val) htobe16(val)
#define BE16_TO_HOST(val) be16toh(val)
#define HOST_TO_LE32(val) htole32(val)
#define LE32_TO_HOST(val) le32toh(val)
#define HOST_TO_BE32(val) htobe32(val)
#define BE32_TO_HOST(val) be32toh(val)
#define HOST_TO_LE64(val) htole64(val)
#define LE64_TO_HOST(val) le64toh(val)
#define HOST_TO_BE64(val) be64toh(val)
#define BE64_TO_HOST(val) be64toh(val)
/*-----------------------
* Apple OSX
*---------------------*/
#elif BLADERF_OS_OSX
#include <libkern/OSByteOrder.h>
#define HOST_TO_LE16(val) OSSwapHostToLittleInt16(val)
#define LE16_TO_HOST(val) OSSwapLittleToHostInt16(val)
#define HOST_TO_BE16(val) OSSwapHostToBigInt16(val)
#define BE16_TO_HOST(val) OSSwapBigToHostInt16(val)
#define HOST_TO_LE32(val) OSSwapHostToLittleInt32(val)
#define LE32_TO_HOST(val) OSSwapLittleToHostInt32(val)
#define HOST_TO_BE32(val) OSSwapHostToBigInt32(val)
#define BE32_TO_HOST(val) OSSwapBigToHostInt32(val)
#define HOST_TO_LE64(val) OSSwapHostToLittleInt64(val)
#define LE64_TO_HOST(val) OSSwapLittleToHostInt64(val)
#define HOST_TO_BE64(val) OSSwapHostToBigInt64(val)
#define BE64_TO_HOST(val) OSSwapBigToHostInt64(val)
/*-----------------------
* Windows
*---------------------*/
#elif BLADERF_OS_WINDOWS
#include <intrin.h>
/* We'll assume little endian for Windows platforms:
* http://blogs.msdn.com/b/larryosterman/archive/2005/06/07/426334.aspx
*/
#define HOST_TO_LE16(val) (val)
#define LE16_TO_HOST(val) (val)
#define HOST_TO_BE16(val) _byteswap_ushort(val)
#define BE16_TO_HOST(val) _byteswap_ushort(val)
#define HOST_TO_LE32(val) (val)
#define LE32_TO_HOST(val) (val)
#define HOST_TO_BE32(val) _byteswap_ulong(val)
#define BE32_TO_HOST(val) _byteswap_ulong(val)
#define HOST_TO_LE64(val) (val)
#define LE64_TO_HOST(val) (val)
#define HOST_TO_BE64(val) _byteswap_uint64(val)
#define BE64_TO_HOST(val) _byteswap_uint64(val)
/*-----------------------
* Unsupported or bug
*---------------------*/
#else
#error "Encountered an OS that we do not have endian wrappers for?"
#endif
/*******************************************************************************
* Endianness conversions for constants
*
* We shouldn't be using the above items for assigning constants because the
* implementations may be functions [1].
*
* [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17679#c7
******************************************************************************/
#define BLADERF_BYTESWAP16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
#define BLADERF_BYTESWAP32(x) ((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24) )
#define BLADERF_BYTESWAP64(x) ((((x) & 0xff00000000000000llu) >> 56) | \
(((x) & 0x00ff000000000000llu) >> 40) | \
(((x) & 0x0000ff0000000000llu) >> 24) | \
(((x) & 0x000000ff00000000llu) >> 8) | \
(((x) & 0x00000000ff000000llu) << 8) | \
(((x) & 0x0000000000ff0000llu) << 24) | \
(((x) & 0x000000000000ff00llu) << 40) | \
(((x) & 0x00000000000000ffllu) << 56) | \
#if BLADERF_BIG_ENDIAN
# define HOST_TO_LE16_CONST(x) (BLADERF_BYTESWAP16(x))
# define LE16_TO_HOST_CONST(x) (BLADERF_BYTESWAP16(x))
# define HOST_TO_BE16_CONST(x) (x)
# define BE16_TO_HOST_CONST(x) (x)
# define HOST_TO_LE32_CONST(x) (BLADERF_BYTESWAP32(x))
# define LE32_TO_HOST_CONST(x) (BLADERF_BYTESWAP32(x))
# define HOST_TO_BE32_CONST(x) (x)
# define BE32_TO_HOST_CONST(x) (x)
# define HOST_TO_LE64_CONST(x) (BLADERF_BYTESWAP64(x))
# define LE64_TO_HOST_CONST(x) (BLADERF_BYTESWAP64(x))
# define HOST_TO_BE64_CONST(x) (x)
# define BE64_TO_HOST_CONST(x) (x)
#else
# define HOST_TO_LE16_CONST(x) (x)
# define LE16_TO_HOST_CONST(x) (x)
# define HOST_TO_BE16_CONST(x) (BLADERF_BYTESWAP16(x))
# define BE16_TO_HOST_CONST(x) (BLADERF_BYTESWAP16(x))
# define HOST_TO_LE32_CONST(x) (x)
# define LE32_TO_HOST_CONST(x) (x)
# define HOST_TO_BE32_CONST(x) (BLADERF_BYTESWAP32(x))
# define BE32_TO_HOST_CONST(x) (BLADERF_BYTESWAP32(x))
# define HOST_TO_LE64_CONST(x) (x)
# define LE64_TO_HOST_CONST(x) (x)
# define HOST_TO_BE64_CONST(x) (BLADERF_BYTESWAP64(x))
# define BE64_TO_HOST_CONST(x) (BLADERF_BYTESWAP64(x))
#endif
/*******************************************************************************
* Miscellaneous Linux fixups
******************************************************************************/
#if BLADERF_OS_LINUX
/* Added here just to keep this out of the other source files. We'll have
* a few Windows replacements for unistd.h items. */
#include <unistd.h>
#include <pwd.h>
/*******************************************************************************
* Miscellaneous FREEBSD fixups
******************************************************************************/
#elif BLADERF_OS_FREEBSD
#include <unistd.h>
#include <pwd.h>
#include <sys/sysctl.h>
/*******************************************************************************
* Miscellaneous OSX fixups
******************************************************************************/
#elif BLADERF_OS_OSX
#include <unistd.h>
#include <pwd.h>
/*******************************************************************************
* Miscellaneous Windows fixups
******************************************************************************/
#elif BLADERF_OS_WINDOWS
/* Rename a few functions and types */
#include <windows.h>
#include <io.h>
#include <direct.h>
#define usleep(x) Sleep((x+999)/1000)
/* Changes specific to Microsoft Visual Studio and its C89-compliant ways */
#if _MSC_VER
# define strtok_r strtok_s
# define strtoull _strtoui64
#if _MSC_VER < 1900
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#else
#define STDC99
#endif
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
# define fileno _fileno
# define strdup _strdup
# define access _access
# define chdir _chdir
# define getcwd _getcwd
# define rmdir _rmdir
# define unlink _unlink
# define mkdir(n, m) _mkdir(n)
/* ssize_t lives elsewhere */
# include <BaseTsd.h>
# define ssize_t SSIZE_T
/* With msvc, inline is only available for C++. Otherwise we need to use __inline:
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx */
# if !defined(__cplusplus)
# define inline __inline
# endif
/* Visual studio 2012 compiler (v17.00.XX) doesn't have round functions */
# if _MSC_VER <= 1700
# include <math.h>
static inline float roundf(float x)
{
return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
}
static inline double round(double x)
{
return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5);
}
# endif
#endif // _MSC_VER
#endif
/* Windows (msvc) does not support C99 designated initializers.
*
* Therefore, the following macro should be used. However, note that you'll
* need to be sure to keep your elements in order to avoid breaking Windows
* portability!
*
* http://stackoverflow.com/questions/5440611/how-to-rewrite-c-struct-designated-initializers-to-c89-resp-msvc-c-compiler
*
* Here's a sample regexep you could use in vim to clean these up in your code:
* @\(\s\+\)\(\.[a-zA-Z0-9_]\+\)\s*=\s*\([a-zA-Z0-9_]\+\)\(,\)\?@\1FIELD_INIT(\2,\3)\4@gc
*/
#if _MSC_VER
# define FIELD_INIT(field, ...) __VA_ARGS__
#else
# define FIELD_INIT(field, ...) field = __VA_ARGS__
#endif // _MSC_VER
/*******************************************************************************
* Miscellaneous utility macros
******************************************************************************/
#define ARRAY_SIZE(n) (sizeof(n) / sizeof(n[0]))
/**
* GCC 7+ warns on implicit fallthroughs in switch statements
* (-Wimplicit-fallthrough), which we use in a couple places for simplicity.
* The statement attribute syntax used to suppress this warning is not
* supported by anything else.
*/
#if __GNUC__ >= 7
#define EXPLICIT_FALLTHROUGH __attribute__((fallthrough))
#else
#define EXPLICIT_FALLTHROUGH
#endif // __GNUC__ >= 7
#endif

View File

@ -1,88 +0,0 @@
/**
* @file backend_config.h
*
* @brief Compile-time backend selection
*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (C) 2013 Nuand LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef BACKEND_BACKEND_CONFIG_H_
#define BACKEND_BACKEND_CONFIG_H_
#define ENABLE_BACKEND_USB
#define ENABLE_BACKEND_LIBUSB
/* #undef ENABLE_BACKEND_CYAPI */
/* #undef ENABLE_BACKEND_DUMMY */
/* #undef ENABLE_BACKEND_LINUX_DRIVER */
#include "backend/backend.h"
#include "backend/usb/usb.h"
#ifdef ENABLE_BACKEND_DUMMY
extern const struct backend_fns backend_fns_dummy;
#define BACKEND_DUMMY &backend_fns_dummy,
#else
#define BACKEND_DUMMY
#endif
#ifdef ENABLE_BACKEND_USB
extern const struct backend_fns backend_fns_usb;
#define BACKEND_USB &backend_fns_usb,
#ifdef ENABLE_BACKEND_LIBUSB
extern const struct usb_driver usb_driver_libusb;
#define BACKEND_USB_LIBUSB &usb_driver_libusb,
#else
#define BACKEND_USB_LIBUSB
#endif
#ifdef ENABLE_BACKEND_CYAPI
extern const struct usb_driver usb_driver_cypress;
#define BACKEND_USB_CYAPI &usb_driver_cypress,
#else
#define BACKEND_USB_CYAPI
#endif
#define BLADERF_USB_BACKEND_LIST \
{ \
BACKEND_USB_LIBUSB \
BACKEND_USB_CYAPI \
}
#if !defined(ENABLE_BACKEND_LIBUSB) && !defined(ENABLE_BACKEND_CYAPI)
#error "No USB backends are enabled. One or more must be enabled."
#endif
#else
#define BACKEND_USB
#endif
#if !defined(ENABLE_BACKEND_USB) && !defined(ENABLE_BACKEND_DUMMY)
#error "No backends are enabled. One more more must be enabled."
#endif
/* This list should be ordered by preference (highest first) */
#define BLADERF_BACKEND_LIST \
{ \
BACKEND_USB \
BACKEND_DUMMY \
}
#endif

View File

@ -1,12 +0,0 @@
#ifndef VERSION_H_
#define VERSION_H_
#define LIBBLADERF_VERSION "2.0.2-git-32058c47-dirty"
// clang-format off
#define LIBBLADERF_VERSION_MAJOR 2
#define LIBBLADERF_VERSION_MINOR 0
#define LIBBLADERF_VERSION_PATCH 2
// clang-format on
#endif

View File

@ -1,523 +0,0 @@
/*
* This file is part of the bladeRF project:
* http://www.github.com/nuand/bladeRF
*
* Copyright (C) 2013-2014 Nuand LLC
* Copyright (C) 2013 Daniel Gröber <dxld ÄT darkboxed DOT org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <libbladeRF.h>
#include "host_config.h"
#include "file_ops.h"
#include "minmax.h"
#include "log.h"
#include "rel_assert.h"
#define LOCAL_BLADERF_OS_LINUX 1
/* Paths to search for bladeRF files */
struct search_path_entries {
bool prepend_home;
const char *path;
};
int file_write(FILE *f, uint8_t *buf, size_t len)
{
size_t rv;
rv = fwrite(buf, 1, len, f);
if(rv < len) {
log_debug("File write failed: %s\n", strerror(errno));
return BLADERF_ERR_IO;
}
return 0;
}
int file_read(FILE *f, char *buf, size_t len)
{
size_t rv;
rv = fread(buf, 1, len, f);
if(rv < len) {
if(feof(f))
log_debug("Unexpected end of file: %s\n", strerror(errno));
else
log_debug("Error reading file: %s\n", strerror(errno));
return BLADERF_ERR_IO;
}
return 0;
}
ssize_t file_size(FILE *f)
{
ssize_t rv = BLADERF_ERR_IO;
long int fpos = ftell(f);
long len;
if(fpos < 0) {
log_verbose("ftell failed: %s\n", strerror(errno));
goto out;
}
if(fseek(f, 0, SEEK_END)) {
log_verbose("fseek failed: %s\n", strerror(errno));
goto out;
}
len = ftell(f);
if(len < 0) {
log_verbose("ftell failed: %s\n", strerror(errno));
goto out;
} else if (len == LONG_MAX) {
log_debug("ftell called with a directory?\n");
goto out;
}
if(fseek(f, fpos, SEEK_SET)) {
log_debug("fseek failed: %s\n", strerror(errno));
goto out;
}
rv = (ssize_t) len;
assert(rv == len);
out:
return rv;
}
int file_read_buffer(const char *filename, uint8_t **buf_ret, size_t *size_ret)
{
int status = BLADERF_ERR_UNEXPECTED;
FILE *f;
uint8_t *buf = NULL;
ssize_t len;
f = fopen(filename, "rb");
if (!f) {
switch (errno) {
case ENOENT:
return BLADERF_ERR_NO_FILE;
case EACCES:
return BLADERF_ERR_PERMISSION;
default:
return BLADERF_ERR_IO;
}
}
len = file_size(f);
if(len < 0) {
status = BLADERF_ERR_IO;
goto out;
}
buf = (uint8_t*) malloc(len);
if (!buf) {
status = BLADERF_ERR_MEM;
goto out;
}
status = file_read(f, (char*)buf, len);
if (status < 0) {
goto out;
}
*buf_ret = buf;
*size_ret = len;
fclose(f);
return 0;
out:
free(buf);
if (f) {
fclose(f);
}
return status;
}
/* Remove the last entry in a path. This is used to strip the executable name
* from a path to get the directory that the executable resides in. */
static size_t strip_last_path_entry(char *buf, char dir_delim)
{
size_t len = strlen(buf);
while (len > 0 && buf[len - 1] != dir_delim) {
buf[len - 1] = '\0';
len--;
}
return len;
}
#if LOCAL_BLADERF_OS_LINUX || LOCAL_BLADERF_OS_OSX || LOCAL_BLADERF_OS_FREEBSD
#define ACCESS_FILE_EXISTS F_OK
#define DIR_DELIMETER '/'
static const struct search_path_entries search_paths[] = {
{ false, "" },
{ true, "/.config/Nuand/bladeRF/" },
{ true, "/.Nuand/bladeRF/" },
/* LIBBLADERF_SEARCH_PATH_PREFIX is defined in the libbladeRF
* CMakeLists.txt file. It defaults to ${CMAKE_INSTALL_PREFIX}, but
* can be overridden via -DLIBBLADERF_SEARCH_PATH_OVERRIDE
*/
// { false, LIBBLADERF_SEARCH_PREFIX "/etc/Nuand/bladeRF/" },
// { false, LIBBLADERF_SEARCH_PREFIX "/share/Nuand/bladeRF/" },
/* These two entries are here for reverse compatibility.
*
* We failed to prefix ${CMAKE_INSTALL_PREFIX} on these from the beginning,
* forcing package maintainers to hard-code one of these locations,
* despite having a different ${CMAKE_INSTALL_PREFIX}.
*
* We'll keep these around for some time as fall-backs, as not to break
* existing packaging scripts.
*/
{ false, "/etc/Nuand/bladeRF/" },
{ false, "/usr/share/Nuand/bladeRF/" },
};
static inline size_t get_home_dir(char *buf, size_t max_len)
{
// const char *home;
//
// home = getenv("HOME");
// if (home != NULL && strlen(home) > 0 && strlen(home) < max_len) {
// strncat(buf, home, max_len);
// } else {
// const struct passwd *passwd;
// const uid_t uid = getuid();
// passwd = getpwuid(uid);
// strncat(buf, passwd->pw_dir, max_len);
// }
strcpy(buf, "/");
return strlen(buf);
}
static inline size_t get_install_dir(char *buf, size_t max_len)
{
return 0;
}
#if LOCAL_BLADERF_OS_LINUX
static inline size_t get_binary_dir(char *buf, size_t max_len)
{
return 0;
// ssize_t result = readlink("/proc/self/exe", buf, max_len);
//
// if (result > 0) {
// return strip_last_path_entry(buf, DIR_DELIMETER);
// } else {
// return 0;
// }
}
#elif LOCAL_BLADERF_OS_FREEBSD
static inline size_t get_binary_dir(char *buf, size_t max_len)
{
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
ssize_t result = sysctl(mib, 4, buf, &max_len, NULL, 0);
if (result > 0) {
return strip_last_path_entry(buf, DIR_DELIMETER);
} else {
return 0;
}
}
#elif LOCAL_BLADERF_OS_OSX
#include <mach-o/dyld.h>
static inline size_t get_binary_dir(char *buf, size_t max_len)
{
uint32_t buf_size = max_len;
int status = _NSGetExecutablePath(buf, &buf_size);
if (status == 0) {
return strip_last_path_entry(buf, DIR_DELIMETER);
} else {
return 0;
}
}
#endif
#elif LOCAL_BLADERF_OS_WINDOWS
#define ACCESS_FILE_EXISTS 0
#define DIR_DELIMETER '\\'
#include <shlobj.h>
static const struct search_path_entries search_paths[] = {
{ false, "" },
{ true, "/Nuand/bladeRF/" },
};
static inline size_t get_home_dir(char *buf, size_t max_len)
{
/* Explicitly link to a runtime DLL to get SHGetKnownFolderPath.
* This deals with the case where we might not be able to staticly
* link it at build time, e.g. mingw32.
*
* http://msdn.microsoft.com/en-us/library/784bt7z7.aspx
*/
typedef HRESULT (CALLBACK* LPFNSHGKFP_T)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR*);
HINSTANCE hDLL; // Handle to DLL
LPFNSHGKFP_T lpfnSHGetKnownFolderPath; // Function pointer
const KNOWNFOLDERID folder_id = FOLDERID_RoamingAppData;
PWSTR path;
HRESULT status;
assert(max_len < INT_MAX);
hDLL = LoadLibrary("Shell32");
if (hDLL == NULL) {
// DLL couldn't be loaded, bail out.
return 0;
}
lpfnSHGetKnownFolderPath = (LPFNSHGKFP_T)GetProcAddress(hDLL, "SHGetKnownFolderPath");
if (!lpfnSHGetKnownFolderPath) {
// Can't find the procedure we want. Free and bail.
FreeLibrary(hDLL);
return 0;
}
status = lpfnSHGetKnownFolderPath(&folder_id, 0, NULL, &path);
if (status == S_OK) {
WideCharToMultiByte(CP_ACP, 0, path, -1, buf, (int)max_len, NULL, NULL);
CoTaskMemFree(path);
}
FreeLibrary(hDLL);
return strlen(buf);
}
static inline size_t get_binary_dir(char *buf, size_t max_len)
{
DWORD status;
assert(max_len <= MAXDWORD);
status = GetModuleFileName(NULL, buf, (DWORD) max_len);
if (status > 0) {
return strip_last_path_entry(buf, DIR_DELIMETER);
} else {
return 0;
}
}
static inline size_t get_install_dir(char *buf, size_t max_len)
{
typedef LONG (CALLBACK* LPFNREGOPEN_T)(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY);
typedef LONG (CALLBACK* LPFNREGQUERY_T)(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
typedef LONG (CALLBACK* LPFNREGCLOSE_T)(HKEY);
HINSTANCE hDLL; // Handle to DLL
LPFNREGOPEN_T lpfnRegOpenKeyEx; // Function pointer
LPFNREGQUERY_T lpfnRegQueryValueEx; // Function pointer
LPFNREGCLOSE_T lpfnRegCloseKey; // Function pointer
HKEY hk;
DWORD len;
assert(max_len < INT_MAX);
memset(buf, 0, max_len);
hDLL = LoadLibrary("Advapi32");
if (hDLL == NULL) {
// DLL couldn't be loaded, bail out.
return 0;
}
lpfnRegOpenKeyEx = (LPFNREGOPEN_T)GetProcAddress(hDLL, "RegOpenKeyExA");
if (!lpfnRegOpenKeyEx) {
// Can't find the procedure we want. Free and bail.
FreeLibrary(hDLL);
return 0;
}
lpfnRegQueryValueEx = (LPFNREGQUERY_T)GetProcAddress(hDLL, "RegQueryValueExA");
if (!lpfnRegQueryValueEx) {
// Can't find the procedure we want. Free and bail.
FreeLibrary(hDLL);
return 0;
}
lpfnRegCloseKey = (LPFNREGCLOSE_T)GetProcAddress(hDLL, "RegCloseKey");
if (!lpfnRegCloseKey) {
// Can't find the procedure we want. Free and bail.
FreeLibrary(hDLL);
return 0;
}
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Nuand LLC", 0, KEY_READ, &hk)) {
FreeLibrary(hDLL);
return 0;
}
len = (DWORD)max_len;
if (RegQueryValueEx(hk, "Path", 0, NULL, (LPBYTE) buf, &len) == ERROR_SUCCESS) {
if (len > 0 && len < max_len && buf[len - 1] != '\\')
strcat(buf, "\\");
} else
len = 0;
if (len) {
lpfnRegCloseKey(hk);
}
FreeLibrary(hDLL);
return len;
}
#else
#error "Unknown OS or missing BLADERF_OS_* definition"
#endif
/* We're not using functions that use the *nix PATH_MAX (which is known to be
* problematic), or the WIN32 MAX_PATH. Therefore, we'll just use this
* arbitrary, but "sufficiently" large max buffer size for paths */
#define PATH_MAX_LEN 4096
char *file_find(const char *filename)
{
size_t i, max_len;
char *full_path = (char*) calloc(PATH_MAX_LEN + 1, 1);
const char *env_var = getenv("BLADERF_SEARCH_DIR");
/* Check directory specified by environment variable */
if (env_var != NULL) {
strncat(full_path, env_var, PATH_MAX_LEN - 1);
full_path[strlen(full_path)] = DIR_DELIMETER;
max_len = PATH_MAX_LEN - strlen(full_path);
if (max_len >= strlen(filename)) {
strncat(full_path, filename, max_len);
if (access(full_path, ACCESS_FILE_EXISTS) != -1) {
return full_path;
}
}
}
/* Check the directory containing the currently running binary */
memset(full_path, 0, PATH_MAX_LEN);
max_len = PATH_MAX_LEN - 1;
if (get_binary_dir(full_path, max_len) != 0) {
max_len -= strlen(full_path);
if (max_len >= strlen(filename)) {
strncat(full_path, filename, max_len);
if (access(full_path, ACCESS_FILE_EXISTS) != -1) {
return full_path;
}
} else {
log_debug("Skipping search for %s in %s. "
"Path would be truncated.\n",
filename, full_path);
}
}
/* Search our list of pre-determined paths */
for (i = 0; i < ARRAY_SIZE(search_paths); i++) {
memset(full_path, 0, PATH_MAX_LEN);
max_len = PATH_MAX_LEN;
if (search_paths[i].prepend_home) {
const size_t len = get_home_dir(full_path, max_len);
if (len != 0) {
max_len -= len;
} else {
continue;
}
}
strncat(full_path, search_paths[i].path, max_len);
max_len = PATH_MAX_LEN - strlen(full_path);
if (max_len >= strlen(filename)) {
strncat(full_path, filename, max_len);
if (access(full_path, ACCESS_FILE_EXISTS) != -1) {
return full_path;
}
} else {
log_debug("Skipping search for %s in %s. "
"Path would be truncated.\n",
filename, full_path);
}
}
/* Search the installation directory, if applicable */
if (get_install_dir(full_path, PATH_MAX_LEN)) {
max_len = PATH_MAX_LEN - strlen(full_path);
if (max_len >= strlen(filename)) {
strncat(full_path, filename, max_len);
if (access(full_path, ACCESS_FILE_EXISTS) != -1) {
return full_path;
}
} else {
log_debug("Skipping search for %s in %s. "
"Path would be truncated.\n",
filename, full_path);
}
}
free(full_path);
return NULL;
}
int file_find_and_read(const char *filename, uint8_t **buf, size_t *size)
{
int status;
char *full_path = file_find(filename);
*buf = NULL;
*size = 0;
if (full_path != NULL) {
status = file_read_buffer(full_path, buf, size);
free(full_path);
return status;
} else {
return BLADERF_ERR_NO_FILE;
}
}
#undef LOCAL_BLADERF_OS_LINUX

View File

@ -1,32 +0,0 @@
project(hackrf)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
set(hackrf_SOURCES
${LIBHACKRFSRC}/libhackrf/src/hackrf.c
)
set(hackrf_HEADERS
${LIBHACKRFSRC}/libhackrf/src/hackrf.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBHACKRFSRC}/libhackrf/src
)
add_definitions(-DQT_SHARED)
add_library(hackrf SHARED
${hackrf_SOURCES}
)
target_link_libraries(hackrf
${LIBUSB_LIBRARIES}
)
install(TARGETS hackrf DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,450 +0,0 @@
cmake_minimum_required(VERSION 2.8.7)
project(iio)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(LIBIIO_VERSION_MAJOR 0)
set(LIBIIO_VERSION_MINOR 17)
set(VERSION "${LIBIIO_VERSION_MAJOR}.${LIBIIO_VERSION_MINOR}")
# Set the default install path to /usr
if (NOT WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "default install path" FORCE)
endif()
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/${PROJECT_NAME}${LIBIIO_VERSION_MAJOR}-doc)")
include(GNUInstallDirs)
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}${LIBIIO_VERSION_MAJOR}-doc")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
CACHE PATH "Installation directory for pkgconfig (.pc) files")
mark_as_advanced(INSTALL_PKGCONFIG_DIR)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS None Debug Release RelWithDebInfo MinSizeRel)
endif()
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
option(OSX_PACKAGE "Create a OSX package" ON)
set(CMAKE_MACOSX_RPATH ON)
set(SKIP_INSTALL_ALL ${OSX_PACKAGE})
endif()
option(WITH_NETWORK_BACKEND "Enable the network backend" OFF)
option(WITH_TESTS "Build the test programs" OFF)
if (WITH_TESTS)
set(NEED_THREADS 1)
endif()
if (MSVC)
# Avoid annoying warnings from Visual Studio
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
endif()
if (NOT LOG_LEVEL)
set(LOG_LEVEL Info CACHE STRING "Log level" FORCE)
set_property(CACHE LOG_LEVEL PROPERTY STRINGS NoLog Error Warning Info Debug)
endif()
if (CMAKE_COMPILER_IS_GNUCC)
if (NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare")
include(CheckCCompilerFlag)
check_c_compiler_flag(-Wpedantic HAS_WPEDANTIC)
if (HAS_WPEDANTIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")
endif()
endif()
include(CheckSymbolExists)
check_symbol_exists(strdup "string.h" HAS_STRDUP)
check_symbol_exists(strerror_r "string.h" HAS_STRERROR_R)
check_symbol_exists(newlocale "locale.h" HAS_NEWLOCALE)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
option(WITH_IIOD "Build the IIO Daemon" OFF)
option(WITH_LOCAL_BACKEND "Enable the local backend" OFF)
if (WITH_IIOD AND NOT WITH_LOCAL_BACKEND)
message(SEND_ERROR "IIOD can only be enabled if the local backend is enabled")
endif()
if (WITH_IIOD)
set(NEED_THREADS 1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
add_definitions(-D_GNU_SOURCE=1)
endif()
option(ENABLE_IPV6 "Define if you want to enable IPv6 support" OFF)
if (ENABLE_IPV6)
check_symbol_exists(in6addr_any "netinet/in.h" HAVE_IPV6)
if (NOT HAVE_IPV6)
message(WARNING "IPv6 is not available in your system.")
endif()
endif()
set(LIBIIO_CFILES ${LIBIIOSRC}/backend.c
${LIBIIOSRC}/buffer.c
${LIBIIOSRC}/channel.c
${LIBIIOSRC}/context.c
${LIBIIOSRC}/device.c
${LIBIIOSRC}/local.c
${LIBIIOSRC}/lock.c
${LIBIIOSRC}/utilities.c
${LIBIIOSRC}/sort.c
${LIBIIOSRC}/scan.c)
set(LIBIIO_HEADERS ${LIBIIOSRC}/iio.h)
add_definitions(-D_POSIX_C_SOURCE=200809L -D__XSI_VISIBLE=500 -DLIBIIO_EXPORTS=1)
# Get the GIT hash of the latest commit
include(FindGit OPTIONAL)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE LIBIIO_GIT_REPO
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (${LIBIIO_GIT_REPO} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE LIBIIO_VERSION_GIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
endif()
if (NOT LIBIIO_VERSION_GIT)
set(LIBIIO_VERSION_GIT v${VERSION})
endif()
if(WITH_LOCAL_BACKEND)
add_definitions(-DLOCAL_BACKEND=1)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/local.c)
# Link with librt if present
find_library(LIBRT_LIBRARIES rt)
if (LIBRT_LIBRARIES)
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${LIBRT_LIBRARIES})
endif()
option(WITH_LOCAL_CONFIG "Read local context attributes from /etc/libiio.ini" OFF)
if (WITH_LOCAL_CONFIG)
find_library(LIBINI_LIBRARIES ini)
find_path(LIBINI_INCLUDE_DIR ini.h)
if (NOT LIBINI_LIBRARIES OR NOT LIBINI_INCLUDE_DIR)
message(SEND_ERROR "WITH_LOCAL_CONFIG option requires libini to be installed")
else()
include_directories(${LIBINI_INCLUDE_DIR})
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${LIBINI_LIBRARIES})
endif()
endif()
endif()
find_library(LIBUSB_LIBRARIES usb-1.0)
find_path(LIBUSB_INCLUDE_DIR libusb-1.0/libusb.h)
if (LIBUSB_LIBRARIES AND LIBUSB_INCLUDE_DIR)
option(WITH_USB_BACKEND "Enable the libusb backend" ON)
if(WITH_USB_BACKEND)
add_definitions(-DUSB_BACKEND=1)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/usb.c)
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${LIBUSB_LIBRARIES})
set(IIOD_CLIENT 1)
set(NEED_LIBXML2 1)
set(NEED_THREADS 1)
include_directories(${LIBUSB_INCLUDE_DIR})
endif()
endif()
find_library(LIBSERIALPORT_LIBRARIES serialport)
find_path(LIBSERIALPORT_INCLUDE_DIR libserialport.h)
if (LIBSERIALPORT_LIBRARIES AND LIBSERIALPORT_INCLUDE_DIR)
option(WITH_SERIAL_BACKEND "Enable the serial backend" OFF)
if (WITH_SERIAL_BACKEND)
file(STRINGS ${LIBSERIALPORT_INCLUDE_DIR}/libserialport.h LIBSERIALPORT_VERSION_STR REGEX "SP_PACKAGE_VERSION_STRING")
string(REGEX REPLACE "#define SP_PACKAGE_VERSION_STRING \"(.*)\"" "\\1" LIBSERIALPORT_VERSION ${LIBSERIALPORT_VERSION_STR})
if ("${LIBSERIALPORT_VERSION}" VERSION_LESS 0.1.1)
message(SEND_ERROR "The installed version of libserialport is too old. The minimum version supported is 0.1.1.")
endif()
add_definitions(-DSERIAL_BACKEND=1)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/serial.c)
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${LIBSERIALPORT_LIBRARIES})
set(NEED_THREADS 1)
set(IIOD_CLIENT 1)
set(NEED_LIBXML2 1)
include_directories(${LIBSERIALPORT_INCLUDE_DIR})
endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
if(WITH_NETWORK_BACKEND)
if (WIN32)
set(LIBS_TO_LINK ${LIBS_TO_LINK} wsock32 ws2_32)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
include(CheckCSourceCompiles)
check_c_source_compiles("#include <fcntl.h>\nint main(void) { return O_TMPFILE; }" HAS_O_TMPFILE)
if (HAS_O_TMPFILE)
option(WITH_NETWORK_GET_BUFFER "Enable experimental zero-copy transfers" OFF)
endif(HAS_O_TMPFILE)
check_c_source_compiles("#include <sys/eventfd.h>\nint main(void) { return eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); }" WITH_NETWORK_EVENTFD)
endif()
if(NOT WIN32)
include(CheckCSourceCompiles)
check_c_source_compiles("#include <unistd.h>\n#include <fcntl.h>\nint main(void) { int fd[2]; return pipe2(fd, O_CLOEXEC | O_NONBLOCK); }" HAS_PIPE2)
endif()
add_definitions(-DNETWORK_BACKEND=1)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/network.c)
find_library(AVAHI_CLIENT_LIBRARIES avahi-client)
find_library(AVAHI_COMMON_LIBRARIES avahi-common)
if(AVAHI_CLIENT_LIBRARIES AND AVAHI_COMMON_LIBRARIES)
set(HAVE_AVAHI ON)
set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARIES} ${AVAHI_COMMON_LIBRARIES})
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${AVAHI_LIBRARIES})
endif()
set(NEED_THREADS 1)
set(IIOD_CLIENT 1)
set(NEED_LIBXML2 1)
endif()
# Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all
# variables correctly set.
# So, try first to find the CMake module provided by libxml2 package, then fallback
# on the CMake's FindLibXml2.cmake module (which can lack some definition, especially
# in static build case).
find_package(LibXml2 QUIET NO_MODULE)
if(DEFINED LIBXML2_VERSION_STRING)
set(LIBXML2_FOUND ON)
set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS})
else()
include(FindLibXml2)
endif()
if (LIBXML2_FOUND)
option(WITH_XML_BACKEND "Enable the serial backend" ON)
if (WITH_XML_BACKEND)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/xml.c)
add_definitions(${LIBXML2_DEFINITIONS} -DXML_BACKEND=1)
include_directories(${LIBXML2_INCLUDE_DIR})
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${LIBXML2_LIBRARIES})
endif()
endif()
if (NEED_LIBXML2 AND NOT (LIBXML2_FOUND AND WITH_XML_BACKEND))
message(SEND_ERROR "The selected backends require libxml2 and the XML backend to be enabled")
endif()
if (NEED_THREADS)
if (NOT WIN32)
find_library(PTHREAD_LIBRARIES pthread)
if (PTHREAD_LIBRARIES)
set(LIBS_TO_LINK ${LIBS_TO_LINK} ${PTHREAD_LIBRARIES})
else()
message(WARNING "pthread library not found; support for threads will be disabled")
set(NO_THREADS ON)
endif()
else()
endif()
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/lock.c)
endif()
if (IIOD_CLIENT)
set(LIBIIO_CFILES ${LIBIIO_CFILES} ${LIBIIOSRC}/iiod-client.c)
endif()
configure_file(${LIBIIOSRC}/libiio.iss.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libiio.iss @ONLY)
set(LIBIIO_PC ${CMAKE_CURRENT_BINARY_DIR}/libiio.pc)
configure_file(${LIBIIOSRC}/libiio.pc.cmakein ${LIBIIO_PC} @ONLY)
if(NOT SKIP_INSTALL_ALL)
install(FILES ${LIBIIO_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
endif()
#set(SETUP_PY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/python/setup.py)
#configure_file(python/setup.py.in ${SETUP_PY} @ONLY)
#add_subdirectory(bindings)
if (WITH_MATLAB_BINDINGS_API)
set(LIBIIO_EXTRA_HEADERS ${LIBIIO_EXTRA_HEADERS} bindings/matlab/iio-wrapper.h)
add_definitions(-DMATLAB_BINDINGS_API=1)
endif()
if(WITH_TESTS)
add_subdirectory(tests)
endif()
add_definitions(-DQT_SHARED)
add_library(iio SHARED ${LIBIIO_CFILES} ${LIBIIO_HEADERS} ${LIBIIO_EXTRA_HEADERS})
set_target_properties(iio PROPERTIES
VERSION ${VERSION}
SOVERSION ${LIBIIO_VERSION_MAJOR}
FRAMEWORK TRUE
PUBLIC_HEADER ${LIBIIO_HEADERS}
C_STANDARD 99
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
)
target_link_libraries(iio LINK_PRIVATE ${LIBS_TO_LINK})
if (MSVC)
set_target_properties(iio PROPERTIES OUTPUT_NAME libiio)
endif()
if(NOT SKIP_INSTALL_ALL)
install(TARGETS iio
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION /Library/Frameworks
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
find_package(Doxygen)
if(DOXYGEN_FOUND)
option(WITH_DOC "Generate documentation with Doxygen" OFF)
if (WITH_DOC)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
set(HTML_DEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/html)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/doc DESTINATION ${HTML_DEST_DIR})
add_custom_command(TARGET iio POST_BUILD
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
if(NOT SKIP_INSTALL_ALL)
install(DIRECTORY ${HTML_DEST_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif()
endif()
else()
message(STATUS "Doxygen not found, API documentation won't be generated")
endif()
# Create an installer if compiling for OSX
if(OSX_PACKAGE)
set(LIBIIO_PKG ${CMAKE_CURRENT_BINARY_DIR}/libiio-${VERSION}.g${LIBIIO_VERSION_GIT}.pkg)
set(LIBIIO_TEMP_PKG ${CMAKE_CURRENT_BINARY_DIR}/libiio-${VERSION}-temp.pkg)
set(LIBIIO_DISTRIBUTION_XML ${CMAKE_CURRENT_BINARY_DIR}/Distribution.xml)
set(LIBIIO_FRAMEWORK_DIR ${CMAKE_CURRENT_BINARY_DIR}/iio.framework)
configure_file(Distribution.xml.cmakein ${LIBIIO_DISTRIBUTION_XML} @ONLY)
find_program(PKGBUILD_EXECUTABLE
NAMES pkgbuild
DOC "OSX Package builder (pkgbuild)")
mark_as_advanced(PKGBUILD_EXECUTABLE)
find_program(PRODUCTBUILD_EXECUTABLE
NAMES productbuild
DOC "OSX Package builder (productbuild)")
mark_as_advanced(PRODUCTBUILD_EXECUTABLE)
foreach(_tool ${IIO_TESTS_TARGETS})
list(APPEND IIO_TESTS $<TARGET_FILE:${_tool}>)
endforeach()
add_custom_command(OUTPUT ${LIBIIO_PKG}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBIIO_FRAMEWORK_DIR}/Tools
COMMAND ${CMAKE_COMMAND} -E copy ${IIO_TESTS} ${LIBIIO_FRAMEWORK_DIR}/Tools
COMMAND ${PKGBUILD_EXECUTABLE}
--component ${LIBIIO_FRAMEWORK_DIR}
--identifier com.adi.iio --version ${VERSION}
--install-location /Library/Frameworks ${LIBIIO_TEMP_PKG}
COMMAND ${PRODUCTBUILD_EXECUTABLE}
--distribution ${LIBIIO_DISTRIBUTION_XML} ${LIBIIO_PKG}
COMMAND ${CMAKE_COMMAND} -E remove ${LIBIIO_TEMP_PKG}
DEPENDS iio ${IIO_TESTS_TARGETS} ${LIBIIO_DISTRIBUTION_XML}
)
if (PKGBUILD_EXECUTABLE AND PRODUCTBUILD_EXECUTABLE)
add_custom_target(libiio-pkg ALL DEPENDS ${LIBIIO_PKG})
install(CODE "execute_process(COMMAND /usr/sbin/installer -pkg ${LIBIIO_PKG} -target /)")
else()
message(WARNING "Missing pkgbuild or productbuild: OSX installer won't be created.")
endif()
endif()
if(WITH_IIOD)
if (NOT PTHREAD_LIBRARIES)
message(WARNING "IIOD requires threads support; disabling")
set(WITH_IIOD OFF CACHE BOOL "" FORCE)
else()
add_subdirectory(iiod)
endif()
endif()
if (NOT OSX_PACKAGE)
# Support creating some basic binpkgs via `make package`.
# Disabled if OSX_PACKAGE is enabled, as tarballs would end up empty otherwise.
option(ENABLE_PACKAGING "Create .deb/.rpm or .tar.gz packages via 'make package'" OFF)
if(ENABLE_PACKAGING)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(cmake/DarwinPackaging.cmake)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
include(cmake/LinuxPackaging.cmake)
endif()
endif()
endif()
if (WITH_USB_BACKEND AND CMAKE_SYSTEM_NAME MATCHES "^Linux")
option(INSTALL_UDEV_RULE "Install a udev rule for detection of USB devices" OFF)
if (INSTALL_UDEV_RULE)
set(UDEV_RULES_INSTALL_DIR /lib/udev/rules.d CACHE PATH "default install path for udev rules")
configure_file(libiio.rules.cmakein ${CMAKE_CURRENT_BINARY_DIR}/90-libiio.rules @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/90-libiio.rules DESTINATION ${UDEV_RULES_INSTALL_DIR})
endif()
endif()
configure_file(${LIBIIOSRC}//iio-config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/iio-config.h @ONLY)
if (WITH_EXAMPLES)
add_subdirectory(examples)
endif()
if (WITH_PLUTOSDR)
add_subdirectory(plutosdr)
endif()

View File

@ -1,30 +0,0 @@
#ifndef IIO_CONFIG_H
#define IIO_CONFIG_H
#define LIBIIO_VERSION_MAJOR 0
#define LIBIIO_VERSION_MINOR 10
#define LIBIIO_VERSION_GIT "3b288d4"
#define LOG_LEVEL Info_L
#define WITH_LOCAL_BACKEND
#define WITH_XML_BACKEND
#define WITH_NETWORK_BACKEND
#define WITH_USB_BACKEND
/* #undef WITH_SERIAL_BACKEND */
#define WITH_MATLAB_BINDINGS_API
/* #undef WITH_NETWORK_GET_BUFFER */
#define WITH_NETWORK_EVENTFD
#define WITH_IIOD_USBD
/* #undef WITH_LOCAL_CONFIG */
#define HAS_PIPE2
#define HAS_STRDUP
#define HAS_STRERROR_R
#define HAS_NEWLOCALE
#define HAS_PTHREAD_SETNAME_NP
#define HAVE_IPV6
/* #undef HAVE_AVAHI */
/* #undef NO_THREADS */
#endif /* IIO_CONFIG_H */

View File

@ -1,30 +0,0 @@
#ifndef IIO_CONFIG_H
#define IIO_CONFIG_H
#define LIBIIO_VERSION_MAJOR 0
#define LIBIIO_VERSION_MINOR 10
#define LIBIIO_VERSION_GIT "3b288d4"
#define LOG_LEVEL Info_L
/* #undef WITH_LOCAL_BACKEND */
#define WITH_XML_BACKEND
/* #undef WITH_NETWORK_BACKEND */
#define WITH_USB_BACKEND
/* #undef WITH_SERIAL_BACKEND */
/* #undef WITH_MATLAB_BINDINGS_API */
/* #undef WITH_NETWORK_GET_BUFFER */
/* #undef WITH_NETWORK_EVENTFD */
/* #undef WITH_IIOD_USBD */
/* #undef WITH_LOCAL_CONFIG */
#define HAS_PIPE2
#define HAS_STRDUP
#define HAS_STRERROR_R
#define HAS_NEWLOCALE
/* #undef HAS_PTHREAD_SETNAME_NP */
/* #undef HAVE_IPV6 */
/* #undef HAVE_AVAHI */
/* #undef NO_THREADS */
#endif /* IIO_CONFIG_H */

View File

@ -1,101 +0,0 @@
project(limesuite)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
set(limesuite_SOURCES
${LIBLIMESUITESRC}/src/Logger.cpp
${LIBLIMESUITESRC}/src/ADF4002/ADF4002.cpp
${LIBLIMESUITESRC}/src/lms7002m_mcu/MCU_BD.cpp
${LIBLIMESUITESRC}/src/ConnectionRegistry/IConnection.cpp
${LIBLIMESUITESRC}/src/ConnectionRegistry/ConnectionHandle.cpp
${LIBLIMESUITESRC}/src/ConnectionRegistry/ConnectionRegistry.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_RegistersMap.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_parameters.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_RxTxCalibrations.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_BaseCalibrations.cpp
${LIBLIMESUITESRC}/src/lms7002m/goert.cpp
${LIBLIMESUITESRC}/src/lms7002m/mcu_dc_iq_calibration.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_filtersCalibration.cpp
${LIBLIMESUITESRC}/src/lms7002m/LMS7002M_gainCalibrations.cpp
${LIBLIMESUITESRC}/src/protocols/LMS64CProtocol.cpp
${LIBLIMESUITESRC}/src/protocols/Streamer.cpp
${LIBLIMESUITESRC}/src/protocols/ConnectionImages.cpp
${LIBLIMESUITESRC}/src/Si5351C/Si5351C.cpp
${LIBLIMESUITESRC}/src/API/lms7_api.cpp
${LIBLIMESUITESRC}/src/API/lms7_device.cpp
${LIBLIMESUITESRC}/src/API/LmsGeneric.cpp
${LIBLIMESUITESRC}/src/API/qLimeSDR.cpp
${LIBLIMESUITESRC}/src/API/LimeSDR_mini.cpp
${LIBLIMESUITESRC}/src/API/LimeSDR.cpp
${LIBLIMESUITESRC}/src/API/LimeSDR_PCIE.cpp
${LIBLIMESUITESRC}/src/API/LimeNET_micro.cpp
${LIBLIMESUITESRC}/src/FPGA_common/FPGA_common.cpp
${LIBLIMESUITESRC}/src/FPGA_common/FPGA_Mini.cpp
${LIBLIMESUITESRC}/src/FPGA_common/FPGA_Q.cpp
${LIBLIMESUITESRC}/src/GFIR/corrections.c
${LIBLIMESUITESRC}/src/GFIR/gfir_lms.c
${LIBLIMESUITESRC}/src/GFIR/lms.c
${LIBLIMESUITESRC}/src/GFIR/recipes.c
${LIBLIMESUITESRC}/src/GFIR/rounding.c
${LIBLIMESUITESRC}/src/windowFunction.cpp
${LIBLIMESUITESRC}/src/ConnectionFTDI/ConnectionFT601.cpp
${LIBLIMESUITESRC}/src/ConnectionFTDI//ConnectionFT601Entry.cpp
${LIBLIMESUITESRC}/src/ConnectionFX3/ConnectionFX3Entry.cpp
${LIBLIMESUITESRC}/src/ConnectionFX3/ConnectionFX3.cpp
src/BuiltinConnections.cpp
src/SystemResources.cpp
src/VersionInfo.cpp
)
set(limesuite_HEADERS
${LIBLIMESUITESRC}/src/lime/*.h
${LIBLIMESUITESRC}/src/API/*.h
${LIBLIMESUITESRC}/src/GFIR/*.h
${LIBLIMESUITESRC}/src/protocols/*.h
${LIBLIMESUITESRC}/src/ConnectionRegistry/*.h
${LIBLIMESUITESRC}/src/lms7002m_mcu/*.h
${LIBLIMESUITESRC}/src/ADF4002/*.h
${LIBLIMESUITESRC}/src/Si5351C/*.h
${LIBLIMESUITESRC}/src/lms7002m/*.h
${LIBLIMESUITESRC}/src/FPGA_common/*.h
${LIBLIMESUITESRC}/src/HPM7/*.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBLIMESUITESRC}/src
${LIBLIMESUITESRC}/src/lime
${LIBLIMESUITESRC}/src/API
${LIBLIMESUITESRC}/src/GFIR
${LIBLIMESUITESRC}/src/protocols
${LIBLIMESUITESRC}/src/ConnectionRegistry
${LIBLIMESUITESRC}/src/lms7002m_mcu
${LIBLIMESUITESRC}/src/ADF4002
${LIBLIMESUITESRC}/src/Si5351C
${LIBLIMESUITESRC}/src/lms7002m
${LIBLIMESUITESRC}/src/FPGA_common
${LIBLIMESUITESRC}/src/HPM7
${LIBLIMESUITESRC}/src/kissFFT
${LIBLIMESUITESRC}/external/cpp-feather-ini-parser
./include
)
set (CMAKE_CXX_STANDARD 11)
add_definitions(-DQT_SHARED)
add_library(limesuite SHARED
${limesuite_SOURCES}
)
target_link_libraries(limesuite
${LIBUSB_LIBRARIES}
)
install(TARGETS limesuite DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,45 +0,0 @@
/***********************************************************************
* This is a collection of all built-in connections that are included
* with the library. Additional connections can be added dynamically.
**********************************************************************/
/* #undef ENABLE_EVB7COM */
#define ENABLE_FX3
/* #undef ENABLE_STREAM_UNITE */
/* #undef ENABLE_NOVENARF7 */
#define ENABLE_FTDI
/* #undef ENABLE_PCIE_XILLYBUS */
void __loadConnectionEVB7COMEntry(void);
void __loadConnectionFX3Entry(void);
void __loadConnectionSTREAM_UNITEEntry(void);
void __loadConnectionNovenaRF7Entry(void);
void __loadConnectionFT601Entry(void);
void __loadConnectionXillybusEntry(void);
void __loadAllConnections(void)
{
#ifdef ENABLE_EVB7COM
__loadConnectionEVB7COMEntry();
#endif
#ifdef ENABLE_FX3
__loadConnectionFX3Entry();
#endif
#ifdef ENABLE_STREAM_UNITE
__loadConnectionSTREAM_UNITEEntry();
#endif
#ifdef ENABLE_FTDI
__loadConnectionFT601Entry();
#endif
#ifdef ENABLE_NOVENARF7
__loadConnectionNovenaRF7Entry();
#endif
#ifdef ENABLE_PCIE_XILLYBUS
__loadConnectionXillybusEntry();
#endif
}

View File

@ -1,208 +0,0 @@
/**
@file SystemResources.h
@author Lime Microsystems
@brief APIs for locating system resources.
*/
#include "SystemResources.h"
#include "Logger.h"
#include <cstdlib> //getenv, system
#include <vector>
#include <sstream>
#include <iostream>
#ifdef _MSC_VER
#include <windows.h>
#include <shlobj.h>
#include <io.h>
//access mode constants
#define F_OK 0
#define R_OK 2
#define W_OK 4
#endif
#ifdef __MINGW32__
#include <unistd.h>
#elif __unix__
#include <unistd.h>
#include <pwd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h> //stat
std::string lime::getLimeSuiteRoot(void)
{
//first check the environment variable
const char *limeSuiteRoot = std::getenv("LIME_SUITE_ROOT");
if (limeSuiteRoot != nullptr) return limeSuiteRoot;
// Get the path to the current dynamic linked library.
// The path to this library can be used to determine
// the installation root without prior knowledge.
#if defined(_MSC_VER) && defined(LIME_DLL)
char path[MAX_PATH];
HMODULE hm = NULL;
if (GetModuleHandleExA(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR) &lime::getLimeSuiteRoot, &hm))
{
const DWORD size = GetModuleFileNameA(hm, path, sizeof(path));
if (size != 0)
{
const std::string libPath(path, size);
const size_t slash0Pos = libPath.find_last_of("/\\");
const size_t slash1Pos = libPath.substr(0, slash0Pos).find_last_of("/\\");
if (slash0Pos != std::string::npos && slash1Pos != std::string::npos)
return libPath.substr(0, slash1Pos);
}
}
#endif //_MSC_VER && LIME_DLL
return "/opt/install/LimeSuite";
}
std::string lime::getHomeDirectory(void)
{
#ifndef __MINGW32__
//first check the HOME environment variable
const char *userHome = std::getenv("HOME");
if (userHome != nullptr) return userHome;
//use unix user id lookup to get the home directory
#ifdef __unix__
const char *pwDir = getpwuid(getuid())->pw_dir;
if (pwDir != nullptr) return pwDir;
#endif
#endif
return "";
}
/*!
* The generic location for data storage with user permission level.
*/
static std::string getBareAppDataDirectory(void)
{
//always check APPDATA (usually windows, but can be set for linux)
const char *appDataDir = std::getenv("APPDATA");
if (appDataDir != nullptr) return appDataDir;
//use windows API to query for roaming app data directory
#ifdef _MSC_VER
char csidlAppDataDir[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, csidlAppDataDir)))
{
return csidlAppDataDir;
}
#endif
//xdg freedesktop standard location environment variable
#ifdef __unix__
const char *xdgDataHome = std::getenv("XDG_DATA_HOME");
if (xdgDataHome != nullptr) return xdgDataHome;
#endif
//xdg freedesktop standard location for data in home directory
return lime::getHomeDirectory() + "/.local/share";
}
std::string lime::getAppDataDirectory(void)
{
return getBareAppDataDirectory() + "/LimeSuite";
}
std::string lime::getConfigDirectory(void)
{
//xdg standard is XDG_CONFIG_HOME or $HOME/.config
//but historically we have used $HOME/.limesuite
return lime::getHomeDirectory() + "/.limesuite";
}
std::vector<std::string> lime::listImageSearchPaths(void)
{
std::vector<std::string> imageSearchPaths;
//separator for search paths in the environment variable
#ifdef _MSC_VER
static const char sep = ';';
#else
static const char sep = ':';
#endif
//check the environment's search path
const char *imagePathEnv = std::getenv("LIME_IMAGE_PATH");
if (imagePathEnv != nullptr)
{
std::stringstream imagePaths(imagePathEnv);
std::string imagePath;
while (std::getline(imagePaths, imagePath, sep))
{
if (imagePath.empty()) continue;
imageSearchPaths.push_back(imagePath);
}
}
//search directories in the user's home directory
imageSearchPaths.push_back(lime::getAppDataDirectory() + "/images");
//search global installation directories
imageSearchPaths.push_back(lime::getLimeSuiteRoot() + "/share/LimeSuite/images");
return imageSearchPaths;
}
std::string lime::locateImageResource(const std::string &name)
{
for (const auto &searchPath : lime::listImageSearchPaths())
{
const std::string fullPath(searchPath + "/18.02/" + name);
if (access(fullPath.c_str(), R_OK) == 0) return fullPath;
}
return "";
}
int lime::downloadImageResource(const std::string &name)
{
const std::string destDir(lime::getAppDataDirectory() + "/images/18.02");
const std::string destFile(destDir + "/" + name);
const std::string sourceUrl("http://downloads.myriadrf.org/project/limesuite/18.02/" + name);
//check if the directory already exists
struct stat s;
if (stat(destDir.c_str(), &s) == 0)
{
if ((s.st_mode & S_IFDIR) == 0)
{
return lime::ReportError("Not a directory: %s", destDir.c_str());
}
}
//create images directory
else
{
#ifdef __unix__
const std::string mkdirCmd("mkdir -p \""+destDir+"\"");
#else
const std::string mkdirCmd("md.exe \""+destDir+"\"");
#endif
int result = std::system(mkdirCmd.c_str());
if (result != 0) return lime::ReportError(result, "Failed: %s", mkdirCmd.c_str());
}
//check for write access
if (access(destDir.c_str(), W_OK) != 0) lime::ReportError("Cannot write: %s", destDir.c_str());
//download the file
#ifdef __unix__
const std::string dnloadCmd("wget --output-document=\""+destFile+"\" \""+sourceUrl+"\"");
#else
const std::string dnloadCmd("powershell.exe -Command \"(new-object System.Net.WebClient).DownloadFile('"+sourceUrl+"', '"+destFile+"')\"");
#endif
int result = std::system(dnloadCmd.c_str());
if (result != 0) return lime::ReportError(result, "Failed: %s", dnloadCmd.c_str());
return 0;
}

View File

@ -1,36 +0,0 @@
/**
@file VersionInfo.cpp
@author Lime Microsystems
@brief API for querying version and build information.
*/
#include "VersionInfo.h"
#include <sstream>
#define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x)
std::string lime::GetLibraryVersion(void)
{
return "17.03.0-gaa726d64";
}
std::string lime::GetBuildTimestamp(void)
{
return "2017-04-17";
}
std::string lime::GetAPIVersion(void)
{
const std::string verStr(QUOTE(LIME_SUITE_API_VERSION));
std::stringstream ss;
ss << std::stoi(verStr.substr(2, 4)) << "."
<< std::stoi(verStr.substr(6, 2)) << "."
<< std::stoi(verStr.substr(8, 2));
return ss.str();
}
std::string lime::GetABIVersion(void)
{
return "17.03-1";
}

View File

@ -1,59 +0,0 @@
project(mirisdr)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DDETACH_KERNEL_DRIVER=ON)
find_package(LibUSB)
set(mirisdr_SOURCES
${LIBMIRISDRSRC}/src/libmirisdr.c
${LIBMIRISDRSRC}/src/getopt/getopt.c
)
set(mirisdr_HEADERS
${LIBMIRISDRSRC}/include/mirisdr.h
${LIBMIRISDRSRC}/include/mirisdr_export.h
${LIBMIRISDRSRC}/src/getopt/getopt.h
${LIBMIRISDRSRC}/src/convert/252_s16.c
${LIBMIRISDRSRC}/src/convert/336_s16.c
${LIBMIRISDRSRC}/src/convert/384_s16.c
${LIBMIRISDRSRC}/src/convert/504_s16.c
${LIBMIRISDRSRC}/src/convert/504_s8.c
${LIBMIRISDRSRC}/src/convert/base.c
${LIBMIRISDRSRC}/src/adc.c
${LIBMIRISDRSRC}/src/async.c
${LIBMIRISDRSRC}/src/constants.h
${LIBMIRISDRSRC}/src/convenience.c
${LIBMIRISDRSRC}/src/devices.c
${LIBMIRISDRSRC}/src/gain.c
${LIBMIRISDRSRC}/src/gain.h
${LIBMIRISDRSRC}/src/hard.c
${LIBMIRISDRSRC}/src/hard.h
${LIBMIRISDRSRC}/src/reg.c
${LIBMIRISDRSRC}/src/soft.c
${LIBMIRISDRSRC}/src/soft.h
${LIBMIRISDRSRC}/src/streaming.c
${LIBMIRISDRSRC}/src/structs.h
${LIBMIRISDRSRC}/src/sync.c
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBMIRISDRSRC}/include
${LIBMIRISDRSRC}/src
)
add_definitions(-DQT_SHARED)
add_library(mirisdr SHARED
${mirisdr_SOURCES}
)
target_link_libraries(mirisdr
${LIBUSB_LIBRARIES}
)
install(TARGETS mirisdr DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,42 +0,0 @@
project(perseus)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(LibUSB)
add_definitions(-DHAVE_CONFIG_H)
set(perseus_SOURCES
fpga_data.c
${LIBPERSEUSSRC}/perseuserr.c
${LIBPERSEUSSRC}/perseusfx2.c
${LIBPERSEUSSRC}/perseus-in.c
${LIBPERSEUSSRC}/perseus-sdr.c
)
set(perseus_HEADERS
fpga_data.h
${LIBPERSEUSSRC}/perseuserr.h
${LIBPERSEUSSRC}/perseusfx2.h
${LIBPERSEUSSRC}/perseus-in.h
${LIBPERSEUSSRC}/perseus-sdr.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBPERSEUSSRC}
)
add_definitions(-DQT_SHARED)
add_library(perseus SHARED
${perseus_SOURCES}
)
target_link_libraries(perseus
${LIBUSB_LIBRARIES}
)
install(TARGETS perseus DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,5 +0,0 @@
#ifdef WIN32
#include "config.windows.h"
#else
#include "config.linux.h"
#endif

View File

@ -1,136 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `dl' library (-ldl). */
#define HAVE_LIBDL 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `usb-1.0' library (-lusb-1.0). */
#define HAVE_LIBUSB_1_0 1
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
/* #undef HAVE_LIBUSB_1_0_LIBUSB_H */
/* Define to 1 if you have the `libusb_strerror' function. */
#define HAVE_LIBUSB_STRERROR 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Linux backend */
#define OS_LINUX 1
/* Windows backend */
/* #undef OS_WINDOWS */
/* Name of package */
#define PACKAGE "libperseus_sdr"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "andrew@montefusco.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libperseus_sdr"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libperseus_sdr 0.7.5.4-af9f"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libperseus_sdr"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.7.5.4-af9f"
/* type of second poll() argument */
/* #undef POLL_NFDS_TYPE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "0.7.5.4-af9f"
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT8_T */
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef int16_t */
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint16_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint8_t */
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
/* #undef volatile */

View File

@ -1,136 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `dl' library (-ldl). */
#define HAVE_LIBDL 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `usb-1.0' library (-lusb-1.0). */
#define HAVE_LIBUSB_1_0 1
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
/* #undef HAVE_LIBUSB_1_0_LIBUSB_H */
/* Define to 1 if you have the `libusb_strerror' function. */
#define HAVE_LIBUSB_STRERROR 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Linux backend */
#define OS_LINUX 1
/* Windows backend */
/* #undef OS_WINDOWS */
/* Name of package */
#define PACKAGE "libperseus_sdr"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "andrew@montefusco.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libperseus_sdr"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libperseus_sdr 0.7.5.4-af9f"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libperseus_sdr"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.7.5.4-af9f"
/* type of second poll() argument */
/* #undef POLL_NFDS_TYPE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "0.7.5.4-af9f"
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT8_T */
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef int16_t */
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint16_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint8_t */
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
/* #undef volatile */

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
// ------------------------------------------------------------------------------
// Perseus SDR Library Interface
//
// Copyright (c) 2010 Nicolangelo Palermo / IV3NWV
// This file is part of the Perseus SDR Library
//
// The Perseus SDR Library is free software; you can redistribute
// it and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either version
// 2.1 of the License, or (at your option) any later version.
// The Perseus SDR Library is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with the Perseus SDR Library;
// if not, see <http://www.gnu.org/licenses/>.
// Creation date: 25 June 2010
// Author: Andrea Montefusco (IW0HDV)
// (andrew at montefusco dot com)
// ------------------------------------------------------------------------------
#if !defined __FPGA_DATA_H__
#define __FPGA_DATA_H__
typedef struct _fpga_images {
const char *name;
const int speed;
const int size;
const unsigned char *code;
const int osize;
} FpgaImages;
extern FpgaImages fpgaImgTbl [];
extern int nFpgaImages;
#endif

View File

@ -1,56 +0,0 @@
project(rtlsdr)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DDETACH_KERNEL_DRIVER=ON)
find_package(LibUSB)
set(rtlsdr_SOURCES
${LIBRTLSDRSRC}/src/librtlsdr.c
${LIBRTLSDRSRC}/src/rtlsdr_rpc_msg.c
${LIBRTLSDRSRC}/src/rtlsdr_rpc.c
${LIBRTLSDRSRC}/src/tuner_e4k.c
${LIBRTLSDRSRC}/src/tuner_fc0012.c
${LIBRTLSDRSRC}/src/tuner_fc0013.c
${LIBRTLSDRSRC}/src/tuner_fc2580.c
${LIBRTLSDRSRC}/src/tuner_r82xx.c
${LIBRTLSDRSRC}/src/getopt/getopt.c
${LIBRTLSDRSRC}/src/convenience/convenience.c
)
set(rtlsdr_HEADERS
${LIBRTLSDRSRC}/include/reg_field.h
${LIBRTLSDRSRC}/include/rtl-sdr_export.h
${LIBRTLSDRSRC}/include/rtlsdr_i2c.h
${LIBRTLSDRSRC}/include/rtlsdr_rpc_msg.h
${LIBRTLSDRSRC}/include/rtlsdr_rpc.h
${LIBRTLSDRSRC}/include/rtl-sdr.h
${LIBRTLSDRSRC}/include/tuner_e4k.h
${LIBRTLSDRSRC}/include/tuner_fc0012.h
${LIBRTLSDRSRC}/include/tuner_fc0013.h
${LIBRTLSDRSRC}/include/tuner_fc2580.h
${LIBRTLSDRSRC}/include/tuner_r82xx.h
${LIBRTLSDRSRC}/include/getopt/getopt.h
${LIBRTLSDRSRC}/src/convenience/convenience.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR}
${LIBRTLSDRSRC}/include
${LIBRTLSDRSRC}/src
)
add_definitions(-DQT_SHARED)
add_library(rtlsdr SHARED
${rtlsdr_SOURCES}
)
target_link_libraries(rtlsdr
${LIBUSB_LIBRARIES}
)
install(TARGETS rtlsdr DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,161 +0,0 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.8.7)
project(SoapySDR)
enable_language(CXX)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#set(SOAPYSDR_SOURCE_DIR "/opt/build/SoapySDR")
########################################################################
# gather version information
# packagers may specify -DSOAPY_SDR_EXTVER="foo" to replace the git hash
########################################################################
file(READ "${SOAPYSDR_SOURCE_DIR}/Changelog.txt" changelog_txt)
string(REGEX MATCH "Release ([0-9]+\\.[0-9]+\\.[0-9]+) \\(" CHANGELOG_MATCH "${changelog_txt}")
if(NOT CHANGELOG_MATCH)
message(FATAL_ERROR "Failed to extract version number from Changelog.txt")
endif(NOT CHANGELOG_MATCH)
set(SOAPY_SDR_LIBVER "${CMAKE_MATCH_1}")
if (NOT SOAPY_SDR_EXTVER)
include(${SOAPYSDR_SOURCE_DIR}/cmake/Modules/GetGitRevisionDescription.cmake)
get_git_head_revision(GITREFSPEC GITHASH)
if (GITHASH)
string(SUBSTRING "${GITHASH}" 0 8 GITHASH)
set(SOAPY_SDR_EXTVER "g${GITHASH}")
else (GITHASH)
set(SOAPY_SDR_EXTVER "unknown")
endif (GITHASH)
endif()
set(SOAPY_SDR_VERSION "${SOAPY_SDR_LIBVER}-${SOAPY_SDR_EXTVER}")
#SOAPY_SDR_ROOT is compiled into the library to locate the install base.
#By default, the SOAPY_SDR_ROOT is set to the CMAKE_INSTALL_PREFIX.
#However users may overload this by specifying -DSOAPY_SDR_ROOT=<path>.
set(SOAPY_SDR_ROOT "${CMAKE_INSTALL_PREFIX}" CACHE PATH
"Installation root for SoapySDR::getRootPath()")
file(TO_CMAKE_PATH "${SOAPY_SDR_ROOT}" SOAPY_SDR_ROOT)
#SOAPY_SDR_ROOT_ENV is the name of the environment variable
#which tells SoapySDR where to find the root installation.
#By default, the environment variable SOAPY_SDR_ROOT is used.
#Example: set -DSOAPY_SDR_ROOT_ENV=SNAP for snappy packages.
set(SOAPY_SDR_ROOT_ENV "SOAPY_SDR_ROOT" CACHE STRING
"Environment variable for SoapySDR::getRootPath()")
########################################################################
# select the release build type by default to get optimization flags
########################################################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
########################################################################
# rpath setup - http://www.cmake.org/Wiki/CMake_RPATH_handling
########################################################################
# use, i.e. don't skip the full RPATH for the build tree
option(CMAKE_SKIP_BUILD_RPATH "skip rpath build" FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
option(CMAKE_BUILD_WITH_INSTALL_RPATH "build with install rpath" FALSE)
# the RPATH to be used when installing, but only if it's not a system directory
option(CMAKE_AUTOSET_INSTALL_RPATH TRUE)
if(CMAKE_AUTOSET_INSTALL_RPATH)
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
ENDIF("${isSystemDir}" STREQUAL "-1")
endif(CMAKE_AUTOSET_INSTALL_RPATH)
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "build with automatic rpath" TRUE)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
########################################################################
# Allows in-tree module util
########################################################################
set(SoapySDR_DIR ${SOAPYSDR_SOURCE_DIR}/cmake/Modules)
set(SOAPY_SDR_IN_TREE_SOURCE_DIR ${SOAPYSDR_SOURCE_DIR})
find_package(SoapySDR NO_MODULE REQUIRED)
include_directories(${SoapySDR_INCLUDE_DIRS}) #local include precedence
########################################################################
# Install cmake helper modules
########################################################################
configure_file(
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRConfigVersion.in.cmake
${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake
@ONLY)
set(cmake_files
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRConfig.cmake
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRUtil.cmake
${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake)
if (UNIX)
install(FILES ${cmake_files} DESTINATION share/cmake/${PROJECT_NAME})
elseif (WIN32)
install(FILES ${cmake_files} DESTINATION cmake)
endif ()
########################################################################
# Install headers
########################################################################
#install(DIRECTORY include/SoapySDR DESTINATION include)
########################################################################
# Build subdirs
########################################################################
add_subdirectory(${SOAPYSDR_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
#add_subdirectory(apps)
#add_subdirectory(tests)
#add_subdirectory(docs)
########################################################################
# uninstall target
########################################################################
configure_file(
"${SOAPYSDR_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${SOAPYSDR_SOURCE_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
#only add uninstall target if this is the top project
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
#########################################################################
# summary
#########################################################################
include(FeatureSummary)
message(STATUS "")
message(STATUS "######################################################")
message(STATUS "## ${PROJECT_NAME} enabled features")
message(STATUS "######################################################")
feature_summary(WHAT ENABLED_FEATURES)
message(STATUS "######################################################")
message(STATUS "## ${PROJECT_NAME} disabled features")
message(STATUS "######################################################")
feature_summary(WHAT DISABLED_FEATURES)
message(STATUS "SoapySDR version: v${SOAPY_SDR_VERSION}")
message(STATUS "ABI/so version: v${SOAPY_SDR_ABI_VERSION}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
#add_definitions(-DQT_SHARED)
#
#message( STATUS "soapysdr_SOURCES: ${soapysdr_SOURCES}" )
#
#add_library(soapysdr SHARED
# ${soapysdr_SOURCES}
#)
#
#install(TARGETS soapysdr DESTINATION ${INSTALL_LIB_DIR})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,564 +0,0 @@
/*
** 2006 June 7
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance. Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "../libsqlite3/sqlite3.h"
/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING: In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only. If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
void * (*aggregate_context)(sqlite3_context*,int nBytes);
int (*aggregate_count)(sqlite3_context*);
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
int (*bind_double)(sqlite3_stmt*,int,double);
int (*bind_int)(sqlite3_stmt*,int,int);
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
int (*bind_null)(sqlite3_stmt*,int);
int (*bind_parameter_count)(sqlite3_stmt*);
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
int (*busy_timeout)(sqlite3*,int ms);
int (*changes)(sqlite3*);
int (*close)(sqlite3*);
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const char*));
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const void*));
const void * (*column_blob)(sqlite3_stmt*,int iCol);
int (*column_bytes)(sqlite3_stmt*,int iCol);
int (*column_bytes16)(sqlite3_stmt*,int iCol);
int (*column_count)(sqlite3_stmt*pStmt);
const char * (*column_database_name)(sqlite3_stmt*,int);
const void * (*column_database_name16)(sqlite3_stmt*,int);
const char * (*column_decltype)(sqlite3_stmt*,int i);
const void * (*column_decltype16)(sqlite3_stmt*,int);
double (*column_double)(sqlite3_stmt*,int iCol);
int (*column_int)(sqlite3_stmt*,int iCol);
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
const char * (*column_name)(sqlite3_stmt*,int);
const void * (*column_name16)(sqlite3_stmt*,int);
const char * (*column_origin_name)(sqlite3_stmt*,int);
const void * (*column_origin_name16)(sqlite3_stmt*,int);
const char * (*column_table_name)(sqlite3_stmt*,int);
const void * (*column_table_name16)(sqlite3_stmt*,int);
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
const void * (*column_text16)(sqlite3_stmt*,int iCol);
int (*column_type)(sqlite3_stmt*,int iCol);
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
int (*complete)(const char*sql);
int (*complete16)(const void*sql);
int (*create_collation)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_collation16)(sqlite3*,const void*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_function)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_function16)(sqlite3*,const void*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
int (*data_count)(sqlite3_stmt*pStmt);
sqlite3 * (*db_handle)(sqlite3_stmt*);
int (*declare_vtab)(sqlite3*,const char*);
int (*enable_shared_cache)(int);
int (*errcode)(sqlite3*db);
const char * (*errmsg)(sqlite3*);
const void * (*errmsg16)(sqlite3*);
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
int (*expired)(sqlite3_stmt*);
int (*finalize)(sqlite3_stmt*pStmt);
void (*free)(void*);
void (*free_table)(char**result);
int (*get_autocommit)(sqlite3*);
void * (*get_auxdata)(sqlite3_context*,int);
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
int (*global_recover)(void);
void (*interruptx)(sqlite3*);
sqlite_int64 (*last_insert_rowid)(sqlite3*);
const char * (*libversion)(void);
int (*libversion_number)(void);
void *(*malloc)(int);
char * (*mprintf)(const char*,...);
int (*open)(const char*,sqlite3**);
int (*open16)(const void*,sqlite3**);
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
void *(*realloc)(void*,int);
int (*reset)(sqlite3_stmt*pStmt);
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_double)(sqlite3_context*,double);
void (*result_error)(sqlite3_context*,const char*,int);
void (*result_error16)(sqlite3_context*,const void*,int);
void (*result_int)(sqlite3_context*,int);
void (*result_int64)(sqlite3_context*,sqlite_int64);
void (*result_null)(sqlite3_context*);
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_value)(sqlite3_context*,sqlite3_value*);
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
char * (*snprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
void (*thread_cleanup)(void);
int (*total_changes)(sqlite3*);
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
sqlite_int64),void*);
void * (*user_data)(sqlite3_context*);
const void * (*value_blob)(sqlite3_value*);
int (*value_bytes)(sqlite3_value*);
int (*value_bytes16)(sqlite3_value*);
double (*value_double)(sqlite3_value*);
int (*value_int)(sqlite3_value*);
sqlite_int64 (*value_int64)(sqlite3_value*);
int (*value_numeric_type)(sqlite3_value*);
const unsigned char * (*value_text)(sqlite3_value*);
const void * (*value_text16)(sqlite3_value*);
const void * (*value_text16be)(sqlite3_value*);
const void * (*value_text16le)(sqlite3_value*);
int (*value_type)(sqlite3_value*);
char *(*vmprintf)(const char*,va_list);
/* Added ??? */
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
/* Added by 3.3.13 */
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
int (*clear_bindings)(sqlite3_stmt*);
/* Added by 3.4.1 */
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
void (*xDestroy)(void *));
/* Added by 3.5.0 */
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
int (*blob_bytes)(sqlite3_blob*);
int (*blob_close)(sqlite3_blob*);
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
int,sqlite3_blob**);
int (*blob_read)(sqlite3_blob*,void*,int,int);
int (*blob_write)(sqlite3_blob*,const void*,int,int);
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*),
void(*)(void*));
int (*file_control)(sqlite3*,const char*,int,void*);
sqlite3_int64 (*memory_highwater)(int);
sqlite3_int64 (*memory_used)(void);
sqlite3_mutex *(*mutex_alloc)(int);
void (*mutex_enter)(sqlite3_mutex*);
void (*mutex_free)(sqlite3_mutex*);
void (*mutex_leave)(sqlite3_mutex*);
int (*mutex_try)(sqlite3_mutex*);
int (*open_v2)(const char*,sqlite3**,int,const char*);
int (*release_memory)(int);
void (*result_error_nomem)(sqlite3_context*);
void (*result_error_toobig)(sqlite3_context*);
int (*sleep)(int);
void (*soft_heap_limit)(int);
sqlite3_vfs *(*vfs_find)(const char*);
int (*vfs_register)(sqlite3_vfs*,int);
int (*vfs_unregister)(sqlite3_vfs*);
int (*xthreadsafe)(void);
void (*result_zeroblob)(sqlite3_context*,int);
void (*result_error_code)(sqlite3_context*,int);
int (*test_control)(int, ...);
void (*randomness)(int,void*);
sqlite3 *(*context_db_handle)(sqlite3_context*);
int (*extended_result_codes)(sqlite3*,int);
int (*limit)(sqlite3*,int,int);
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
const char *(*sql)(sqlite3_stmt*);
int (*status)(int,int*,int*,int);
int (*backup_finish)(sqlite3_backup*);
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
int (*backup_pagecount)(sqlite3_backup*);
int (*backup_remaining)(sqlite3_backup*);
int (*backup_step)(sqlite3_backup*,int);
const char *(*compileoption_get)(int);
int (*compileoption_used)(const char*);
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void(*xDestroy)(void*));
int (*db_config)(sqlite3*,int,...);
sqlite3_mutex *(*db_mutex)(sqlite3*);
int (*db_status)(sqlite3*,int,int*,int*,int);
int (*extended_errcode)(sqlite3*);
void (*log)(int,const char*,...);
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
const char *(*sourceid)(void);
int (*stmt_status)(sqlite3_stmt*,int,int);
int (*strnicmp)(const char*,const char*,int);
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
int (*wal_autocheckpoint)(sqlite3*,int);
int (*wal_checkpoint)(sqlite3*,const char*);
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
int (*vtab_config)(sqlite3*,int op,...);
int (*vtab_on_conflict)(sqlite3*);
/* Version 3.7.16 and later */
int (*close_v2)(sqlite3*);
const char *(*db_filename)(sqlite3*,const char*);
int (*db_readonly)(sqlite3*,const char*);
int (*db_release_memory)(sqlite3*);
const char *(*errstr)(int);
int (*stmt_busy)(sqlite3_stmt*);
int (*stmt_readonly)(sqlite3_stmt*);
int (*stricmp)(const char*,const char*);
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
char *(*vsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);
void *(*realloc64)(void*,sqlite3_uint64);
void (*reset_auto_extension)(void);
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
void(*)(void*));
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
void(*)(void*), unsigned char);
int (*strglob)(const char*,const char*);
/* Version 3.8.11 and later */
sqlite3_value *(*value_dup)(const sqlite3_value*);
void (*value_free)(sqlite3_value*);
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
/* Version 3.9.0 and later */
unsigned int (*value_subtype)(sqlite3_value*);
void (*result_subtype)(sqlite3_context*,unsigned int);
/* Version 3.10.0 and later */
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
int (*strlike)(const char*,const char*,unsigned int);
int (*db_cacheflush)(sqlite3*);
/* Version 3.12.0 and later */
int (*system_errno)(sqlite3*);
/* Version 3.14.0 and later */
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
char *(*expanded_sql)(sqlite3_stmt*);
/* Version 3.18.0 and later */
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
};
/*
** This is the function signature used for all extension entry points. It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
/*
** The following macros redefine the API routines so that they are
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition. But the main library does not want to redefine
** the API. So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob sqlite3_api->bind_blob
#define sqlite3_bind_double sqlite3_api->bind_double
#define sqlite3_bind_int sqlite3_api->bind_int
#define sqlite3_bind_int64 sqlite3_api->bind_int64
#define sqlite3_bind_null sqlite3_api->bind_null
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
#define sqlite3_bind_text sqlite3_api->bind_text
#define sqlite3_bind_text16 sqlite3_api->bind_text16
#define sqlite3_bind_value sqlite3_api->bind_value
#define sqlite3_busy_handler sqlite3_api->busy_handler
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
#define sqlite3_changes sqlite3_api->changes
#define sqlite3_close sqlite3_api->close
#define sqlite3_collation_needed sqlite3_api->collation_needed
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
#define sqlite3_column_blob sqlite3_api->column_blob
#define sqlite3_column_bytes sqlite3_api->column_bytes
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
#define sqlite3_column_count sqlite3_api->column_count
#define sqlite3_column_database_name sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype sqlite3_api->column_decltype
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
#define sqlite3_column_double sqlite3_api->column_double
#define sqlite3_column_int sqlite3_api->column_int
#define sqlite3_column_int64 sqlite3_api->column_int64
#define sqlite3_column_name sqlite3_api->column_name
#define sqlite3_column_name16 sqlite3_api->column_name16
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
#define sqlite3_column_table_name sqlite3_api->column_table_name
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
#define sqlite3_column_text sqlite3_api->column_text
#define sqlite3_column_text16 sqlite3_api->column_text16
#define sqlite3_column_type sqlite3_api->column_type
#define sqlite3_column_value sqlite3_api->column_value
#define sqlite3_commit_hook sqlite3_api->commit_hook
#define sqlite3_complete sqlite3_api->complete
#define sqlite3_complete16 sqlite3_api->complete16
#define sqlite3_create_collation sqlite3_api->create_collation
#define sqlite3_create_collation16 sqlite3_api->create_collation16
#define sqlite3_create_function sqlite3_api->create_function
#define sqlite3_create_function16 sqlite3_api->create_function16
#define sqlite3_create_module sqlite3_api->create_module
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
#define sqlite3_data_count sqlite3_api->data_count
#define sqlite3_db_handle sqlite3_api->db_handle
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
#define sqlite3_errcode sqlite3_api->errcode
#define sqlite3_errmsg sqlite3_api->errmsg
#define sqlite3_errmsg16 sqlite3_api->errmsg16
#define sqlite3_exec sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired sqlite3_api->expired
#endif
#define sqlite3_finalize sqlite3_api->finalize
#define sqlite3_free sqlite3_api->free
#define sqlite3_free_table sqlite3_api->free_table
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#define sqlite3_get_table sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover sqlite3_api->global_recover
#endif
#define sqlite3_interrupt sqlite3_api->interruptx
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#define sqlite3_libversion sqlite3_api->libversion
#define sqlite3_libversion_number sqlite3_api->libversion_number
#define sqlite3_malloc sqlite3_api->malloc
#define sqlite3_mprintf sqlite3_api->mprintf
#define sqlite3_open sqlite3_api->open
#define sqlite3_open16 sqlite3_api->open16
#define sqlite3_prepare sqlite3_api->prepare
#define sqlite3_prepare16 sqlite3_api->prepare16
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_profile sqlite3_api->profile
#define sqlite3_progress_handler sqlite3_api->progress_handler
#define sqlite3_realloc sqlite3_api->realloc
#define sqlite3_reset sqlite3_api->reset
#define sqlite3_result_blob sqlite3_api->result_blob
#define sqlite3_result_double sqlite3_api->result_double
#define sqlite3_result_error sqlite3_api->result_error
#define sqlite3_result_error16 sqlite3_api->result_error16
#define sqlite3_result_int sqlite3_api->result_int
#define sqlite3_result_int64 sqlite3_api->result_int64
#define sqlite3_result_null sqlite3_api->result_null
#define sqlite3_result_text sqlite3_api->result_text
#define sqlite3_result_text16 sqlite3_api->result_text16
#define sqlite3_result_text16be sqlite3_api->result_text16be
#define sqlite3_result_text16le sqlite3_api->result_text16le
#define sqlite3_result_value sqlite3_api->result_value
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#define sqlite3_snprintf sqlite3_api->snprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
#define sqlite3_total_changes sqlite3_api->total_changes
#define sqlite3_trace sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook sqlite3_api->update_hook
#define sqlite3_user_data sqlite3_api->user_data
#define sqlite3_value_blob sqlite3_api->value_blob
#define sqlite3_value_bytes sqlite3_api->value_bytes
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
#define sqlite3_value_double sqlite3_api->value_double
#define sqlite3_value_int sqlite3_api->value_int
#define sqlite3_value_int64 sqlite3_api->value_int64
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
#define sqlite3_value_text sqlite3_api->value_text
#define sqlite3_value_text16 sqlite3_api->value_text16
#define sqlite3_value_text16be sqlite3_api->value_text16be
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
#define sqlite3_blob_close sqlite3_api->blob_close
#define sqlite3_blob_open sqlite3_api->blob_open
#define sqlite3_blob_read sqlite3_api->blob_read
#define sqlite3_blob_write sqlite3_api->blob_write
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
#define sqlite3_file_control sqlite3_api->file_control
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
#define sqlite3_memory_used sqlite3_api->memory_used
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
#define sqlite3_mutex_free sqlite3_api->mutex_free
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
#define sqlite3_mutex_try sqlite3_api->mutex_try
#define sqlite3_open_v2 sqlite3_api->open_v2
#define sqlite3_release_memory sqlite3_api->release_memory
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
#define sqlite3_sleep sqlite3_api->sleep
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find sqlite3_api->vfs_find
#define sqlite3_vfs_register sqlite3_api->vfs_register
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
#define sqlite3_result_error_code sqlite3_api->result_error_code
#define sqlite3_test_control sqlite3_api->test_control
#define sqlite3_randomness sqlite3_api->randomness
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
#define sqlite3_limit sqlite3_api->limit
#define sqlite3_next_stmt sqlite3_api->next_stmt
#define sqlite3_sql sqlite3_api->sql
#define sqlite3_status sqlite3_api->status
#define sqlite3_backup_finish sqlite3_api->backup_finish
#define sqlite3_backup_init sqlite3_api->backup_init
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
#define sqlite3_backup_step sqlite3_api->backup_step
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
#define sqlite3_db_config sqlite3_api->db_config
#define sqlite3_db_mutex sqlite3_api->db_mutex
#define sqlite3_db_status sqlite3_api->db_status
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
#define sqlite3_log sqlite3_api->log
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
#define sqlite3_sourceid sqlite3_api->sourceid
#define sqlite3_stmt_status sqlite3_api->stmt_status
#define sqlite3_strnicmp sqlite3_api->strnicmp
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook sqlite3_api->wal_hook
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#define sqlite3_vtab_config sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
/* Version 3.7.16 and later */
#define sqlite3_close_v2 sqlite3_api->close_v2
#define sqlite3_db_filename sqlite3_api->db_filename
#define sqlite3_db_readonly sqlite3_api->db_readonly
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
#define sqlite3_errstr sqlite3_api->errstr
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
#define sqlite3_stricmp sqlite3_api->stricmp
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#define sqlite3_malloc64 sqlite3_api->malloc64
#define sqlite3_msize sqlite3_api->msize
#define sqlite3_realloc64 sqlite3_api->realloc64
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#define sqlite3_result_text64 sqlite3_api->result_text64
#define sqlite3_strglob sqlite3_api->strglob
/* Version 3.8.11 and later */
#define sqlite3_value_dup sqlite3_api->value_dup
#define sqlite3_value_free sqlite3_api->value_free
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
/* Version 3.9.0 and later */
#define sqlite3_value_subtype sqlite3_api->value_subtype
#define sqlite3_result_subtype sqlite3_api->result_subtype
/* Version 3.10.0 and later */
#define sqlite3_status64 sqlite3_api->status64
#define sqlite3_strlike sqlite3_api->strlike
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
/* Version 3.12.0 and later */
#define sqlite3_system_errno sqlite3_api->system_errno
/* Version 3.14.0 and later */
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
/* This case when the file really is being compiled as a loadable
** extension */
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
# define SQLITE_EXTENSION_INIT3 \
extern const sqlite3_api_routines *sqlite3_api;
#else
/* This case when the file is being statically linked into the
** application */
# define SQLITE_EXTENSION_INIT1 /*no-op*/
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
# define SQLITE_EXTENSION_INIT3 /*no-op*/
#endif
#endif /* SQLITE3EXT_H */

View File

@ -1,38 +0,0 @@
project(mbelib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(mbelib_SOURCES
${LIBMBELIBSRC}/ambe3600x2400.c
${LIBMBELIBSRC}/ambe3600x2450.c
${LIBMBELIBSRC}/ecc.c
${LIBMBELIBSRC}/imbe7100x4400.c
${LIBMBELIBSRC}/imbe7200x4400.c
${LIBMBELIBSRC}/mbelib.c
)
set(mbelib_HEADERS
${LIBMBELIBSRC}/ambe3600x2400_const.h
${LIBMBELIBSRC}/ambe3600x2450_const.h
${LIBMBELIBSRC}/ecc_const.h
${LIBMBELIBSRC}/imbe7200x4400_const.h
${LIBMBELIBSRC}/mbelib.h
${LIBMBELIBSRC}/mbelib_const.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBMBELIBSRC}
)
add_definitions(-DQT_SHARED)
add_library(mbelib SHARED
${mbelib_SOURCES}
)
target_link_libraries(mbelib
)
install(TARGETS mbelib DESTINATION ${INSTALL_LIB_DIR})

View File

@ -1,31 +0,0 @@
project(serialdv)
set(serialdv_SOURCES
${LIBSERIALDVSRC}/dvcontroller.cpp
${LIBSERIALDVSRC}/serialdatacontroller.cpp
)
set(serialdv_HEADERS
${LIBSERIALDVSRC}/dvcontroller.h
${LIBSERIALDVSRC}/serialdatacontroller.h
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBSERIALDVSRC}
)
add_definitions(-DQT_SHARED)
add_library(serialdv SHARED
${serialdv_SOURCES}
)
set_target_properties(serialdv PROPERTIES DEFINE_SYMBOL "serialdv_EXPORTS")
target_link_libraries(serialdv
${LIBUSB_LIBRARIES}
)
install(TARGETS serialdv DESTINATION ${INSTALL_LIB_DIR})