Compare commits

...

8 Commits

Author SHA1 Message Date
Ding, Zhehang "Eox 2ba6fabbd6
Merge 826c50e162 into 0ddef6ed96 2024-01-15 14:57:44 +08:00
Rémi Verschelde 0ddef6ed96
Merge pull request #1354 from nightblade9/patch-1
Update README.md with basic pre-requisites
2024-01-11 13:11:30 +01:00
Rémi Verschelde 64529361b4
Merge pull request #1351 from Daylily-Zeleen/daylily-zeleen/remove_namespace_in_global_constants_binding
Remove "godot" namespace when binding global constants.
2024-01-11 13:10:51 +01:00
Rémi Verschelde edf1637c2c
Merge pull request #1349 from AThousandShips/op_fix
Add missing `OP_POWER` operator to `Variant`
2024-01-11 13:10:07 +01:00
nightblade9 ee169b201b Update README.md with basic pre-requisites 2024-01-10 15:29:23 -05:00
Daylily-Zeleen bd40a94424 Remove "godot" namespace when binding global constants. 2024-01-07 15:24:02 +08:00
A Thousand Ships f037a697eb
Add missing `OP_POWER` operator to `Variant` 2024-01-06 21:12:52 +01:00
Zhehang Ding 826c50e162 Export cmake target config to build directory 2023-02-15 23:40:38 -08:00
5 changed files with 37 additions and 3 deletions

View File

@ -214,3 +214,27 @@ set_target_properties(${PROJECT_NAME}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
OUTPUT_NAME "${OUTPUT_NAME}" OUTPUT_NAME "${OUTPUT_NAME}"
) )
install(TARGETS ${PROJECT_NAME} EXPORT godot_cpp_targets)
# Export the target to the build directory.
# The target then can be imported by another cmake project like this:
# find_package(godot-cpp CONFIG REQUIRED)
#
# add_library(libfoo SHARED)
# set_target_properties(libfoo PROPERTIES POSITION_INDEPENDENT_CODE ON)
# target_link_libraries(libfoo PUBLIC godot::godot-cpp)
#
# And user provides the build directory to cmake:
# -DCMAKE_PREFIX_PATH=<absolute-path-to-godot-cpp-build-dir>.
export(EXPORT godot_cpp_targets
FILE "${PROJECT_BINARY_DIR}/cmake/godot-cpp.cmake"
NAMESPACE godot::
)
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/config.cmake.in
"${PROJECT_BINARY_DIR}/cmake/godot-cpp-config.cmake"
INSTALL_DESTINATION "lib/cmake/godot-cpp"
)

View File

@ -74,7 +74,10 @@ so formatting is done before your changes are submitted.
## Getting started ## Getting started
It's a bit similar to what it was for 3.x but also a bit different. You need the same C++ pre-requisites installed that are required for the `godot` repository. Follow the [official build instructions for your target platform](https://docs.godotengine.org/en/latest/contributing/development/compiling/index.html#building-for-target-platforms).
Getting started with GDExtensions is a bit similar to what it was for 3.x but also a bit different.
This new approach is much more akin to how core Godot modules are structured. This new approach is much more akin to how core Godot modules are structured.
Compiling this repository generates a static library to be linked with your shared lib, Compiling this repository generates a static library to be linked with your shared lib,

View File

@ -1778,9 +1778,9 @@ def generate_global_constant_binds(api, output_dir):
continue continue
if enum_def["is_bitfield"]: if enum_def["is_bitfield"]:
header.append(f'VARIANT_BITFIELD_CAST(godot::{enum_def["name"]});') header.append(f'VARIANT_BITFIELD_CAST({enum_def["name"]});')
else: else:
header.append(f'VARIANT_ENUM_CAST(godot::{enum_def["name"]});') header.append(f'VARIANT_ENUM_CAST({enum_def["name"]});')
# Variant::Type is not a global enum, but only one line, it is worth to place in this file instead of creating new file. # Variant::Type is not a global enum, but only one line, it is worth to place in this file instead of creating new file.
header.append(f"VARIANT_ENUM_CAST(godot::Variant::Type);") header.append(f"VARIANT_ENUM_CAST(godot::Variant::Type);")
@ -2433,6 +2433,7 @@ def get_operator_id_name(op):
"unary-": "negate", "unary-": "negate",
"unary+": "positive", "unary+": "positive",
"%": "module", "%": "module",
"**": "power",
"<<": "shift_left", "<<": "shift_left",
">>": "shift_right", ">>": "shift_right",
"&": "bit_and", "&": "bit_and",

5
cmake/config.cmake.in Normal file
View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/godot-cpp.cmake")
check_required_components(godot-cpp)

View File

@ -122,6 +122,7 @@ public:
OP_NEGATE, OP_NEGATE,
OP_POSITIVE, OP_POSITIVE,
OP_MODULE, OP_MODULE,
OP_POWER,
// bitwise // bitwise
OP_SHIFT_LEFT, OP_SHIFT_LEFT,
OP_SHIFT_RIGHT, OP_SHIFT_RIGHT,