Skip to content

Commit

Permalink
Merge pull request #401 from Matom-ai/litepcie-update-windows
Browse files Browse the repository at this point in the history
Windows Build w/ USB device support
  • Loading branch information
rjonaitis authored Feb 19, 2024
2 parents 21b1a50 + da698d3 commit 0ececf9
Show file tree
Hide file tree
Showing 55 changed files with 873 additions and 319 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ name: clang-format

on:
push:
branches: [ master, litepcie-update ]
branches: [master, litepcie-update]
pull_request:

jobs:
build:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq clang-format colordiff
- name: Run clang-format
run: |
before="${{ github.event.pull_request.base.sha }}"
if [ "$before" == "" ]; then
before="${{ github.event.before }}"
fi
diff=$(git-clang-format --diff --commit "$before")
[ "$diff" = "no modified files to format" ] && exit 0
[ "$diff" = "clang-format did not modify any files" ] && exit 0
printf "\033[1mYou have introduced coding style breakages, suggested changes:\n\n"
echo "$diff" | colordiff
exit 1
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq clang-format colordiff
- name: Run clang-format
run: |
before="${{ github.event.pull_request.base.sha }}"
if [ "$before" == "" ]; then
before="${{ github.event.before }}"
fi
diff=$(git-clang-format --diff --commit "$before")
[ "$diff" = "no modified files to format" ] && exit 0
[ "$diff" = "clang-format did not modify any files" ] && exit 0
printf "\033[1mYou have introduced coding style breakages, suggested changes:\n\n"
echo "$diff" | colordiff
exit 1
95 changes: 48 additions & 47 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CMake

on:
push:
branches: [ master, litepcie-update ]
branches: [master, litepcie-update]
pull_request:

env:
Expand All @@ -11,56 +11,57 @@ env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
SOAPY_SDR_BRANCH: master
INSTALL_PREFIX: ${{github.workspace}}/deps

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, macos-latest, windows-latest]
matrix:
os:
[ubuntu-latest, windows-latest]
# os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq libusb-1.0-0-dev libwxbase3.0-dev libwxgtk3.0-gtk3-dev liboctave-dev
- name: Install osx dependencies
if: matrix.os == 'macos-latest'
run: brew install libusb wxmac
- name: Download windows dependencies
if: matrix.os == 'windows-latest'
run: |
mkdir ${{github.workspace}}/deps
curl -o ${{github.workspace}}/deps/FX3SDK.zip -L https://downloads.myriadrf.org/project/limesuite/appveyor/FX3SDK.zip
7z x ${{github.workspace}}/deps/FX3SDK.zip -o${{github.workspace}}/deps/FX3SDK
curl -o ${{github.workspace}}/deps/wxWidgets-headers.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxWidgets-3.1.5-headers.7z
7z x ${{github.workspace}}/deps/wxWidgets-headers.7z -o${{github.workspace}}/deps/wxWidgets
curl -o ${{github.workspace}}/deps/wxWidgets.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxMSW-3.1.5_vc14x_x64_Dev.7z
7z x ${{github.workspace}}/deps/wxWidgets.7z -o${{github.workspace}}/deps/wxWidgets
- name: install SoapySDR from source
run: |
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR
git checkout ${{env.SOAPY_SDR_BRANCH}}
mkdir build && cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_APPS=OFF -DENABLE_TESTS=OFF -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF
cmake --build .
cmake --build . --target install
- name: Configure CMake (windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DwxWidgets_ROOT_DIR=${{github.workspace}}/deps/wxWidgets -DFX3_SDK_PATH=${{github.workspace}}/deps/FX3SDK
- name: Configure CMake (linux)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}}
- uses: actions/checkout@v2

- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq libusb-1.0-0-dev libwxbase3.0-dev libwxgtk3.0-gtk3-dev liboctave-dev
- name: Install osx dependencies
if: matrix.os == 'macos-latest'
run: brew install libusb wxmac

- name: Download windows dependencies
if: matrix.os == 'windows-latest'
run: |
mkdir ${{github.workspace}}/deps
curl -o ${{github.workspace}}/deps/FX3SDK.zip -L https://downloads.myriadrf.org/project/limesuite/appveyor/FX3SDK.zip
7z x ${{github.workspace}}/deps/FX3SDK.zip -o${{github.workspace}}/deps/FX3SDK
curl -o ${{github.workspace}}/deps/wxWidgets-headers.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.4/wxWidgets-3.2.4-headers.7z
7z x ${{github.workspace}}/deps/wxWidgets-headers.7z -o${{github.workspace}}/deps/wxWidgets
curl -o ${{github.workspace}}/deps/wxWidgets.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.4/wxMSW-3.2.4_vc14x_x64_Dev.7z
7z x ${{github.workspace}}/deps/wxWidgets.7z -o${{github.workspace}}/deps/wxWidgets
- name: install SoapySDR from source
run: |
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR
git checkout ${{env.SOAPY_SDR_BRANCH}}
mkdir build && cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_APPS=OFF -DENABLE_TESTS=OFF -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF
cmake --build .
cmake --build . --target install
- name: Configure CMake (windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DwxWidgets_ROOT_DIR=${{github.workspace}}/deps/wxWidgets -DFX3_SDK_PATH=${{github.workspace}}/deps/FX3SDK

- name: Configure CMake (linux)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
82 changes: 43 additions & 39 deletions .github/workflows/gtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: GTest tests

on:
push:
branches: [ master, litepcie-update ]
branches: [master, litepcie-update]
pull_request:

env:
Expand All @@ -16,43 +16,47 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, macos-latest, windows-latest]
matrix:
os:
[ubuntu-latest, windows-latest]
# os: [ubuntu-latest, macos-latest, ]

steps:
- uses: actions/checkout@v2

- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq libusb-1.0-0-dev
- name: Install osx dependencies
if: matrix.os == 'macos-latest'
run: brew install libusb wxmac

