Merge pull request #960 from akien-mga/godot-headers-is-dead-long-live-godot-headers
Rename godot-headers to gdextension, move header to top folderpull/962/head
commit
a0b0560e20
|
@ -2,8 +2,8 @@
|
||||||
# CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug)
|
# CMAKE_BUILD_TYPE: Compilation target (Debug or Release defaults to Debug)
|
||||||
#
|
#
|
||||||
# godot-cpp cmake arguments
|
# godot-cpp cmake arguments
|
||||||
# GODOT_HEADERS_DIR: Custom include path for the GDExtension. It should include interface header at this subpath: godot/gdextension_interface.h
|
# GODOT_GDEXTENSION_DIR: Path to the directory containing GDExtension interface header and API JSON file
|
||||||
# GODOT_CUSTOM_API_FILE: Custom path for extension_api.json
|
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
|
||||||
# FLOAT_TYPE Floating-point precision (32, 64)
|
# FLOAT_TYPE Floating-point precision (32, 64)
|
||||||
#
|
#
|
||||||
# Android cmake arguments
|
# Android cmake arguments
|
||||||
|
@ -57,9 +57,14 @@ if(NOT DEFINED BITS)
|
||||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Input from user for godot headers and the api file
|
# Input from user for GDExtension interface header and the API JSON file
|
||||||
set(GODOT_HEADERS_DIR "godot-headers" CACHE STRING "")
|
set(GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "")
|
||||||
set(GODOT_CUSTOM_API_FILE "godot-headers/extension_api.json" CACHE STRING "")
|
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
|
||||||
|
|
||||||
|
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
|
||||||
|
if (NOT "${GODOT_CUSTOM_API_FILE}" STREQUAL "") # User-defined override.
|
||||||
|
set(GODOT_GDEXTENSION_API_FILE "${GODOT_CUSTOM_API_FILE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(GODOT_COMPILE_FLAGS )
|
set(GODOT_COMPILE_FLAGS )
|
||||||
set(GODOT_LINKER_FLAGS )
|
set(GODOT_LINKER_FLAGS )
|
||||||
|
@ -125,16 +130,16 @@ else()
|
||||||
set(GENERATE_BINDING_PARAMETERS "False")
|
set(GENERATE_BINDING_PARAMETERS "False")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True, sources=True)"
|
execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_GDEXTENSION_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True, sources=True)"
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GENERATED_FILES_LIST
|
OUTPUT_VARIABLE GENERATED_FILES_LIST
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${GENERATED_FILES_LIST}
|
add_custom_command(OUTPUT ${GENERATED_FILES_LIST}
|
||||||
COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_CUSTOM_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${BITS}\", \"${FLOAT_TYPE_FLAG}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
|
COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_GDEXTENSION_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${BITS}\", \"${FLOAT_TYPE_FLAG}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
MAIN_DEPENDENCY ${GODOT_CUSTOM_API_FILE}
|
MAIN_DEPENDENCY ${GODOT_GDEXTENSION_API_FILE}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/binding_generator.py
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/binding_generator.py
|
||||||
COMMENT "Generating bindings"
|
COMMENT "Generating bindings"
|
||||||
)
|
)
|
||||||
|
@ -173,7 +178,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
# Put godot headers as SYSTEM PUBLIC to exclude warnings from irrelevant headers
|
# Put godot headers as SYSTEM PUBLIC to exclude warnings from irrelevant headers
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
SYSTEM PUBLIC
|
SYSTEM PUBLIC
|
||||||
${GODOT_HEADERS_DIR}
|
${GODOT_GDEXTENSION_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add the compile flags
|
# Add the compile flags
|
||||||
|
|
|
@ -24,10 +24,9 @@ Stable releases are also tagged on this repository:
|
||||||
this repository as a Git submodule, checking out the specific tag matching your
|
this repository as a Git submodule, checking out the specific tag matching your
|
||||||
Godot version.**
|
Godot version.**
|
||||||
|
|
||||||
> As the `master` and `3.x` branches are constantly getting updates, if you are
|
> As the `master` branch of Godot is constantly getting updated, if you are
|
||||||
> using `godot-cpp` against a more current version of Godot, see the instructions
|
> using `godot-cpp` against a more current version of Godot, see the instructions
|
||||||
> in [**godot-headers**](https://github.com/godotengine/godot-headers) for
|
> in the `gdextension` folder to update the relevant files.
|
||||||
> updating the relevant files.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
20
SConstruct
20
SConstruct
|
@ -77,10 +77,20 @@ opts.Add(
|
||||||
)
|
)
|
||||||
opts.Add(
|
opts.Add(
|
||||||
PathVariable(
|
PathVariable(
|
||||||
"headers_dir", "Path to the directory containing Godot headers", "godot-headers", PathVariable.PathIsDir
|
"gdextension_dir",
|
||||||
|
"Path to the directory containing GDExtension interface header and API JSON file",
|
||||||
|
"gdextension",
|
||||||
|
PathVariable.PathIsDir,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
opts.Add(
|
||||||
|
PathVariable(
|
||||||
|
"custom_api_file",
|
||||||
|
"Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)",
|
||||||
|
None,
|
||||||
|
PathVariable.PathIsFile,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
opts.Add(PathVariable("custom_api_file", "Path to a custom JSON API file", None, PathVariable.PathIsFile))
|
|
||||||
opts.Add(
|
opts.Add(
|
||||||
BoolVariable("generate_bindings", "Force GDExtension API bindings generation. Auto-detected by default.", False)
|
BoolVariable("generate_bindings", "Force GDExtension API bindings generation. Auto-detected by default.", False)
|
||||||
)
|
)
|
||||||
|
@ -179,11 +189,11 @@ json_api_file = ""
|
||||||
if "custom_api_file" in env:
|
if "custom_api_file" in env:
|
||||||
json_api_file = env["custom_api_file"]
|
json_api_file = env["custom_api_file"]
|
||||||
else:
|
else:
|
||||||
json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "extension_api.json")
|
json_api_file = os.path.join(os.getcwd(), env["gdextension_dir"], "extension_api.json")
|
||||||
|
|
||||||
bindings = env.GenerateBindings(
|
bindings = env.GenerateBindings(
|
||||||
env.Dir("."),
|
env.Dir("."),
|
||||||
[json_api_file, os.path.join(env["headers_dir"], "godot", "gdextension_interface.h"), "binding_generator.py"],
|
[json_api_file, os.path.join(env["gdextension_dir"], "gdextension_interface.h"), "binding_generator.py"],
|
||||||
)
|
)
|
||||||
|
|
||||||
scons_cache_path = os.environ.get("SCONS_CACHE")
|
scons_cache_path = os.environ.get("SCONS_CACHE")
|
||||||
|
@ -197,7 +207,7 @@ if env["generate_bindings"]:
|
||||||
NoCache(bindings)
|
NoCache(bindings)
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
env.Append(CPPPATH=[[env.Dir(d) for d in [env["headers_dir"], "include", os.path.join("gen", "include")]]])
|
env.Append(CPPPATH=[[env.Dir(d) for d in [env["gdextension_dir"], "include", os.path.join("gen", "include")]]])
|
||||||
|
|
||||||
# Sources to compile
|
# Sources to compile
|
||||||
sources = []
|
sources = []
|
||||||
|
|
|
@ -377,7 +377,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
||||||
if len(fully_used_classes) > 0:
|
if len(fully_used_classes) > 0:
|
||||||
result.append("")
|
result.append("")
|
||||||
|
|
||||||
result.append(f"#include <godot/gdextension_interface.h>")
|
result.append(f"#include <gdextension_interface.h>")
|
||||||
result.append("")
|
result.append("")
|
||||||
result.append("namespace godot {")
|
result.append("namespace godot {")
|
||||||
result.append("")
|
result.append("")
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# GDExtension header and API
|
||||||
|
|
||||||
|
This repository contains the C header and API JSON for
|
||||||
|
[**Godot Engine**](https://github.com/godotengine/godot)'s *GDExtensions* API.
|
||||||
|
|
||||||
|
## Updating header and API
|
||||||
|
|
||||||
|
If the current branch is not up-to-date for your needs, or if you want to sync
|
||||||
|
the header and API JSON with your own modified version of Godot, here is the
|
||||||
|
update procedure used to sync this repository with upstream releases:
|
||||||
|
|
||||||
|
- Compile [Godot Engine](https://github.com/godotengine/godot) at the specific
|
||||||
|
version/commit which you are using.
|
||||||
|
* Or if you use an official release, download that version of the Godot editor.
|
||||||
|
- Use the compiled or downloaded executable to generate the `extension_api.json`
|
||||||
|
and `gdextension_interface.h` files with:
|
||||||
|
|
||||||
|
```
|
||||||
|
godot --dump-extension-api --dump-gdextension-interface
|
||||||
|
```
|
|
@ -1,16 +0,0 @@
|
||||||
# godot-headers
|
|
||||||
|
|
||||||
This repository contains C headers for
|
|
||||||
[**Godot Engine**](https://github.com/godotengine/godot)'s *GDExtensions* API.
|
|
||||||
|
|
||||||
## Updating Headers
|
|
||||||
|
|
||||||
If the current branch is not up-to-date for your needs, or if you want to sync
|
|
||||||
the headers with your own modified version of Godot, here is the update
|
|
||||||
procedure used to sync this repository with upstream releases:
|
|
||||||
|
|
||||||
- Compile [Godot Engine](https://github.com/godotengine/godot) at the specific
|
|
||||||
version/commit which you are using.
|
|
||||||
- Use the compiled executable to generate the `extension_api.json` file with:
|
|
||||||
`godot --dump-extension-api extension_api.json`
|
|
||||||
- Copy the file `core/extension/gdextension_interface.h` to `godot`
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifndef GODOT_BINDER_COMMON_HPP
|
#ifndef GODOT_BINDER_COMMON_HPP
|
||||||
#define GODOT_BINDER_COMMON_HPP
|
#define GODOT_BINDER_COMMON_HPP
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <godot_cpp/core/method_ptrcall.hpp>
|
#include <godot_cpp/core/method_ptrcall.hpp>
|
||||||
#include <godot_cpp/core/type_info.hpp>
|
#include <godot_cpp/core/type_info.hpp>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifndef GODOT_BUILTIN_PTRCALL_HPP
|
#ifndef GODOT_BUILTIN_PTRCALL_HPP
|
||||||
#define GODOT_BUILTIN_PTRCALL_HPP
|
#define GODOT_BUILTIN_PTRCALL_HPP
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifndef GODOT_CLASS_DB_HPP
|
#ifndef GODOT_CLASS_DB_HPP
|
||||||
#define GODOT_CLASS_DB_HPP
|
#define GODOT_CLASS_DB_HPP
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <godot_cpp/core/defs.hpp>
|
#include <godot_cpp/core/defs.hpp>
|
||||||
#include <godot_cpp/core/error_macros.hpp>
|
#include <godot_cpp/core/error_macros.hpp>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifndef GODOT_ENGINE_PTRCALL_HPP
|
#ifndef GODOT_ENGINE_PTRCALL_HPP
|
||||||
#define GODOT_ENGINE_PTRCALL_HPP
|
#define GODOT_ENGINE_PTRCALL_HPP
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <godot_cpp/core/binder_common.hpp>
|
#include <godot_cpp/core/binder_common.hpp>
|
||||||
#include <godot_cpp/core/object.hpp>
|
#include <godot_cpp/core/object.hpp>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include <godot_cpp/core/defs.hpp>
|
#include <godot_cpp/core/defs.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include <godot_cpp/core/memory.hpp>
|
#include <godot_cpp/core/memory.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <godot_cpp/classes/global_constants.hpp>
|
#include <godot_cpp/classes/global_constants.hpp>
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
#include <godot_cpp/godot.hpp>
|
#include <godot_cpp/godot.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
#include <godot_cpp/godot.hpp>
|
#include <godot_cpp/godot.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <godot_cpp/variant/typed_array.hpp>
|
#include <godot_cpp/variant/typed_array.hpp>
|
||||||
#include <godot_cpp/variant/variant.hpp>
|
#include <godot_cpp/variant/variant.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifndef GODOT_GODOT_HPP
|
#ifndef GODOT_GODOT_HPP
|
||||||
#define GODOT_GODOT_HPP
|
#define GODOT_GODOT_HPP
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <godot_cpp/variant/builtin_types.hpp>
|
#include <godot_cpp/variant/builtin_types.hpp>
|
||||||
#include <godot_cpp/variant/variant_size.hpp>
|
#include <godot_cpp/variant/variant_size.hpp>
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
|
||||||
|
|
||||||
from binding_generator import get_file_list, generate_bindings
|
from binding_generator import get_file_list, generate_bindings
|
||||||
|
|
||||||
api_filepath = "godot-headers/extension_api.json"
|
api_filepath = "gdextension/extension_api.json"
|
||||||
bits = "64"
|
bits = "64"
|
||||||
double = "float"
|
double = "float"
|
||||||
output_dir = "self_test"
|
output_dir = "self_test"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
project(godot-cpp-test)
|
project(godot-cpp-test)
|
||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.6)
|
||||||
|
|
||||||
set(GODOT_HEADERS_PATH ../godot-headers/ CACHE STRING "Path to Godot headers")
|
set(GODOT_GDEXTENSION_DIR ../gdextension/ CACHE STRING "Path to GDExtension interface header directory")
|
||||||
set(CPP_BINDINGS_PATH ../ CACHE STRING "Path to C++ bindings")
|
set(CPP_BINDINGS_PATH ../ CACHE STRING "Path to C++ bindings")
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
@ -103,7 +103,7 @@ target_include_directories(${PROJECT_NAME} SYSTEM
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CPP_BINDINGS_PATH}/include
|
${CPP_BINDINGS_PATH}/include
|
||||||
${CPP_BINDINGS_PATH}/gen/include
|
${CPP_BINDINGS_PATH}/gen/include
|
||||||
${GODOT_HEADERS_PATH}
|
${GODOT_GDEXTENSION_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the correct name (godot.os.build_type.system_bits)
|
# Create the correct name (godot.os.build_type.system_bits)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include <godot/gdextension_interface.h>
|
#include <gdextension_interface.h>
|
||||||
|
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
#include <godot_cpp/core/defs.hpp>
|
#include <godot_cpp/core/defs.hpp>
|
||||||
|
|
Loading…
Reference in New Issue