Skip to content

Commit

Permalink
Add build check Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Apr 20, 2024
1 parent ee6ab38 commit d1aaae6
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 8 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build check
on:
push:
pull_request:
workflow_dispatch:

jobs:
macos_macports_build_job:
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} (macports)
steps:
- uses: actions/checkout@v4
- uses: melusina-org/setup-macports@v1
- name: Install ports
run: sudo port install SoapySDR limesuite libiio libad9361-iio
- name: Configure
run: cmake -B build
- name: Build
run: cmake --build build

macos_tfcollins_build_job:
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} (tfcollins)
steps:
- uses: actions/checkout@v4
- name: Setup tools
run: |
brew tap tfcollins/homebrew-formulae
brew update
brew install soapysdr limesuite libiio libad9361-iio
- name: Configure
run: cmake -B build
- name: Build
run: cmake --build build

macos_pothos_build_job:
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} (pothos)
steps:
- uses: actions/checkout@v4
- name: Setup tools
# Note: "distutils" package is removed in python version 3.12
# pothosware libiio homebrew formula will fail without "setuptools"
run: |
brew tap pothosware/homebrew-pothos
brew update
pip3 install --break-system-packages setuptools
brew install soapysdr limesuite libiio libad9361
- name: Configure
run: cmake -B build
- name: Build
run: cmake --build build

linux_build_job:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup tools
run: |
sudo apt-get update -q -y
sudo apt-get install -y --no-install-recommends cmake ninja-build
sudo apt-get install -q -y libsoapysdr-dev liblimesuite-dev libiio-dev libad9361-dev
- name: Configure
run: cmake -GNinja -B build
- name: Build
run: cmake --build build
34 changes: 28 additions & 6 deletions cmake/FindLibAD9361.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# - Try to find libad9361-iio
# Once done this will define
#
# LibAD9361_FOUND - system has libiio
# LibAD9361_INCLUDE_DIRS - the libiio include directory
# LibAD9361_LIBRARIES - Link these to use libiio
# LibAD9361_DEFINITIONS - Compiler switches required for using libiio
# LibAD9361_FOUND - system has libad9361
# LibAD9361_INCLUDE_DIRS - the libad9361 include directory
# LibAD9361_LIBRARIES - Link these to use libad9361
# LibAD9361_DEFINITIONS - Compiler switches required for using libad9361
# LibAD9361_VERSION - the libad9361 version
#
# Redistribution and use is allowed according to the terms of the New BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
Expand All @@ -14,17 +15,38 @@ find_package(PkgConfig)
pkg_check_modules(PC_LibAD9361 QUIET libad9361)
set(LibAD9361_DEFINITIONS ${PC_LibAD9361_CFLAGS_OTHER})

# $ENV{HOMEBREW_PREFIX} can be /opt/homebrew (arm64) or defaults to /usr/local
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})
if(NOT HOMEBREW_PREFIX)
set(HOMEBREW_PREFIX "/usr/local")
endif()

# Note: a 0.2 version might be named 0.3 and a 0.1 might be missing the version
find_path(LibAD9361_INCLUDE_DIR ad9361.h
HINTS ${PC_LibAD9361_INCLUDEDIR} ${PC_LibAD9361_INCLUDE_DIRS}
PATHS
/opt/local/Library/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361-iio/${PC_LibIIO_VERSION}/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361-iio/0.3/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361/${PC_LibIIO_VERSION}
${HOMEBREW_PREFIX}/Cellar/libad9361/0.1
PATH_SUFFIXES libad9361-iio)

find_library(LibAD9361_LIBRARY NAMES ad9361 libad9361
HINTS ${PC_LibAD9361_LIBDIR} ${PC_LibAD9361_LIBRARY_DIRS})
HINTS ${PC_LibAD9361_LIBDIR} ${PC_LibAD9361_LIBRARY_DIRS}
PATHS
/opt/local/Library/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361-iio/${PC_LibIIO_VERSION}/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361-iio/0.3/Frameworks
${HOMEBREW_PREFIX}/Cellar/libad9361/${PC_LibIIO_VERSION}
${HOMEBREW_PREFIX}/Cellar/libad9361/0.1)

