Skip to content

Commit

Permalink
Partial fix of compilation errors on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonaitis committed Feb 9, 2024
1 parent 77c1782 commit 4e62b9a
Show file tree
Hide file tree
Showing 33 changed files with 146 additions and 193 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ endif()

if (MSVC)
include_directories(${PROJECT_SOURCE_DIR}/external/msvc)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOGDI -DNOMINMAX)
set( MSVC_MULTITHREAD_COMPILE_FLAGS "/MP")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSVC_MULTITHREAD_COMPILE_FLAGS}" )

Expand Down
6 changes: 5 additions & 1 deletion amarisoft-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ set(CMAKE_BUILD_TYPE "Release")

include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_AMARISOFT_PLUGIN "Build LimeSuite integration to Amarisoft" ON "ENABLE_LIBRARY" OFF)
cmake_dependent_option(ENABLE_AMARISOFT_PLUGIN "Build LimeSuite integration to Amarisoft" ON "UNIX;ENABLE_LIBRARY" OFF)
add_feature_info(AMARISOFT_PLUGIN ENABLE_AMARISOFT_PLUGIN "LimeSuite Amarisoft integration plugin")

if (NOT ENABLE_AMARISOFT_PLUGIN)
return()
endif()

#include modules for finding libraries
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

Expand Down
1 change: 1 addition & 0 deletions src/DSP/Equalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Register.h"
#include "limesuite/IComms.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include <assert.h>
#include <algorithm>
Expand Down
10 changes: 5 additions & 5 deletions src/FPGA_common/FPGA_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ OpStatus FPGA::SetPllFrequency(const uint8_t pllIndex, const double inputFreq, F
lime::debug("FPGA SetPllFrequency: PLL[%i] input:%.3f MHz clockCount:%i", pllIndex, inputFreq / 1e6, clockCount);
WriteRegistersBatch batch(this);
const auto timeout = chrono::seconds(3);
if (not fpgaPort)
if (!fpgaPort)
return ReportError(OpStatus::IO_FAILURE, "ConfigureFPGA_PLL: connection port is NULL");

const bool waitForDone = HasWaitForDone(ReadRegister(0)); // read targetDevice
Expand All @@ -463,7 +463,7 @@ OpStatus FPGA::SetPllFrequency(const uint8_t pllIndex, const double inputFreq, F
clocks[i].phaseShift_deg,
clocks[i].findPhase);
willDoPhaseSearch |= clocks[i].findPhase;
if (clocks[i].outFrequency < PLLlowerLimit && not clocks[i].bypass)
if (clocks[i].outFrequency < PLLlowerLimit && !clocks[i].bypass)
return ReportError(
OpStatus::OUT_OF_RANGE, "FPGA SetPllFrequency: PLL[%i], clock[%i] must be >=%g MHz", pllIndex, i, PLLlowerLimit / 1e6);
}
Expand Down Expand Up @@ -570,13 +570,13 @@ OpStatus FPGA::SetPllFrequency(const uint8_t pllIndex, const double inputFreq, F
const int C = ceil(Fvco / clocks[i].outFrequency);
if (i < 8)
{
if (not clocks[i].bypass && C != 1)
if (!clocks[i].bypass && C != 1)
c7_c0_odds_byps &= ~(1 << (i * 2)); //enable output
c7_c0_odds_byps |= (C % 2) << (i * 2 + 1); //odd bit
}
else
{
if (not clocks[i].bypass && C != 1)
if (!clocks[i].bypass && C != 1)
c15_c8_odds_byps &= ~(1 << ((i - 8) * 2)); //enable output
c15_c8_odds_byps |= (C % 2) << ((i - 8) * 2 + 1); //odd bit
}
Expand Down Expand Up @@ -624,7 +624,7 @@ OpStatus FPGA::SetPllFrequency(const uint8_t pllIndex, const double inputFreq, F

OpStatus FPGA::SetDirectClocking(int clockIndex)
{
if (not fpgaPort)
if (!fpgaPort)
return ReportError(OpStatus::IO_FAILURE, "SetDirectClocking: connection port is NULL");

uint16_t drct_clk_ctrl_0005 = ReadRegister(0x0005);
Expand Down
1 change: 1 addition & 0 deletions src/boards/LMS7002M_SDRDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Logger.h"
#include "TRXLooper.h"

#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
Expand Down
28 changes: 2 additions & 26 deletions src/boards/LimeSDR/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
########################################################################
## Support for LimeSDR board
########################################################################

if(WIN32)
find_package(CyAPI)
set(USB_FOUND ${CYAPI_FOUND})
set(USB_INCLUDE_DIRS ${CYAPI_INCLUDE_DIRS})
set(USB_LIBRARIES ${CYAPI_LIBRARIES} SetupAPI)
elseif(UNIX)
find_package(libusb-1.0)
set(USB_FOUND ${LIBUSB_1_FOUND})
set(USB_INCLUDE_DIRS ${LIBUSB_1_INCLUDE_DIRS})
set(USB_LIBRARIES ${LIBUSB_1_LIBRARIES})
endif()

if (NOT USB_FOUND)
message(STATUS "USB libraries for LimeSDR support not found. Requires libusb-1.0 or CyAPI")
else()
message(STATUS "USB_INCLUDE_DIRS: ${USB_INCLUDE_DIRS}")
message(STATUS "USB_LIBRARIES: ${USB_LIBRARIES}")
endif()

set(THIS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/LimeSDR)

set(LIMESDR_SOURCES
Expand All @@ -29,16 +9,12 @@ set(LIMESDR_SOURCES
${THIS_SOURCE_DIR}/USB_CSR_Pipe_SDR.cpp
)

set(LIMESDR_LIBRARIES
${USB_LIBRARIES}
)

########################################################################
## Feature registration
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIMESDR_USB "Enable LimeSDR support" ON "ENABLE_LIBRARY;USB_FOUND" OFF)
cmake_dependent_option(ENABLE_LIMESDR_USB "Enable LimeSDR support" ON "ENABLE_LIBRARY;ENABLE_USB_FX3" OFF)
add_feature_info(BoardLimeSDR ENABLE_LIMESDR_USB "LimeSDR board support")
if (NOT ENABLE_LIMESDR_USB)
return()
Expand All @@ -49,4 +25,4 @@ endif()
########################################################################
target_include_directories(${MAIN_LIBRARY_NAME} PUBLIC ${USB_INCLUDE_DIRS} ${THIS_SOURCE_DIR})
target_sources(${MAIN_LIBRARY_NAME} PRIVATE ${LIMESDR_SOURCES})
target_link_libraries(${MAIN_LIBRARY_NAME} PUBLIC ${LIMESDR_LIBRARIES})
target_link_libraries(${MAIN_LIBRARY_NAME} PRIVATE ${LIMESDR_LIBRARIES})
46 changes: 1 addition & 45 deletions src/boards/LimeSDR_Mini/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
########################################################################
## Support for LimeSDR Mini v1 board
########################################################################

if(WIN32)
set(USB_FOUND TRUE)
set(USB_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/external/FTD3XXLibrary)

#library directory based on x64 vs x86
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(FTD3XX_LIB_DIR ${USB_INCLUDE_DIRS}/x64)
else()
set(FTD3XX_LIB_DIR ${USB_INCLUDE_DIRS}/Win32)
endif()

#default is to use static libs
option(FTD3XX_STATIC "Use static libs for FTD3XX" TRUE)

#when using static libs specify FTD3XX_STATIC
if (FTD3XX_STATIC)
set(USB_LIBRARIES ${FTD3XX_LIB_DIR}/Static/FTD3XX.lib SetupAPI)
add_definitions(-DFTD3XX_STATIC)

#when using dynamic libs install the dll to bin/
else()
set(USB_LIBRARIES ${FTD3XX_LIB_DIR}/FTD3XX.lib SetupAPI)
install(FILES ${FTD3XX_LIB_DIR}/FTD3XX.dll DESTINATION bin)
endif()
elseif(UNIX)
find_package(libusb-1.0)
set(USB_FOUND ${LIBUSB_1_FOUND})
set(USB_INCLUDE_DIRS ${LIBUSB_1_INCLUDE_DIRS})
set(USB_LIBRARIES ${LIBUSB_1_LIBRARIES})
endif()

if (NOT USB_FOUND)
message(STATUS "USB libraries for LimeSDR support not found. Requires libusb-1.0 or CyAPI")
else()
message(STATUS "USB_INCLUDE_DIRS: ${USB_INCLUDE_DIRS}")
message(STATUS "USB_LIBRARIES: ${USB_LIBRARIES}")
endif()

set(THIS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boards/LimeSDR_Mini)

set(LIMESDR_MINI_SOURCES
Expand All @@ -49,16 +10,12 @@ set(LIMESDR_MINI_SOURCES
${THIS_SOURCE_DIR}/USB_CSR_Pipe_Mini.cpp
)

set(LIMESDR_MINI_LIBRARIES
${USB_LIBRARIES}
)

########################################################################
## Feature registration
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIMESDR_MINI "Enable LimeSDR Mini support" ON "ENABLE_LIBRARY;USB_FOUND" OFF)
cmake_dependent_option(ENABLE_LIMESDR_MINI "Enable LimeSDR Mini support" ON "ENABLE_LIBRARY;ENABLE_USB_FTDI" OFF)
add_feature_info(BoardLimeSDR_Mini ENABLE_LIMESDR_MINI "LimeSDR Mini board support")
if (NOT ENABLE_LIMESDR_MINI)
return()
Expand All @@ -69,4 +26,3 @@ endif()
########################################################################
target_include_directories(${MAIN_LIBRARY_NAME} PUBLIC ${USB_INCLUDE_DIRS} ${THIS_SOURCE_DIR})
target_sources(${MAIN_LIBRARY_NAME} PRIVATE ${LIMESDR_MINI_SOURCES})
target_link_libraries(${MAIN_LIBRARY_NAME} PUBLIC ${LIMESDR_MINI_LIBRARIES})
4 changes: 1 addition & 3 deletions src/boards/LimeSDR_Mini/LimeSDR_MiniEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ std::vector<DeviceHandle> LimeSDR_MiniEntry::enumerate(const DeviceHandle& hint)
ftStatus = FT_GetDeviceInfoDetail(i, &Flags, nullptr, nullptr, nullptr, SerialNumber, Description, nullptr);
if (!FT_FAILED(ftStatus))
{
ConnectionHandle handle;
DeviceHandle handle;
handle.media = Flags & FT_FLAGS_SUPERSPEED ? "USB 3" : Flags & FT_FLAGS_HISPEED ? "USB 2" : "USB";
handle.module = "FT601";
handle.name = Description;
handle.index = i;
handle.serial = SerialNumber;
// Add handle conditionally, filter by serial number
if (hint.serial.empty() || handle.serial.find(hint.serial) != std::string::npos)
Expand Down
2 changes: 1 addition & 1 deletion src/boards/LimeSDR_X3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(LIMESDR_X3_SOURCES
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIMESDR_X3 "Enable LimeSDR X3 board support" ON "ENABLE_LIBRARY" OFF)
cmake_dependent_option(ENABLE_LIMESDR_X3 "Enable LimeSDR X3 board support" ON "ENABLE_LIBRARY;ENABLE_LITE_PCIE" OFF)
add_feature_info(ENABLE_LIMESDR_X3 ENABLE_LIMESDR_X3 "LimeSDR X3 board support")
if (NOT ENABLE_LIMESDR_X3)
return()
Expand Down
2 changes: 1 addition & 1 deletion src/boards/LimeSDR_XTRX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(LIMESDR_XTRX_SOURCES
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIMESDR_XTRX "Enable LimeSDR XTRX support" ON "ENABLE_LIBRARY" OFF)
cmake_dependent_option(ENABLE_LIMESDR_XTRX "Enable LimeSDR XTRX support" ON "ENABLE_LIBRARY;ENABLE_LITE_PCIE" OFF)
add_feature_info(BoardLimeSDRXTRX ENABLE_LIMESDR_XTRX "LimeSDR XTRX board support")
if (NOT ENABLE_LIMESDR_XTRX)
return()
Expand Down
2 changes: 1 addition & 1 deletion src/boards/MMX8/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(MM_X8_SOURCES
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIMESDR_MMX8 "Enable LimeMM-X8 board support" ON "ENABLE_LIBRARY" OFF)
cmake_dependent_option(ENABLE_LIMESDR_MMX8 "Enable LimeMM-X8 board support" ON "ENABLE_LIBRARY;ENABLE_LITE_PCIE" OFF)
add_feature_info(ENABLE_LIMESDR_MMX8 ENABLE_LIMESDR_MMX8 "LimeSDR MM-X8 board support")
if (NOT ENABLE_LIMESDR_MMX8)
return()
Expand Down
7 changes: 4 additions & 3 deletions src/cli/limeTRX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "kissFFT/kiss_fft.h"
#include <condition_variable>
#include <mutex>

// #define USE_GNU_PLOT 1
#ifdef USE_GNU_PLOT
#include "gnuPlotPipe.h"
Expand Down Expand Up @@ -80,7 +81,7 @@ enum Args {
HELP = 'h',
DEVICE = 'd',
CHIP = 'c',
INPUT = 'i',
INPUTFILE = 'i',
OUTPUT = 'o',
SAMPLES_COUNT = 's',
TIME = 't',
Expand Down Expand Up @@ -328,7 +329,7 @@ int main(int argc, char** argv)
static struct option long_options[] = { { "help", no_argument, 0, Args::HELP },
{ "device", required_argument, 0, Args::DEVICE },
{ "chip", required_argument, 0, Args::CHIP },
{ "input", required_argument, 0, Args::INPUT },
{ "input", required_argument, 0, Args::INPUTFILE },
{ "output", required_argument, 0, Args::OUTPUT },
{ "looptx", no_argument, 0, Args::LOOPTX },
{ "samplesCount", required_argument, 0, Args::SAMPLES_COUNT },
Expand Down Expand Up @@ -380,7 +381,7 @@ int main(int argc, char** argv)
case Args::LOOPTX:
loopTx = true;
break;
case Args::INPUT:
case Args::INPUTFILE:
if (optarg != NULL)
{
tx = true;
Expand Down
2 changes: 1 addition & 1 deletion src/comms/PCIe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(COMMS_LITE_PCIE_SOURCES
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LITE_PCIE "Enable Lite PCIe" ON "ENABLE_LIBRARY" OFF)
cmake_dependent_option(ENABLE_LITE_PCIE "Enable Lite PCIe" ON "UNIX;ENABLE_LIBRARY" OFF)
add_feature_info(ConnectionLitePCIe ENABLE_LITE_PCIE "Lite PCIe Connection support")
if (NOT ENABLE_LITE_PCIE)
return()
Expand Down
16 changes: 10 additions & 6 deletions src/comms/PCIe/LitePCIe.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#include "LitePCIe.h"
#include <unistd.h>
#include <fcntl.h>

#include <iostream>
#include <poll.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <string.h>
#include <thread>

#include "Logger.h"

#ifdef __unix__
#include <unistd.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "software/kernel/litepcie.h"
#endif

using namespace std;
using namespace lime;
using namespace std::literals::string_literals;
Expand Down
33 changes: 1 addition & 32 deletions src/comms/USB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,17 @@ set(THIS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/comms/USB)
include(${THIS_SOURCE_DIR}/FT601/CMakeLists.txt)
include(${THIS_SOURCE_DIR}/FX3/CMakeLists.txt)

message(STATUS "USB_INCLUDE_DIRS: ${USB_INCLUDE_DIRS}")
message(STATUS "USB_LIBRARIES: ${USB_LIBRARIES}")

set(CONNECTION_FX3_SOURCES
${THIS_SOURCE_DIR}/FX3/FX3.cpp
${THIS_SOURCE_DIR}/FX3/USBTransferContext_FX3.cpp
)

set(CONNECTION_FT601_SOURCES
${THIS_SOURCE_DIR}/FT601/FT601.cpp
${THIS_SOURCE_DIR}/FT601/USBTransferContext_FT601.cpp
)

set(COMMS_USB_SOURCES
${THIS_SOURCE_DIR}/LMS64C_FPGA_Over_USB.cpp
${THIS_SOURCE_DIR}/LMS64C_LMS7002M_Over_USB.cpp
${THIS_SOURCE_DIR}/TRXLooper_USB.cpp
${THIS_SOURCE_DIR}/USBEntry.cpp
${THIS_SOURCE_DIR}/USBGeneric.cpp
${THIS_SOURCE_DIR}/USBTransferContext.cpp
${CONNECTION_FX3_SOURCES}
${CONNECTION_FT601_SOURCES}
)

set(CONNECTION_FX3_LIBRARIES
${USB_LIBRARIES}
)

########################################################################
## Feature registration
########################################################################
include(FeatureSummary)
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_FX3 "Enable FX3" ON "ENABLE_LIBRARY;USB_FOUND" OFF)
add_feature_info(ConnectionFX3 ENABLE_FX3 "FX3 Connection support")
if (NOT ENABLE_FX3)
return()
endif()

########################################################################
## Add to library
########################################################################
target_include_directories(${MAIN_LIBRARY_NAME} PUBLIC ${USB_INCLUDE_DIRS} ${THIS_SOURCE_DIR})
target_include_directories(${MAIN_LIBRARY_NAME} PUBLIC ${THIS_SOURCE_DIR})
target_sources(${MAIN_LIBRARY_NAME} PRIVATE ${COMMS_USB_SOURCES})
target_link_libraries(${MAIN_LIBRARY_NAME} PUBLIC ${CONNECTION_FX3_LIBRARIES})
Loading

0 comments on commit 4e62b9a

Please sign in to comment.