diff --git a/cmd/ebitenmobile/gomobile.go b/cmd/ebitenmobile/gomobile.go index b50f105f2..a4ef7cd97 100644 --- a/cmd/ebitenmobile/gomobile.go +++ b/cmd/ebitenmobile/gomobile.go @@ -23,7 +23,7 @@ import ( "runtime" ) -const gomobileHash = "93619952ba7f31652358bff518518889daa7c097" +const gomobileHash = "76c259c465ba39f84de7e2751a666612ddca556b" func runCommand(command string, args []string, env []string) error { if buildX || buildN { diff --git a/cmd/ebitenmobile/main.go b/cmd/ebitenmobile/main.go index fb6db4ba7..f4d81057c 100644 --- a/cmd/ebitenmobile/main.go +++ b/cmd/ebitenmobile/main.go @@ -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 diff --git a/go.mod b/go.mod index 8ef536292..316c08d97 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 3e189b357..4b26a29ed 100644 --- a/go.sum +++ b/go.sum @@ -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=