Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Conversation

@stuartmorgan-g
Copy link
Contributor

This is not sufficient to make a working arm64 build for Windows, but it adds the buildroot plumbing to at least start experimenting:

  • Fixes build_config.h to recognize the MSVC define for arm64 builds.
  • Allows for differing host and target toolchains when building for Windows.
  • Adds arm64 toolchain definitions.
  • Sets target flags for Windows clang builds based on architecture (and moving the recently added -m32 from being hard-coded in the toolchain to being a cflag).
  • Fixes several Windows configurations that had an if (x64) { ... } else { assume x86 } structure to include arm64, and to error out for unhandled configurations so that if we ever need to add more architectures these places will be easier to find (instead of silently doing the wrong thing).
  • Adds arm64 support to setup_toolchain.py.

In general, these changes are taken from looking at how Chromium's versions of these files evolved for Windows arm64 support.

stuartmorgan-g added a commit to stuartmorgan-g/engine that referenced this pull request Jul 30, 2020
- Rolls buildroot to pick up
  flutter/buildroot#389
- Adds support to the gn wrapper for setting the traget CPU on Windows

Attempting to generate Windows arm64 GN files will currently fail, due
to lack of arm64 support for an OpenGL test support target, but this
sets the foundation, and makes experimentation easier.

Part of flutter/flutter#62597
Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome.

#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__aarch64__)
#elif defined(__aarch64__) || defined(_M_ARM64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really surprised just __aarch64__ for Clang on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we still support non-clang local builds, at least in theory.

}
} else if (is_win) {
if (is_clang) {
if (current_cpu == "x86") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does x86 actually work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No clue; all the support has been there since before we forked. My guess based on this experience and also reviving the stale Windows clang code is that in terms of just our build system, it's probably more or less working, and the problems would be all the expected issues with Dart.

We could theoretically rip it all out, but I don't want to mix that with this PR. (And since we have an open-even-if-unlikely-to-be-addressed issue requesting x86 Windows support, I'm not sure we actually want to go out of our way to do that.)

@stuartmorgan-g stuartmorgan-g merged commit 292ac48 into flutter:master Aug 3, 2020
@stuartmorgan-g stuartmorgan-g deleted the windows-arm-buildroot branch August 3, 2020 16:24
stuartmorgan-g added a commit to flutter/engine that referenced this pull request Aug 4, 2020
- Rolls buildroot to pick up
  flutter/buildroot#389
- Adds support to the gn wrapper for setting the traget CPU on Windows

Attempting to generate Windows arm64 GN files will currently fail, due
to lack of arm64 support for an OpenGL test support target, but this
sets the foundation, and makes experimentation easier.

Part of flutter/flutter#62597
chinmaygarde pushed a commit to chinmaygarde/flutter_buildroot that referenced this pull request May 4, 2021
This is not sufficient to make a working arm64 build for Windows, but it adds the buildroot plumbing to at least start experimenting:
- Fixes build_config.h to recognize the MSVC define for arm64 builds.
- Allows for differing host and target toolchains when building for Windows.
- Adds arm64 toolchain definitions.
- Sets target flags for Windows clang builds based on architecture (and moving the recently added -m32 from being hard-coded in the toolchain to being a cflag).
- Fixes several Windows configurations that had an `if (x64) { ... } else { assume x86 }` structure to include arm64, and to error out for unhandled configurations so that if we ever need to add more architectures these places will be easier to find (instead of silently doing the wrong thing).
- Adds arm64 support to setup_toolchain.py.

In general, these changes are taken from looking at how Chromium's versions of these files evolved for Windows arm64 support.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants