Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Bindea Cristian <cristian.bindea@analog.com>
  • Loading branch information
bindea-cristian committed Jul 12, 2024
1 parent f3fe0eb commit 80f585a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ci/armhf/scopy.AppDir
ci/armhf/scopy.squashfs
ci/x86_64/staging
ci/x86_64/scopy.AppDir
ci/windows/staging
windows/*
core/include/scopy-core_config.h
core/include/scopy-core_export.h
Expand Down
57 changes: 47 additions & 10 deletions ci/windows/build_and_create_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if [ "$CI_SCRIPT" == "ON" ];
set -x
SRC_FOLDER=$(git rev-parse --show-toplevel)
export WORKDIR=$SRC_FOLDER
git clone https://github.com/analogdevicesinc/scopy-mingw-build-deps.git -b ci-for-scopy2 $WORKDIR/scopy-mingw-build-deps
fi

BUILD_TARGET=x86_64
Expand Down Expand Up @@ -42,9 +41,40 @@ GRUTIL_DLL=$BUILD_FOLDER/gr-util
REGMAP_XMLS=$BUILD_FOLDER/plugins/regmap/xmls

# Generate build status info for the about page
cp $BUILD_STATUS_FILE $SRC_FOLDER/build-status

# to be added back later
# cp $BUILD_STATUS_FILE $SRC_FOLDER/build-status

pacman -Qe >> $SRC_FOLDER/build-status

download_tools() {
pushd $STAGING_AREA
if [ ! -f windres.exe ]; then
wget http://swdownloads.analog.com/cse/build/windres.exe.gz
gunzip windres.exe.gz
fi

if [ ! -f dpinst.zip ]; then
wget http://swdownloads.analog.com/cse/m1k/drivers/dpinst.zip
unzip "dpinst.zip"
fi

if [ ! -f dfu-util.zip ]; then
wget http://swdownloads.analog.com/cse/m1k/drivers/dfu-util.zip
unzip "dfu-util.zip"
fi

if [ ! -f cv2pdb-dlls.zip ]; then
wget https://swdownloads.analog.com/cse/scopydeps/cv2pdb-dlls.zip
unzip "cv2pdb-dlls.zip"
fi

if [ ! -f is.exe ]; then
wget https://jrsoftware.org/download.php/is.exe
fi
popd
}

build_scopy(){
echo "### Building Scopy"
mkdir -p $BUILD_FOLDER
Expand Down Expand Up @@ -73,6 +103,7 @@ deploy_app(){
if [ -d $DEST_FOLDER ]; then
rm -rf $DEST_FOLDER
fi
rm -rf $DEST_FOLDER
mkdir $DEST_FOLDER
cp $BUILD_FOLDER/Scopy.exe $DEST_FOLDER/
cp $BUILD_FOLDER/qt.conf $DEST_FOLDER/
Expand Down Expand Up @@ -117,28 +148,31 @@ deploy_app(){

extract_debug_symbols(){
echo "### Duplicating unstripped bundle"
rm -rf $DEBUG_FOLDER
mkdir -p $DEBUG_FOLDER
cp -r $DEST_FOLDER/* $DEBUG_FOLDER/
echo "### Stripping bundle for installer"
/c/msys64/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/*.exe
/c/msys64/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/*.dll
/c/msys64/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/plugins/plugins/*.dll
/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/*.exe
/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/*.dll
/$MINGW_VERSION/bin/strip.exe --strip-debug --strip-unneeded $DEST_FOLDER/plugins/plugins/*.dll
}

bundle_drivers(){
echo "### Bundling drivers"
cp -R $SRC_FOLDER/windows/drivers $DEST_FOLDER
if [[ $ARCH_BIT == "64" ]]; then
cp -R $TOOLS_FOLDER/dfu-util-static-amd64.exe $DEST_FOLDER/drivers/dfu-util.exe
cp -R $TOOLS_FOLDER/dpinst_amd64.exe $DEST_FOLDER/drivers/dpinst.exe
cp -R $STAGING_AREA/dfu-util-static-amd64.exe $DEST_FOLDER/drivers/dfu-util.exe
cp -R $STAGING_AREA/dpinst_amd64.exe $DEST_FOLDER/drivers/dpinst.exe
else
cp -R $TOOLS_FOLDER/dfu-util-static.exe $DEST_FOLDER/drivers/dfu-util.exe
cp -R $TOOLS_FOLDER/dpinst.exe $DEST_FOLDER/drivers/dpinst.exe
cp -R $STAGING_AREA/dfu-util-static.exe $DEST_FOLDER/drivers/dfu-util.exe
cp -R $STAGING_AREA/dpinst.exe $DEST_FOLDER/drivers/dpinst.exe
fi
}

create_installer() {
echo "### Creating installer"
rm -rf $ARTIFACT_FOLDER
rm -rf $SRC_FOLDER/artifact_$ARCH
mkdir -p $ARTIFACT_FOLDER
cd $WORKDIR
cp -R $WORKDIR/scopy_${ARCH} $ARTIFACT_FOLDER/scopy-${ARCH}
Expand All @@ -149,20 +183,23 @@ create_installer() {

echo "Done. Artifacts generated in $ARTIFACT_FOLDER"
ls -la $ARTIFACT_FOLDER
cp -R $ARTIFACT_FOLDER $SRC_FOLDER
[ "$CI_SCRIPT" == "ON" ] && cp -R $ARTIFACT_FOLDER $SRC_FOLDER
ls -la $SRC_FOLDER
}


run_workflow(){
build_scopy
build_iio-emu
download_tools
deploy_app
bundle_drivers
extract_debug_symbols
create_installer
}

run_workflow

for arg in $@; do
$arg
done
31 changes: 16 additions & 15 deletions ci/windows/mingw_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ set -ex
# get the full directory path of the script
export WORKFOLDER=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

BUILD_STATUS_FILE=$WORKFOLDER/scopy-mingw-build-status
BUILD_STATUS_FILE=$HOME/scopy-mingw-build-status

LIBIIO_VERSION=libiio-v0
LIBAD9361_BRANCH=main
GLOG_BRANCH=v0.4.0
LIBM2K_BRANCH=main
SPDLOG_BRANCH=v1.x
LIBSNDFILE_BRANCH=1.2.2
VOLK_BRANCH=main
GNURADIO_BRANCH=maint-3.10
GRSCOPY_BRANCH=3.10
Expand All @@ -24,16 +25,6 @@ MINGW_VERSION=mingw64
ARCH=x86_64
STAGING_AREA=$WORKFOLDER/staging

RC_COMPILER_OPT="-DCMAKE_RC_COMPILER=/mingw64/bin/windres.exe"
PATH="/bin:$STAGING_DIR/bin:$WORKFOLDER/cv2pdb:/c/Program Files (x86)/Inno Setup 6:/c/innosetup/:/bin:/usr/bin:${STAGING_DIR}/bin:/c/Program\ Files/Git/cmd:/c/Windows/System32:/c/Program\ Files/Appveyor/BuildAgent:$PATH"
QMAKE=${STAGING_DIR}/bin/qmake
PKG_CONFIG_PATH=$STAGING_DIR/lib/pkgconfig
CC=${STAGING_DIR}/bin/${ARCH}-w64-mingw32-gcc.exe
CXX=${STAGING_DIR}/bin/${ARCH}-w64-mingw32-g++.exe
JOBS="-j9"
MAKE_BIN=$STAGING_DIR/usr/bin/make.exe
MAKE_CMD="$MAKE_BIN $JOBS"

USE_STAGING=$1
if [ ! -z "$USE_STAGING" ] && [ "$USE_STAGING" == "ON" ]
then
Expand All @@ -49,7 +40,18 @@ if [ ! -z "$USE_STAGING" ] && [ "$USE_STAGING" == "ON" ]
export PACMAN="pacman --noconfirm --needed"
fi

CMAKE_OPTS=( \
RC_COMPILER_OPT="-DCMAKE_RC_COMPILER=/mingw64/bin/windres.exe"
PATH="/bin:$STAGING_DIR/bin:$WORKFOLDER/cv2pdb:/c/Program Files (x86)/Inno Setup 6:/c/innosetup/:/bin:/usr/bin:${STAGING_DIR}/bin:/c/Program\ Files/Git/cmd:/c/Windows/System32:/c/Program\ Files/Appveyor/BuildAgent:$PATH"
QMAKE=${STAGING_DIR}/bin/qmake
PKG_CONFIG_PATH=$STAGING_DIR/lib/pkgconfig
CC=${STAGING_DIR}/bin/${ARCH}-w64-mingw32-gcc.exe
CXX=${STAGING_DIR}/bin/${ARCH}-w64-mingw32-g++.exe
JOBS="-j22"
MAKE_BIN=/usr/bin/make.exe
MAKE_CMD="$MAKE_BIN $JOBS"
export CMAKE_GENERATOR="Unix Makefiles"

export CMAKE_OPTS=( \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_C_COMPILER:FILEPATH=${CC} \
Expand All @@ -60,10 +62,9 @@ CMAKE_OPTS=( \
-DCMAKE_PREFIX_PATH=$STAGING_DIR/lib/cmake \
-DCMAKE_STAGING_PREFIX=$STAGING_DIR \
-DCMAKE_INSTALL_PREFIX=$STAGING_DIR \
)
)

CMAKE_GENERATOR="Unix Makefiles"
CMAKE="${STAGING_DIR}/bin/cmake ${CMAKE_OPTS[@]} "
export CMAKE="${STAGING_DIR}/bin/cmake ${CMAKE_OPTS[@]} "

AUTOCONF_OPTS="--prefix=$STAGING_DIR \
--host=${ARCH}-w64-mingw32 \
Expand Down
59 changes: 22 additions & 37 deletions ci/windows/windows_build_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,45 +59,19 @@ install_packages() {
$PACMAN -S $PACMAN_SYNC_DEPS
}

download_tools() {
pushd $WORKFOLDER
if [ ! -f windres.exe ]; then
wget http://swdownloads.analog.com/cse/build/windres.exe.gz
gunzip windres.exe.gz
fi

if [ ! -f dpinst.zip ]; then
wget http://swdownloads.analog.com/cse/m1k/drivers/dpinst.zip
unzip "dpinst.zip"
fi

if [ ! -f dfu-util.zip ]; then
wget http://swdownloads.analog.com/cse/m1k/drivers/dfu-util.zip
unzip "dfu-util.zip"
fi

if [ ! -f cv2pdb-dlls.zip ]; then
wget https://swdownloads.analog.com/cse/scopydeps/cv2pdb-dlls.zip
unzip "cv2pdb-dlls.zip"
fi

if [ ! -f is.exe ]; then
wget https://jrsoftware.org/download.php/is.exe
fi
popd
}

clone() {
echo "#######CLONE#######"
mkdir -p $STAGING_AREA
pushd $STAGING_AREA
[ -d 'libiio' ] || git clone --recursive https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio
[ -d 'libad9361' ] || git clone --recursive https://github.com/analogdevicesinc/libad9361-iio.git -b $LIBAD9361_BRANCH libad9361
[ -d 'libm2k' ] || git clone --recursive https://github.com/analogdevicesinc/libm2k.git -b $LIBM2K_BRANCH libm2k
[ -d 'spdlog' ] || git clone --recursive https://github.com/gabime/spdlog.git -b $SPDLOG_BRANCH spdlog
[ -d 'volk' ] || git clone --recursive https://github.com/gnuradio/volk.git -b $VOLK_BRANCH volk
[ -d 'gnuradio' ] || git clone --recursive https://github.com/gnuradio/gnuradio.git -b $GNURADIO_BRANCH gnuradio
[ -d 'libsndfile' ] || git clone --recursive https://github.com/libsndfile/libsndfile -b $LIBSNDFILE_BRANCH libsndfile
[ -d 'gr-scopy' ] || git clone --recursive https://github.com/analogdevicesinc/gr-scopy.git -b $GRSCOPY_BRANCH gr-scopy
[ -d 'gr-m2k' ] || git clone --recursive https://github.com/analogdevicesinc/gr-m2k.git -b $GRM2K_BRANCH gr-m2k
[ -d 'volk' ] || git clone --recursive https://github.com/gnuradio/volk.git -b $VOLK_BRANCH volk
[ -d 'gnuradio' ] || git clone --recursive https://github.com/gnuradio/gnuradio.git -b $GNURADIO_BRANCH gnuradio
[ -d 'qwt' ] || git clone --recursive https://github.com/cseci/qwt.git -b $QWT_BRANCH qwt
[ -d 'libsigrokdecode' ] || git clone --recursive https://github.com/sigrokproject/libsigrokdecode.git -b $LIBSIGROKDECODE_BRANCH libsigrokdecode
[ -d 'libtinyiiod' ] || git clone --recursive https://github.com/analogdevicesinc/libtinyiiod.git -b $LIBTINYIIOD_BRANCH libtinyiiod
Expand Down Expand Up @@ -138,7 +112,7 @@ build_with_cmake() {
eval $CURRENT_BUILD_POST_CMAKE
make $JOBS
if [ "$INSTALL" == "ON" ];then
if [ "$USE_STAGING" == "ON" ]; then make install; else sudo make install; fi
make install
fi
eval $CURRENT_BUILD_POST_MAKE
echo "$CURRENT_BUILD - $(git rev-parse --short HEAD)" >> $BUILD_STATUS_FILE
Expand All @@ -160,14 +134,13 @@ build_libiio() {
CURRENT_BUILD=libiio
CURRENT_BUILD_CMAKE_OPTS="\
${RC_COMPILER_OPT}\
-DWITH_TESTS:BOOL=OFF\
-DWITH_USB_BACKEND:BOOL=ON\
-DWITH_SERIAL_BACKEND:BOOL=ON\
-DWITH_DOC:BOOL=OFF\
-DCSHARP_BINDINGS:BOOL=OFF\
-DPYTHON_BINDINGS:BOOL=OFF\
-DHAVE_DNS_SD:BOOL=ON\
-DENABLE_IPV6:BOOL=OFF\
-DWITH_EXAMPLES:BOOL=ON\
"
build_with_cmake $1
}
Expand Down Expand Up @@ -270,6 +243,20 @@ build_qwt() {
pushd $STAGING_AREA/$CURRENT_BUILD
git clean -xdf

patch -p1 <<-EOF
--- a/qwtconfig.pri
+++ b/qwtconfig.pri
@@ -24,7 +24,7 @@ unix {
}
win32 {
- QWT_INSTALL_PREFIX = ""
+ QWT_INSTALL_PREFIX = "/mingw64"
# QWT_INSTALL_PREFIX = C:/Qwt-\$\$QWT_VERSION-dev-qt-\$\$QT_VERSION
}
EOF

INSTALL=$1
[ -z $INSTALL ] && INSTALL=ON

Expand All @@ -284,9 +271,7 @@ build_qwt() {
else
$QMAKE qwt.pro
make $JOBS
if [ "$INSTALL" == "ON" ];then
sudo make install
fi
make install
fi

cp $STAGING_DIR/lib/qwt.dll $STAGING_DIR/bin/qwt.dll
Expand Down Expand Up @@ -320,7 +305,7 @@ build_libsigrokdecode() {
fi

if [ "$INSTALL" == "ON" ];then
if [ "$USE_STAGING" == "ON" ]; then make install; else sudo make install; fi
make install
fi

#clean deps folder
Expand Down

0 comments on commit 80f585a

Please sign in to comment.