Skip to content

Commit

Permalink
ci/ test commit
Browse files Browse the repository at this point in the history
- libm2k not compiling locally
- some deps needed to be placed outside of the build folder

Signed-off-by: Adrian Stanea <[email protected]>
  • Loading branch information
Adrian-Stanea committed Nov 10, 2023
1 parent 75d16dc commit 29f5337
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 48 deletions.
11 changes: 3 additions & 8 deletions CI/windows/install_deps.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@

$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$COMPILER = $Env:COMPILER
$ARCH = $Env:ARCH

$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"


$SRC_DIR = Get-Location

$OUTSIDE_BUILD = [System.IO.Path]::GetDirectoryName($SRC_DIR.Path)
Expand All @@ -17,7 +12,7 @@ $DEPS_DIR = Join-Path $OUTSIDE_BUILD "deps" # save deps outside libm2k repo
$BUILD_DIR = Join-Path $SRC_DIR "build-$ARCH" #libm2k build dir
$LIBIIO_VERSION = "libiio-v0"

$DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH" #
$DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH"

Write-Output "Python located at:"
Get-Command python
Expand All @@ -41,7 +36,6 @@ if (-not (Test-Path -Path ($BUILD_DIR))) {
New-Item -Path ($BUILD_DIR) -ItemType Directory
}


function Get-Libiio-Deps { #CHECKED
param (
[string]$SRC_DIR
Expand Down Expand Up @@ -210,7 +204,8 @@ function Install-All {
Install-Swig -SRC_DIR $DEPS_DIR
Get-Libiio-Deps -SRC_DIR $DEPS_DIR
Install-Libiiio -SRC_DIR $DEPS_DIR -GENERATOR $COMPILER -ARCH $ARCH

Set-Location $SRC_DIR
}

Install-All
Install-All
86 changes: 46 additions & 40 deletions CI/windows/make_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$COMPILER = $Env:COMPILER
$ARCH = $Env:ARCH

$COMPILER = "Visual Studio 17 2022"
$ARCH = "x64"

$SRC_DIR = Get-Location
$OUTSIDE_BUILD = [System.IO.Path]::GetDirectoryName($SRC_DIR.Path)
$DEPS_DIR= Join-Path $OUTSIDE_BUILD "deps"

Write-Output "SRC DIR = $SRC_DIR"
Write-Output "COMPILER = $COMPILER"
Write-Output "ARCH = $ARCH"

# $BUILD_DIR = Join-Path $SRC_DIR "build-$ARCH"
# $DIST_DIR = Join-Path $SRC_DIR "build-$ARCH\dist"
Expand All @@ -15,16 +22,12 @@ $SRC_DIR = Get-Location
# New-Item -Path $DIST_DIR -ItemType Directory
# }


function Build-Python-Wheel {
param(
[string]$PLATFORM
[string]$PLATFORM,
[string]$PYTHON_PATH
)
# TODO: extend path to include swig => export PATH="/c/swig/;/c/swig/Lib/;$OLD_PATH" => TO BE TESTED
$OLD_PATH = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
$SWIG_PATH= (Join-Path $SRC_DIR "swig") + ";" + (Join-Path $SRC_DIR "swig\Lib")
$NEW_PATH = $SWIG_PATH + ";" + $OLD_PATH
[System.Environment]::SetEnvironmentVariable('PATH', $NEW_PATH, [System.EnvironmentVariableTarget]::Machine)

python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv
$env:COMPILE_BINDINGS = $true
Expand All @@ -37,14 +40,14 @@ function Build-Python-Wheel {

function Build-Libm2k {
param(
[string]$PLATFORM
[string]$PLATFORM,
[string]$PYTHON_VERSION,
[string]$PYTHON_PATH,
[string]$GENERATOR,
[string]$ARCH,
[string]$ARCH
)

$DIST_DIR = Join-Path $SRC_DIR "build-$PLATFORM\dist"
$DIST_DIR = Join-Path $SRC_DIR "build-$ARCH"
# Create the official build directory for this platform
if (-not (Test-Path -Path $DIST_DIR)) {
New-Item -Path $DIST_DIR -ItemType Directory
Expand All @@ -57,45 +60,48 @@ function Build-Libm2k {
}
New-Item -Path $TEMP_BUILD_DIR -ItemType Directory

# Q: do i need to add python path manually if already did this in a previous step in the CI job?
# $OLD_PATH = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
# $NEW_PATH = $SWIG_PATH + ";" + $OLD_PATH
# [System.Environment]::SetEnvironmentVariable('PATH', $NEW_PATH, [System.EnvironmentVariableTarget]::Machine)
Write-Output "DIST_DIR = $DIST_DIR"
Write-Output "TEMP_BUILD_DIR = $TEMP_BUILD_DIR"

Set-Location $TEMP_BUILD_DIR

$DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH"

$pythonExecutable = (python -c "import sys; print(sys.executable)") -replace '\\', '/'
$PATH_SWIG_DIR = (Join-Path $SRC_DIR "swig\Lib") -replace '\\', '/'
$PATH_SWIG_EXE = (Join-Path $SRC_DIR "swig\Lib\swig.exe") -replace '\\', '/'
$PATH_SWIG_DIR = (Join-Path $DEPS_DIR "swig\Lib") -replace '\\', '/'
$PATH_SWIG_EXE = (Join-Path $DEPS_DIR "swig\Lib\swig.exe") -replace '\\', '/'
$SWIG_VERSION = "4.0.0"
$IIO_LIBS_DIR= (Join-Path $SRC_DIR "deps\libiio/build-$ARCH\Release\libiio.lib") -replace '\\', '/'
$IIO_INCLUDE_DIR= (Join-Path $SRC_DIR "deps\libiio/build-$ARCH") -replace '\\', '/'

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 `
..
$IIO_LIBS_DIR= (Join-Path $DEST_LIBIIO "libiio.lib") -replace '\\', '/'
$IIO_INCLUDE_DIR= ($DEST_LIBIIO) -replace '\\', '/'

cmake --build . --config Release
Write-Output "Running cmake on generator $GENERATOR for $ARCH"
Get-ChildItem

cmake -G "$GENERATOR" -A "$ARCH" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -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 ..

cat setup.py
if ($LASTEXITCODE -ne 0) {
Write-Output "## cmake #1 failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}

$PY_SUFFIX=""
if ($PLATFORM -eq "win64") {
$PY_SUFFIX = "-x64"
Write-Output "Running second cmake"
Get-ChildItem

cmake --build . --config Release

if ($LASTEXITCODE -ne 0) {
Write-Output "## cmake #2 failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Get-ChildItem


Get-Content setup.py

# $PY_SUFFIX=""
# if ($PLATFORM -eq "win64") {
# $PY_SUFFIX = "-x64"
# }
Build-Python-Wheel -PLATFORM $PLATFORM -PYTHON_PATH $PYTHON_PATH
}

Expand Down

0 comments on commit 29f5337

Please sign in to comment.