-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
一. (先不管)Godot运行时包含
gdspxrt2.1.36 + gdspxrt2.1.36.pck + runtime.gdextension
二. go动态库编译流程(可看重构后的版本https://github.com/goplus/spx/pull/1071)
func (pself *CmdTool) BuildDll() error {
// 1. Restore original files (undoing a potential previous step)
if err := pself.restoreFiles(); err != nil {
return err
}
// 2. Determine the list of target architectures.
targetArchs, err := pself.determineTargetArchs()
if err != nil {
return err
}
// 3. Generate Go code and get tags
tagStr := pself.genGo()
// 4. Execute the build for each target architecture inside GoDir.
return pself.withGoDir(func() error {
if err := pself.executeDllBuild(targetArchs, tagStr); err != nil {
return err
}
// 5. Final check: ensure the resulting library path is set.
if pself.LibPath == "" {
return fmt.Errorf("build error: cannot find matched dylib for runtime arch %s", runtime.GOARCH)
}
return nil
})
}
- 根据架构选择环境变量(加上CGO_ENABLED=1)
示例:envs=[CGO_ENABLED=1 GOARCH=arm64] - 编译动态库(重构后去掉了-tags=simulation ),-o指定路径
示例:[go build -buildmode=c-shared -o /Users/mac/qiniu/spx/tutorial/00-Hello/project/lib/gdspx-darwin-arm64.dylib]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels