From 9c0a3e02448599a0a0124adc8ef943b0923a3d0e Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Tue, 13 Dec 2022 02:27:55 +0000 Subject: [PATCH 1/3] CI: remove BUILD_TYPE environment variable. We were only setting this to Release, so there is no current need for an environment variable. Removing it allows us to reuse some steps for Windows, where the syntax to insert an environment variable is different. --- .github/workflows/build.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b91fd2f..ef858dbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,9 +8,6 @@ on: schedule: - cron: 1 12 * * 1 -env: - BUILD_TYPE: Release - jobs: host: strategy: @@ -40,12 +37,12 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/host/build - run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/host/build shell: bash - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config Release - name: Create Build Environment (libhackrf) run: cmake -E make_directory ${{runner.workspace}}/host/libhackrf/build @@ -53,18 +50,18 @@ jobs: - name: Configure CMake (libhackrf) shell: bash working-directory: ${{runner.workspace}}/host/libhackrf/build - run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release - name: Build (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build shell: bash - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config Release - name: Install (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build shell: bash run: | - sudo cmake --install . --config $BUILD_TYPE + sudo cmake --install . --config Release - name: Create Build Environment (hackrf-tools) run: cmake -E make_directory ${{runner.workspace}}/host/hackrf-tools/build @@ -72,12 +69,12 @@ jobs: - name: Configure CMake (hackrf-tools) shell: bash working-directory: ${{runner.workspace}}/host/hackrf-tools/build - run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release - name: Build (hackrf-tools) working-directory: ${{runner.workspace}}/host/hackrf-tools/build shell: bash - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config Release firmware: strategy: @@ -117,10 +114,10 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/firmware/build - run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBOARD=${{ matrix.board }} + run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} - name: Build working-directory: ${{runner.workspace}}/firmware/build shell: bash - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config Release From d912c8c32653a08e21f444b9193c50dbd67aa362 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Tue, 13 Dec 2022 02:16:06 +0000 Subject: [PATCH 2/3] CI: don't specify bash as shell for commands. On Linux and macOS runners, bash is already the default. For Windows, specifying bash prevents the same step being used. --- .github/workflows/build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef858dbd..63ab4de3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,31 +35,26 @@ jobs: run: cmake -E make_directory ${{runner.workspace}}/host/build - name: Configure CMake - shell: bash working-directory: ${{runner.workspace}}/host/build run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release - name: Build working-directory: ${{runner.workspace}}/host/build - shell: bash run: cmake --build . --config Release - name: Create Build Environment (libhackrf) run: cmake -E make_directory ${{runner.workspace}}/host/libhackrf/build - name: Configure CMake (libhackrf) - shell: bash working-directory: ${{runner.workspace}}/host/libhackrf/build run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release - name: Build (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build - shell: bash run: cmake --build . --config Release - name: Install (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build - shell: bash run: | sudo cmake --install . --config Release @@ -67,13 +62,11 @@ jobs: run: cmake -E make_directory ${{runner.workspace}}/host/hackrf-tools/build - name: Configure CMake (hackrf-tools) - shell: bash working-directory: ${{runner.workspace}}/host/hackrf-tools/build run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release - name: Build (hackrf-tools) working-directory: ${{runner.workspace}}/host/hackrf-tools/build - shell: bash run: cmake --build . --config Release firmware: From 9fce4ebf04ef30f3c64fe7bf9d33c62c57ba37ab Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Tue, 13 Dec 2022 02:18:46 +0000 Subject: [PATCH 3/3] CI: add steps to build libhackrf and host-tools on Windows. --- .github/workflows/build.yml | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63ab4de3..66d1ce46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,11 +8,19 @@ on: schedule: - cron: 1 12 * * 1 +env: + WIN_LIBUSB_INC: -DLIBUSB_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include/libusb-1.0 + WIN_LIBUSB_LIB: -DLIBUSB_LIBRARIES=C:/vcpkg/installed/x64-windows/lib/libusb-1.0.lib + WIN_FFTW_INC: -DFFTW_INCLUDES=C:/vcpkg/installed/x64-windows/include + 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_LIB: -DTHREADS_PTHREADS_WIN32_LIBRARY=C:/vcpkg/installed/x64-windows/lib/pthreadvc3.lib + jobs: host: strategy: matrix: - os: ['macos-latest', 'ubuntu-latest'] + os: ['macos-latest', 'ubuntu-latest', 'windows-latest'] # Don't cancel all builds when one fails fail-fast: false @@ -31,12 +39,22 @@ jobs: sudo apt install libfftw3-dev libusb-1.0-0-dev if: matrix.os == 'ubuntu-latest' + - name: Install dependencies (Windows) + run: vcpkg install --triplet=x64-windows libusb fftw3 pthreads + if: matrix.os == 'windows-latest' + - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/host/build - name: Configure CMake working-directory: ${{runner.workspace}}/host/build run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release + if: matrix.os != 'windows-latest' + + - name: Configure CMake (Windows) + working-directory: ${{runner.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 + if: matrix.os == 'windows-latest' - name: Build working-directory: ${{runner.workspace}}/host/build @@ -48,6 +66,12 @@ jobs: - name: Configure CMake (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release + if: matrix.os != 'windows-latest' + + - name: Configure CMake (libhackrf, Windows) + working-directory: ${{runner.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 + if: matrix.os == 'windows-latest' - name: Build (libhackrf) working-directory: ${{runner.workspace}}/host/libhackrf/build @@ -57,6 +81,13 @@ jobs: working-directory: ${{runner.workspace}}/host/libhackrf/build run: | sudo cmake --install . --config Release + if: matrix.os != 'windows-latest' + + - name: Install (libhackrf, Windows) + working-directory: ${{runner.workspace}}/host/libhackrf/build + run: | + cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install + if: matrix.os == 'windows-latest' - name: Create Build Environment (hackrf-tools) run: cmake -E make_directory ${{runner.workspace}}/host/hackrf-tools/build @@ -64,10 +95,21 @@ jobs: - name: Configure CMake (hackrf-tools) working-directory: ${{runner.workspace}}/host/hackrf-tools/build run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release + if: matrix.os != 'windows-latest' + + - name: Configure CMake (hackrf-tools, Windows) + working-directory: ${{runner.workspace}}/host/hackrf-tools/build + 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 + if: matrix.os == 'windows-latest' - name: Build (hackrf-tools) working-directory: ${{runner.workspace}}/host/hackrf-tools/build 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 + # the previous steps above. + if: matrix.os != 'windows-latest' firmware: strategy: