Browse Source

Fix android builds

mikymod 11 years ago
parent
commit
9080561a60
3 changed files with 111 additions and 43 deletions
  1. 5 0
      engine/os/android/AndroidDevice.cpp
  2. 2 1
      engine/resource/FileBundle.cpp
  3. 104 42
      premake/premake4.lua

+ 5 - 0
engine/os/android/AndroidDevice.cpp

@@ -35,6 +35,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Touch.h"
 #include "OsWindow.h"
 
+extern "C"
+{
+#include <android_native_app_glue.c>
+}
+
 namespace crown
 {
 

+ 2 - 1
engine/resource/FileBundle.cpp

@@ -34,6 +34,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "StringUtils.h" 
 #include "Types.h"
 #include "OS.h"
+#include "Log.h"
 
 namespace crown
 {
@@ -51,7 +52,7 @@ public:
 	{
 		// Convert name/type into strings
 		char resource_name[512];
-		snprintf(resource_name, 512, "%.16lx-%.16lx", name.type, name.name);
+		snprintf(resource_name, 512, "%.16"PRIx64"-%.16"PRIx64, name.type, name.name);
 
 		// Open the resource and check magic number/version
 		File* file = m_filesystem.open(resource_name, FOM_READ);

+ 104 - 42
premake/premake4.lua

@@ -131,18 +131,12 @@ solution "crown"
 	configuration { "release", "x64" }
 		targetsuffix "-release-64"
 
-	configuration { "debug", "native" }
-		targetsuffix "-debug"
 	configuration { "debug", "native" }
 		targetsuffix "-debug"
 
-	configuration { "development", "native" }
-		targetsuffix "-development"
 	configuration { "development", "native" }
 		targetsuffix "-development"
 
-	configuration { "release", "native" }
-		targetsuffix "-release"
 	configuration { "release", "native" }
 		targetsuffix "-release"
 
@@ -394,33 +388,63 @@ solution "crown"
 			}
 
 		configuration { "android" }
-			kind "SharedLib"
+			kind "ConsoleApp"
+			targetprefix "lib"
+			targetextension ".so"
+
 			targetdir(CROWN_INSTALL_DIR .. "bin/android") -- must be specified by user -- tmp
 
+			flags { "NoImportLib" }
+
+			defines { "__STDC_FORMAT_MACROS" }
+
 			buildoptions
 			{
+				"--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-18/arch-arm",
+				"-ffunction-sections",
+				"-fPIC",
+				"-march=armv7-a",
+				"-mfloat-abi=softfp",
+				"-mthumb",
+				"-no-canonical-prefixes",
 				"-std=c++03",
-				"--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-18/arch-arm"
+				"-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
+				"-no-canonical-prefixes",
+				"-fstack-protector",
+				"-mfpu=neon",
+				"-Wa,--noexecstack",
 			}
 			
 			linkoptions
 			{
-				"-Wl,-rpath=\\$$ORIGIN",
+				"-shared",
 				"-nostdlib",
 				"-static-libgcc",
 				"--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-18/arch-arm",
 				"$(ANDROID_NDK_ROOT)/platforms/android-18/arch-arm/usr/lib/crtbegin_so.o",
 				"$(ANDROID_NDK_ROOT)/platforms/android-18/arch-arm/usr/lib/crtend_so.o",
+				"-no-canonical-prefixes",
+				"-Wl,--no-undefined",
+				"-Wl,-z,noexecstack",
+				"-Wl,-z,relro",
+				"-Wl,-z,now",
+				"-march=armv7-a",
+				"-Wl,--fix-cortex-a8",
 			}
 
 			links
 			{
-				"log",
+				":libluajit-5.1.a",
 				"android",
+				"c",
+				"dl",
 				"EGL",
+				"gcc",
 				"GLESv2",
-				"z",
-				"OpenSLES",
+				"gnustl_static",
+				"log",
+				"m",
+				"OpenSLES"
 			}
 
 			includedirs {
@@ -477,45 +501,83 @@ solution "crown"
 			}
 
 		configuration { "debug", "android" }
+			-- linkoptions
+			-- {
+			-- 	"-Wl,--start-group $(addprefix -l," ..
+			-- 	"	LowLevelClothCHECKED" ..
+			-- 	"	PhysX3CHECKED " ..
+			-- 	"	PhysX3CommonCHECKED" ..
+			-- 	"	PxTaskCHECKED" ..
+			-- 	"	LowLevelCHECKED" ..
+			-- 	"	PhysX3CharacterKinematicCHECKED" ..
+			-- 	"	PhysX3CookingCHECKED" ..
+			-- 	"	PhysX3ExtensionsCHECKED" ..
+			-- 	"	PhysX3VehicleCHECKED" ..
+			-- 	"	PhysXProfileSDKCHECKED" ..
+			-- 	"	PhysXVisualDebuggerSDKCHECKED" ..
+			-- 	"	PvdRuntimeCHECKED" ..
+			-- 	"	SceneQueryCHECKED" ..
+			-- 	"	SimulationControllerCHECKED" ..
+			-- 	") -Wl,--end-group"
+			-- }
 			linkoptions
-			{
+			{ 
 				"-Wl,--start-group $(addprefix -l," ..
-				"	LowLevelClothCHECKED" ..
-				"	PhysX3CHECKED " ..
-				"	PhysX3CommonCHECKED" ..
-				"	PxTaskCHECKED" ..
-				"	LowLevelCHECKED" ..
-				"	PhysX3CharacterKinematicCHECKED" ..
-				"	PhysX3CookingCHECKED" ..
-				"	PhysX3ExtensionsCHECKED" ..
-				"	PhysX3VehicleCHECKED" ..
-				"	PhysXProfileSDKCHECKED" ..
-				"	PhysXVisualDebuggerSDKCHECKED" ..
-				"	PvdRuntimeCHECKED" ..
-				"	SceneQueryCHECKED" ..
-				"	SimulationControllerCHECKED" ..
+				"	LowLevelCloth" ..
+				"	PhysX3 " ..
+				"	PhysX3Common" ..
+				"	PxTask" ..
+				"	LowLevel" ..
+				"	PhysX3CharacterKinematic" ..
+				"	PhysX3Cooking" ..
+				"	PhysX3Extensions" ..
+				"	PhysX3Vehicle" ..
+				"	PhysXProfileSDK" ..
+				"	PhysXVisualDebuggerSDK" ..
+				"	PvdRuntime" ..
+				"	SceneQuery" ..
+				"	SimulationController" ..
 				") -Wl,--end-group"
 			}
 		configuration { "development", "android"}
+			-- linkoptions
+			-- { 
+			-- 	"-Wl,--start-group $(addprefix -l," ..
+			-- 	"	LowLevelClothPROFILE" ..
+			-- 	"	PhysX3PROFILE " ..
+			-- 	"	PhysX3CommonPROFILE" ..
+			-- 	"	PxTaskPROFILE" ..
+			-- 	"	LowLevelPROFILE" ..
+			-- 	"	PhysX3CharacterKinematicPROFILE" ..
+			-- 	"	PhysX3CookingPROFILE" ..
+			-- 	"	PhysX3ExtensionsPROFILE" ..
+			-- 	"	PhysX3VehiclePROFILE" ..
+			-- 	"	PhysXProfileSDKPROFILE" ..
+			-- 	"	PhysXVisualDebuggerSDKPROFILE" ..
+			-- 	"	PvdRuntimePROFILE" ..
+			-- 	"	SceneQueryPROFILE" ..
+			-- 	"	SimulationControllerPROFILE" ..
+			-- 	") -Wl,--end-group"
+			-- }
 			linkoptions
 			{ 
 				"-Wl,--start-group $(addprefix -l," ..
-				"	LowLevelClothPROFILE" ..
-				"	PhysX3PROFILE " ..
-				"	PhysX3CommonPROFILE" ..
-				"	PxTaskPROFILE" ..
-				"	LowLevelPROFILE" ..
-				"	PhysX3CharacterKinematicPROFILE" ..
-				"	PhysX3CookingPROFILE" ..
-				"	PhysX3ExtensionsPROFILE" ..
-				"	PhysX3VehiclePROFILE" ..
-				"	PhysXProfileSDKPROFILE" ..
-				"	PhysXVisualDebuggerSDKPROFILE" ..
-				"	PvdRuntimePROFILE" ..
-				"	SceneQueryPROFILE" ..
-				"	SimulationControllerPROFILE" ..
+				"	LowLevelCloth" ..
+				"	PhysX3 " ..
+				"	PhysX3Common" ..
+				"	PxTask" ..
+				"	LowLevel" ..
+				"	PhysX3CharacterKinematic" ..
+				"	PhysX3Cooking" ..
+				"	PhysX3Extensions" ..
+				"	PhysX3Vehicle" ..
+				"	PhysXProfileSDK" ..
+				"	PhysXVisualDebuggerSDK" ..
+				"	PvdRuntime" ..
+				"	SceneQuery" ..
+				"	SimulationController" ..
 				") -Wl,--end-group"
-			}		
+			}	
 		configuration { "release", "android"}
 			linkoptions
 			{