diff --git a/.circleci/config.yml b/.circleci/config.yml index 5718e58c..ebd40317 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,14 +169,34 @@ 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: @@ -184,7 +204,12 @@ workflows: - windows_build: requires: - windows_fetch - + build-windows-32: + jobs: + - windows_fetch + - windows_build-32: + requires: + - windows_fetch build-mac: jobs: - mac_fetch diff --git a/repos/kaleido/py/setup.py b/repos/kaleido/py/setup.py index 897f63be..95eced3b 100644 --- a/repos/kaleido/py/setup.py +++ b/repos/kaleido/py/setup.py @@ -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"): diff --git a/repos/win_scripts/args.gn b/repos/win_scripts/args_x64.gn similarity index 92% rename from repos/win_scripts/args.gn rename to repos/win_scripts/args_x64.gn index fbd6d732..efcbc374 100644 --- a/repos/win_scripts/args.gn +++ b/repos/win_scripts/args_x64.gn @@ -14,3 +14,5 @@ symbol_level=0 blink_symbol_level=0 is_debug=false is_component_build=false + +target_cpu = "x64" \ No newline at end of file diff --git a/repos/win_scripts/args_x86.gn b/repos/win_scripts/args_x86.gn new file mode 100644 index 00000000..19aad93d --- /dev/null +++ b/repos/win_scripts/args_x86.gn @@ -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" \ No newline at end of file diff --git a/repos/win_scripts/build_kaleido.ps1 b/repos/win_scripts/build_kaleido.ps1 index 92c20a02..e5613211 100644 --- a/repos/win_scripts/build_kaleido.ps1 +++ b/repos/win_scripts/build_kaleido.ps1 @@ -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\.. @@ -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) { @@ -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)) { @@ -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\ @@ -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\ @@ -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 @@ -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 - -} \ No newline at end of file +Compress-Archive -Path ..\kaleido\py\dist -DestinationPath ..\kaleido\py\kaleido_wheel.zip \ No newline at end of file