Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix macOS builds #368

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 76 additions & 39 deletions CI/macOS/install_deps
Original file line number Diff line number Diff line change
@@ -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 ..
install_packages
build_glog
build_libiio
49 changes: 36 additions & 13 deletions CI/macOS/make_macOS
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading