Browse Source

Also enable AS wrapper when targeting 64-bit ARM platform.

Yao Wei Tjong 姚伟忠 9 years ago
parent
commit
ccd9dac3c7

+ 2 - 5
Source/ThirdParty/AngelScript/CMakeLists.txt

@@ -23,11 +23,8 @@
 # Define target name
 # Define target name
 set (TARGET_NAME AngelScript)
 set (TARGET_NAME AngelScript)
 
 
-#ADDED define flag to build the library with the normal function/method macros
-set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DURHO_PROJECT_BUILD")
-set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DURHO_PROJECT_BUILD")
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DURHO_PROJECT_BUILD")
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DURHO_PROJECT_BUILD")
+# Add compiler define to build the library with the normal function/method macros
+add_definitions (-DAS_IS_BUILDING)
 
 
 # Define source files
 # Define source files
 define_source_files (GLOB_CPP_PATTERNS source/*.cpp GLOB_H_PATTERNS include/*.h source/*.h)
 define_source_files (GLOB_CPP_PATTERNS source/*.cpp GLOB_H_PATTERNS include/*.h source/*.h)

+ 9 - 10
Source/ThirdParty/AngelScript/include/angelscript.h

@@ -39,8 +39,8 @@
 #ifndef ANGELSCRIPT_H
 #ifndef ANGELSCRIPT_H
 #define 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)
+// Urho3D: Define AS_MAX_PORTABILITY for Web and 64-bit ARM platforms
+#if defined(__EMSCRIPTEN__) || defined(__aarch64__)
 #define AS_MAX_PORTABILITY
 #define AS_MAX_PORTABILITY
 #endif
 #endif
 
 
@@ -1931,17 +1931,16 @@ const asSBCInfo asBCInfo[256] =
 #define asBC_SWORDARG1(x) (*(((short*)x)+2))
 #define asBC_SWORDARG1(x) (*(((short*)x)+2))
 #define asBC_SWORDARG2(x) (*(((short*)x)+3))
 #define asBC_SWORDARG2(x) (*(((short*)x)+3))
 
 
-
-END_AS_NAMESPACE
-
 // Urho3D: Include the wrapper macros file but only after they have been defined above
 // 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 
+// This causes a large number of warnings, which could possibly be prevented with further
 // changes to 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 the CMakeLists.txt file for the AngelScript (sub)library)
-#ifndef URHO_PROJECT_BUILD
+// Only include this file if we are NOT building the angelscript library itself,
+// as Angelscript already provides generic wrappers for their classes
+// (AS_IS_BUILDING is defined in the CMakeLists.txt file for the AngelScript (sub)library)
+#ifndef AS_IS_BUILDING
 #include "wrapmacros.h"
 #include "wrapmacros.h"
 #endif
 #endif
 
 
+END_AS_NAMESPACE
+
 #endif
 #endif

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

@@ -31,13 +31,13 @@
 //can help solve potential ... problems if we need it at the start: http://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros
 //can help solve potential ... problems if we need it at the start: http://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros
 
 
 //Overview of the process:
 //Overview of the process:
-//take the original funciton that registers a function for the angelscript engine:
+//take the original function that registers a function for the angelscript engine:
 //(RegisterGlobalFunction, RegisterObjectMethod, ...)
 //(RegisterGlobalFunction, RegisterObjectMethod, ...)
-//Define it as a macro. Redefine the asFUNCTION family of macros to extract the arguments passed to them 
-//and pass an F, M, FPR, or MPR depending on which macro was chosen as another argument before the original 
+//Define it as a macro. Redefine the asFUNCTION family of macros to extract the arguments passed to them
+//and pass an F, M, FPR, or MPR depending on which macro was chosen as another argument before the original
 //contents of the asFUNCTION macro
 //contents of the asFUNCTION macro
-//Use the ## operator to paste the F, M, FPR< or MPR allong with the asECallConvTypes name to form the name of another macro
-//This other macro will then bundle the arguments back into the original RegisterGlobalFunction... call, but will use the 
+//Use the ## operator to paste the F, M, FPR< or MPR along with the asECallConvTypes name to form the name of another macro
+//This other macro will then bundle the arguments back into the original RegisterGlobalFunction... call, but will use the
 //wrap macros from the wrap16.h and wrap.h files instead of the original asFUNCTION... call, and will specify the asCALL_GENERIC
 //wrap macros from the wrap16.h and wrap.h files instead of the original asFUNCTION... call, and will specify the asCALL_GENERIC
 //calling convention
 //calling convention
 //***NOTE***: not all of the possibly calling convention/method combinations have been finished, and those that Urho does not use are untested
 //***NOTE***: not all of the possibly calling convention/method combinations have been finished, and those that Urho does not use are untested

+ 3 - 3
Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp

@@ -145,9 +145,9 @@ void Urho3DPlayer::Start()
             ParseArguments(commandLine, false);
             ParseArguments(commandLine, false);
         }
         }
     }
     }
-    
+
     GetScriptFileName();
     GetScriptFileName();
-    
+
     if (scriptFileName_.Empty())
     if (scriptFileName_.Empty())
     {
     {
         ErrorExit("Script file name not specified; cannot proceed");
         ErrorExit("Script file name not specified; cannot proceed");
@@ -265,4 +265,4 @@ void Urho3DPlayer::GetScriptFileName()
     const Vector<String>& arguments = GetArguments();
     const Vector<String>& arguments = GetArguments();
     if (arguments.Size() && arguments[0][0] != '-')
     if (arguments.Size() && arguments[0][0] != '-')
         scriptFileName_ = GetInternalPath(arguments[0]);
         scriptFileName_ = GetInternalPath(arguments[0]);
-}
+}