diff --git a/CI/macOS/install_deps b/CI/macOS/install_deps index def74c07..20e08ae3 100755 --- a/CI/macOS/install_deps +++ b/CI/macOS/install_deps @@ -1,44 +1,81 @@ #!/bin/sh -e -TOP_DIR=$(pwd) +set -ex + LIBIIO_VERSION=libiio-v0 +GLOG_VERSION=v0.4.0 -set -ex +WORKDIR=$(pwd) + +install_packages() { + echo "### Installing packages" + + echo "#### Installing brew packages" + BREW_LIBIIO="doxygen libusb libxml2 ncurses cdk libserialport sphinx-doc pkg-config" + BREW_LIBM2K="cmake doxygen libusb libxml2 swig curl python" + PACKAGES="$BREW_LIBIIO $BREW_LIBM2K" + brew install --display-times $PACKAGES + + echo "#### Installing pip packages" + PIP_LIBIIO="sphinx setuptools" + PIP_LIBM2K="wheel twine build virtualenv" + PACKAGES="$PIP_LIBIIO $PIP_LIBM2K" + pip3 install $PACKAGES +} + +build_glog() { + echo "### Building glog - version $GLOG_VERSION" + git clone https://github.com/google/glog -b $GLOG_VERSION "${WORKDIR}"/glog + + cd "${WORKDIR}"/glog + mkdir -p build_"${GLOG_VERSION}" && cd build_"${GLOG_VERSION}" + cmake "${WORKDIR}"/glog + make + sudo make install + cd "${WORKDIR}" +} + +build_libiio() { + echo "### Building libiio - version $LIBIIO_VERSION" + git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION "${WORKDIR}"/libiio + + echo "#### Building: .pkg" + cd "${WORKDIR}"/libiio + mkdir -p build && cd build + cmake "${WORKDIR}"/libiio \ + -Werror=dev \ + -DCOMPILE_WARNING_AS_ERROR=ON \ + -DOSX_PACKAGE=ON \ + -DCPP_BINDINGS=ON \ + -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DPYTHON_BINDINGS=ON \ + -DWITH_EXAMPLES=ON \ + -DWITH_SERIAL_BACKEND=ON \ + -DWITH_ZSTD=OFF + make + sudo make install + + echo "#### Building: .tar" + cd "${WORKDIR}"/libiio + mkdir -p build_tar && cd build_tar + cmake "${WORKDIR}"/libiio \ + -Werror=dev \ + -DCOMPILE_WARNING_AS_ERROR=ON \ + -DOSX_PACKAGE=OFF \ + -DENABLE_PACKAGING=ON \ + -DCPP_BINDINGS=ON \ + -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DPYTHON_BINDINGS=ON \ + -DWITH_SERIAL_BACKEND=ON \ + -DWITH_ZSTD=OFF \ + -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} + make package + mv ../CI/azure/macos_tar_fixup.sh . + chmod +x macos_tar_fixup.sh + ./macos_tar_fixup.sh + cd "${WORKDIR}" +} -# 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 +install_packages +build_glog +build_libiio \ No newline at end of file diff --git a/CI/macOS/make_macOS b/CI/macOS/make_macOS index 6e4f23a9..e1f0af6c 100755 --- a/CI/macOS/make_macOS +++ b/CI/macOS/make_macOS @@ -1,19 +1,42 @@ #!/bin/sh -e -TOP_DIR=$(pwd) +set -ex -set -x - -mkdir -p build -mkdir -p build_tar +WORKDIR=$(pwd) export MACOSX_DEPLOYMENT_TARGET=10.15 -cd build -cmake -DOSX_PACKAGE=ON -DENABLE_TOOLS=ON -DENABLE_PYTHON=ON -DENABLE_CSHARP=ON -DENABLE_LOG=ON -DBUILD_EXAMPLES=ON .. -make -ls +make_package() { + echo "### Make OSX packague" + mkdir -p "${WORKDIR}"/build && cd "${WORKDIR}"/build + cmake "$WORKDIR" \ + -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DOSX_PACKAGE=ON \ + -DENABLE_TOOLS=ON \ + -DENABLE_PYTHON=ON \ + -DENABLE_CSHARP=ON \ + -DENABLE_LOG=ON \ + -DBUILD_EXAMPLES=ON + make + ls + cd "$WORKDIR" +} + +make_tar() { + echo "### Make OSX tar" + mkdir -p "${WORKDIR}"/build_tar && cd "${WORKDIR}"/build_tar + cmake "${WORKDIR}" \ + -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DOSX_PACKAGE=OFF \ + -DENABLE_PACKAGING=ON \ + -DENABLE_PYTHON=ON \ + -DENABLE_CSHARP=ON \ + -DENABLE_TOOLS=ON \ + -DENABLE_LOG=ON \ + -DBUILD_EXAMPLES=ON + make && make package + ls + cd "$WORKDIR" +} -cd ${TOP_DIR}/build_tar -cmake -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DENABLE_PYTHON=ON -DENABLE_CSHARP=ON -DENABLE_TOOLS=ON -DENABLE_LOG=ON -DBUILD_EXAMPLES=ON .. -make && make package -ls +make_package +make_tar diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c998d8c..8f15cb18 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,11 +86,6 @@ jobs: clean: all strategy: matrix: - macOS_11: - poolName: 'Azure Pipelines' - vmImage: 'macOS-11' - agentName: 'Azure Pipelines 4' - artifactName: 'macOS-11' macOS_12: poolName: 'Azure Pipelines' vmImage: 'macOS-12' diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index f0d1072e..37af9824 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -37,7 +37,18 @@ if(${CMAKE_VERSION} VERSION_LESS "3.12.0") set(Python_INCLUDE_PATH ${PYTHON_INCLUDE_PATH}) set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) else() + if(PYTHON_EXECUTABLE) + set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + endif() + if (PYTHON_LIBRARY) + set(Python_LIBRARY ${PYTHON_LIBRARY}) + endif() + if (PYTHON_INCLUDE_DIR) + set(Python_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) + endif() + message(STATUS "bin=${Python_EXECUTABLE} lib=${Python_LIBRARY} inc=${Python_INCLUDE_DIR}") find_package(Python COMPONENTS Interpreter Development) + message(STATUS "Python_EXECUTABLE ${Python_EXECUTABLE}") endif() FIND_PACKAGE(SWIG REQUIRED)