Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
pcercuei committed Aug 7, 2023
2 parents 6711950 + d62bc62 commit 569916d
Show file tree
Hide file tree
Showing 93 changed files with 4,799 additions and 1,460 deletions.
9 changes: 9 additions & 0 deletions .codespell-ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SOM
som
mitre
mis
tread
elease
tREAD
tRead
tRead
3 changes: 0 additions & 3 deletions .codespell-whitelist

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# GitHub Action to automate the identification of common misspellings in text files.
# https://github.com/codespell-project/actions-codespell
# https://github.com/codespell-project/codespell
name: codespell
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

permissions:
contents: read # to fetch code (actions/checkout)
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@v1 # v1.0
with:
check_filenames: true
skip: .git,deps
ignore_words_file: .codespell-ignore.txt
11 changes: 5 additions & 6 deletions CI/azure/zip.txt → CI/azure/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@

In this archive, you should find the following directories:
o ./include : Common include files
o ./MinGW32 : 32-bit binaries compiled by the MinGW toolchain
o ./MinGW64 : 64-bit binaries compiled by the MinGW toolchain
o ./MS32 : 32-bit binaries compiled by the MicroSoft toolchain
o ./MS64 : 364bit binaries compiled by the MicroSoft toolchain
o ./Windows-MinGW-W64 : 64-bit binaries compiled by the MinGW toolchain
o ./Windows-VS-2019-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2019
o ./Windows-VS-2022-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2022

o Visual Studio:
- Open existing or create a new project for your application
- Copy iio.h, from the include\ directory, into your project and make sure that
the location where the file reside appears in the 'Additional Include
Directories' section (Configuration Properties -> C/C++ -> General).
- Copy the relevant .lib file from MS32\ or MS64\ and add 'libiio.lib' to
- Copy the relevant .lib file from Windows-VS-2019-x64\ or Windows-VS-2022-x64\ and add 'libiio.lib' to
your 'Additional Dependencies' (Configuration Properties -> Linker -> Input)
Also make sure that the directory where libiio.lib resides is added to
'Additional Library Directories' (Configuration Properties -> Linker
Expand All @@ -44,7 +43,7 @@ o WDK/DDK:
SOURCES=your_app.c

o MinGW/cygwin
- Copy libiio.h, from include/ to your default include directory,
- Copy iio.h, from include/ to your default include directory,
and copy the MinGW32/ or MinGW64/ .a files to your default library directory.
Or, if you don't want to use the default locations, make sure that you feed
the relevant -I and -L options to the compiler.
Expand Down
34 changes: 34 additions & 0 deletions CI/azure/check_README_BUILD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

# Check the project CMake for options, which are not described in the README_BUILD.md file
# At the same time, check to make sure the defaults are described properly.

error=0

options() {
for file in $(find ./ -not \( -path ./deps -prune \) -name CMakeLists.txt)
do
grep option[[:space:]]*\( "${file}" | \
sed -e "s/^[[:space:]]*//g" -e "s/(/ /g" | \
awk '{print $2}'
done | sort | uniq
}

for opt in $(options)
do
default=$(for file in $(find ./ -not \( -path ./deps -prune \) -name CMakeLists.txt)
do
grep "option[[:space:]]*(${opt} " "${file}" | \
sed -e "s/^[[:space:]]*//g" -e "s/)[[:space:]]*$//" | \
awk '{print $NF}'
done)
if ! grep -q "${opt}.*${default}" README_BUILD.md ; then
echo "no match with ${opt} set with ${default}"
grep -R "${opt}" ./*
error=1
fi
done

if [ "${error}" -eq "1" ] ; then
exit 1
fi
3 changes: 2 additions & 1 deletion CI/azure/ci-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -x
uname -a
echo "$PWD"
mkdir build && cd build
cmake .. -DWITH_HWMON=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}"
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}"
make
make package
make required2tar
2 changes: 1 addition & 1 deletion CI/azure/generateDocumentationAndDeploy.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -x
#
# Preconditions:
# - Packages doxygen graphviz must be installed.
# - An gh-pages branch should already exist. See below for mor info on how to
# - An gh-pages branch should already exist. See below for more info on how to
# create a gh-pages branch.
#
# This script will generate Doxygen documentation and push the documentation to
Expand Down
51 changes: 51 additions & 0 deletions CI/azure/macos_tar_fixup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -xe

# Extract tar.gz to temp folder
tarname=$(find . -maxdepth 1 -name '*.tar.gz')
if [ -z "${tarname}" ]; then
echo "tar.gz not found"
exit 1
fi
# Remove .tar.gz from filename
subfoldername=$(echo "${tarname}" | rev | cut -b 8- | rev)

mkdir -p temp_tar
tar -xzf "${tarname}" -C temp_tar
mv "temp_tar/${subfoldername}" temp
cd temp

deps_dir=Library/Frameworks/iio.framework/Versions/Current/Dependencies
libiio_loc=Library/Frameworks/iio.framework/Versions/Current/iio
libiioheader_loc=Library/Frameworks/iio.framework/Versions/Current/Headers/iio.h

mkdir -p "${deps_dir}"

# Create links to framework files
mkdir -p usr/local/{lib,include}
ln -fs "../../../${libiio_loc}" usr/local/lib/libiio.dylib
ln -fs "../../../${libiioheader_loc}" usr/local/include/iio.h

# Update rpath of library
install_name_tool -add_rpath @loader_path/. "${libiio_loc}"

# Copy dependent libs to local libs, and update rpath of dependencies
for each in $(otool -L "${libiio_loc}" |grep homebrew |cut -f2 | cut -d' ' -f1) ; do
name=$(basename "${each}")
cp "${each}" "${deps_dir}"
chmod +w "${deps_dir}/${name}"
install_name_tool -id "@rpath/Dependencies/${name}" "${deps_dir}/${name}"
install_name_tool -change "${each}" "@rpath/Dependencies/${name}" "${libiio_loc}"
codesign --force -s - "${deps_dir}/${name}"
done

# Update tools
for tool in Library/Frameworks/iio.framework/Tools/*;
do
install_name_tool -add_rpath @loader_path/../.. "${tool}"
done

# Remove old tar and create new one
rm "../${tarname}"
tar -czf "../${tarname}" .
cd ..
rm -rf temp
35 changes: 26 additions & 9 deletions CI/azure/prepare_assets.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/bin/bash -e

release_artifacts() {
local deb_linux_assets='Fedora-34 Ubuntu-20.04 Ubuntu-22.04'
local deb_linux_assets='Fedora-34 Fedora-28 Ubuntu-18.04 Ubuntu-20.04 Ubuntu-22.04 Debian-11 openSUSE-15.4 CentOS-7'
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
for i in $deb_linux_assets; do
cd "Linux-${i}"
if [ "${i}" == "Fedora-34" ]; then
if [ "${i}" == "Fedora-34" ] || [ "${i}" == "Fedora-28" ] || [ "${i}" == "CentOS-7" ]; then
find . -name '*.rpm' -exec mv {} ../ ";"
fi
find . -name '*.deb' -exec mv {} ../ ";"
find . -name '*.tar.gz' -exec mv {} ../ ";"
cd ../
rm -r "Linux-${i}"
done

local pkg_assets='macOS-11 macOS-12'
local pkg_assets='macOS-11 macOS-12 macOS-13-x64 macOS-13-arm64'
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
for i in $pkg_assets; do
cd "${i}"
Expand All @@ -30,37 +31,49 @@ release_artifacts() {
rm -r "${i}"
done

local zip_assets='2019 2022'
local zip_assets='VS-2019-x64 VS-2022-x64 MinGW-W64'
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
mkdir Windows
cd Windows
mkdir include
cd ..
cp ./Windows-VS-2019-x64/iio.h ./Windows/include
for i in $zip_assets; do
zip -r "Windows-VS-${i}-x64".zip "Windows-VS-${i}-x64"
rm -r "Windows-VS-${i}-x64"
rm ./"Windows-${i}"/iio.h
mv ./"Windows-${i}" Windows
done
cp /home/vsts/work/1/s/CI/azure/README.txt ./Windows
cd Windows
zip -r Windows.zip ./*
cp ./Windows.zip ../
cd ..
rm -r Windows

local deb_arm_assets='arm32v7 arm64v8 ppc64le x390x'
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
for i in $deb_arm_assets; do
cd "Ubuntu-${i}"
find . -name '*.deb' -exec mv {} ../ ";"
find . -name '*.tar.gz' -exec mv {} ../ ";"
cd ../
rm -r "Ubuntu-${i}"
done

}

swdownloads_artifacts() {
local linux_dist='Fedora-34 Ubuntu-20.04 Ubuntu-22.04'
local linux_dist='Fedora-34 Fedora-28 Ubuntu-18.04 Ubuntu-20.04 Ubuntu-22.04 Debian-11 openSUSE-15.4 CentOS-7'
for distribution in $linux_dist; do
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/Linux-${distribution}"
if [ "${distribution}" == "Fedora-34" ]; then
if [ "${distribution}" == "Fedora-34" ] || [ "${distribution}" == "Fedora-28" ] || [ "${distribution}" == "CentOS-7" ]; then
find . -name '*.rpm' -exec mv {} ../"${distribution}_latest_master_libiio.rpm" ";"
fi
find . -name '*.tar.gz' -exec mv {} ../"${distribution}_latest_master_libiio.tar.gz" ";"
find . -name '*.deb' -exec mv {} ../"${distribution}_latest_master_libiio.deb" ";"
rm -r ../Linux-"${distribution}"
done

local macOS_dist='macOS-11 macOS-12'
local macOS_dist='macOS-11 macOS-12 macOS-13-x64 macOS-13-arm64'
for distribution in $macOS_dist; do
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/${distribution}"
find . -name '*.pkg' -exec mv {} ../"${distribution}_latest_master_libiio.pkg" ";"
Expand All @@ -86,6 +99,10 @@ swdownloads_artifacts() {
cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/Libiio-Setup-Exe"
mv libiio-setup.exe ../libiio-setup.exe
rm -r ../Libiio-Setup-Exe

cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
zip -r Windows-MinGW-W64-latest_master_libiio.zip Windows-MinGW-W64
rm -r Windows-MinGW-W64
}

check_artifacts() {
Expand Down
3 changes: 2 additions & 1 deletion CI/build_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ $ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$COMPILER=$Env:COMPILER
$USE_CSHARP=$Env:USE_CSHARP
$src_dir=$pwd

echo "Running cmake for $COMPILER on 64 bit..."
mkdir build-x64
cp .\libiio.iss.cmakein .\build-x64
cd build-x64

cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" -DLIBZSTD_INCLUDE_DIR="C:\\include" -DLIBZSTD_LIBRARIES="C:\\libs\\64\\libzstd.dll.a" ..
cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=$USE_CSHARP -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" -DLIBZSTD_INCLUDE_DIR="C:\\include" -DLIBZSTD_LIBRARIES="C:\\libs\\64\\libzstd.dll.a" ..
cmake --build . --config Release
if ( $LASTEXITCODE -ne 0 ) {
throw "[*] cmake build failure"
Expand Down
38 changes: 25 additions & 13 deletions CI/publish_deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,34 @@ $ErrorView = "NormalView"
$src_dir=$pwd
$COMPILER=$Env:COMPILER

if ($COMPILER -eq "Visual Studio 16 2019") {
cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
}else {
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
}

cd $src_dir
mkdir dependencies
cd dependencies
wget http://swdownloads.analog.com/cse/build/libiio-deps-20220517.zip -OutFile "libiio-win-deps.zip"
7z x -y "libiio-win-deps.zip"

cp .\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
if ($COMPILER -eq "MinGW Makefiles") {
cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.2.8\mingw\bin\libgcc_s_seh-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.4.5\mingw\bin\libiconv-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.4.5\mingw\bin\zlib1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.4.5\mingw\bin\liblzma-5.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.4.5\mingw\bin\libwinpthread-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.4.5\mingw\bin\libxml2-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp C:\ghcup\ghc\9.2.8\mingw\bin\libstdc++-6.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
} else {
cp $src_dir\dependencies\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY

if ($COMPILER -eq "Visual Studio 16 2019") {
cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
} else {
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
}
}
Loading

0 comments on commit 569916d

Please sign in to comment.