This commit is contained in:
Hajime Hoshi 2021-07-13 19:37:19 +09:00
parent 7417eb677f
commit deb5f6f180
4 changed files with 38 additions and 36 deletions

View File

@ -23,7 +23,7 @@ import (
"runtime"
)
const gomobileHash = "93619952ba7f31652358bff518518889daa7c097"
const gomobileHash = "76c259c465ba39f84de7e2751a666612ddca556b"
func runCommand(command string, args []string, env []string) error {
if buildX || buildN {

View File

@ -221,42 +221,44 @@ func doBind(args []string, flagset *flag.FlagSet, buildOS string) error {
}
if buildOS == "darwin" {
dir := filepath.Join(buildO, "Versions", "A")
for _, target := range []string{"ios", "simulator", "catalyst", "macos"} {
dir := filepath.Join(target, buildO, "Versions", "A")
if err := ioutil.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
return err
}
// TODO: Remove 'Ebitenmobileview.objc.h' here. Now it is hard since there is a header file importing
// that header file.
fs, err := ioutil.ReadDir(filepath.Join(dir, "Headers"))
if err != nil {
return err
}
var headerFiles []string
for _, f := range fs {
if strings.HasSuffix(f.Name(), ".h") {
headerFiles = append(headerFiles, f.Name())
if err := ioutil.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
return err
}
}
// TODO: Remove 'Ebitenmobileview.objc.h' here. Now it is hard since there is a header file importing
// that header file.
w, err := os.OpenFile(filepath.Join(dir, "Modules", "module.modulemap"), os.O_WRONLY, 0644)
if err != nil {
return err
}
defer w.Close()
var mmVals = struct {
Module string
Headers []string
}{
Module: prefixUpper,
Headers: headerFiles,
}
if err := iosModuleMapTmpl.Execute(w, mmVals); err != nil {
return err
}
fs, err := ioutil.ReadDir(filepath.Join(dir, "Headers"))
if err != nil {
return err
}
var headerFiles []string
for _, f := range fs {
if strings.HasSuffix(f.Name(), ".h") {
headerFiles = append(headerFiles, f.Name())
}
}
// TODO: Remove Ebitenmobileview.objc.h?
w, err := os.OpenFile(filepath.Join(dir, "Modules", "module.modulemap"), os.O_WRONLY, 0644)
if err != nil {
return err
}
defer w.Close()
var mmVals = struct {
Module string
Headers []string
}{
Module: prefixUpper,
Headers: headerFiles,
}
if err := iosModuleMapTmpl.Execute(w, mmVals); err != nil {
return err
}
// TODO: Remove Ebitenmobileview.objc.h?
}
}
return nil

2
go.mod
View File

@ -12,7 +12,7 @@ require (
github.com/jakecoffman/cp v1.1.0
github.com/jfreymuth/oggvorbis v1.0.3
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
golang.org/x/mobile v0.0.0-20210701032007-93619952ba7f
golang.org/x/mobile v0.0.0-20210710064935-76c259c465ba
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210510120138-977fb7262007
golang.org/x/tools v0.1.2

4
go.sum
View File

@ -38,8 +38,8 @@ golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mobile v0.0.0-20210701032007-93619952ba7f h1:y/B+7vjMun05cWPZ1aMq+JQULM63ZrxqOSA3wIyPs/c=
golang.org/x/mobile v0.0.0-20210701032007-93619952ba7f/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E=
golang.org/x/mobile v0.0.0-20210710064935-76c259c465ba h1:vmJktSw4DoCP759f9XyhgVoL+AX9FsJr7pdS13s4ySE=
golang.org/x/mobile v0.0.0-20210710064935-76c259c465ba/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=