Skip to content

Commit

Permalink
Updated various extension docs
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Sep 24, 2024
1 parent 37b6fb1 commit e710aed
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 172 deletions.
6 changes: 3 additions & 3 deletions docs/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,8 @@
"name": "Debugging"
},
{
"path": "/manuals/extensions-build-variants",
"name": "Build Variants"
"path": "/manuals/extensions-ext-manifest",
"name": "Extension Manifests"
},
{
"path": "/manuals/app-manifest",
Expand All @@ -1564,7 +1564,7 @@
"name": "Manifest Merging"
},
{
"path": "https://lua.msys.ch/lua-integration-guide.html#_the_lua_c_api",
"path": "https://www.lua.org/pil/contents.html#P4",
"name": "The Lua C API (external)"
},
{
Expand Down
125 changes: 0 additions & 125 deletions docs/en/manuals/extensions-build-variants.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/en/manuals/extensions-defold-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ The available SDK functions are documented in our [API reference](/ref/dmExtensi
* [Shared Library](/ref/sharedlibrary/) - Utility functions for shared library export/import.
* [Sony vector Math Library](../assets/Vector_Math_Library-Overview.pdf) - The Sony Vector Math library mainly provides functions used in 3-D graphics for 3-D and 4-D vector operations, matrix operations, and quaternion operations.

If you need the `dmsdk/sdk.h` header file for code completion in your editor of choice it can be found [here in the main GitHub repository for Defold](https://github.com/defold/defold/blob/dev/engine/sdk/src/dmsdk/sdk.h) with [header files for the individual namespaces here](https://github.com/defold/defold/tree/dev/engine/dlib/src/dmsdk/dlib).
The Defold SDK headers are included as a separate `defoldsdk_headers.zip` archive for each Defold [release on GitHub](https://github.com/defold/defold/releases). You can use these headers for code completion in your editor of choice.
74 changes: 74 additions & 0 deletions docs/en/manuals/extensions-ext-manifests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Native extensions - extension manifest
brief: This manual describes the extension manifest and how it correlates to the application manifest.
---

# Extension manifest

The extension manifest is a configuration file with flags and defines used when building a single extension. This configuration is combined with an application level configuration and a base level configuration for the Defold engine itself.

## App Manifest

The application manifest (file extension `.appmanifest`) is an application level configuration of how to build your game on the build servers. The application manifest lets you remove parts of the engine that you don't use. If you don't need a physics engine, you can remove that from the executable to reduce it's size. Learn how to exclude unused feature [in the application manifest manual](/manuals/app-manifest).

## Engine manifest

The Defold engine has a build manifest (`build.yml`) which is included with each release of the engine and the Defold SDK. The manifest controls which SDK versions to use, which compilers, linkers and other tools to run and which default build and link flags to pass to these tools. The manifest can be found in share/extender/build_input.yml [on GitHub](https://github.com/defold/defold/blob/dev/share/extender/build_input.yml).

## Extension Manifest

The extension manifest (`ext.manifest`) on the other hand is a configuration file specifically for an extension. The extension manifest controls how the source code of the extension is compiled and linked and which additional libraries to include.

The three different manifest files all share the same syntax so that they can be merged and fully control how the extensions and the game is built.

For each extension that is built, the manifests are combined as follows:

manifest = merge(game.appmanifest, ext.manifest, build.yml)

This allows the user to override the default behaviour of the engine and also each extension. And, for the final link stage, we merge the app manifest with the defold manifest:

manifest = merge(game.appmanifest, build.yml)


### The ext.manifest file

Apart from the name of the extension, the manifest file can contain platform specific compile flags, link flags, libs and frameworks. If the *ext.manifest* file does not contain a "platforms" segment, or a platform is missing from the list, the platform you bundle for will still build, but without any extra flags set.

Here is an example:

```yaml
name: "AdExtension"

platforms:
arm64-ios:
context:
frameworks: ["CoreGraphics", "CFNetwork", "GLKit", "CoreMotion", "MessageUI", "MediaPlayer", "StoreKit", "MobileCoreServices", "AdSupport", "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreMotion", "CoreTelephony", "CoreVideo", "Foundation", "GLKit", "JavaScriptCore", "MediaPlayer", "MessageUI", "MobileCoreServices", "OpenGLES", "SafariServices", "StoreKit", "SystemConfiguration", "UIKit", "WebKit"]
flags: ["-stdlib=libc++"]
linkFlags: ["-ObjC"]
libs: ["z", "c++", "sqlite3"]
defines: ["MY_DEFINE"]

armv7-ios:
context:
frameworks: ["CoreGraphics", "CFNetwork", "GLKit", "CoreMotion", "MessageUI", "MediaPlayer", "StoreKit", "MobileCoreServices", "AdSupport", "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreMotion", "CoreTelephony", "CoreVideo", "Foundation", "GLKit", "JavaScriptCore", "MediaPlayer", "MessageUI", "MobileCoreServices", "OpenGLES", "SafariServices", "StoreKit", "SystemConfiguration", "UIKit", "WebKit"]
flags: ["-stdlib=libc++"]
linkFlags: ["-ObjC"]
libs: ["z", "c++", "sqlite3"]
defines: ["MY_DEFINE"]
```
#### Allowed keys
Allowed keys are for platform specific compile flags are:
* `frameworks` - Apple frameworks to include when building (iOS and OSX)
* `flags` - Flags that should be passed to the compiler
* `linkFlags` - Flags that should be passed to the linker
* `libs` - Additional libraries to include when linking
* `defines` - Defines to set when building
* `aaptExtraPackages` - Extra package name that should be generated (Android)
* `aaptExcludePackages` - Regexp (or exact names) of packages to exclude (Android)
* `aaptExcludeResourceDirs` - Regexp (or exact names) of resource dirs to exclude (Android)
* `excludeLibs`, `excludeJars`, `excludeSymbols` - These flags are used to remove things previously defined in the platform context.

For all the keywords, we apply white listing filter. This is to avoid illegal path handling and accessing files outside of the build upload folder.
43 changes: 1 addition & 42 deletions docs/en/manuals/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Defold provides a zero setup entry point to native extensions with a cloud based

![Cloud build](images/extensions/cloud_build.png)

Defold provides the cloud build server free of charge, without any usage restrictions. The server is hosted in Europe, and the URL to which native code is sent is configured in the [Editor Preferences window](/manuals/editor-preferences/#extensions) or through the `--build-server` command line option to [bob](/manuals/bob/#usage). If you wish to learn more about the cloud build server or how to set up your own server please refer to the [instructions on GitHub](https://github.com/defold/extender).
Defold provides the cloud build server free of charge, without any usage restrictions. The server is hosted in Europe, and the URL to which native code is sent is configured in the [Editor Preferences window](/manuals/editor-preferences/#extensions) or through the `--build-server` command line option to [bob](/manuals/bob/#usage). If you wish to set up your own server please [follow these instructions](/manuals/extender-local-setup).

## Project layout

Expand Down Expand Up @@ -233,47 +233,6 @@ The following identifiers are defined by the builder on each respective platform

Build server logs are available when the project is using native extensions. The build server log (`log.txt`) is downloaded together with the custom engine when the project is built and stored inside the file `.internal/%platform%/build.zip` and also unpacked to the build folder of your project.


## The ext.manifest file

Apart from the name of the extension, the manifest file can contain platform specific compile flags, link flags, libs and frameworks. If the *ext.manifest* file does not contain a "platforms" segment, or a platform is missing from the list, the platform you bundle for will still build, but without any extra flags set.

Here is an example:

```yaml
name: "AdExtension"

platforms:
arm64-ios:
context:
frameworks: ["CoreGraphics", "CFNetwork", "GLKit", "CoreMotion", "MessageUI", "MediaPlayer", "StoreKit", "MobileCoreServices", "AdSupport", "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreMotion", "CoreTelephony", "CoreVideo", "Foundation", "GLKit", "JavaScriptCore", "MediaPlayer", "MessageUI", "MobileCoreServices", "OpenGLES", "SafariServices", "StoreKit", "SystemConfiguration", "UIKit", "WebKit"]
flags: ["-stdlib=libc++"]
linkFlags: ["-ObjC"]
libs: ["z", "c++", "sqlite3"]
defines: ["MY_DEFINE"]

armv7-ios:
context:
frameworks: ["CoreGraphics", "CFNetwork", "GLKit", "CoreMotion", "MessageUI", "MediaPlayer", "StoreKit", "MobileCoreServices", "AdSupport", "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreMotion", "CoreTelephony", "CoreVideo", "Foundation", "GLKit", "JavaScriptCore", "MediaPlayer", "MessageUI", "MobileCoreServices", "OpenGLES", "SafariServices", "StoreKit", "SystemConfiguration", "UIKit", "WebKit"]
flags: ["-stdlib=libc++"]
linkFlags: ["-ObjC"]
libs: ["z", "c++", "sqlite3"]
defines: ["MY_DEFINE"]
```
### Allowed keys
Allowed keys are for platform specific compile flags are:
* `frameworks` - Apple frameworks to include when building (iOS and OSX)
* `flags` - Flags that should be passed to the compiler
* `linkFlags` - Flags that should be passed to the linker
* `libs` - Libraries to include when linking
* `defines` - Defines to set when building
* `aaptExtraPackages` - Extra package name that should be generated (Android)
* `aaptExcludePackages` - Regexp (or exact names) of packages to exclude (Android)
* `aaptExcludeResourceDirs` - Regexp (or exact names) of resource dirs to exclude (Android)

## Example extensions

* [Basic extension example](https://github.com/defold/template-native-extension) (the extension from this manual)
Expand Down
2 changes: 1 addition & 1 deletion docs/en/shared/platforms.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Supported platforms are `ios`, `android`, `osx`, `win32`, `linux`, `web`.

Supported `arc-platform` pairs are `armv7-ios`, `arm64-ios`, `x86_64-ios`, `armv7-android`, `arm64-android`, `x86-osx`, `x86_64-osx`, `x86-win32`, `x86_64-win32`, `x86_64-linux`, `js-web` and `wasm-web`.
Supported `arc-platform` pairs are `arm64-ios`, `x86_64-ios`, `armv7-android`, `arm64-android`, `arm64-osx`, `x86_64-osx`, `x86-win32`, `x86_64-win32`, `x86_64-linux`, `js-web` and `wasm-web`.

0 comments on commit e710aed

Please sign in to comment.