From d2adbd343c765afc717da9a99551acc83a491986 Mon Sep 17 00:00:00 2001 From: Andreea Andrisan Date: Thu, 12 Sep 2024 13:16:59 +0300 Subject: [PATCH] CI:azure:windows_build_deps.cmd: builds windows msvc dependencies This script will clone and download different dependencies of the libiio in order to build them with the msvc compiler. Using msbuild that is the visual studio program designed for terminal builds of visual studio projects. Signed-off-by: Andreea Andrisan --- CI/azure/windows_build_deps.cmd | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 CI/azure/windows_build_deps.cmd diff --git a/CI/azure/windows_build_deps.cmd b/CI/azure/windows_build_deps.cmd new file mode 100644 index 000000000..ca46a613e --- /dev/null +++ b/CI/azure/windows_build_deps.cmd @@ -0,0 +1,40 @@ +:: this script will download and build the necessary dependencies of libiio for windows operating systems +:: if is run from the root of the libiio project all the dependencies will be found in the deps folder of the project +:: in case you already have some dependencies build just comment them in the script and during compilation of libiio specify the path +:: export as environment variables the ARCH, PLATFORM_TOOLSET and COMPILER used for visual studio build +:: ex: set ARCH=x64, PLATFROM_TOOLSET=v143 and COMPILER='Visual Studio 17 2022' for VS2022 + +IF not exist .\deps ( + echo Directory does not exist. Creating it... + mkdir .\deps +) ELSE ( + echo Directory already exists. + cd .\deps +) +choco install -y wget + +:: set the msbuild compiler in order to build from terminal the visual studio projects +SETLOCAL ENABLEDELAYEDEXPANSION +IF "%COMPILER%" == "Visual Studio 16 2019" SET vswhere_params=-version [16,17) -products * +IF "%COMPILER%" == "Visual Studio 17 2022" SET vswhere_params=-version [17,18) -products * +SET vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +FOR /F "USEBACKQ TOKENS=*" %%F IN (`%vswhere% !vswhere_params! -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) DO ( +SET msbuild="%%F" +) +:: clone the zstd repo and build it with the desierd configuration +git clone --branch v1.5.6 https://github.com/facebook/zstd.git +%msbuild% .\zstd\build\VS2010\zstd.sln /p:Platform=%ARCH% /p:Configuration=Release /p:PlatformToolset=%PLATFORM_TOOLSET% + +:: download libusb release +wget https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z +7z x -y .\libusb-1.0.27.7z -o".\libusb" + +:: download and build libxml2 library with cmake +wget https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz +cmake -E tar xf .\libxml2-2.9.14.tar.xz +cmake -DCMAKE_INSTALL_PREFIX=libxml2-install -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ZLIB=OFF -S .\libxml2-2.9.14\ -B libxml2-build +cmake --build libxml2-build --config Release --target install + +:: clone and build libserialport project +git clone https://github.com/sigrokproject/libserialport.git +%msbuild% .\libserialport\libserialport.vcxproj /p:Platform=%ARCH% /p:Configuration=Release /p:PlatformToolset=%PLATFORM_TOOLSET%