set(LibAD9361_VERSION ${PC_LibAD9361_VERSION})

include(FindPackageHandleStandardArgs)
# Note that `FOUND_VAR LibIIO_FOUND` is needed for cmake 3.2 and older.
find_package_handle_standard_args(LibAD9361
FOUND_VAR LibAD9361_FOUND
REQUIRED_VARS LibAD9361_LIBRARY LibAD9361_INCLUDE_DIR
VERSION_VAR LibAD9361_VERSION)

Expand All @@ -33,4 +55,4 @@ mark_as_advanced(LibAD9361_INCLUDE_DIR LibAD9361_LIBRARY)
if (LibAD9361_FOUND)
set(LibAD9361_LIBRARIES ${LibAD9361_LIBRARY})
set(LibAD9361_INCLUDE_DIRS ${LibAD9361_INCLUDE_DIR})
endif()
endif()
21 changes: 19 additions & 2 deletions cmake/FindLibIIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# LibIIO_INCLUDE_DIRS - the libiio include directory
# LibIIO_LIBRARIES - Link these to use libiio
# LibIIO_DEFINITIONS - Compiler switches required for using libiio
# LibIIO_VERSION - the libiio version
#
# Redistribution and use is allowed according to the terms of the New BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
Expand All @@ -14,21 +15,37 @@ find_package(PkgConfig)
pkg_check_modules(PC_LibIIO QUIET libiio)
set(LibIIO_DEFINITIONS ${PC_LibIIO_CFLAGS_OTHER})

# $ENV{HOMEBREW_PREFIX} can be /opt/homebrew (arm64) or defaults to /usr/local
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})
if(NOT HOMEBREW_PREFIX)
set(HOMEBREW_PREFIX "/usr/local")
endif()

find_path(LibIIO_INCLUDE_DIR iio.h
HINTS ${PC_LibIIO_INCLUDEDIR} ${PC_LibIIO_INCLUDE_DIRS}
PATHS
/opt/local/Library/Frameworks
${HOMEBREW_PREFIX}/Cellar/libiio/${PC_LibIIO_VERSION}/Frameworks
${HOMEBREW_PREFIX}/Cellar/libiio/${PC_LibIIO_VERSION}
PATH_SUFFIXES libiio)

find_library(LibIIO_LIBRARY NAMES iio libiio
HINTS ${PC_LibIIO_LIBDIR} ${PC_LibIIO_LIBRARY_DIRS})
HINTS ${PC_LibIIO_LIBDIR} ${PC_LibIIO_LIBRARY_DIRS}
PATHS
/opt/local/Library/Frameworks
${HOMEBREW_PREFIX}/Cellar/libiio/${PC_LibIIO_VERSION}/Frameworks
${HOMEBREW_PREFIX}/Cellar/libiio/${PC_LibIIO_VERSION})

set(LibIIO_VERSION ${PC_LibIIO_VERSION})

include(FindPackageHandleStandardArgs)
# Note that `FOUND_VAR LibIIO_FOUND` is needed for cmake 3.2 and older.
find_package_handle_standard_args(LibIIO
FOUND_VAR LibIIO_FOUND
REQUIRED_VARS LibIIO_LIBRARY LibIIO_INCLUDE_DIR
VERSION_VAR LibIIO_VERSION)

mark_as_advanced(LibIIO_INCLUDE_DIR LibIIO_LIBRARY)

set(LibIIO_LIBRARIES ${LibIIO_LIBRARY})
set(LibIIO_INCLUDE_DIRS ${LibIIO_INCLUDE_DIR})
set(LibIIO_INCLUDE_DIRS ${LibIIO_INCLUDE_DIR})

0 comments on commit d1aaae6

Please sign in to comment.