- name: Download windows dependencies
if: matrix.os == 'windows-latest'
run: |
mkdir ${{github.workspace}}/deps
curl -o ${{github.workspace}}/deps/FX3SDK.zip -L https://downloads.myriadrf.org/project/limesuite/appveyor/FX3SDK.zip
7z x ${{github.workspace}}/deps/FX3SDK.zip -o${{github.workspace}}/deps/FX3SDK
curl -o ${{github.workspace}}/deps/wxWidgets-headers.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxWidgets-3.1.5-headers.7z
7z x ${{github.workspace}}/deps/wxWidgets-headers.7z -o${{github.workspace}}/deps/wxWidgets
curl -o ${{github.workspace}}/deps/wxWidgets.7z -L https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxMSW-3.1.5_vc14x_x64_Dev.7z
7z x ${{github.workspace}}/deps/wxWidgets.7z -o${{github.workspace}}/deps/wxWidgets
- name: Configure CMake (windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DwxWidgets_ROOT_DIR=${{github.workspace}}/deps/wxWidgets -DFX3_SDK_PATH=${{github.workspace}}/deps/FX3SDK

- name: Configure CMake (linux)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DBUILD_SHARED_LIBS=OFF -DBINARY_OUTPUT_DIR=${{github.workspace}}/build/bin/

- name: Build and run tests
run: |
cmake --build ${{github.workspace}}/build --config LimeSuite2Test
${{github.workspace}}/build/bin/LimeSuite2Test
- uses: actions/checkout@v2

- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq libusb-1.0-0-dev
- name: Install osx dependencies
if: matrix.os == 'macos-latest'
run: brew install libusb wxmac

- name: Download windows dependencies
if: matrix.os == 'windows-latest'
run: |
mkdir ${{github.workspace}}/deps
curl -o ${{github.workspace}}/deps/FX3SDK.zip -L https://downloads.myriadrf.org/project/limesuite/appveyor/FX3SDK.zip
7z x ${{github.workspace}}/deps/FX3SDK.zip -o${{github.workspace}}/deps/FX3SDK
- name: Configure CMake (windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DwxWidgets_ROOT_DIR=${{github.workspace}}/deps/wxWidgets -DFX3_SDK_PATH=${{github.workspace}}/deps/FX3SDK -DBUILD_SHARED_LIBS=OFF

- name: Configure CMake (linux)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_EVB7COM=ON -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} -DBUILD_SHARED_LIBS=OFF -DBINARY_OUTPUT_DIR=${{github.workspace}}/build/bin/

- name: Build tests
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target LimeSuite2Test

- name: Run tests (Linux)
if: matrix.os != 'windows-latest'
run: ${{github.workspace}}/build/bin/LimeSuite2Test

- name: Run tests (Windows)
if: matrix.os == 'windows-latest'
run: ${{github.workspace}}/build/bin/${{env.BUILD_TYPE}}/LimeSuite2Test.exe

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ docs/LMS_API_Documentation/*
/debian/limesuite-images20.10.*
!/debian/limesuite-images20.10.*.in
/debian/debhelper-build-stamp
/.vs
/out/
/CMakeSettings.json
/deps/
7 changes: 5 additions & 2 deletions 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 -DNOGDI -DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
set( MSVC_MULTITHREAD_COMPILE_FLAGS "/MP")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSVC_MULTITHREAD_COMPILE_FLAGS}" )

Expand Down Expand Up @@ -182,8 +182,11 @@ if(ENABLE_TESTING)
set(INSTALL_GMOCK OFF) # Don't install the GMock headers
set(INSTALL_GTEST OFF) # Don't install the GTest headers

FetchContent_MakeAvailable(googletest)
if (MSVC)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()

FetchContent_MakeAvailable(googletest)
enable_testing()
endif()

Expand Down
18 changes: 5 additions & 13 deletions cmake/Modules/FindCyAPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,11 @@ if(MSVC)
mark_as_advanced(CYAPI_HEADER_FILE)
get_filename_component(CYAPI_INCLUDE_DIRS "${CYAPI_HEADER_FILE}" PATH)

if(MSVC)
if(CMAKE_CL_64)
set(CYAPI_ARCH x64)
else(CMAKE_CL_64)
set(CYAPI_ARCH x86)
endif(CMAKE_CL_64)
elseif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CYAPI_ARCH x64)
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CYAPI_ARCH x86)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
if(CMAKE_CL_64)
set(CYAPI_ARCH x64)
else(CMAKE_CL_64)
set(CYAPI_ARCH x86)
endif(CMAKE_CL_64)

find_library(CYAPI_LIBRARY
NAMES
Expand Down
1 change: 0 additions & 1 deletion external/msvc/getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if (ENABLE_LIBRARY)
target_compile_definitions(${MAIN_LIBRARY_NAME} PUBLIC "LIME_DLL")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ENABLE_CODE_COVERAGE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ENABLE_CODE_COVERAGE AND (NOT MSVC))
include(CodeCoverage)
append_coverage_compiler_flags_to_target(${MAIN_LIBRARY_NAME})
endif()
Expand Down
5 changes: 4 additions & 1 deletion src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifdef _MSC_VER
#define thread_local __declspec(thread)
#include <Windows.h>
#undef ERROR
#endif

#ifdef __APPLE__
Expand All @@ -34,8 +35,10 @@ static const char* errToStr(const int errnum)
NULL);
return buff;
#else
#ifndef __unix__
strerror_s(buff, sizeof(buff), errnum);
#elif !(defined(__GLIBC__) && defined(__GNU_SOURCE))
//http://linux.die.net/man/3/strerror_r
#if !(defined(__GLIBC__) && defined(__GNU_SOURCE))
auto result = strerror_r(errnum, buff, sizeof(buff));
(void)result;
#else
Expand Down
2 changes: 2 additions & 0 deletions src/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <stdexcept>
#include <cstdint>

#undef ERROR

namespace lime {

enum class LogLevel : uint8_t {
Expand Down
9 changes: 5 additions & 4 deletions src/StreamComposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ template<class T> int StreamComposite::StreamTx(const T* const* samples, uint32_
}

// force instantiate functions with these types
template int StreamComposite::StreamRx<lime::complex16_t>(lime::complex16_t** samples, uint32_t count, SDRDevice::StreamMeta* meta);
template int StreamComposite::StreamRx<lime::complex32f_t>(
template LIME_API int StreamComposite::StreamRx<lime::complex16_t>(
lime::complex16_t** samples, uint32_t count, SDRDevice::StreamMeta* meta);
template LIME_API int StreamComposite::StreamRx<lime::complex32f_t>(
lime::complex32f_t** samples, uint32_t count, SDRDevice::StreamMeta* meta);
template int StreamComposite::StreamTx<lime::complex16_t>(
template LIME_API int StreamComposite::StreamTx<lime::complex16_t>(
const lime::complex16_t* const* samples, uint32_t count, const SDRDevice::StreamMeta* meta);
template int StreamComposite::StreamTx<lime::complex32f_t>(
template LIME_API int StreamComposite::StreamTx<lime::complex32f_t>(
const lime::complex32f_t* const* samples, uint32_t count, const SDRDevice::StreamMeta* meta);

} // namespace lime
2 changes: 2 additions & 0 deletions src/SystemResources.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <shlobj.h>
#include <io.h>

#undef ERROR

//access mode constants
#define F_OK 0
#define R_OK 2
Expand Down
Loading

0 comments on commit 0ececf9

Please sign in to comment.