Compare commits
9 Commits
072c576a82
...
7724999a76
Author | SHA1 | Date |
---|---|---|
Slawomir Grabowski | 7724999a76 | |
Rémi Verschelde | 0ddef6ed96 | |
Rémi Verschelde | 64529361b4 | |
Rémi Verschelde | edf1637c2c | |
nightblade9 | ee169b201b | |
Daylily-Zeleen | bd40a94424 | |
A Thousand Ships | f037a697eb | |
Slawomir Grabowski | 6b02a58e5a | |
Slawomir Grabowski | 79a0d64f8a |
|
@ -6,6 +6,7 @@
|
||||||
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one.
|
# GODOT_CPP_SYSTEM_HEADERS Mark the header files as SYSTEM. This may be useful to supress warnings in projects including this one.
|
||||||
# GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors
|
# GODOT_CPP_WARNING_AS_ERROR Treat any warnings as errors
|
||||||
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
|
# GODOT_CUSTOM_API_FILE: Path to a custom GDExtension API JSON file (takes precedence over `gdextension_dir`)
|
||||||
|
# GODOT_CPP_INSTALL: Enables target install for exporting godot-cpp cmake configuration
|
||||||
# FLOAT_PRECISION: Floating-point precision level ("single", "double")
|
# FLOAT_PRECISION: Floating-point precision level ("single", "double")
|
||||||
#
|
#
|
||||||
# Android cmake arguments
|
# Android cmake arguments
|
||||||
|
@ -43,6 +44,8 @@ project(godot-cpp LANGUAGES CXX)
|
||||||
option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON)
|
option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON)
|
||||||
option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
|
option(GODOT_CPP_SYSTEM_HEADERS "Expose headers as SYSTEM." ON)
|
||||||
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
|
option(GODOT_CPP_WARNING_AS_ERROR "Treat warnings as errors" OFF)
|
||||||
|
option(GODOT_CPP_INSTALL "Enables target install for exporting godot-cpp cmake configuration" ON)
|
||||||
|
|
||||||
|
|
||||||
# Add path to modules
|
# Add path to modules
|
||||||
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
|
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" )
|
||||||
|
@ -65,7 +68,7 @@ if(NOT DEFINED BITS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Input from user for GDExtension interface header and the API JSON file
|
# Input from user for GDExtension interface header and the API JSON file
|
||||||
set(GODOT_GDEXTENSION_DIR "gdextension" CACHE STRING "")
|
set(GODOT_GDEXTENSION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/gdextension" CACHE STRING "")
|
||||||
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
|
set(GODOT_CUSTOM_API_FILE "" CACHE STRING "")
|
||||||
|
|
||||||
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
|
set(GODOT_GDEXTENSION_API_FILE "${GODOT_GDEXTENSION_DIR}/extension_api.json")
|
||||||
|
@ -183,9 +186,10 @@ if (GODOT_CPP_SYSTEM_HEADERS)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
|
target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
|
||||||
include
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gen/include
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen/include>
|
||||||
${GODOT_GDEXTENSION_DIR}
|
$<BUILD_INTERFACE:${GODOT_GDEXTENSION_DIR}>
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add the compile flags
|
# Add the compile flags
|
||||||
|
@ -214,3 +218,43 @@ 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}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ($CACHE{GODOT_CPP_INSTALL})
|
||||||
|
install(TARGETS ${PROJECT_NAME}
|
||||||
|
EXPORT GodotCppTargets
|
||||||
|
)
|
||||||
|
|
||||||
|
install(EXPORT GodotCppTargets
|
||||||
|
FILE GodotCppTargets.cmake
|
||||||
|
NAMESPACE godot::
|
||||||
|
DESTINATION lib/cmake/GodotCpp
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
if (GODOT_GDEXTENSION_DIR AND EXISTS ${GODOT_GDEXTENSION_DIR})
|
||||||
|
install(DIRECTORY ${GODOT_GDEXTENSION_DIR}/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GodotCppConfig.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake"
|
||||||
|
INSTALL_DESTINATION "lib/cmake/GodotCpp"
|
||||||
|
NO_SET_AND_CHECK_MACRO
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/GodotCppConfig.cmake
|
||||||
|
DESTINATION lib/cmake/GodotCpp
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/GodotCppTargets.cmake")
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue