Support cross-compiling Windows binaries on Linux
This defines another mutator between HostOrDevice and Arch that will
expand host modules into a module for each host type
(Darwin/Linux/Windows) that is currently being built.
Change-Id: I4c8ac6b616c229f6bd45ad8a35902652fb6a4fff
diff --git a/common/variable.go b/common/variable.go
index 9a5998f..5b9092f 100644
--- a/common/variable.go
+++ b/common/variable.go
@@ -17,6 +17,7 @@
import (
"fmt"
"reflect"
+ "runtime"
"strings"
"github.com/google/blueprint/proptools"
@@ -69,6 +70,10 @@
HostArch *string `json:",omitempty"`
HostSecondaryArch *string `json:",omitempty"`
+
+ CrossHost *string `json:",omitempty"`
+ CrossHostArch *string `json:",omitempty"`
+ CrossHostSecondaryArch *string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
@@ -99,6 +104,11 @@
DeviceSecondaryCpuVariant: stringPtr("denver"),
DeviceSecondaryAbi: &[]string{"armeabi-v7a"},
}
+
+ if runtime.GOOS == "linux" {
+ v.CrossHost = stringPtr("windows")
+ v.CrossHostArch = stringPtr("x86")
+ }
}
func variableMutator(mctx AndroidBottomUpMutatorContext) {