* Fix quoting issue causing bad library include path, add install step hackrf-tools.

* Add artifact publish step for Windows libraries and host tools.
* Replace runner.workspace with github.workspace.
* Update checkout task to v4 to supress warning.
* Update CMAKE for libhackrf and hackrf-tools to also install DLLs on WIN32 platforms.
* Update uploadartifact task to v4 since v3 uses an end-of-life node version 16.
* Add a new windows variable for the vcpkg cmake toolchain makefile.
This commit is contained in:
Demetri Maltsiniotis
2023-07-14 09:27:56 -05:00
parent 8486cb2a0c
commit 3d83a2f911
5 changed files with 58 additions and 26 deletions

View File

@ -15,6 +15,7 @@ env:
WIN_FFTW_LIB: -DFFTW_LIBRARIES=C:/vcpkg/installed/x64-windows/lib/fftw3f.lib WIN_FFTW_LIB: -DFFTW_LIBRARIES=C:/vcpkg/installed/x64-windows/lib/fftw3f.lib
WIN_PTHREAD_INC: -DTHREADS_PTHREADS_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include WIN_PTHREAD_INC: -DTHREADS_PTHREADS_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include
WIN_PTHREAD_LIB: -DTHREADS_PTHREADS_WIN32_LIBRARY=C:/vcpkg/installed/x64-windows/lib/pthreadvc3.lib WIN_PTHREAD_LIB: -DTHREADS_PTHREADS_WIN32_LIBRARY=C:/vcpkg/installed/x64-windows/lib/pthreadvc3.lib
WIN_CMAKE_TOOLCHAIN: -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
jobs: jobs:
host: host:
@ -27,7 +28,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Install dependencies (macOS) - name: Install dependencies (macOS)
run: brew install fftw run: brew install fftw
@ -43,74 +44,91 @@ jobs:
run: vcpkg install --triplet=x64-windows libusb fftw3 pthreads run: vcpkg install --triplet=x64-windows libusb fftw3 pthreads
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
# Build libhackrf and hackrf-tools together
- name: Create Build Environment - name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/host/build run: cmake -E make_directory ${{github.workspace}}/host/build
- name: Configure CMake - name: Configure CMake
working-directory: ${{runner.workspace}}/host/build working-directory: ${{github.workspace}}/host/build
run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release
if: matrix.os != 'windows-latest' if: matrix.os != 'windows-latest'
- name: Configure CMake (Windows) - name: Configure CMake (Windows)
working-directory: ${{runner.workspace}}/host/build working-directory: ${{github.workspace}}/host/build
run: cmake $env:GITHUB_WORKSPACE/host/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_FFTW_INC $env:WIN_FFTW_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB run: cmake $env:GITHUB_WORKSPACE/host/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_FFTW_INC $env:WIN_FFTW_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB $env:WIN_CMAKE_TOOLCHAIN
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
- name: Build - name: Build
working-directory: ${{runner.workspace}}/host/build working-directory: ${{github.workspace}}/host/build
run: cmake --build . --config Release run: cmake --build . --config Release
# Build libhackrf ONLY
- name: Create Build Environment (libhackrf) - name: Create Build Environment (libhackrf)
run: cmake -E make_directory ${{runner.workspace}}/host/libhackrf/build run: cmake -E make_directory ${{github.workspace}}/host/libhackrf/build
- name: Configure CMake (libhackrf) - name: Configure CMake (libhackrf)
working-directory: ${{runner.workspace}}/host/libhackrf/build working-directory: ${{github.workspace}}/host/libhackrf/build
run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release
if: matrix.os != 'windows-latest' if: matrix.os != 'windows-latest'
- name: Configure CMake (libhackrf, Windows) - name: Configure CMake (libhackrf, Windows)
working-directory: ${{runner.workspace}}/host/libhackrf/build working-directory: ${{github.workspace}}/host/libhackrf/build
run: cmake $env:GITHUB_WORKSPACE/host/libhackrf/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB run: cmake $env:GITHUB_WORKSPACE/host/libhackrf/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB $env:WIN_CMAKE_TOOLCHAIN
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
- name: Build (libhackrf) - name: Build (libhackrf)
working-directory: ${{runner.workspace}}/host/libhackrf/build working-directory: ${{github.workspace}}/host/libhackrf/build
run: cmake --build . --config Release run: cmake --build . --config Release
- name: Install (libhackrf) - name: Install (libhackrf)
working-directory: ${{runner.workspace}}/host/libhackrf/build working-directory: ${{github.workspace}}/host/libhackrf/build
run: | run: |
sudo cmake --install . --config Release sudo cmake --install . --config Release
if: matrix.os != 'windows-latest' if: matrix.os != 'windows-latest'
- name: Install (libhackrf, Windows) - name: Install (libhackrf, Windows)
working-directory: ${{runner.workspace}}/host/libhackrf/build working-directory: ${{github.workspace}}/host/libhackrf/build
run: | run: |
cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
# Build hackrf-tools ONLY
- name: Create Build Environment (hackrf-tools) - name: Create Build Environment (hackrf-tools)
run: cmake -E make_directory ${{runner.workspace}}/host/hackrf-tools/build run: cmake -E make_directory ${{github.workspace}}/host/hackrf-tools/build
- name: Configure CMake (hackrf-tools) - name: Configure CMake (hackrf-tools)
working-directory: ${{runner.workspace}}/host/hackrf-tools/build working-directory: ${{github.workspace}}/host/hackrf-tools/build
run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release
if: matrix.os != 'windows-latest' if: matrix.os != 'windows-latest'
- name: Configure CMake (hackrf-tools, Windows) - name: Configure CMake (hackrf-tools, Windows)
working-directory: ${{runner.workspace}}/host/hackrf-tools/build working-directory: ${{github.workspace}}/host/hackrf-tools/build
run: | run: |
cmake $env:GITHUB_WORKSPACE/host/hackrf-tools/ $env:WIN_FFTW_INC $env:WIN_FFTW_LIB -DLIBHACKRF_INCLUDE_DIR=$env:GITHUB_WORKSPACE/install/include/libhackrf -DLIBHACKRF_LIBRARIES=$env:GITHUB_WORKSPACE/install/bin/hackrf.lib cmake $env:GITHUB_WORKSPACE/host/hackrf-tools/ $env:WIN_FFTW_INC $env:WIN_FFTW_LIB -DLIBHACKRF_INCLUDE_DIR="$env:GITHUB_WORKSPACE/install/include/libhackrf" -DLIBHACKRF_LIBRARIES="$env:GITHUB_WORKSPACE/install/bin/hackrf.lib" $env:WIN_CMAKE_TOOLCHAIN
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
- name: Build (hackrf-tools) - name: Build (hackrf-tools)
working-directory: ${{runner.workspace}}/host/hackrf-tools/build working-directory: ${{github.workspace}}/host/hackrf-tools/build
run: cmake --build . --config Release run: cmake --build . --config Release
# This step should work on Windows too, but currently MSVC fails to find
# hackrf.h, despite us having installed it and specified its location in - name: Install (hackrf-tools)
# the previous steps above. working-directory: ${{github.workspace}}/host/hackrf-tools/build
run: sudo cmake --install . --config Release
if: matrix.os != 'windows-latest' if: matrix.os != 'windows-latest'
- name: Install (hackrf-tools, Windows)
working-directory: ${{github.workspace}}/host/hackrf-tools/build
run: cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install
if: matrix.os == 'windows-latest'
# Publish the contents of install/bin (which should be the combination libhackrf and host-tools) for Windows
- name: Publish Artifacts (Windows)
uses: actions/upload-artifact@v4
with:
name: hackrf-tools-windows
path: ${{github.workspace}}/install/bin
if: matrix.os == 'windows-latest'
firmware: firmware:
strategy: strategy:
matrix: matrix:
@ -122,7 +140,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
@ -144,15 +162,15 @@ jobs:
run: make run: make
- name: Create Build Environment - name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/firmware/build run: cmake -E make_directory ${{github.workspace}}/firmware/build
- name: Configure CMake - name: Configure CMake
shell: bash shell: bash
working-directory: ${{runner.workspace}}/firmware/build working-directory: ${{github.workspace}}/firmware/build
run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }}
- name: Build - name: Build
working-directory: ${{runner.workspace}}/firmware/build working-directory: ${{github.workspace}}/firmware/build
shell: bash shell: bash
run: cmake --build . --config Release run: cmake --build . --config Release

View File

@ -16,7 +16,7 @@ jobs:
- check: 'firmware/hackrf_usb' - check: 'firmware/hackrf_usb'
exclude: '' exclude: ''
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Run clang-format-action - name: Run clang-format-action
uses: jidicula/clang-format-action@v4.6.2 uses: jidicula/clang-format-action@v4.6.2
with: with:

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
*.srec *.srec
host/build/ host/build/
host/**/build host/**/build
install/
# Operating system spew # Operating system spew
.DS_Store .DS_Store

View File

@ -65,3 +65,10 @@ foreach(tool ${TOOLS})
target_link_libraries(${tool} ${TOOLS_LINK_LIBS}) target_link_libraries(${tool} ${TOOLS_LINK_LIBS})
install(TARGETS ${tool} RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR}) install(TARGETS ${tool} RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR})
endforeach(tool) endforeach(tool)
if( ${WIN32} )
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/"
DESTINATION ${INSTALL_DEFAULT_BINDIR}
FILES_MATCHING
PATTERN "fftw*.dll")
endif( ${WIN32} )

View File

@ -70,6 +70,12 @@ if( ${WIN32} )
DESTINATION bin DESTINATION bin
COMPONENT sharedlibs COMPONENT sharedlibs
) )
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/"
DESTINATION bin
FILES_MATCHING
PATTERN "libusb*.dll"
PATTERN "pthread*.dll"
)
install(TARGETS hackrf-static install(TARGETS hackrf-static
DESTINATION bin DESTINATION bin
COMPONENT staticlibs COMPONENT staticlibs