Ver código fonte

Clean up the code to check for AS_MAX_PORTABILITY define so that it could also come from AS' own config. Minor typo fix.

Lasse Öörni 9 anos atrás
pai
commit
cc5761d09d

+ 5 - 5
Source/ThirdParty/AngelScript/include/angelscript.h

@@ -36,14 +36,14 @@
 // The script engine interface
 //
 
+#ifndef ANGELSCRIPT_H
+#define ANGELSCRIPT_H
+
 // Urho3D: Define AS_MAX_PORTABILITY for Web builds and when specifically requested (This could be moved to the CMake files)
 #if defined(__EMSCRIPTEN__) || defined(FORCE_AS_PORTABLE)
 #define AS_MAX_PORTABILITY
 #endif
 
-#ifndef ANGELSCRIPT_H
-#define ANGELSCRIPT_H
-
 #include <stddef.h>
 #ifndef _MSC_VER
 #include <stdint.h>
@@ -1936,10 +1936,10 @@ END_AS_NAMESPACE
 
 // Urho3D: Include the wrapper macros file but only after they have been defined above
 // This causes a large number of warnings, which could possibly be prevented with further 
-//  changes ot the library or the Urho Angelscript code
+// changes to the library or the Urho Angelscript code
 // Only include this file if we request are NOT building the angelscript library itself, 
 // as Angelscript already provides generic wrappers for their classes 
-// (URHO_PROJECT_BUILD is defined in teh CMakeLists.txt file for the AngelScript (sub)library)
+// (URHO_PROJECT_BUILD is defined in the CMakeLists.txt file for the AngelScript (sub)library)
 #ifndef URHO_PROJECT_BUILD
 #include "wrapmacros.h"
 #endif

+ 2 - 2
Source/ThirdParty/AngelScript/include/wrapmacros.h

@@ -22,8 +22,8 @@
 
 #pragma once
 
-//only use this file if we are in a web build or the portable (wrapped) code has been specifically requested
-#if defined(__EMSCRIPTEN__) || defined(FORCE_AS_PORTABLE)
+// Only use this file if the portable (wrapped) code has been specifically requested
+#ifdef AS_MAX_PORTABILITY
 
 //the template wrapper code
 #include "wrap16.h"

+ 3 - 3
Source/Urho3D/AngelScript/Script.cpp

@@ -86,7 +86,7 @@ Script::Script(Context* context) :
     scriptEngine_->SetEngineProperty(asEP_ALLOW_IMPLICIT_HANDLE_TYPES, (asPWORD)true);
     scriptEngine_->SetEngineProperty(asEP_BUILD_WITHOUT_LINE_CUES, (asPWORD)true);
 // Use the copy of the original asMETHOD macro in a web build (for some reason it still works, presumably because the signature of the function is known)
-#if defined(__EMSCRIPTEN__) || defined(FORCE_AS_PORTABLE)
+#ifdef AS_MAX_PORTABILITY
     scriptEngine_->SetMessageCallback(_asMETHOD(Script, MessageCallback), this, asCALL_THISCALL);
 #else
     scriptEngine_->SetMessageCallback(asMETHOD(Script, MessageCallback), this, asCALL_THISCALL);
@@ -95,7 +95,7 @@ Script::Script(Context* context) :
     // Create the context for immediate execution
     immediateContext_ = scriptEngine_->CreateContext();
 // Use the copy of the original asMETHOD macro in a web build (for some reason it still works, presumably because the signature of the function is known)
-#if defined(__EMSCRIPTEN__) || defined(FORCE_AS_PORTABLE)
+#ifdef AS_MAX_PORTABILITY
     immediateContext_->SetExceptionCallback(_asMETHOD(Script, ExceptionCallback), this, asCALL_THISCALL);
 #else
     immediateContext_->SetExceptionCallback(asMETHOD(Script, ExceptionCallback), this, asCALL_THISCALL);
@@ -314,7 +314,7 @@ asIScriptContext* Script::GetScriptFileContext()
     {
         asIScriptContext* newContext = scriptEngine_->CreateContext();
 // Use the copy of the original asMETHOD macro in a web build (for some reason it still works, presumably because the signature of the function is known)
-#if defined(__EMSCRIPTEN__) || defined(FORCE_AS_PORTABLE)
+#ifdef AS_MAX_PORTABILITY
         newContext->SetExceptionCallback(_asMETHOD(Script, ExceptionCallback), this, asCALL_THISCALL);
 #else
         newContext->SetExceptionCallback(asMETHOD(Script, ExceptionCallback), this, asCALL_THISCALL);