Skip to content

Commit

Permalink
building: Add script for automating Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
selimnairb committed Nov 15, 2024
1 parent a6b5a01 commit 600a5a1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 26 deletions.
28 changes: 2 additions & 26 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,8 @@ Download [swigwin-4.3.0](https://www.swig.org/download.html) and upzip to
> Note: You must run `install.ps1` from an admin shell since libxml2 creates symlinks and
> Windows doesn't allow this from normal user shells.
Now, the build BAG, do the following:
```pwsh
$env:ARCHITECTURE="amd64"
. "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch $env:ARCHITECTURE
$env:CC="cl.exe"
$env:CXX="cl.exe"
cmake -G "Visual Studio 17 2022" -B build -S . -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH=docs\win-build\baglibs\install `
-DCMAKE_INSTALL_PREFIX=docs\win-build\baglibs\install -DBUILD_SHARED_LIBS=ON `
-DBAG_BUILD_TESTS:BOOL=ON -DBAG_CI=ON -DCMAKE_OBJECT_PATH_MAX=1024
cmake --build build --config Release --target install
$env:PATH=$env:PATH + ";build\api\Release;docs\win-build\baglibs\install\bin"
$env:BAG_SAMPLES_PATH="examples\sample-data"
build\tests\Release\bag_tests.exe
python -m venv win-venv
& .\win-venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
$env:CMAKE_PREFIX_PATH="$PWD\docs\win-build\baglibs\install"
$env:SWIG_EXECUTABLE="$PWD\docs\win-build\baglibs\install\swigwin-4.3.0\swig.exe"
python -m pip wheel -w .\wheel\ .\build\api\swig\python
$whl_path=Resolve-Path ".\wheel\bagPy-*.whl"
python -m pip install $whl_path
$env:BAG_BIN = "$PWD\docs\win-build\baglibs\install\bin"
python -m pytest .\python\test_dataset.py
```
Now, the build BAG, run the PowerShell script [win-build.ps1](../scripts/win-build.ps1). This will also
run the C++ and Python tests.

### Dependencies from Miniconda

Expand Down
43 changes: 43 additions & 0 deletions scripts/win-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Cleanup
if(test-path build) {
Remove-Item -Recurse -Force build
}
if(test-path wheel) {
Remove-Item -Recurse -Force wheel
}

$env:ARCHITECTURE="amd64"
. "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch $env:ARCHITECTURE

# Make sure the current directory is the content root of the repo after setting up VsDevShell
$content_root=Resolve-Path "$PSScriptRoot\.."
pushd $content_root

$env:CC="cl.exe"
$env:CXX="cl.exe"
cmake -G "Visual Studio 17 2022" -B build -S . -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH=docs\win-build\baglibs\install `
-DCMAKE_INSTALL_PREFIX=docs\win-build\baglibs\install -DBUILD_SHARED_LIBS=ON `
-DBAG_BUILD_TESTS:BOOL=ON -DBAG_CI=ON -DCMAKE_OBJECT_PATH_MAX=1024
cmake --build build --config Release --target install
$env:PATH=$env:PATH + ";build\api\Release;docs\win-build\baglibs\install\bin"
$env:BAG_SAMPLES_PATH="examples\sample-data"
build\tests\Release\bag_tests.exe
python -m venv win-venv
& .\win-venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
$env:CMAKE_PREFIX_PATH="$PWD\docs\win-build\baglibs\install"
$env:SWIG_EXECUTABLE="$PWD\docs\win-build\baglibs\install\swigwin-4.3.0\swig.exe"
python -m pip wheel -w .\wheel\ .\build\api\swig\python
$whl_path=Resolve-Path ".\wheel\bagPy-*.whl"
python -m pip install $whl_path
$env:BAG_BIN = "$PWD\docs\win-build\baglibs\install\bin"
python -m pytest .\python\test_compat_bag15.py .\python\test_compounddatatype.py .\python\test_dataset.py .\python\test_descriptor.py `
.\python\test_interleavedlegacylayer.py .\python\test_interleavedlegacylayerdescriptor.py `
.\python\test_metadata.py .\python\test_record.py .\python\test_simplelayer.py `
.\python\test_simplelayerdescriptor.py .\python\test_surfacecorrections.py `
.\python\test_surfacecorrectionsdescriptor.py .\python\test_trackinglist.py .\python\test_valuetable.py `
.\python\test_vrmetadata.py .\python\test_vrmetadatadescriptor.py .\python\test_vrnode.py `
.\python\test_vrnodedescriptor.py .\python\test_vrrefinements.py .\python\test_vrrefinementsdescriptor.py `
.\python\test_vrtrackinglist.py

0 comments on commit 600a5a1

Please sign in to comment.