Skip to content
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
31 changes: 28 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,47 @@ jobs:
command: Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force
- attach_workspace:
at: .\repos
- run: .\repos\win_scripts\build_kaleido.ps1
- run: .\repos\win_scripts\build_kaleido.ps1 x64
- run: dir .\repos\build\kaleido
- run: dir .\repos\kaleido\py\dist
- store_artifacts:
path: ./repos/build/kaleido_win.zip
- store_artifacts:
path: ./repos/kaleido/py/kaleido_wheel.zip


windows_build-32:
executor:
name: win/default
size: "xlarge"
shell: powershell.exe
steps:
- checkout
- run:
name: Update PowerShell.Archive to fix slash direction
command: Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force
- attach_workspace:
at: .\repos
- run: .\repos\win_scripts\build_kaleido.ps1 x86
- run: dir .\repos\build\kaleido
- run: dir .\repos\kaleido\py\dist
- store_artifacts:
path: ./repos/build/kaleido_win.zip
- store_artifacts:
path: ./repos/kaleido/py/kaleido_wheel.zip

workflows:
build-windows:
jobs:
- windows_fetch
- windows_build:
requires:
- windows_fetch

build-windows-32:
jobs:
- windows_fetch
- windows_build-32:
requires:
- windows_fetch
build-mac:
jobs:
- mac_fetch
Expand Down
7 changes: 7 additions & 0 deletions repos/kaleido/py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ def run(self):
# Use current platform as plat_name, but replace linux with manylinux2014
cmd_obj.plat_name = distutils.util.get_platform().replace("linux-", "manylinux1-")

# Handle windows 32-bit cross compilation
print(os.environ.get("KALEIDO_ARCH", "x64"))
if cmd_obj.plat_name.startswith("win-"):
arch = os.environ.get("KALEIDO_ARCH", "x64")
if arch == "x86":
cmd_obj.plat_name = "win32"
print(cmd_obj.plat_name)
# Set macos platform to 10.10 to match chromium build target (See build/config/mac/mac_sdk.gni)
# rather than Python environment
if cmd_obj.plat_name.startswith("macosx"):
Expand Down
2 changes: 2 additions & 0 deletions repos/win_scripts/args.gn → repos/win_scripts/args_x64.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ symbol_level=0
blink_symbol_level=0
is_debug=false
is_component_build=false

target_cpu = "x64"
18 changes: 18 additions & 0 deletions repos/win_scripts/args_x86.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copied windows compatible options from //build/args/headless.gn
# Embed resource.pak into binary to simplify deployment.
headless_use_embedded_resources = true

# Use embedded data instead external files for headless in order
# to simplify deployment.
v8_use_external_startup_data = false

enable_nacl = false
enable_remoting = false

# Debug / symbols
symbol_level=0
blink_symbol_level=0
is_debug=false
is_component_build=false

target_cpu = "x86"
27 changes: 15 additions & 12 deletions repos/win_scripts/build_kaleido.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
& {
$arch = $args[0]
echo $arch
if (-not ($arch -eq "x86" -or $arch -eq "x64")) {
throw "Invalid architecture,: must be one of x86 or x64: received $arch"
}

# cd to repos directory
cd $PSScriptRoot\..
Expand Down Expand Up @@ -29,12 +33,12 @@ $env:DEPOT_TOOLS_WIN_TOOLCHAIN=0
cd src

# Make output directory
if (-Not (Test-Path out\Kaleido_win)) {
New-Item -Path out\Kaleido_win -ItemType "directory" -ErrorAction Ignore
if (-Not (Test-Path out\Kaleido_win_$arch)) {
New-Item -Path out\Kaleido_win_$arch -ItemType "directory" -ErrorAction Ignore
}

# Write out/Kaleido_win/args.gn
Copy-Item ..\win_scripts\args.gn -Destination out\Kaleido_win
Copy-Item ..\win_scripts\args_$arch.gn -Destination out\Kaleido_win_$arch\args.gn

# Copy kaleido/kaleido.cc to src/headless/app/kaleido.cc
if (Test-Path headless\app\scopes) {
Expand All @@ -43,8 +47,8 @@ if (Test-Path headless\app\scopes) {
Copy-Item ..\kaleido\cc\* -Destination headless\app\ -Recurse

# Perform build, result will be out/Kaleido_win/kaleido
gn gen out\Kaleido_win
ninja -C out\Kaleido_win -j 16 kaleido
gn gen out\Kaleido_win_$arch
ninja -C out\Kaleido_win_$arch -j 16 kaleido

# Copy build files
if (-Not (Test-Path ..\build\kaleido)) {
Expand All @@ -53,8 +57,8 @@ if (-Not (Test-Path ..\build\kaleido)) {
Remove-Item -Recurse -Force ..\build\kaleido\* -ErrorAction Ignore
New-Item -Path ..\build\kaleido\bin -ItemType "directory"

Copy-Item out\Kaleido_win\kaleido.exe -Destination ..\build\kaleido\bin -Recurse
Copy-Item out\Kaleido_win\swiftshader -Destination ..\build\kaleido\bin -Recurse
Copy-Item out\Kaleido_win_$arch\kaleido.exe -Destination ..\build\kaleido\bin -Recurse
Copy-Item out\Kaleido_win_$arch\swiftshader -Destination ..\build\kaleido\bin -Recurse

# version
cp ..\kaleido\version ..\build\kaleido\
Expand All @@ -63,7 +67,7 @@ cp ..\kaleido\version ..\build\kaleido\
cp ..\kaleido\LICENSE.txt ..\build\kaleido\

# Copy icudtl.dat
Copy-Item .\out\Kaleido_win\icudtl.dat -Destination ..\build\kaleido\bin
Copy-Item .\out\Kaleido_win_$arch\icudtl.dat -Destination ..\build\kaleido\bin

# Copy javascript
cd ..\kaleido\js\
Expand All @@ -86,6 +90,7 @@ Copy-Item ..\win_scripts\kaleido.cmd -Destination ..\build\kaleido\

# Build python wheel
cd ../kaleido/py
$env:KALEIDO_ARCH=$arch
python setup.py package

# Change up to kaleido/ directory
Expand All @@ -101,6 +106,4 @@ Compress-Archive -Path ..\build\kaleido -DestinationPath ..\build\kaleido_win.zi
if (Test-Path ..\kaleido\py\kaleido_wheel.zip) {
Remove-Item -Recurse -Force ..\kaleido\py\kaleido_wheel.zip
}
Compress-Archive -Path ..\kaleido\py\dist -DestinationPath ..\kaleido\py\kaleido_wheel.zip

}
Compress-Archive -Path ..\kaleido\py\dist -DestinationPath ..\kaleido\py\kaleido_wheel.zip