@@ -1042,17 +1042,17 @@ def generate_header(class_name, class_def, plan):
10421042 if class_name != 'MetaPlatformSDK' :
10431043 lines .append ('#include "platform_sdk/meta_platform_sdk.h"' )
10441044 lines .append ('' )
1045- lines .append ('#ifdef ANDROID_ENABLED' )
1045+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10461046 for ovr_header in class_def ['ovr_headers' ]:
10471047 lines .append (f'#include <{ ovr_header } >' )
1048- lines .append ('#endif // ANDROID_ENABLED' )
1048+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10491049 else :
10501050 lines .append ('#include <godot_cpp/classes/ref.hpp>' )
10511051 lines .append ('#include <godot_cpp/templates/hash_map.hpp>' )
10521052 lines .append ('' )
1053- lines .append ('#ifdef ANDROID_ENABLED' )
1053+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10541054 lines .append ('#include <OVR_Types.h>' )
1055- lines .append ('#endif // ANDROID_ENABLED' )
1055+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10561056 lines .append ('' )
10571057 lines .append ('#include "platform_sdk/meta_platform_sdk_request.h"' )
10581058 lines .append ('' )
@@ -1083,15 +1083,15 @@ def generate_header(class_name, class_def, plan):
10831083 if class_def ['type' ] == 'singleton' :
10841084 lines .append (f'\t static { class_name } *singleton;' )
10851085 lines .append ('' )
1086- lines .append ('#ifdef ANDROID_ENABLED' )
1086+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10871087 lines .append ('\t bool _platform_initialized = false;' )
10881088 lines .append ('\t HashMap<ovrRequest, Ref<MetaPlatformSDK_Request>> requests;' )
1089- lines .append ('#endif // ANDROID_ENABLED' )
1089+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10901090 lines .append ('' )
10911091 else :
1092- lines .append ('#ifdef ANDROID_ENABLED' )
1092+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10931093 lines .append (f'\t { class_def ["ovr_handle" ]} handle = nullptr;' )
1094- lines .append ('#endif // ANDROID_ENABLED' )
1094+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
10951095 lines .append ('' )
10961096 if class_name == 'MetaPlatformSDK_Message' :
10971097 lines .append ('\t MetaPlatformSDK::MessageType type = MetaPlatformSDK::MESSAGE_UNKNOWN;' )
@@ -1129,20 +1129,20 @@ def generate_header(class_name, class_def, plan):
11291129 if class_name == 'MetaPlatformSDK' :
11301130 lines .append (f'\t static void _register_generated_classes();' )
11311131 lines .append ('' )
1132- lines .append ('#ifdef ANDROID_ENABLED' )
1132+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
11331133 lines .append (f'\t void _initialize_platform();' )
11341134 lines .append (f'\t void _initialize_platform_async(const Ref<MetaPlatformSDK_Message> &p_message);' )
11351135 lines .append (f'\t Ref<MetaPlatformSDK_Request> _create_request(ovrRequest p_request);' )
11361136 lines .append (f'\t void _process_messages();' )
1137- lines .append ('#endif // ANDROID_ENABLED' )
1137+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
11381138 lines .append ('' )
11391139 lines .append (f'\t PlatformInitializeResult initialize_platform(const String &p_app_id, const Dictionary &p_options);' )
11401140 lines .append (f'\t Ref<MetaPlatformSDK_Request> initialize_platform_async(const String &p_app_id);' )
11411141 else :
1142- lines .append ('#ifdef ANDROID_ENABLED' )
1142+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
11431143 lines .append (f'\t static Ref<{ class_name } > _create_with_ovr_handle({ class_def ["ovr_handle" ]} p_handle);' )
11441144 lines .append (f'\t inline { class_def ["ovr_handle" ]} _get_ovr_handle() {{ return handle; }}' )
1145- lines .append ('#endif // ANDROID_ENABLED' )
1145+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
11461146 lines .append ('' )
11471147 if class_name == 'MetaPlatformSDK_Message' :
11481148 lines .append ('\t inline MetaPlatformSDK::MessageType get_type() const { return type; }' )
@@ -1203,10 +1203,10 @@ def generate_source(class_name, class_def, plan):
12031203
12041204 if class_name == 'MetaPlatformSDK' :
12051205 lines .append ('' )
1206- lines .append ('#ifdef ANDROID_ENABLED' )
1206+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
12071207 for ovr_header in class_def ['ovr_headers' ]:
12081208 lines .append (f'#include <{ ovr_header } >' )
1209- lines .append ('#endif // ANDROID_ENABLED' )
1209+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
12101210 lines .append ('' )
12111211
12121212 # Include all the other classes so we can register them.
@@ -1215,10 +1215,10 @@ def generate_source(class_name, class_def, plan):
12151215 continue
12161216 lines .append (f'#include "platform_sdk/{ camel_to_snake_case (other_class_name )} .h"' )
12171217 elif class_name == 'MetaPlatformSDK_Message' :
1218- lines .append ('#ifdef ANDROID_ENABLED' )
1218+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
12191219 # Needed for ovr_FreeMessage().
12201220 lines .append (f'#include <OVR_Platform.h>' )
1221- lines .append ('#endif // ANDROID_ENABLED' )
1221+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
12221222
12231223 lines .append ('' )
12241224
@@ -1338,7 +1338,7 @@ def generate_source(class_name, class_def, plan):
13381338 null_return_value = make_null_value (function ['return' ], plan )
13391339
13401340 lines .append (make_function_decl (function_name , function , class_name ) + ' {' )
1341- lines .append ('#ifdef ANDROID_ENABLED' )
1341+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
13421342
13431343 # Check that we are initialized.
13441344 if class_def ['ovr_handle' ]:
@@ -1405,7 +1405,7 @@ def generate_source(class_name, class_def, plan):
14051405 lines .append ('#else' )
14061406 lines .append (f'\t return { null_return_value } ;' )
14071407
1408- lines .append ('#endif // ANDROID_ENABLED' )
1408+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14091409 lines .append ('}' )
14101410 lines .append ('' )
14111411
@@ -1416,15 +1416,15 @@ def generate_source(class_name, class_def, plan):
14161416 lines .append ('' );
14171417 lines .append ('\t singleton = this;' )
14181418 elif class_def ['type' ] == 'model' :
1419- lines .append ('#ifdef ANDROID_ENABLED' )
1419+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14201420 lines .append (f"\t handle = { class_def ['create_func' ]['name' ]} ();" )
1421- lines .append ('#endif // ANDROID_ENABLED' )
1421+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14221422 lines .append ('}' )
14231423 lines .append ('' )
14241424
14251425 # Creation from handle.
14261426 if class_def ['type' ] == 'result' :
1427- lines .append ('#ifdef ANDROID_ENABLED' )
1427+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14281428 lines .append (f'Ref<{ class_name } > { class_name } ::_create_with_ovr_handle({ class_def ["ovr_handle" ]} p_handle) {{' )
14291429 lines .append (f'\t Ref<{ class_name } > inst;' )
14301430 lines .append ('\t if (p_handle != nullptr) {' )
@@ -1435,23 +1435,23 @@ def generate_source(class_name, class_def, plan):
14351435 lines .append ('\t }' )
14361436 lines .append ('\t return inst;' )
14371437 lines .append ('}' )
1438- lines .append ('#endif // ANDROID_ENABLED' )
1438+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14391439 lines .append ('' )
14401440
14411441 # Destructor.
14421442 lines .append (f'{ class_name } ::~{ class_name } () {{' )
14431443 if class_def ['type' ] == 'singleton' :
14441444 lines .append ('\t singleton = nullptr;' )
14451445 elif class_def ['type' ] == 'model' :
1446- lines .append ('#ifdef ANDROID_ENABLED' )
1446+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14471447 lines .append (f"\t { class_def ['destroy_func' ]['name' ]} (handle);" )
1448- lines .append ('#endif // ANDROID_ENABLED' )
1448+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14491449 elif class_def ['type' ] == 'result' and 'free_func' in class_def :
1450- lines .append ('#ifdef ANDROID_ENABLED' )
1450+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14511451 lines .append ('\t if (handle) {' )
14521452 lines .append (f"\t \t { class_def ['free_func' ]['name' ]} (handle);" )
14531453 lines .append ('\t }' )
1454- lines .append ('#endif // ANDROID_ENABLED' )
1454+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14551455 lines .append ('}' )
14561456 lines .append ('' )
14571457
@@ -1472,7 +1472,7 @@ def generate_source(class_name, class_def, plan):
14721472 #
14731473
14741474 lines .append ('Variant MetaPlatformSDK_Message::get_data() const {' )
1475- lines .append ('#ifdef ANDROID_ENABLED' )
1475+ lines .append ('#if defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
14761476 lines .append ('\t ERR_FAIL_COND_V(type == MetaPlatformSDK::MessageType::MESSAGE_UNKNOWN, Variant());' )
14771477 lines .append ('' )
14781478 lines .append ('\t if (data.get_type() != Variant::NIL) {' )
@@ -1503,7 +1503,7 @@ def generate_source(class_name, class_def, plan):
15031503 lines .append ('\t return data;' )
15041504 lines .append ('#else' )
15051505 lines .append ('\t return Variant();' )
1506- lines .append ('#endif // ANDROID_ENABLED' )
1506+ lines .append ('#endif // defined( ANDROID_ENABLED) && !defined(TOOLS_ENABLED) ' )
15071507 lines .append ('}' )
15081508 lines .append ('' )
15091509
0 commit comments