From 7ea33961b6ca133281074e3a1145f08dc4b70b31 Mon Sep 17 00:00:00 2001 From: William Yang Date: Sun, 18 Feb 2024 03:23:36 +1100 Subject: [PATCH] Update build instructions and workflows --- .../workflows/{macos.yml => x86-macos.yml} | 16 +++++++++--- .github/workflows/x86-ubuntu.yml | 26 +++++++++++-------- .github/workflows/x86-windows.yml | 17 +++++++----- README.md | 7 ++--- toolchains/macos/README.md | 20 ++++++++++++++ toolchains/ubuntu/README.md | 11 ++++---- toolchains/ubuntu/cmake_configure.sh | 11 -------- toolchains/ubuntu/create_package.sh | 8 ------ toolchains/ubuntu/linux-gnu-toolchain.cmake | 2 -- toolchains/windows/README.md | 2 +- toolchains/windows/cmake_configure.sh | 11 -------- toolchains/windows/create_package.sh | 8 ------ 12 files changed, 66 insertions(+), 73 deletions(-) rename .github/workflows/{macos.yml => x86-macos.yml} (72%) create mode 100644 toolchains/macos/README.md delete mode 100755 toolchains/ubuntu/cmake_configure.sh delete mode 100755 toolchains/ubuntu/create_package.sh delete mode 100644 toolchains/ubuntu/linux-gnu-toolchain.cmake delete mode 100755 toolchains/windows/cmake_configure.sh delete mode 100755 toolchains/windows/create_package.sh diff --git a/.github/workflows/macos.yml b/.github/workflows/x86-macos.yml similarity index 72% rename from .github/workflows/macos.yml rename to .github/workflows/x86-macos.yml index 1860fe5..a4fc232 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/x86-macos.yml @@ -1,4 +1,4 @@ -name: macos +name: x86-macos on: workflow_dispatch: @@ -7,6 +7,8 @@ on: env: BUILD_TYPE: Release + BUILD_DIR: build + PACKAGE_DIR: build-out OSX_TARGET: "12.0" jobs: @@ -52,13 +54,19 @@ jobs: sudo cmake --build build --config ${{env.BUILD_TYPE}} --target install - name: Configure CMake - run: cmake . -B ${{github.workspace}}/build-macos -DCMAKE_OSX_DEPLOYMENT_TARGET=${{env.OSX_TARGET}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja + run: cmake . -B ${{github.workspace}}/${{env.BUILD_DIR}} -DCMAKE_OSX_DEPLOYMENT_TARGET=${{env.OSX_TARGET}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja - name: Build - run: cmake --build ${{github.workspace}}/build-macos --config ${{env.BUILD_TYPE}} --target dab_plugin + run: cmake --build ${{github.workspace}}/${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} --target dab_plugin + + - name: Create package + run: | + mkdir -p ${{env.PACKAGE_DIR}} + cp ${{env.BUILD_DIR}}/src/*.dylib ${{env.PACKAGE_DIR}}/ + cp README.md ${{env.PACKAGE_DIR}}/ - name: Upload files (Release) uses: actions/upload-artifact@v3 with: name: sdrpp_dab_radio_plugin_macos - path: ${{github.workspace}}/build-macos/src + path: ${{github.workspace}}/${{env.PACKAGE_DIR}} diff --git a/.github/workflows/x86-ubuntu.yml b/.github/workflows/x86-ubuntu.yml index d034f60..3729700 100644 --- a/.github/workflows/x86-ubuntu.yml +++ b/.github/workflows/x86-ubuntu.yml @@ -7,6 +7,8 @@ on: env: BUILD_TYPE: Release + BUILD_DIR: build + PACKAGE_DIR: build-out jobs: skip_check: @@ -21,7 +23,7 @@ jobs: concurrent_skipping: 'same_content' cancel_others: 'true' skip_after_successful_duplicate: 'true' - paths_ignore: '["**/README.md", "**/docs/**", "**/LICENSE.txt", "vcpkg.json", "toolchains/windows/*"]' + paths_ignore: '["**/README.md", "**/docs/**", "**/LICENSE.txt", "vcpkg.json", "toolchains/windows/*", "toolchains/macos/*"]' do_not_skip: '["workflow_dispatch", "schedule"]' build: @@ -34,25 +36,27 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive - + - name: Install packages - shell: bash - run: ./toolchains/ubuntu/install_packages.sh - + run: | + sudo apt-get install + ./toolchains/ubuntu/install_packages.sh + - name: Configure CMake - shell: bash - run: cmake -B ${{github.workspace}}/build-ubuntu -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/toolchains/ubuntu/linux-gnu-toolchain.cmake + run: cmake . -B ${{github.workspace}}/${{env.BUILD_DIR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja - name: Build - run: ninja -C ${{github.workspace}}/build-ubuntu dab_plugin + run: cmake --build ${{github.workspace}}/${{env.BUILD_DIR}} --target dab_plugin - name: Create package - shell: sh - run: ./toolchains/ubuntu/create_package.sh + run: | + mkdir -p ${{env.PACKAGE_DIR}} + cp ${{env.BUILD_DIR}}/src/*.so ${{env.PACKAGE_DIR}}/ + cp README.md ${{env.PACKAGE_DIR}}/ - name: Upload files (Release) uses: actions/upload-artifact@v3 with: name: sdrpp_dab_radio_plugin_ubuntu - path: ${{github.workspace}}/plugin_package + path: ${{github.workspace}}/${{env.PACKAGE_DIR}} diff --git a/.github/workflows/x86-windows.yml b/.github/workflows/x86-windows.yml index a483467..9bf192c 100644 --- a/.github/workflows/x86-windows.yml +++ b/.github/workflows/x86-windows.yml @@ -7,6 +7,8 @@ on: env: BUILD_TYPE: Release + BUILD_DIR: build + PACKAGE_DIR: build-out jobs: skip_check: @@ -21,7 +23,7 @@ jobs: concurrent_skipping: 'same_content' cancel_others: 'true' skip_after_successful_duplicate: 'true' - paths_ignore: '["**/README.md", "**/docs/**", "**/LICENSE.txt", "toolchains/ubuntu/*"]' + paths_ignore: '["**/README.md", "**/docs/**", "**/LICENSE.txt", "toolchains/ubuntu/*", "toolchains/macos/*"]' do_not_skip: '["workflow_dispatch", "schedule"]' build: @@ -49,17 +51,20 @@ jobs: run: python -m pip install mako - name: Configure CMake - run: cmake -B ${{github.workspace}}/build-windows -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE:STRING=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -G "Ninja" + run: cmake -B ${{github.workspace}}/${{env.BUILD_DIR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE:STRING=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake -G Ninja - name: Build - run: cmake --build ${{github.workspace}}/build-windows --config ${{env.BUILD_TYPE}} --target dab_plugin + run: cmake --build ${{github.workspace}}/${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} --target dab_plugin - name: Create package - shell: sh - run: ./toolchains/windows/create_package.sh + shell: bash + run: | + mkdir -p ${{env.PACKAGE_DIR}} + cp ${{env.BUILD_DIR}}/src/*.dll ${{env.PACKAGE_DIR}}/ + cp README.md ${{env.PACKAGE_DIR}}/ - name: Upload files (Release) uses: actions/upload-artifact@v3 with: name: sdrpp_dab_radio_plugin_windows - path: ${{github.workspace}}/plugin_package + path: ${{github.workspace}}/${{env.PACKAGE_DIR}} diff --git a/README.md b/README.md index 631744c..f4497cc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Introduction [![x86-windows](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-windows.yml/badge.svg)](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-windows.yml) [![x86-ubuntu](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-ubuntu.yml/badge.svg)](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-ubuntu.yml) -[![macos](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/macos.yml/badge.svg)](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/macos.yml) +[![x86-macos](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-macos.yml/badge.svg)](https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin/actions/workflows/x86-macos.yml) SDR++ DAB radio plugin. @@ -35,11 +35,8 @@ Download from releases page or build using the instructions below. Make sure you 7. If no sound is present, check the ```Sinks``` tab and make sure that ```DAB Radio``` is set to ```Audio``` and to the correct audio device. 8. You may also copy ```fftw3f.dll``` into the main SDR++ folder since it is compiled with AVX2 which may improve performance. Be sure to backup the original file before replacing it. -### Ubuntu -Build using the instructions at ```./toolchains/ubuntu/README.md```. - ## Build instructions -Refer to ```./toolchains/*/README.md``` for build instructions. +Refer to ```toolchains/*/README.md``` for build instructions. The github workflows in ```.github/workflows``` can also be used as a reference for a working build setup. ## TODO - Improve the user interface so that you can view as much information as the original GUI found [here](https://github.com/williamyang98/DAB-Radio). diff --git a/toolchains/macos/README.md b/toolchains/macos/README.md new file mode 100644 index 0000000..bc19627 --- /dev/null +++ b/toolchains/macos/README.md @@ -0,0 +1,20 @@ +# Instructions +Clone the repository recursively so all the submodules are installed. +```git clone https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin.git --recurse-submodules``` + +## Steps +1. Update brew: ```brew update``` +2. Install packages: ```brew bundle install --file=./toolchains/macos/Brewfile``` +3. Install mako: ```pip3 install mako``` +4. Install volk: + - Change to volk: ```cd vendor/volk``` + - Configure cmake: ```cmake . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja``` + - Build and install: ```sudo cmake --build build --config Release --target install``` +5. Configure cmake: ```cmake . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja``` +6. Build: ```cmake --build build --config Release --target dab_plugin``` + +## Install files +Copy ```build/src/dab_plugin.dylib``` into your SDR++ modules directory. + +Make sure that the version of SDR++ in ```vendor/sdrplusplus``` is the same as your SDR++ installation. + diff --git a/toolchains/ubuntu/README.md b/toolchains/ubuntu/README.md index 2862d28..3c872ed 100644 --- a/toolchains/ubuntu/README.md +++ b/toolchains/ubuntu/README.md @@ -1,15 +1,14 @@ # Instructions Clone the repository recursively so all the submodules are installed. -```git clone https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin``` +```git clone https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin.git --recurse-submodules``` ## Steps -1. ```./toolchains/ubuntu/install_packages.sh```. -2. ```./toolchains/ubuntu/cmake_configure.sh```. -3. ```ninja -C build-ubuntu dab_plugin```. -4. ```./toolchains/ubuntu/create_package.sh```. +1. Install packages: ```./toolchains/ubuntu/install_packages.sh```. +2. Configure cmake: ```cmake . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja```. +3. Build: ```cmake --build build --config Release```. ## Install files -Copy the contents of ```plugin_package/``` into ```/usr/lib/sdrpp/plugins/```. +Copy ```build/src/dab_plugin.so``` into ```/usr/lib/sdrpp/plugins/```. Make sure that the version of SDR++ in ```vendor/sdrplusplus``` is the same as your SDR++ installation. diff --git a/toolchains/ubuntu/cmake_configure.sh b/toolchains/ubuntu/cmake_configure.sh deleted file mode 100755 index aefc12e..0000000 --- a/toolchains/ubuntu/cmake_configure.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -TOOLCHAIN_FILE="./toolchains/ubuntu/linux-gnu-toolchain.cmake" -BUILD_DIR="build-ubuntu" -BUILD_TYPE=Release - -cmake\ - -B $BUILD_DIR\ - -G Ninja\ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE\ - -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE\ - -DCMAKE_TOOLCHAIN_FILE:STRING=$TOOLCHAIN_FILE diff --git a/toolchains/ubuntu/create_package.sh b/toolchains/ubuntu/create_package.sh deleted file mode 100755 index ad9b6b7..0000000 --- a/toolchains/ubuntu/create_package.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -build_dir="build-ubuntu/src" -output_dir="plugin_package" -rm -rf ${output_dir} -mkdir -p ${output_dir} - -cp ${build_dir}/*.so ${output_dir}/ -cp README.md ${output_dir}/ diff --git a/toolchains/ubuntu/linux-gnu-toolchain.cmake b/toolchains/ubuntu/linux-gnu-toolchain.cmake deleted file mode 100644 index 204284d..0000000 --- a/toolchains/ubuntu/linux-gnu-toolchain.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(CMAKE_C_COMPILER "/usr/bin/gcc") -set(CMAKE_CXX_COMPILER "/usr/bin/g++") diff --git a/toolchains/windows/README.md b/toolchains/windows/README.md index 8936604..01f5446 100644 --- a/toolchains/windows/README.md +++ b/toolchains/windows/README.md @@ -1,7 +1,7 @@ # Instructions Clone the repository recursively so all the submodules are installed. -```git clone https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin --recurse-submodules``` +```git clone https://github.com/williamyang98/SDRPlusPlus-DAB-Radio-Plugin.git --recurse-submodules``` ## Prerequistes ### Volk diff --git a/toolchains/windows/cmake_configure.sh b/toolchains/windows/cmake_configure.sh deleted file mode 100755 index 4a1f7cb..0000000 --- a/toolchains/windows/cmake_configure.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -TOOLCHAIN_FILE="C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake" -BUILD_DIR="build-windows" -BUILD_TYPE=Release - -cmake\ - -B $BUILD_DIR\ - -G Ninja\ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE\ - -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE\ - -DCMAKE_TOOLCHAIN_FILE:STRING=$TOOLCHAIN_FILE diff --git a/toolchains/windows/create_package.sh b/toolchains/windows/create_package.sh deleted file mode 100755 index 7d69d19..0000000 --- a/toolchains/windows/create_package.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -build_dir="build-windows/src" -output_dir="plugin_package" -rm -rf ${output_dir} -mkdir -p ${output_dir} - -cp ${build_dir}/*.dll ${output_dir}/ -cp README.md ${output_dir}/