diff --git a/.github/scripts/install_deps.sh b/.github/scripts/install_deps.sh index 2a629953..43d36407 100755 --- a/.github/scripts/install_deps.sh +++ b/.github/scripts/install_deps.sh @@ -1,15 +1,22 @@ #!/bin/sh -e +LIBIIO_VERSION=libiio-v0 PACKAGE_DIR=${1-build} echo $PACKAGE_DIR -apt-get -qq update -apt-get install -y git wget tar graphviz libavahi-common-dev libavahi-client-dev libaio-dev libusb-1.0-0-dev libxml2-dev rpm tar bzip2 gzip flex bison git swig python3 python3-dev python3-setuptools python3-pip python3-all libserialport-dev +yum -y update +echo "## Installing dependencies" + +yum install -y bzip2 gzip rpm rpm-build git wget tar \ + libxml2-devel libusbx-devel libusb-devel doxygen libaio-devel avahi-devel avahi-tools graphviz swig flex bison \ + python3 python3-devel python3-setuptools python3-pip python3 -m pip install cmake cmake --version -git clone -b 'master' --single-branch --depth 1 https://github.com/analogdevicesinc/libiio.git +#Install libiio +echo "## Building libiio $LIBIIO_VERSION" +git clone -b $LIBIIO_VERSION --single-branch --depth 1 https://github.com/analogdevicesinc/libiio.git libiio cd libiio mkdir -p build cd build @@ -19,6 +26,7 @@ make install cd ../.. #Install glog +echo "## Building glog" git clone --branch v0.4.0 --depth 1 https://github.com/google/glog mkdir -p glog/build_0_4_0 cd glog/build_0_4_0 @@ -39,3 +47,9 @@ make cat setup.py make install +# Repair wheel step fails if it does not find the .so file +echo "## Content from src folder" +ls ./src +echo "creating links to .so" +cp ./src/libm2k.so* /usr/lib/ && ldconfig -n -v /usr/lib + diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 90d73536..cf9a53e2 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -2,18 +2,21 @@ name: Build on: [push, pull_request] +# TODO: add a simple test that tries to import the libm2k package after creating wheel; +# NOTE: do i have a acces to a pip install during the cybuildwheel process? jobs: build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04] - python_version: ['3.10'] + os: [ubuntu-22.04] + # os: [CentOS_7] # manylinux2014: (CentOS 7 based) + python_version: ['3.11'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 name: Install Python ${{ matrix.python_version }} with: python-version: ${{ matrix.python_version }} @@ -22,23 +25,25 @@ jobs: run: | mkdir ${{ github.workspace }}/build touch ${{ github.workspace }}/build/setup.py + # TODO: Test using more recent Docker image - name: Get some sample wheels run: | python -m pip install cibuildwheel twine cibuildwheel --output-dir ${{ github.workspace }}/wheelhouse ${{ github.workspace }}/build env: - CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24 - CIBW_MANYLINUX_I686_IMAGE: manylinux_2_24 - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_24 + CIBW_DEBUG_KEEP_CONTAINER=: TRUE + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 # Skip building PyPy wheels on all platforms # Skip musllinux builds - CIBW_SKIP: "pp* *-musllinux*" - CIBW_BUILD_VERBOSITY: 1 + # Skip i686 builds: 32bit arch not supported in manylinux_2_28 + CIBW_SKIP: "pp* *-musllinux* *i686" + CIBW_BUILD_VERBOSITY: 3 CIBW_BEFORE_ALL: > cd {project} && ./.github/scripts/install_deps.sh {package} - CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-*" + CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*" CIBW_ENVIRONMENT: COMPILE_BINDINGS="True" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: manylinux_wheels path: ${{ github.workspace }}/wheelhouse @@ -51,9 +56,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Install Python 3.10 + name: Install Python 3.11 with: - python-version: '3.10' + python-version: '3.11' - uses: actions/download-artifact@v2 with: name: manylinux_wheels diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 45e84949..00000000 --- a/.travis.yml +++ /dev/null @@ -1,97 +0,0 @@ -language: cpp -sudo: required - -cache: - directories: - - ${TRAVIS_BUILD_DIR}/deps - -services: - - docker - -env: - global: - secure: "PUXsXOrIGEZMK78hPI2do7FRLr1qB/jS/cXPOgVEHT/iJYU9hzu5BkJHjRLKZ7uM6L+17FM3OVJFsWk68Rcql7pT79G1nI6l0RyqsazMdgDDed2FlxxmvRmHuRT6ONqvBEDSItkIn16Y2ld+UukG36bLSVYyuc5NaMBV/cB8kyBgq41rf+jBvrGvsBV5aN73ZWqMwCqNsRLhwGRqhJlGcPsAc0j957O3fzEeTRF9SMVczpMt8fGFD/2R2gyyX50zX2YTRAT9d7kyl/IFi9GtIYQs/afIQ1hYDzWK+bYpHozoiSYHfs8YBYdtFItj2P3h2XsZgG9t4FlLInF7phCTftRTTB+G6eT0N8mOPi+uCXR1m9lU7TF5rKhL7Yg+KTQiHFfDxHzPrzmKht06b7lCuMfY7nBgmJXEZOtDFuhPdxubu3TD4DRtn36NyW1PPMOBI/guii1ywrlWl0HeKciaRlPHbP0RB+s0eBWWzVpiJVveO1sO0MgtZ4/+v+REtqNAsD26iLGgvrahMMdw/dWTt3Niez93xrUSYVA9mnk/Dlc42y02+Okwu+Jw0GPnBCMq7snfYwZMFM2EN4waCaxbgPSNOvuLIfmLTWnpjMcVh2FtfP39jlBPymO9FYZyqlfZBc6mzFOEB9pVN1rMKPqk9cYFvcvY1sP10owVwFSWpIo=" - -matrix: - include: - - os: linux - dist: focal - python: 3.6 - env: - - PYTHON=python PIP=pip - - os: linux - dist: bionic - python: 3.6 - env: - - PYTHON=python PIP=pip - - os: linux - dist: xenial - python: 3.6 - env: - - PYTHON=python PIP=pip - - os: linux - dist: bionic - env: - - OS_TYPE=doxygen - addons: { apt: { packages: ["cmake", "graphviz"] } } - - compiler: "gcc" - os: osx - osx_image: xcode10.1 - env: - - EXTRA_SSH=-oHostKeyAlgorithms=+ssh-dss - - compiler: "gcc" - os: osx - osx_image: xcode11 - env: - - EXTRA_SSH=-oHostKeyAlgorithms=+ssh-dss - - compiler: "gcc" - os: osx - osx_image: xcode12 - env: - - EXTRA_SSH=-oHostKeyAlgorithms=+ssh-dss - -before_install: - - - export DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - - mkdir -p ${DEPS_DIR} - - # Configure git user for Travis to push documentation - - git config --global user.name "Travis Bot" - - git config --global user.email "<>" - - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./CI/travis/before_install_darwin ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./CI/travis/before_install_linux "$OS_TYPE" "$OS_VERSION" ; fi - - - mkdir -p $TRAVIS_BUILD_DIR/build - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p $TRAVIS_BUILD_DIR/build_tar ; fi - -script: - - if [[ -z "$ARCH" && "$TRAVIS_OS_NAME" == "linux" ]]; then ${TRAVIS_BUILD_DIR}/CI/travis/make_linux libm2k "$OS_TYPE" "$OS_VERSION" ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ${TRAVIS_BUILD_DIR}/CI/travis/make_darwin; fi -before_deploy: - - ". ${TRAVIS_BUILD_DIR}/CI/travis/before_deploy" - -deploy: - - provider: releases - api_key: - secure: SwUgor/ddmI5JMdgjyaQGSp0fxCxHsHAFgq223rSByrn5yCSXarv8O43iQPWSN+1yRlykP/AIsmnVoXroMeOTW8natz4p0DvMO+HF1yrCZCL9kc3zqQOgnNTEAW3KZPFh57+m2F6qsPI57rLyT084oMSNQS3CG2dbYxmnwvZfk+wYU0afvNGFjXqsrBk5/nAcrQzCEKMgQ6ppS6FX1Er7WRsQh29JjClUp3vfbDjAKud/0m5OOIc08BfCWAETwBIX+mYkbX6Dm900c0HcbcCqrZm78Z+9SbnsHKB3f7vKhNa44EbsJ5r7oLvaXhxQsc6eYvF7yVwDINrbfSkUEfyexbVC1gZari5SozNDfuagUtuYwvvNkDNQOoIKSzkq78p4Zr9SJAMvdWnt4n7vIyl4WSod8sFvQkQAJtbt6YqR3IsWrNBwQ30krEA/jpZHoVAGH1kU31Yh4ql86S9lwgmHkdg5byWh6BOJgiBi6bwjHrATn/erPArEMBRtaqKJosPnhyd4mnStAL8fraMvejhwZEMziiDNzgClv7BC4gFJA07ncOIpgePNecdjvGxm4jmr9sK3s8Kumhn37afclqTf2TWCUbSZCkPztR0bB/QcEo0QaJn34+gx8YYziB5WQp9j+CH1D9mscYyA4vwgcpDZebIMg0NMguaCdEjqmP4pU8= - file: - - "${RELEASE_PKG_FILE_DEB}" - - "${RELEASE_PY_FILE_DEB}" - - "${RELEASE_PKG_FILE_TGZ}" - skip_cleanup: true - on: - repo: analogdevicesinc/libm2k - tags: true - condition: "($TRAVIS_OS_NAME = linux) && ($OS_TYPE != doxygen)" - - provider: releases - api_key: - secure: SwUgor/ddmI5JMdgjyaQGSp0fxCxHsHAFgq223rSByrn5yCSXarv8O43iQPWSN+1yRlykP/AIsmnVoXroMeOTW8natz4p0DvMO+HF1yrCZCL9kc3zqQOgnNTEAW3KZPFh57+m2F6qsPI57rLyT084oMSNQS3CG2dbYxmnwvZfk+wYU0afvNGFjXqsrBk5/nAcrQzCEKMgQ6ppS6FX1Er7WRsQh29JjClUp3vfbDjAKud/0m5OOIc08BfCWAETwBIX+mYkbX6Dm900c0HcbcCqrZm78Z+9SbnsHKB3f7vKhNa44EbsJ5r7oLvaXhxQsc6eYvF7yVwDINrbfSkUEfyexbVC1gZari5SozNDfuagUtuYwvvNkDNQOoIKSzkq78p4Zr9SJAMvdWnt4n7vIyl4WSod8sFvQkQAJtbt6YqR3IsWrNBwQ30krEA/jpZHoVAGH1kU31Yh4ql86S9lwgmHkdg5byWh6BOJgiBi6bwjHrATn/erPArEMBRtaqKJosPnhyd4mnStAL8fraMvejhwZEMziiDNzgClv7BC4gFJA07ncOIpgePNecdjvGxm4jmr9sK3s8Kumhn37afclqTf2TWCUbSZCkPztR0bB/QcEo0QaJn34+gx8YYziB5WQp9j+CH1D9mscYyA4vwgcpDZebIMg0NMguaCdEjqmP4pU8= - file: - - "${RELEASE_PKG_FILE_PKG}" - - "${RELEASE_PKG_FILE_TGZ}" - skip_cleanup: true - on: - repo: analogdevicesinc/libm2k - tags: true - condition: "$TRAVIS_OS_NAME = osx" diff --git a/CI/appveyor/build_appveyor_msvc.sh b/CI/appveyor/build_appveyor_msvc.sh deleted file mode 100644 index fcb5644b..00000000 --- a/CI/appveyor/build_appveyor_msvc.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -set -e -MCS_EXECUTABLE_PATH="C:\Windows\Microsoft.NET\Framework\v4.0.30319" -OLD_PATH="$PATH" -DEST_LIBIIO="/c/libiio" -TOP_DIR="/c/projects/libm2k" - -__build_python_wheel() { - local PLATFORM="$1" - local PY_PATH="$2" - export PATH="/c/swig/;/c/swig/Lib/;$OLD_PATH" - "$PY_PATH" -m pip install --user --upgrade pip setuptools wheel twine build virtualenv - export COMPILE_BINDINGS=True - "$PY_PATH" -m build - export COMPILE_BINDINGS= - cp dist/libm2k*.whl "${TOP_DIR}/build-$PLATFORM/dist/" -} - -__build_libm2k() { - local PLATFORM="$1" - local PY_VERSION="$2" - local PY_PATH="$3" - local GENERATOR="$4" - local ARCH="$5" - local PLAT_NAME="${6:-$PLATFORM}" - - # Create the official build directory for this platform - mkdir -p "${TOP_DIR}/build-$PLATFORM/dist" - - # Create and clear up the temporary build directory for this platform - rm -rf "${TOP_DIR}/tmp-build-$PLATFORM" - mkdir -p "${TOP_DIR}/tmp-build-$PLATFORM" - export PATH="$PY_PATH;$PY_PATH/libs;$OLD_PATH" - cd ${TOP_DIR}/tmp-build-"$PLATFORM" - cmake -G "$GENERATOR" \ - -A "$ARCH" \ - -DIIO_LIBRARIES:FILEPATH="$DEST_LIBIIO"-"$PLATFORM"/libiio.lib \ - -DIIO_INCLUDE_DIRS:PATH="$DEST_LIBIIO"-"$PLATFORM" \ - -DCMAKE_CONFIGURATION_TYPES=RELEASE \ - -DSWIG_DIR=/c/swig/Lib \ - -DSWIG_EXECUTABLE=/c/swig/swig.exe \ - -DSWIG_VERSION="4.0.0" \ - -DENABLE_TOOLS=ON \ - -DENABLE_LOG=ON \ - -DPython_EXECUTABLE="$PY_PATH/python.exe" \ - -DBUILD_EXAMPLES=ON \ - -DENABLE_CSHARP=ON \ - -DENABLE_LABVIEW=ON \ - .. - cmake --build . --config Release - - cat setup.py - - PY_SUFFIX="" - if [[ "$PLATFORM" == "win64" ]]; then - PY_SUFFIX="-x64" - fi - __build_python_wheel "$PLATFORM" "/c/Python37""$PY_SUFFIX""/python.exe" - __build_python_wheel "$PLATFORM" "/c/Python38""$PY_SUFFIX""/python.exe" - __build_python_wheel "$PLATFORM" "/c/Python39""$PY_SUFFIX""/python.exe" - __build_python_wheel "$PLATFORM" "/c/Python310""$PY_SUFFIX""/python.exe" -} - -__mv_to_build_dir() { - local PLATFORM="$1" - - DST_FOLDER="${TOP_DIR}/build-$PLATFORM/" - cd "${TOP_DIR}/tmp-build-$PLATFORM" - cp *.dll $DST_FOLDER - cp *.exe $DST_FOLDER - cp *.lib $DST_FOLDER - cp *.iss $DST_FOLDER - cd .. -} - -if [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2015" ]]; then - generator="Visual Studio 14 2015" -elif [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2017" ]]; then - generator="Visual Studio 15 2017" -elif [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2019" ]]; then - generator="Visual Studio 16 2019" -fi - -__build_libm2k win32 37 "/c/Python39" "$generator" Win32 -__mv_to_build_dir win32 - -__build_libm2k win64 37 "/c/Python39-x64" "$generator" x64 "win_amd64" -__mv_to_build_dir win64 diff --git a/CI/appveyor/install_deps_msvc.sh b/CI/appveyor/install_deps_msvc.sh deleted file mode 100644 index 86eaec11..00000000 --- a/CI/appveyor/install_deps_msvc.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -set -e -DEST_LIBIIO="/c/libiio" -SRC_LIBIIO="/c/projects/libiio" -DEPS_LIBIIO="/c/libs" -TOP_DIR=$(pwd) - - -__build_libiio() { - local PLATFORM="$1" - local VERSION="$2" - local CONFIGURATION="$3" - local GENERATOR="$4" - local ARCH="$5" - - # Create the build directory for this platform - mkdir -p "$SRC_LIBIIO/build-$PLATFORM" - cd "$SRC_LIBIIO/build-$PLATFORM" - - cmake -G "$GENERATOR" -A "$ARCH" -DCMAKE_CONFIGURATION_TYPES="$CONFIGURATION" -DWITH_TESTS=OFF -DENABLE_IPV6:BOOL=OFF -DCMAKE_SYSTEM_PREFIX_PATH="C:" -DCSHARP_BINDINGS:BOOL=OFF -DPYTHON_BINDINGS:BOOL=OFF -DLIBXML2_LIBRARIES="$DEPS_LIBIIO/$VERSION/libxml2.lib" -DLIBUSB_LIBRARIES="$DEPS_LIBIIO/$VERSION/libusb-1.0.lib" .. - cmake --build . --config "$CONFIGURATION" - - __mv_to_build_dir $PLATFORM $VERSION $CONFIGURATION -} - -__mv_to_build_dir() { - local PLATFORM="$1" - local VERSION="$2" - local CONFIGURATION="$3" - - DST_FOLDER="$DEST_LIBIIO-$PLATFORM/" - mkdir -p "$DST_FOLDER" - cd "$SRC_LIBIIO/build-$PLATFORM" - cp $CONFIGURATION/*.dll $DST_FOLDER - cp $CONFIGURATION/*.lib $DST_FOLDER - cp *.iss $DST_FOLDER - cp $DEPS_LIBIIO/$VERSION/*.dll $DST_FOLDER - cd .. - cp iio.h $DST_FOLDER -} - -git clone https://github.com/analogdevicesinc/libiio "$SRC_LIBIIO" -cd "$SRC_LIBIIO" -git checkout 0939f127ca5fa431df6d88758796c0cb1590174f -git submodule update --init - -if [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2015" ]]; then - generator="Visual Studio 14 2015" -elif [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2017" ]]; then - generator="Visual Studio 15 2017" -elif [[ "$APPVEYOR_BUILD_WORKER_IMAGE" == "Visual Studio 2019" ]]; then - generator="Visual Studio 16 2019" -fi - -__build_libiio win64 64 Release "$generator" x64 -__build_libiio win32 32 Release "$generator" Win32 - diff --git a/CI/appveyor/install_glog.bat b/CI/appveyor/install_glog.bat deleted file mode 100644 index de725638..00000000 --- a/CI/appveyor/install_glog.bat +++ /dev/null @@ -1,27 +0,0 @@ -set configuration=%~1 -set arch=%~2 - -if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( - set generator=Visual Studio 14 2015 -) else if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( - set generator=Visual Studio 15 2017 -) else if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( - set generator=Visual Studio 16 2019 -) - -echo "%generator%" -echo "%arch%" - -set folder_arch=%arch% - -if not exist "glog" ( git clone --branch v0.3.5 --depth 1 https://github.com/google/glog ) -pushd glog -git checkout tags/v0.3.5 -if not exist "build_0_4_0-%folder_arch%" ( mkdir build_0_4_0-%folder_arch% ) -pushd build_0_4_0-%folder_arch% - -cmake -DWITH_GFLAGS=off -DBUILD_SHARED_LIBS=on -G "%generator%" -A "%arch%" .. -cmake --build . --target install --config %configuration% - -popd -popd diff --git a/CI/macOS/install_deps b/CI/macOS/install_deps new file mode 100755 index 00000000..def74c07 --- /dev/null +++ b/CI/macOS/install_deps @@ -0,0 +1,44 @@ +#!/bin/sh -e + +TOP_DIR=$(pwd) +LIBIIO_VERSION=libiio-v0 + +set -ex + +# libiio deps +brew install doxygen libusb libxml2 ncurses cdk libserialport sphinx-doc pkg-config +# libm2k deps +brew install cmake doxygen libusb libxml2 swig curl + +pip3 install sphinx +pip3 install wheel twine build virtualenv + +# Install glog +echo "Building glog" +cd ${TOP_DIR} +git clone --branch v0.4.0 --depth 1 https://github.com/google/glog +mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 +cmake .. +make +sudo make install + +# Install libiio +echo "Building libiio - version $LIBIIO_VERSION" +cd ${TOP_DIR} +git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio +cd libiio +## build .pkg +mkdir build && cd build +cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_EXAMPLES=ON -DWITH_SERIAL_BACKEND=ON -DWITH_ZSTD=OFF +make +sudo make install +cd .. +## built tar +mkdir build_tar && cd build_tar +cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=ON -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} +make +make package +mv ../CI/azure/macos_tar_fixup.sh . +chmod +x macos_tar_fixup.sh +./macos_tar_fixup.sh +cd .. \ No newline at end of file diff --git a/CI/travis/make_darwin b/CI/macOS/make_macOS similarity index 98% rename from CI/travis/make_darwin rename to CI/macOS/make_macOS index 31a1865d..6e4f23a9 100755 --- a/CI/travis/make_darwin +++ b/CI/macOS/make_macOS @@ -2,6 +2,8 @@ TOP_DIR=$(pwd) +set -x + mkdir -p build mkdir -p build_tar export MACOSX_DEPLOYMENT_TARGET=10.15 diff --git a/CI/travis/after_deploy b/CI/travis/after_deploy deleted file mode 100755 index f0bd53d6..00000000 --- a/CI/travis/after_deploy +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e - -. CI/travis/lib.sh - -should_trigger_next_builds "$TRAVIS_BRANCH" || exit 0 - diff --git a/CI/travis/before_deploy b/CI/travis/before_deploy deleted file mode 100755 index b0973eb6..00000000 --- a/CI/travis/before_deploy +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -e - -. "$TRAVIS_BUILD_DIR"/CI/travis/lib.sh - -# Don't prepare a deploy on a Coverity build -if [ "x${COVERITY_SCAN_PROJECT_NAME}" != "x" ] ; then exit 0; fi - -deploy=0 -if [ -z "$TRAVIS_BUILD_DIR" ] ; then - t=$(find ./ -name CMakeCache.txt|head -1) - if [ -n "${t}" ] ; then - cd $(dirname $(dirname ${t})) - TRAVIS_BUILD_DIR=$(pwd) - else - echo "I am confused - can't find CMakeCache.txt" - exit - fi -else - cd $TRAVIS_BUILD_DIR -fi -pwd - -if [ -z "${LDIST}" -a -f "build/.LDIST" ] ; then - export LDIST="-$(cat build/.LDIST)" -fi -if [ -z "${LDIST}" ] ; then - export LDIST="-$(get_ldist)" -fi - -check_file() -{ -NAME=${2:-libm2k} -temp="" -for i in $(find ./ -name CMakeCache.txt) -do -hit=$(find $(dirname ${i}) -maxdepth 1 -name "${NAME}*.$1" -a ! -name "*${LDIST}*") -if [ "$(echo ${hit} | wc -w)" -gt "1" ] ; then - echo "I am confused - more than 2 $1 files!" - echo $hit - exit 1 -else - if [ "$(echo ${hit} | wc -w)" -eq "1" ] ; then - if [ -z "${temp}" ] ; then - temp=$hit - else - echo "I am confused - more than 2 $1 files" - echo $temp - echo $hit - exit 1 - fi - fi -fi -done -} - - -check_file deb python3 -if [ -n "${temp}" ] ; then - deploy=$(expr ${deploy} + 1) - if [ -z "${TARGET_DEB}" ] ; then - export TARGET_DEB=$(echo ${temp} | \ - sed -e 's:^./.*/::' -e 's:.deb$::')${LDIST}.deb - fi - echo "deploying ${temp} to nightly $TARGET_DEB" - if [ -z "${RELEASE_PY_FILE_DEB}" ] ; then - export RELEASE_PY_FILE_DEB=$(dirname ${temp})/${TARGET_DEB} - cp ${temp} ${RELEASE_PY_FILE_DEB} - fi - echo ${TARGET_DEB} - ls -lh ${temp} - echo ${RELEASE_PY_FILE_DEB} - ls -lh ${RELEASE_PY_FILE_DEB} -else - echo "Skipping deployment of debian package" -fi - -temp="" -TARGET_DEB="" -check_file deb -if [ -n "${temp}" ] ; then - deploy=$(expr ${deploy} + 1) - if [ -z "${TARGET_DEB}" ] ; then - export TARGET_DEB=$(echo ${temp} | \ - sed -e 's:^./.*/::' -e 's:-Linux::' -e 's:.deb$::')${LDIST}.deb - fi - echo "deploying ${temp} to nightly $TARGET_DEB" - if [ -z "${RELEASE_PKG_FILE_DEB}" ] ; then - export RELEASE_PKG_FILE_DEB=$(dirname ${temp})/${TARGET_DEB} - cp ${temp} ${RELEASE_PKG_FILE_DEB} - fi - echo ${TARGET_DEB} - ls -lh ${temp} - echo ${RELEASE_PKG_FILE_DEB} - ls -lh ${RELEASE_PKG_FILE_DEB} -else - echo "Skipping deployment of debian package" -fi - -check_file rpm -if [ -n "${temp}" ] ; then - deploy=$(expr ${deploy} + 1) - if [ -z "${TARGET_RPM}" ] ; then - export TARGET_RPM=$(echo ${temp} | \ - sed -e 's:^./.*/::' -e 's:-Linux::' -e 's:.rpm$::')${LDIST}.rpm - fi - echo "deploying ${temp} to nightly $TARGET_RPM" - if [ -z "${RELEASE_PKG_FILE_RPM}" ] ; then - export RELEASE_PKG_FILE_RPM=$(dirname ${temp})/${TARGET_RPM} - cp ${temp} ${RELEASE_PKG_FILE_RPM} - fi - echo ${TARGET_RPM} - ls -lh ${temp} - echo ${RELEASE_PKG_FILE_RPM} - ls -lh ${RELEASE_PKG_FILE_RPM} -else - echo "Skipping deployment of rpm package" -fi - -check_file tar.gz -if [ -n "${temp}" ] ; then - deploy=$(expr ${deploy} + 1) - if [ -z "${TARGET_TGZ}" ] ; then - export TARGET_TGZ=$(echo ${temp} | \ - sed -e 's:^./.*/::' -e 's:-Linux::' -e 's:-Darwin::' -e 's:.tar.gz$::')${LDIST}.tar.gz; - fi - echo "deploying ${temp} to $TARGET_TGZ" - if [ -z "${RELEASE_PKG_FILE_TGZ}" ] ; then - export RELEASE_PKG_FILE_TGZ=$(dirname ${temp})/${TARGET_TGZ} - cp ${temp} ${RELEASE_PKG_FILE_TGZ} - fi - echo ${TARGET_TGZ} - ls -lh ${temp} - echo ${RELEASE_PKG_FILE_TGZ} - ls -lh ${RELEASE_PKG_FILE_TGZ} -else - echo "Skipping deployment of tarball" -fi - -check_file pkg -if [ -n "${temp}" ] ; then - deploy=$(expr ${deploy} + 1) - if [ -z "${TARGET_PKG}" ] ; then - export TARGET_PKG=$(echo ${temp} | \ - sed -e 's:^./.*/::' -e 's:.pkg$::')${LDIST}.pkg - fi - echo "deploying ${temp} to nightly $TARGET_PKG" - if [ -z "${RELEASE_PKG_FILE_PKG}" ] ; then - export RELEASE_PKG_FILE_PKG=$(dirname ${temp})/${TARGET_PKG} - cp ${temp} ${RELEASE_PKG_FILE_PKG} - fi - echo ${TARGET_PKG} - ls -lh ${temp} - echo ${RELEASE_PKG_FILE_PKG} - ls -lh ${RELEASE_PKG_FILE_PKG} -else - echo "Skipping deployment of OS X package" -fi - -if [ "${deploy}" -eq "0" ] ; then - echo did not deploy any files - exit 1 -fi diff --git a/CI/travis/before_install_darwin b/CI/travis/before_install_darwin deleted file mode 100755 index 8244b43e..00000000 --- a/CI/travis/before_install_darwin +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -e - -. CI/travis/lib.sh - -# Note: not installing 'mono', it comes with Azure images, -# but it doesn't look it's installed with Homebrew - -brew_install_if_not_exists cmake doxygen libusb libxml2 swig curl python - -if [ -n "$PACKAGE_TO_INSTALL" ] ; then - for file in $PACKAGE_TO_INSTALL ; do - sudo installer -pkg "${file}" -target / - done -elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget http://swdownloads.analog.com/cse/travis_builds/${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg - sudo installer -pkg ${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg -target / -fi - -cd ${TOP_DIR} -git clone --branch v0.4.0 --depth 1 https://github.com/google/glog -mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 -cmake .. -make -sudo make install - -pip3 install wheel twine build virtualenv diff --git a/CI/travis/before_install_linux b/CI/travis/before_install_linux deleted file mode 100755 index 592c3392..00000000 --- a/CI/travis/before_install_linux +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -e - -TOP_DIR=$(pwd) - -. CI/travis/lib.sh - -get_libiio_release() { - git clone https://github.com/analogdevicesinc/libiio && cd libiio - IIO_TAG=`git describe --tags $(git rev-list --tags --max-count=1)` - git checkout ${IIO_TAG} - IIO_TAG_SHA=${IIO_TAG}.g`git rev-parse --short HEAD` - wget https://github.com/analogdevicesinc/libiio/releases/download/${IIO_TAG}/libiio-${IIO_TAG_SHA}${LDIST}.deb -} - -handle_centos() { - # FIXME: see about adding `libserialport-dev` from EPEL ; maybe libusb-1.0.0-devel... - yum -y groupinstall 'Development Tools' - - if is_centos_at_least_ver "8" ; then - # On CentOS 8, avahi-devel & doxygen are in this repo; enable it - yum -y install yum-utils - yum config-manager --set-enabled powertools - fi - - yum -y install cmake libxml2-devel libusb1-devel doxygen libaio-devel \ - avahi-devel bzip2 gzip rpm rpm-build swig - - if [ -n "$PACKAGE_TO_INSTALL" ] ; then - sudo yum localinstall -y $PACKAGE_TO_INSTALL - elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - fi -} - -handle_generic_docker() { - prepare_docker_image -} - -handle_default() { - sudo apt-get -qq update - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cmake doxygen graphviz \ - libaio-dev libavahi-client-dev libavahi-common-dev libusb-1.0-0-dev \ - libxml2-dev rpm tar bzip2 gzip flex bison git curl \ - python3-dev python3-setuptools python3-pip python3-all \ - debhelper devscripts fakeroot libserialport-dev swig dh-python - - if [ -n "$PACKAGE_TO_INSTALL" ] ; then - sudo dpkg -i $PACKAGE_TO_INSTALL - elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - fi - - #Install glog - cd ${TOP_DIR} - git clone --branch v0.4.0 --depth 1 https://github.com/google/glog - mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 - cmake -DCMAKE_PREFIX_PATH=/usr .. - make - sudo make install - - sudo pip3 install --upgrade pip stdeb argparse -} - -handle_doxygen() { - # Install a recent version of doxygen - DOXYGEN_URL="wget https://sourceforge.net/projects/doxygen/files/rel-1.8.15/doxygen-1.8.15.src.tar.gz" - cd ${DEPS_DIR} - [ -d "doxygen" ] || { - mkdir doxygen && wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen - } - cd doxygen - mkdir -p build && cd build - cmake .. - make -j${NUM_JOBS} - sudo make install - cd .. - cd .. - - cd ${TOP_DIR}/doc - mkdir -p build && cd build - cmake .. - cd .. - cd .. - - handle_default - cd ${TOP_DIR} - #Also install Sphinx for Python bindings - sudo apt-get install python3-sphinx - sudo pip3 install --upgrade sphinx_rtd_theme -} - -handle_ubuntu() { - handle_default -} - -handle_debian() { - handle_default -} - -setup_build_type_env_vars - -handle_${BUILD_TYPE} diff --git a/CI/travis/deploy b/CI/travis/deploy deleted file mode 100755 index 168b2c1b..00000000 --- a/CI/travis/deploy +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -e - -. CI/travis/lib.sh - -# libname from to suffix -upload_file_to_swdownloads libm2k ${RELEASE_PKG_FILE_DEB} ${TARGET_DEB} .deb -upload_file_to_swdownloads libm2k ${RELEASE_PKG_FILE_RPM} ${TARGET_RPM} .rpm -upload_file_to_swdownloads libm2k ${RELEASE_PKG_FILE_TGZ} ${TARGET_TGZ} .tar.gz -upload_file_to_swdownloads libm2k ${RELEASE_PKG_FILE_PKG} ${TARGET_PKG} .pkg - diff --git a/CI/travis/lib.sh b/CI/travis/lib.sh deleted file mode 100644 index 7fea98d6..00000000 --- a/CI/travis/lib.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -e - -TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-'./'} - -LIBIIO_BRANCH=master - -command_exists() { - local cmd=$1 - [ -n "$cmd" ] || return 1 - type "$cmd" >/dev/null 2>&1 -} - -ensure_command_exists() { - local cmd="$1" - local package="$2" - [ -n "$cmd" ] || return 1 - [ -n "$package" ] || package="$cmd" - ! command_exists "$cmd" || return 0 - # go through known package managers - for pacman in apt-get brew yum ; do - command_exists $pacman || continue - $pacman install -y $package || { - # Try an update if install doesn't work the first time - $pacman -y update && \ - $pacman install -y $package - } - return $? - done - return 1 -} - -ensure_command_exists wget -ensure_command_exists sudo - -# Get the common stuff from libiio -[ -f ${TRAVIS_BUILD_DIR}/build/lib.sh ] || { - mkdir -p ${TRAVIS_BUILD_DIR}/build - wget https://raw.githubusercontent.com/analogdevicesinc/libiio/master/CI/travis/lib.sh \ - -O ${TRAVIS_BUILD_DIR}/build/lib.sh -} - -. ${TRAVIS_BUILD_DIR}/build/lib.sh - -INSIDE_DOCKER_TRAVIS_CI_ENV="$INSIDE_DOCKER_TRAVIS_CI_ENV PACKAGE_TO_INSTALL PYTHON PIP" - -if [ -z "${LDIST}" -a -f "build/.LDIST" ] ; then - export LDIST="-$(cat build/.LDIST)" -fi -if [ -z "${LDIST}" ] || [ "$LDIST" = "DO_NOT_DEPLOY" ] ; then - export LDIST="-$(get_ldist)" -fi diff --git a/CI/travis/doxygen.sh b/CI/ubuntu/doxygen.sh similarity index 100% rename from CI/travis/doxygen.sh rename to CI/ubuntu/doxygen.sh diff --git a/CI/ubuntu/install_deps b/CI/ubuntu/install_deps new file mode 100755 index 00000000..cd795b43 --- /dev/null +++ b/CI/ubuntu/install_deps @@ -0,0 +1,91 @@ +#!/bin/sh -e + +TOP_DIR=$(pwd) +LIBIIO_VERSION=libiio-v0 + +set -x + +install_deps() { + echo "# INSTALLING DEPENDENCIES" + + sudo apt-get -qq update + echo "libm2k packages" + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cmake doxygen graphviz \ + libaio-dev libavahi-client-dev libavahi-common-dev libusb-1.0-0-dev \ + libxml2-dev rpm tar bzip2 gzip flex bison git curl \ + python3-dev python3-setuptools python3-pip python3-all \ + debhelper devscripts fakeroot libserialport-dev swig dh-python \ + libunwind-dev libunwind8 + + # libiio dependencies + echo "libiio packages" + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libxml2-dev bison flex libcdk5-dev cmake \ + libaio-dev libusb-1.0-0-dev \ + libserialport-dev libavahi-client-dev man2html \ + python3-sphinx +} + +install_glog() { + echo "## Building glog" + + cd ${TOP_DIR} + git clone --branch v0.4.0 --depth 1 https://github.com/google/glog + mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 + cmake -DCMAKE_PREFIX_PATH=/usr .. + make + sudo make install + sudo pip3 install --upgrade pip stdeb argparse +} + +install_libiio() { + echo "## Building libiio - version $LIBIIO_VERSION" + + cd ${TOP_DIR} + git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio + mkdir ./libiio/build && cd ./libiio/build + cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_PACKAGING=ON -DPYTHON_BINDINGS=ON -DWITH_DOC=ON -DWITH_SERIAL_BACKEND=ON -DWITH_MAN=ON -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + make + make package + sudo apt install ./libiio-*.deb +} + +handle_default() { + install_deps + install_glog + install_libiio +} + +handle_ubuntu_docker() { + handle_default +} + +handle_doxygen() { + # Install a recent version of doxygen + DOXYGEN_URL="wget https://sourceforge.net/projects/doxygen/files/rel-1.8.15/doxygen-1.8.15.src.tar.gz" + cd ${DEPS_DIR} + [ -d "doxygen" ] || { + mkdir doxygen && wget --quiet -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen + } + cd doxygen + mkdir -p build && cd build + cmake .. + make -j${NUM_JOBS} + sudo make install + cd .. + cd .. + + cd ${TOP_DIR}/doc + mkdir -p build && cd build + cmake .. + cd .. + cd .. + + handle_default + cd ${TOP_DIR} + #Also install Sphinx for Python bindings + sudo apt-get install python3-sphinx + sudo pip3 install --upgrade sphinx_rtd_theme +} + +handle_${OS_TYPE} diff --git a/CI/travis/make_linux b/CI/ubuntu/make_linux similarity index 64% rename from CI/travis/make_linux rename to CI/ubuntu/make_linux index c7a8f8e0..f5daf76e 100755 --- a/CI/travis/make_linux +++ b/CI/ubuntu/make_linux @@ -2,7 +2,7 @@ TOP_DIR=$(pwd) -. CI/travis/lib.sh +set -x handle_default() { mkdir -p build @@ -17,6 +17,7 @@ handle_default() { cd ${TOP_DIR}/build/ #remove the tar.gz for bindings sudo rm *.tar.gz + ls #create simple .deb without Python bindings cmake -DENABLE_PACKAGING=ON -DDEB_DETECT_DEPENDENCIES=ON -DENABLE_PYTHON=OFF -DENABLE_CSHARP=ON -DENABLE_TOOLS=ON -DENABLE_LOG=ON -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=ON .. @@ -24,18 +25,6 @@ handle_default() { ls } -handle_centos() { - mkdir -p build - cd build - cmake -DENABLE_PACKAGING=ON -DENABLE_PYTHON=OFF -DENABLE_CSHARP=ON -DENABLE_TOOLS=ON -DENABLE_LOG=ON -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_EXAMPLES=ON .. - make && make package - cd .. -} - -handle_generic_docker() { - run_docker_script inside_docker.sh -} - handle_doxygen() { mkdir -p build cd build @@ -43,21 +32,11 @@ handle_doxygen() { make && sudo make install make doc cd .. - ./CI/travis/doxygen.sh -} - -handle_ubuntu() { - handle_default + ./CI/ubuntu/doxygen.sh } -handle_debian() { +handle_ubuntu_docker() { handle_default } -handle_generic_docker() { - run_docker_script inside_docker.sh -} - -setup_build_type_env_vars - -handle_${BUILD_TYPE} +handle_${OS_TYPE} \ No newline at end of file diff --git a/CI/windows/create_installer.ps1 b/CI/windows/create_installer.ps1 new file mode 100644 index 00000000..9a57ef40 --- /dev/null +++ b/CI/windows/create_installer.ps1 @@ -0,0 +1,26 @@ +$ErrorActionPreference = "Stop" +$ErrorView = "NormalView" + +$COMPILER = $Env:COMPILER +$ARCH = $Env:ARCH +$PLATFORM = $Env:PLATFORM + +$SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY # path to repo +$OUTSIDE_BUILD = $SRC_DIR.Parent.FullName +$BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$PLATFORM" +$INSTALLER_PATH = "C:\libm2k-system-setup.exe" + +Write-Output "Running script from $SRC_DIR" +Write-Output "OUTSIDE_BUILD to $OUTSIDE_BUILD" +Write-Output "BUILD_DIR to $BUILD_DIR" +Write-Output "INSTALLER_PATH to $INSTALLER_PATH" + + +Set-Location $SRC_DIR +ISCC (Join-Path $BUILD_DIR "libm2k.iss") + +$ARTIFACTS_DIR = Get-Item -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY # path to repo +New-Item -Path (Join-Path $ARTIFACTS_DIR "installer") -ItemType Directory +Copy-Item -Path $INSTALLER_PATH -Destination (Join-Path $ARTIFACTS_DIR "installer") + +Set-Location $SRC_DIR \ No newline at end of file diff --git a/CI/windows/create_zips.ps1 b/CI/windows/create_zips.ps1 new file mode 100644 index 00000000..a2ae67dc --- /dev/null +++ b/CI/windows/create_zips.ps1 @@ -0,0 +1,17 @@ +$ErrorActionPreference = "Stop" +$ErrorView = "NormalView" + +$COMPILER = $Env:COMPILER +$ARCH = $Env:ARCH +$PLATFORM = $Env:PLATFORM + +$SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY # path to repo +$OUTSIDE_BUILD = $SRC_DIR.Parent.FullName +$BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$PLATFORM\*" + + +$ARTIFACTS_DIR = Get-Item -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY # path to repo +New-Item -Path (Join-Path $ARTIFACTS_DIR "libm2k-$PLATFORM") -ItemType Directory +Copy-Item -Path $BUILD_DIR -Destination (Join-Path $ARTIFACTS_DIR "libm2k-$PLATFORM") -Recurse -Container + +Set-Location $SRC_DIR diff --git a/CI/windows/install_deps.ps1 b/CI/windows/install_deps.ps1 new file mode 100644 index 00000000..31d96473 --- /dev/null +++ b/CI/windows/install_deps.ps1 @@ -0,0 +1,184 @@ +$ErrorActionPreference = "Stop" +$ErrorView = "NormalView" + +$COMPILER = $Env:COMPILER +$ARCH = $Env:ARCH +$PLATFORM = $Env:PLATFORM +$LIBIIO_VERSION = $env:LIBIIO_VERSION + + +$SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY # path to repo +$OUTSIDE_BUILD = $SRC_DIR.Parent.FullName +$DEPS_DIR = Join-Path $OUTSIDE_BUILD "deps" + +$LIBIIO_DEPS_DIR = Join-Path $DEPS_DIR "libiio-deps" +$LIBIIO_COMPILE_OUTPUT = Join-Path $OUTSIDE_BUILD "libiio-$ARCH" + +Write-Output "Python located at:" +Get-Command python + +Write-Output "Running script from $SRC_DIR" +Write-Output "COMPILER = $COMPILER" +Write-Output "ARCH = $ARCH" +Write-Output "SRC_DIR to $SRC_DIR" +Write-Output "DEPS_DIR to $DEPS_DIR" +Write-Output "OUTSIDE_BUILD to $OUTSIDE_BUILD" +Write-Output "LIBIIO_COMPILE_OUTPUT = $LIBIIO_COMPILE_OUTPUT" + +if (-not (Test-Path -Path ($DEPS_DIR))) { + New-Item -Path ($DEPS_DIR) -ItemType Directory +} + +function Get-Libiio-Deps { + param ( + [string]$DIR_PATH + ) + Write-Output "# Building libiio dependencies" + + Write-Output "## Installing libxml" + $LIBXML_DIR = Join-Path $DIR_PATH "libxml" + New-Item -Path $LIBXML_DIR -ItemType Directory + Set-Location $LIBXML_DIR + Invoke-WebRequest -Uri "https://www.zlatkovic.com/pub/libxml/64bit/libxml2-2.9.3-win32-x86_64.7z" -OutFile "libxml.7z" + 7z x -y "libxml.7z" + Remove-Item "libxml.7z" + + Write-Output "## Installing libiio-deps" + if (-not (Test-Path -Path ($LIBIIO_DEPS_DIR))) { + New-Item -Path ($LIBIIO_DEPS_DIR) -ItemType Directory + } + Set-Location $LIBIIO_DEPS_DIR + Invoke-WebRequest -Uri "http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip " -OutFile "libiio-win-deps.zip" + 7z x -y "libiio-win-deps.zip" + Remove-Item "libiio-win-deps.zip" + + # NOTE: organize cmake folder structure + Set-Location "include" + New-Item -Path (Join-Path $LIBIIO_DEPS_DIR "include\libserialport") -ItemType Directory + Move-Item -Path ./libserialport.h -Destination libserialport +} + +function Install-Libiiio { + param ( + [string]$DIR_PATH, + [string]$GENERATOR, + [string]$ARCH + ) + Write-Output "# Installing libiio" + Set-Location $DIR_PATH + + git clone "https://github.com/analogdevicesinc/libiio" -b $LIBIIO_VERSION "libiio" + Set-Location (Join-Path $DIR_PATH "libiio") + git submodule update --init + + Write-Output "## Running cmake for LIBIIO $COMPILER on $ARCH..." # x64 instead of ARCH in example + New-Item -Path (Join-Path $DIR_PATH "libiio\build-$ARCH") -ItemType Directory + Copy-Item -Path ".\libiio.iss.cmakein" -Destination (Join-Path $DIR_PATH "libiio\build-$ARCH") + Set-Location (Join-Path $DIR_PATH "libiio\build-$ARCH") + + # cmake config from libiio CI scripts + $pythonExecutable = (python -c "import sys; print(sys.executable)") -replace '\\', '/' + $PATH_LIBXML2_LIB = (Join-Path $DIR_PATH "libiio-deps\libs\64\libxml2.lib") -replace '\\', '/' + $PATH_LIBUSB_LIB = (Join-Path $DIR_PATH "libiio-deps\libs\64\libusb-1.0.lib") -replace '\\', '/' + $PATH_LIBSERIALPORT_LIB = (Join-Path $DIR_PATH "libiio-deps\libs\64\libserialport.dll.a") -replace '\\', '/' + $PATH_LIBUSB_INCLUDE = (Join-Path $DIR_PATH "libiio-deps\include\libusb-1.0") -replace '\\', '/' + $PATH_LIBXML2_INCLUDE = (Join-Path $DIR_PATH "libiio-deps\include\libxml2") -replace '\\', '/' + $PATH_LIBSERIALPORT_INCLUDE = (Join-Path $DIR_PATH "libiio-deps\include\libserialport") -replace '\\', '/' + + cmake -G "$COMPILER" -DPYTHON_EXECUTABLE:FILEPATH="$pythonExecutable" -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=OFF -DLIBXML2_LIBRARIES="$PATH_LIBXML2_LIB" -DLIBUSB_LIBRARIES="$PATH_LIBUSB_LIB" -DLIBSERIALPORT_LIBRARIES="$PATH_LIBSERIALPORT_LIB" -DLIBUSB_INCLUDE_DIR="$PATH_LIBUSB_INCLUDE" -DLIBXML2_INCLUDE_DIR="$PATH_LIBXML2_INCLUDE" -DLIBSERIALPORT_INCLUDE_DIR="$PATH_LIBSERIALPORT_INCLUDE" .. + cmake --build . --config Release + + if ($LASTEXITCODE -ne 0) { + Write-Output "## cmake failed with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } + + # After building libiio, copy files to a known directory + if (-not (Test-Path -Path ($LIBIIO_COMPILE_OUTPUT))) { + New-Item -Path ($LIBIIO_COMPILE_OUTPUT) -ItemType Directory + } + Copy-Item -Path ".\Release\*.dll" -Destination ($LIBIIO_COMPILE_OUTPUT) + Copy-Item -Path ".\Release\*.lib" -Destination ($LIBIIO_COMPILE_OUTPUT) + Copy-Item -Path "*.iss" -Destination ($LIBIIO_COMPILE_OUTPUT) + Set-Location -Path .. + Copy-Item -Path "iio.h" -Destination ($LIBIIO_COMPILE_OUTPUT) + Copy-Item -Path ".\*.dll" -Destination ($LIBIIO_COMPILE_OUTPUT) # might not need this: no .dll files in libiio sources + # copy .dll used to build libiio + Copy-Item -Path (Join-Path $LIBIIO_DEPS_DIR "libs\64\*.dll") -Destination ($LIBIIO_COMPILE_OUTPUT) + + # NOTE: the result of these commands is a .tar.gz file -> copied from LIBIIO CI scripts + Set-Location (Join-Path $DIR_PATH "libiio\build-$ARCH") + + Set-Location -Path .\bindings\python + python.exe setup.py sdist + Get-ChildItem dist\pylibiio-*.tar.gz | Rename-Item -NewName "libiio-py39-amd64.tar.gz" + Move-Item -Path .\dist\*.gz -Destination . + Remove-Item -Path .\dist\*.gz +} + +function Install-Swig { + param ( + [string]$DIR_PATH + ) + Write-Output "# Installing swig" + Set-Location $DIR_PATH + + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + $crnt_attempt=0 + $max_attemps=10 + do { + try { + curl.exe -L -o "swigwin-4.0.0.zip" "https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.0/swigwin-4.0.0.zip/download" + } catch { + Write-Output "## curl failed, retrying..." + Start-Sleep -s 3 + } + } while (-not (Test-Path -Path "swigwin-4.0.0.zip") -and ($crnt_attempt++ -lt $max_attemps)) + + 7z x "swigwin-4.0.0.zip" -oswig + Remove-Item "swigwin-4.0.0.zip" + Set-Location (Join-Path "swig" "swigwin-4.0.0") + xcopy * .. /s /e /h /Q + Get-ChildItem +} + +function Install-Inno-Setup { + Write-Output "# Installing inno-setup" + choco install InnoSetup -y +} + +function Install-Glog { + param ( + [string]$DIR_PATH, + [string]$CONFIGURATION, + [string]$ARCH, + [string]$GENERATOR + ) + Write-Output "# Installing glog" + Set-Location $DIR_PATH + + if (-not (Test-Path -Path (Join-Path $DIR_PATH "glog"))) { + git clone --branch v0.3.5 --depth 1 https://github.com/google/glog + } + Set-Location (Join-Path $DIR_PATH "glog") + git checkout "tags/v0.3.5" + + if (-not (Test-Path -Path (Join-Path $DIR_PATH "glog\build_0_4_0-$ARCH"))) { + New-Item -Path (Join-Path $DIR_PATH "glog\build_0_4_0-$ARCH") -ItemType Directory + } + Set-Location ((Join-Path $DIR_PATH "glog\build_0_4_0-$ARCH")) + + cmake -DWITH_GFLAGS=off -DBUILD_SHARED_LIBS=on -G "$GENERATOR" -A "$ARCH" .. + cmake --build . --target install --config "$CONFIGURATION" +} + +function Install-All { + Install-Inno-Setup + Install-Glog -DIR_PATH $DEPS_DIR -CONFIGURATION "Release" -GENERATOR $COMPILER -ARCH $ARCH + Install-Swig -DIR_PATH $DEPS_DIR + Get-Libiio-Deps -DIR_PATH $DEPS_DIR + Install-Libiiio -DIR_PATH $DEPS_DIR -GENERATOR $COMPILER -ARCH $ARCH +} + +Install-All +Set-Location $SRC_DIR diff --git a/CI/windows/make_windows.ps1 b/CI/windows/make_windows.ps1 new file mode 100644 index 00000000..7bc13096 --- /dev/null +++ b/CI/windows/make_windows.ps1 @@ -0,0 +1,130 @@ +# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference +$ErrorActionPreference = "Stop" +$ErrorView = "NormalView" + +$COMPILER = $Env:COMPILER +$ARCH = $Env:ARCH +$PLATFORM = $Env:PLATFORM + +$SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY # path to repo +$OUTSIDE_BUILD = $SRC_DIR.Parent.FullName +$DEPS_DIR= Join-Path $OUTSIDE_BUILD "deps" + +$BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$PLATFORM" +$TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$PLATFORM" +$DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH" + +Write-Output "COMPILER = $COMPILER" +Write-Output "ARCH = $ARCH" +Write-Output "PLATFORM = $PLATFORM" +Write-Output "SRC DIR = $SRC_DIR" +Write-Output "OUTSIDE_BUILD = $OUTSIDE_BUILD" +Write-Output "DEPS_DIR = $DEPS_DIR" +Write-Output "BUILD_DIR = $BUILD_DIR" +Write-Output "TEMP_BUILD_DIR = $TEMP_BUILD_DIR" +Write-Output "DEST_LIBIIO = $DEST_LIBIIO" + +if (-not (Test-Path -Path $BUILD_DIR)) { + New-Item -Path $BUILD_DIR -ItemType Directory + New-Item -Path (Join-Path $BUILD_DIR "dist") -ItemType Directory +} + +function Build-Libm2k { + param( + [string]$PLATFORM, + [string]$PYTHON_VERSION, + [string]$GENERATOR, + [string]$ARCH + ) + + if (Test-Path -Path $TEMP_BUILD_DIR) { + Remove-Item $TEMP_BUILD_DIR -Recurse -Force + } + New-Item -Path $TEMP_BUILD_DIR -ItemType Directory + + Set-Location $TEMP_BUILD_DIR + + $pythonExecutable = (python -c "import sys; print(sys.executable)") -replace '\\', '/' + $PATH_SWIG_DIR = (Join-Path $DEPS_DIR "swig\Lib") -replace '\\', '/' + $PATH_SWIG_EXE = (Join-Path $DEPS_DIR "swig\swig.exe") -replace '\\', '/' + $SWIG_VERSION = "4.0.0" + $IIO_LIBS_DIR= (Join-Path $DEST_LIBIIO "libiio.lib") -replace '\\', '/' + $IIO_INCLUDE_DIR= ($DEST_LIBIIO) -replace '\\', '/' + + Write-Output "Running cmake on generator $GENERATOR for $ARCH" + + cmake -G "$GENERATOR" -A "$ARCH" -DIIO_LIBRARIES:FILEPATH="$IIO_LIBS_DIR" -DIIO_INCLUDE_DIRS:PATH="$IIO_INCLUDE_DIR" -DCMAKE_CONFIGURATION_TYPES=RELEASE -DSWIG_DIR="$PATH_SWIG_DIR" -DSWIG_EXECUTABLE="$PATH_SWIG_EXE" -DSWIG_VERSION="$SWIG_VERSION" -DENABLE_TOOLS=ON -DENABLE_LOG=ON -DPython_EXECUTABLE="$pythonExecutable" -DBUILD_EXAMPLES=ON -DENABLE_CSHARP=ON -DENABLE_LABVIEW=ON -DENABLE_PYTHON=ON .. + + if ($LASTEXITCODE -ne 0) { + Write-Output "## cmake #1 failed with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } + + Write-Output "Running second cmake" + cmake --build . --config Release + + if ($LASTEXITCODE -ne 0) { + Write-Output "## cmake #2 failed with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } + Get-Content setup.py +} + +function Get-Dll-Paths() { + $vsPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + if ($vsPath -eq $null) { + Write-Host "Visual Studio (vswhere.exe) not found - can't find dll paths." + return $null + } + + $vsInstallerPath = & $vsPath -latest -requires Microsoft.Component.MSBuild -property installationPath + if ($vsInstallerPath -eq $null) { + Write-Host "Visual Studio Installer path is not available" + return $null + } + + $msvcp140Path = Join-Path $vsInstallerPath 'VC\Tools\MSVC\14.*\bin\Hostx64\x64\msvcp140.dll' + $vcruntime140Path = Join-Path $vsInstallerPath 'VC\Tools\MSVC\14.*\bin\Hostx64\x64\vcruntime140.dll' + if (($msvcp140Path -eq $null) -or ($vcruntime140Path -eq $null)) { + Write-Host "Dll paths not found in Visual Studion installation path." + return $null + } + + $result = New-Object PSObject -Property @{ + msvcp140Path = $msvcp140Path + vcruntime140Path = $vcruntime140Path + } + return $result +} + +function Move-To-Build-Dir() { + $ddlPaths = Get-Dll-Paths + + if ($ddlPaths -ne $null) { + Write-Host "msvcp140Path: $($ddlPaths.msvcp140Path)" + Write-Host "vcruntime140Path: $($ddlPaths.vcruntime140Path)" + } else { + Write-Host "Dll Paths not found." + } + + Copy-Item -Path $ddlPaths.msvcp140Path -Destination $BUILD_DIR + Copy-Item -Path $ddlPaths.vcruntime140Path -Destination $BUILD_DIR + + Set-Location $TEMP_BUILD_DIR + Copy-Item -Path "*.dll" -Destination $BUILD_DIR + Copy-Item -Path "*.exe" -Destination $BUILD_DIR + Copy-Item -Path "*libm2k.lib" -Destination $BUILD_DIR + Copy-Item -Path "*.iss" -Destination $BUILD_DIR + + Copy-Item -Path (Join-Path $OUTSIDE_BUILD "libiio-$ARCH\*.dll") -Destination $BUILD_DIR + Copy-Item -Path (Join-Path $OUTSIDE_BUILD "libiio-$ARCH\*.dll") -Destination $BUILD_DIR + Copy-Item -Path (Join-Path $OUTSIDE_BUILD "deps\glog\build_0_4_0-x64\Release\glog.dll") -Destination $BUILD_DIR + + Set-Location $SRC_DIR + xcopy include $BUILD_DIR /s /e /h +} + +Build-Libm2k -PLATFORM $PLATFORM -GENERATOR $COMPILER -ARCH $ARCH +Move-To-Build-Dir + +Set-Location $SRC_DIR diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index ba24b938..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,111 +0,0 @@ -image: - - Visual Studio 2019 - -#init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - - -version: '{branch}.{build}' -clone_depth: 1 - -environment: - # Tell msys2 to add mingw64 to the path - MSYSTEM: MINGW64 - # Tell msys2 to inherit the current directory when starting the shell - CHERE_INVOKING: 1 - TWINE_USERNAME: __token__ - -cache: - - C:\glog -> CI\appveyor\install_glog.bat - -install: - #Download libiio deps - - echo "Downloading deps..." - - cd c:\ - - appveyor DownloadFile http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip - - 7z x -y "c:\libiio-win-deps-libusb1.0.24.zip" - - # Build and install libiio - - bash -c "/c/projects/libm2k/CI/appveyor/install_deps_msvc.sh" - - # Download SWIG - - cd c:\ - - appveyor DownloadFile https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.0/swigwin-4.0.0.zip - - 7z x swigwin-4.0.0.zip -oswig - - cd swig/swigwin-4.0.0 - - xcopy * .. /s /e /h /Q - - #Install Inno Setup - - choco install InnoSetup - - set PATH=%PATH%;"C:\Program Files (x86)\Inno Setup 5" - -build_script: - # Download glog - - cd c:\ - - C:\projects\libm2k\CI\appveyor\install_glog.bat "Release" "x64" - - C:\projects\libm2k\CI\appveyor\install_glog.bat "Release" "Win32" - - - bash -c "/c/projects/libm2k/CI/appveyor/build_appveyor_msvc.sh" - #Create the installer - - copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\msvcp140.dll" c:\projects\libm2k\build-win32 - - copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140.dll" c:\projects\libm2k\build-win64 - - copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.29.30133\x86\Microsoft.VC142.CRT\vcruntime140.dll" c:\projects\libm2k\build-win32 - - copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vcruntime140.dll" c:\projects\libm2k\build-win64 - - ISCC c:\projects\libm2k\build-win64\libm2k.iss - - appveyor PushArtifact C:\libm2k-system-setup.exe - - # Create ZIPs - - cd c:\projects\libm2k - - - mkdir c:\wheelhouse - - mkdir c:\libm2k-win32 - - mkdir c:\libm2k-win32\dist - - xcopy include c:\libm2k-win32 /s /e /h - - copy build-win32\libm2k.* c:\libm2k-win32\ - - copy build-win32\_libm2k.* c:\libm2k-win32\ - - copy build-win32\libm2k_lv.dll c:\libm2k-win32\ - - copy build-win32\libm2k-sharp.dll c:\libm2k-win32\ - - copy build-win32\libm2k-sharp-cxx-wrap.dll c:\libm2k-win32\ - - copy build-win32\*.exe c:\libm2k-win32\ - - copy build-win32\msvc*.dll c:\libm2k-win32\ - - copy build-win32\vcruntime*.dll c:\libm2k-win32\ - - copy build-win32\dist\*.whl c:\libm2k-win32\dist\ - - copy build-win32\dist\*.whl c:\wheelhouse - - copy c:\libiio-win32\*.dll c:\libm2k-win32\ - - copy c:\glog\build_0_4_0-Win32\Release\glog.dll c:\libm2k-win32\ - - 7z a "c:\libm2k-win32.zip" c:\libm2k-win32 - - ps: Get-ChildItem c:\libm2k-win32\dist\*.whl | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - appveyor PushArtifact c:\libm2k-win32.zip - - - mkdir c:\libm2k-win64 - - mkdir c:\libm2k-win64\dist - - xcopy include c:\libm2k-win64 /s /e /h - - copy build-win64\libm2k.* c:\libm2k-win64\ - - copy build-win64\_libm2k.* c:\libm2k-win64\ - - copy build-win64\libm2k_lv.dll c:\libm2k-win64\ - - copy build-win64\libm2k-sharp.dll c:\libm2k-win64\ - - copy build-win64\libm2k-sharp-cxx-wrap.dll c:\libm2k-win64\ - - copy build-win64\*.exe c:\libm2k-win64\ - - copy build-win64\msvc*.dll c:\libm2k-win64\ - - copy build-win64\vcruntime*.dll c:\libm2k-win64\ - - copy build-win64\dist\*.whl c:\libm2k-win64\dist\ - - copy build-win64\dist\*.whl c:\wheelhouse - - copy c:\libiio-win64\*.dll c:\libm2k-win64\ - - copy c:\glog\build_0_4_0-x64\Release\glog.dll c:\libm2k-win64\ - - 7z a "c:\libm2k-win64.zip" c:\libm2k-win64 - - ps: Get-ChildItem c:\libm2k-win64\dist\*.whl | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - appveyor PushArtifact c:\libm2k-win64.zip - -# push to testpypi only if this is a master build -# on releases push to mainline pypi -# on other branches, wheels will be available in the zip archive -deploy_script: - - ps: >- - If($Env:APPVEYOR_REPO_TAG -eq "true") - { - c:\Python39-x64\python.exe -m pip install --upgrade pip twine - c:\Python39-x64\python.exe -m twine upload --repository testpypi c:\wheelhouse\* - } - -#on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0cbd01be..0c998d8c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,7 @@ variables: BRANCH_NAME: $(Build.SourceBranchName) REPO_SLUG: $(Build.Repository.Name) CURRENT_COMMIT: $(Build.SourceVersion) + LIBIIO_VERSION: 'libiio-v0' trigger: - main @@ -25,39 +26,31 @@ parameters: - name: pythonVersions type: object default: + - 3.11 - '3.10' - 3.9 - 3.8 - 3.7 - +# TODO: Fix conditions to export artifacts after validating current pipelines jobs: - job: LinuxBuilds strategy: matrix: - ubuntu_18_04: - imageName: 'ubuntu-18.04' - OS_TYPE: 'ubuntu_docker' - OS_VERSION: bionic - artifactName: 'Linux-Ubuntu-18.04' - PACKAGE_TO_INSTALL: 'build/*.deb' ubuntu_20_04: imageName: 'ubuntu-20.04' OS_TYPE: 'ubuntu_docker' OS_VERSION: focal artifactName: 'Linux-Ubuntu-20.04' - PACKAGE_TO_INSTALL: 'build/*.deb' ubuntu_22_04: imageName: 'ubuntu-22.04' OS_TYPE: 'ubuntu_docker' OS_VERSION: jammy artifactName: 'Linux-Ubuntu-22.04' - PACKAGE_TO_INSTALL: 'build/*.deb' deploy_doxygen: imageName: 'ubuntu-20.04' OS_TYPE: 'doxygen' OS_VERSION: focal artifactName: 'Linux-Ubuntu-20.04' - PACKAGE_TO_INSTALL: 'build/*.deb' pool: vmImage: $(imageName) steps: @@ -65,62 +58,82 @@ jobs: fetchDepth: 1 clean: true persistCredentials: true - - task: DownloadPipelineArtifact@2 - displayName: 'Get libiio artifacts' - inputs: - source: 'specific' - project: '$(AnalogDevices_OpenSource_GUID)' - pipeline: $(libiioPipelineId) - artifact: '$(artifactName)' - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - path: '$(Agent.BuildDirectory)/s/build/' - - script: ./CI/travis/before_install_linux + - script: ./CI/ubuntu/install_deps displayName: "Install Dependencies" - - script: ./CI/travis/make_linux + - task: CopyFiles@2 + condition: ne(variables['System.JobName'], 'deploy_doxygen') + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build/' + contents: '$(Agent.BuildDirectory)/s/libiio/build/?(*.deb)' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - script: ./CI/ubuntu/make_linux displayName: "Build" - task: CopyFiles@2 condition: ne(variables['System.JobName'], 'deploy_doxygen') inputs: sourceFolder: '$(Agent.BuildDirectory)/s/build/' - contents: '$(Agent.BuildDirectory)/s/build/?(*.deb|*.rpm)' + contents: '$(Agent.BuildDirectory)/s/build/?(libm2k*.deb|libm2k*.rpm)' targetFolder: '$(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@1 - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['System.JobName'], 'deploy_doxygen')) + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne(variables['System.JobName'], 'deploy_doxygen')) + condition: and(succeeded(), ne(variables['System.JobName'], 'deploy_doxygen')) inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' - job: macOSBuilds + workspace: + clean: all strategy: matrix: macOS_11: - imageName: 'macOS-11' + poolName: 'Azure Pipelines' + vmImage: 'macOS-11' + agentName: 'Azure Pipelines 4' artifactName: 'macOS-11' macOS_12: - imageName: 'macOS-12' + poolName: 'Azure Pipelines' + vmImage: 'macOS-12' + agentName: 'Azure Pipelines 3' artifactName: 'macOS-12' + macOS_13_x64: + poolName: 'Azure Pipelines' + vmImage: 'macOS-13' + agentName: 'Azure Pipelines 2' + artifactName: 'macOS-13-x64' + # TODO: discuss with DevOps team how to setup ARM agent + # macOS_13_arm64: + # poolName: 'Default' + # vmImage: + # agentName: 'macOS_arm64' + # artifactName: 'macOS-13-arm64' pool: - vmImage: $(imageName) - variables: - PACKAGE_TO_INSTALL: 'build/*.pkg' + name: $(poolName) + vmImage: $(vmImage) + demands: + - agent.name -equals $(agentName) steps: - checkout: self fetchDepth: 1 clean: true - - task: DownloadPipelineArtifact@2 - displayName: 'Get libiio artifacts' + - task: UsePythonVersion@0 inputs: - source: 'specific' - project: '$(AnalogDevices_OpenSource_GUID)' - pipeline: $(libiioPipelineId) - artifact: '$(artifactName)' - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - path: '$(Agent.BuildDirectory)/s/build/' - - script: ./CI/travis/before_install_darwin + versionSpec: '3.11' + addToPath: true + - script: ./CI/macOS/install_deps displayName: "Install Dependencies" - - script: ./CI/travis/make_darwin + condition: ne(variables['agentName'],'macOS_arm64') + - task: CopyFiles@2 + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build/' + contents: '$(Agent.BuildDirectory)/s/libiio/build/?(*.pkg)' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/libiio/build_tar/' + contents: '$(Agent.BuildDirectory)/s/libiio/build_tar/?(*.tar.gz)' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - script: ./CI/macOS/make_macOS displayName: "Build" - ${{ each pyVersion in parameters.pythonVersions }}: - task: UsePythonVersion@0 @@ -153,7 +166,8 @@ jobs: contents: '$(Agent.BuildDirectory)/s/build_tar/?(*.tar.gz)' targetFolder: '$(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@1 - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + condition: succeeded() inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' @@ -165,4 +179,92 @@ jobs: displayName: "Upload to PyPI" env: TWINE_USERNAME: '__token__' - TWINE_PASSWORD: $(TWINE_PASSWORD) \ No newline at end of file + TWINE_PASSWORD: $(TWINE_PASSWORD) + +- job: WindowsBuilds + workspace: + clean: all + strategy: + matrix: + VS_2022: + poolName: 'Azure Pipelines' + vmImage: 'windows-2022' + COMPILER: 'Visual Studio 17 2022' + ARCH: 'x64' + PLATFORM: 'win64' + artifactName: 'Windows-VS-2022-x64' + VS_2019: + poolName: 'Azure Pipelines' + vmImage: 'windows-2019' + COMPILER: 'Visual Studio 16 2019' + ARCH: 'x64' + PLATFORM: 'win64' + artifactName: 'Windows-VS-2019-x64' + pool: + vmImage: $[ variables['vmImage'] ] + steps: + - checkout: self + fetchDepth: 1 + clean: true + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.11' + - task: PowerShell@2 + displayName: 'Install Dependencies' + inputs: + targetType: filePath + filePath: ./CI/windows/install_deps.ps1 + - task: PowerShell@2 + displayName: "Build libm2k" + inputs: + targetType: 'filePath' + filePath: ./CI/windows/make_windows.ps1 + - ${{ each pyVersion in parameters.pythonVersions }}: + - task: UsePythonVersion@0 + displayName: Use Python ${{ pyVersion }} + inputs: + versionSpec: '${{ pyVersion }}' + - powershell: | + $SRC_DIR = Get-Item -Path $env:BUILD_SOURCESDIRECTORY + $OUTSIDE_BUILD = $SRC_DIR.Parent.FullName + + $BUILD_DIR = Join-Path $OUTSIDE_BUILD "libm2k-$env:PLATFORM" + $TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$env:PLATFORM" + + Set-Location $TEMP_BUILD_DIR + python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv + $env:COMPILE_BINDINGS = $true + python.exe -m build + Remove-Item Env:COMPILE_BINDINGS + Copy-Item -Path "dist/libm2k*.whl" -Destination (Join-Path $BUILD_DIR "dist") + Set-Location $SRC_DIR + displayName: Wheel Python ${{ pyVersion }} + - task: PowerShell@2 + displayName: 'Create libm2k-system-setup installer' + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) + condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) + inputs: + targetType: 'filePath' + filePath: ./CI/windows/create_installer.ps1 + - task: PublishPipelineArtifact@1 + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.JobName'], 'VS_2022')) + condition: and(succeeded(), eq(variables['System.JobName'], 'VS_2022')) + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/installer' + artifactName: 'Libm2k-System-Setup-Exe' + - task: PowerShell@2 + displayName: "Create ZIPs" + inputs: + targetType: 'filePath' + filePath: ./CI/windows/create_zips.ps1 + - task: PublishPipelineArtifact@1 + # condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + condition: succeeded() + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/libm2k-$(PLATFORM)' + artifactName: '$(artifactName)' + + + + + diff --git a/libm2k.iss.cmakein b/libm2k.iss.cmakein index 088dc7c4..6485c2c8 100644 --- a/libm2k.iss.cmakein +++ b/libm2k.iss.cmakein @@ -11,7 +11,7 @@ AppSupportURL="http://www.analog.com" AppUpdatesURL="http://www.analog.com" AppCopyright="Copyright 2019 ADI and other contributors" CreateAppDir=no -LicenseFile="C:\projects\libm2k\LICENSE" +LicenseFile="D:\a\1\s\LICENSE" OutputBaseFilename=libm2k-system-setup OutputDir="C:\" Compression=lzma @@ -70,48 +70,48 @@ begin end; [Files] -Source: "C:\projects\libm2k\build-win32\libm2k.dll"; DestDir: "{sys}"; Flags: 32bit replacesameversion -Source: "C:\projects\libm2k\build-win64\libm2k.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion +;Source: "C:\projects\libm2k\build-win32\libm2k.dll"; DestDir: "{sys}"; Flags: 32bit replacesameversion +Source: "D:\a\1\libm2k-win64\libm2k.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion -Source: "C:\projects\libm2k\build-win32\{#MsvcLib}"; DestDir: "{sys}"; Check: not isMsvcInstalled; Flags: onlyifdoesntexist 32bit -Source: "C:\projects\libm2k\build-win64\{#MsvcLib}"; DestDir: "{sys}"; Check: Is64BitInstallMode and (not isMsvcInstalled); Flags: onlyifdoesntexist +;Source: "C:\projects\libm2k\build-win32\{#MsvcLib}"; DestDir: "{sys}"; Check: not isMsvcInstalled; Flags: onlyifdoesntexist 32bit +Source: "D:\a\1\libm2k-win64\{#MsvcLib}"; DestDir: "{sys}"; Check: Is64BitInstallMode and (not isMsvcInstalled); Flags: onlyifdoesntexist -Source: "C:\projects\libm2k\build-win32\{#MsvcRuntime}"; DestDir: "{sys}"; Check: not isMsvcInstalled; Flags: onlyifdoesntexist 32bit -Source: "C:\projects\libm2k\build-win64\{#MsvcRuntime}"; DestDir: "{sys}"; Check: Is64BitInstallMode and (not isMsvcInstalled); Flags: onlyifdoesntexist +;Source: "C:\projects\libm2k\build-win32\{#MsvcRuntime}"; DestDir: "{sys}"; Check: not isMsvcInstalled; Flags: onlyifdoesntexist 32bit +Source: "D:\a\1\libm2k-win64\{#MsvcRuntime}"; DestDir: "{sys}"; Check: Is64BitInstallMode and (not isMsvcInstalled); Flags: onlyifdoesntexist ;Source: "C:\projects\libm2k\build-win32\*.exe"; DestDir: "{sys}"; Check: not Is64BitInstallMode -;Source: "C:\projects\libm2k\build-win64\*.exe"; DestDir: "{sys}"; Check: Is64BitInstallMode +;Source: "D:\a\1\libm2k-win64\*.exe"; DestDir: "{sys}"; Check: Is64BitInstallMode -Source: "C:\projects\libm2k\build-win32\m2kcli.exe"; DestDir: "{sys}"; Check: not Is64BitInstallMode; -Source: "C:\projects\libm2k\build-win64\m2kcli.exe"; DestDir: "{sys}"; Check: Is64BitInstallMode; +;Source: "C:\projects\libm2k\build-win32\m2kcli.exe"; DestDir: "{sys}"; Check: not Is64BitInstallMode; +Source: "D:\a\1\libm2k-win64\m2kcli.exe"; DestDir: "{sys}"; Check: Is64BitInstallMode; -Source: "C:\projects\libm2k\build-win32\libm2k.lib"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\lib"; Check: not Is64BitInstallMode -Source: "C:\projects\libm2k\build-win64\libm2k.lib"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\lib\amd64"; Check: Is64BitInstallMode -Source: "C:\projects\libm2k\include\*"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\include"; Flags: replacesameversion recursesubdirs +;Source: "C:\projects\libm2k\build-win32\libm2k.lib"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\lib"; Check: not Is64BitInstallMode +Source: "D:\a\1\libm2k-win64\libm2k.lib"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\lib\amd64"; Check: Is64BitInstallMode +Source: "D:\a\1\libm2k-win64\libm2k\*"; DestDir: "{pf32}\Microsoft Visual Studio 15.0\VC\include"; Flags: replacesameversion recursesubdirs -Source: "C:\libiio-win32\libiio.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit replacesameversion -Source: "C:\libiio-win64\libiio.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; Flags: replacesameversion +;Source: "C:\libiio-win32\libiio.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit replacesameversion +Source: "D:\a\1\libiio-x64\libiio.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; Flags: replacesameversion -Source: "C:\libiio-win32\libxml2.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit -Source: "C:\libiio-win64\libxml2.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; +;Source: "C:\libiio-win32\libxml2.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit +Source: "D:\a\1\libiio-x64\libxml2.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; -Source: "C:\libiio-win32\libusb-1.0.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit -Source: "C:\libiio-win64\libusb-1.0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; +;Source: "C:\libiio-win32\libusb-1.0.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit +Source: "D:\a\1\\libiio-x64\libusb-1.0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; -Source: "C:\libiio-win32\libserialport-0.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit -Source: "C:\libiio-win64\libserialport-0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; +;Source: "C:\libiio-win32\libserialport-0.dll"; DestDir: "{sys}"; Tasks: install_libiio_force install_libiio; Flags: 32bit +Source: "D:\a\1\libiio-x64\libserialport-0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_libiio_force install_libiio; -Source: "C:\glog\build_0_4_0-Win32\Release\glog.dll"; DestDir: "{sys}"; Tasks: install_glog; Flags: 32bit -Source: "C:\glog\build_0_4_0-x64\Release\glog.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_glog; +;Source: "C:\glog\build_0_4_0-Win32\Release\glog.dll"; DestDir: "{sys}"; Tasks: install_glog; Flags: 32bit +Source: "D:\a\1\deps\glog\build_0_4_0-x64\Release\glog.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Tasks: install_glog; -Source: "C:\projects\libm2k\build-win32\libm2k-sharp.dll"; DestDir: "{cf}\libm2k"; Check: not Is64BitInstallMode; Flags: replacesameversion -Source: "C:\projects\libm2k\build-win32\libm2k-sharp-cxx-wrap.dll"; DestDir: "{sys}"; Check: not Is64BitInstallMode; Flags: replacesameversion +;Source: "C:\projects\libm2k\build-win32\libm2k-sharp.dll"; DestDir: "{cf}\libm2k"; Check: not Is64BitInstallMode; Flags: replacesameversion +;Source: "C:\projects\libm2k\build-win32\libm2k-sharp-cxx-wrap.dll"; DestDir: "{sys}"; Check: not Is64BitInstallMode; Flags: replacesameversion -Source: "C:\projects\libm2k\build-win64\libm2k-sharp.dll"; DestDir: "{cf}\libm2k"; Check: Is64BitInstallMode; Flags: replacesameversion -Source: "C:\projects\libm2k\build-win64\libm2k-sharp-cxx-wrap.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion +Source: "D:\a\1\libm2k-win64\libm2k-sharp.dll"; DestDir: "{cf}\libm2k"; Check: Is64BitInstallMode; Flags: replacesameversion +Source: "D:\a\1\libm2k-win64\libm2k-sharp-cxx-wrap.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion -Source: "C:\projects\libm2k\build-win32\libm2k_lv.dll"; DestDir: "{sys}"; Flags: 32bit replacesameversion; Tasks: install_labview_wrapper; -Source: "C:\projects\libm2k\build-win64\libm2k_lv.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion; Tasks: install_labview_wrapper; +;Source: "C:\projects\libm2k\build-win32\libm2k_lv.dll"; DestDir: "{sys}"; Flags: 32bit replacesameversion; Tasks: install_labview_wrapper; +Source: "D:\a\1\libm2k-win64\libm2k_lv.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: replacesameversion; Tasks: install_labview_wrapper; [Tasks] Name: "install_libiio"; Description: "Install libiio"; Check: Not isIioInstalled;