This build script is an example of how to automate GodotPython builds by using custom build templates for Mac OSX builds. For more instructions on how to make custom build templates check out: https://godotforums.org/discussion/20550/how-to-create-export-templates
project:
addons:
pythonscript:
osx-64:
bin
include
lib
licenses
libpythonscript.dylib
lib: # <------- Location of all project Python files
python_based_node.py # <--- A Node that is defined using Python
python_based_scene.tscn # <---- A Scene that references the node above.
misc_resource.tscn
misc_resources_dir
project.godot
# And a build_templates directory strcutured as:
build_templates:
osx-64:
osx_template.source.app
windows:
another_build_template
linux:
a_linux_build_template
At a high level, here is the flow:
- Copy a blank OS-specific build template (as described in Godot forums)
- Copy the files from
addons/pythonscript/osx-64/
into the build template (in my case for MacOS this isbuild_template.app/Contents/Frameworks/
) but this is basically the same location where GDNative DLL files ends up on their respective operating system. - Copy the files from
path/to/project/lib
directory (i.e. all the python files from my project) are copied into the embedded python location in the bundle. In my case this begins inaddons/pythonscript/osx-64/lib/python3.8/site-packages
and then ends up inbuild_template.app/Contents/Frameworks/lib/python3.8/site-packages/lib
- Once all the python files have been copied, make a zip archive from the build template.
- Set the
custom_template/release
andcustom_template/debug
values inProjectSettings
to the absolute paths of your output build template zip file. - Export your project and all the GodotPython files be in their correct location alongside the DLLs.