Browse Source

Android studio 2.3 fixes.

Mark Sibly 8 years ago
parent
commit
5be4ae41ff

+ 26 - 26
products/android/Monkey2Game/app/build.gradle

@@ -1,26 +1,26 @@
-apply plugin: 'com.android.application'
-
-android {
-    compileSdkVersion 24
-    buildToolsVersion "23.0.3"
-
-    defaultConfig {
-        applicationId "${PACKAGE_NAME}"
-        minSdkVersion 10
-        targetSdkVersion 24
-        versionCode 1
-        versionName "1.0"
-    }
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-        }
-    }
-}
-
-dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    testCompile 'junit:junit:4.12'
-    compile 'com.android.support:appcompat-v7:24.0.0'
-}
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 24
+    buildToolsVersion "25.0.2"
+
+    defaultConfig {
+        applicationId "${PACKAGE_NAME}"
+        minSdkVersion 10
+        targetSdkVersion 24
+        versionCode 1
+        versionName "1.0"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    testCompile 'junit:junit:4.12'
+    compile 'com.android.support:appcompat-v7:24.0.0'
+}

+ 22 - 23
products/android/Monkey2Game/build.gradle

@@ -1,23 +1,22 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
-    repositories {
-        jcenter()
-    }
-    dependencies {
-        classpath 'com.android.tools.build:gradle:2.1.3'
-
-        // NOTE: Do not place your application dependencies here; they belong
-        // in the individual module build.gradle files
-    }
-}
-
-allprojects {
-    repositories {
-        jcenter()
-    }
-}
-
-task clean(type: Delete) {
-    delete rootProject.buildDir
-}
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+    repositories {
+        jcenter()
+    }
+    
+    dependencies {
+	    classpath 'com.android.tools.build:gradle:2.3.0'
+    }
+}
+
+allprojects {
+    repositories {
+        jcenter()
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}

+ 27 - 5
src/mx2cc/buildproduct.monkey2

@@ -582,7 +582,20 @@ Class GccBuildProduct Extends BuildProduct
 		
 		lnkFiles+=" "+LD_SYSLIBS.Join( " " )
 		
-		If opts.target="windows"
+#If __TARGET__="windows"
+
+		lnkFiles=lnkFiles.Replace( " -Wl,"," " )
+		Local tmp:=AllocTmpFile( "lnkFiles" )
+		SaveString( lnkFiles,tmp )
+		cmd+=" @"+tmp
+		
+'		If opts.target="windows" cmd+=" -Wl,@"+tmp Else cmd+=" @"+tmp
+#Else
+		cmd+=lnkFiles
+#Endif
+
+#rem
+		If opts.target="windows" Or opts.target="emscripten"
 			lnkFiles=lnkFiles.Replace( " -Wl,"," " )
 			Local tmp:=AllocTmpFile( "lnkFiles" )
 			SaveString( lnkFiles,tmp )
@@ -590,6 +603,7 @@ Class GccBuildProduct Extends BuildProduct
 		Else
 			cmd+=lnkFiles
 		Endif
+#end
 
 		CopyAssets( assetsDir )
 		
@@ -763,19 +777,27 @@ Class AndroidBuildProduct Extends BuildProduct
 		
 		If opts.productType="app"
 		
+			Local whole_libs:=""
+		
 			buf.Push( "LOCAL_STATIC_LIBRARIES := \" )
 			For Local imp:=Eachin imports
 				If imp=module Continue
 				
-				If imp.name="sdl2" Or imp.name="admob" Continue
+				If imp.name="sdl2" Or imp.name="admob" 
+					whole_libs+=" mx2_"+imp.name
+					Continue
+				Endif
 				
 				buf.Push( "mx2_"+imp.name+" \" )
 			Next
 			buf.Push( "" )
 			
-			'This keeps the JNI functions in sdl2 and admob alive: ugly, ugly stuff but that's the joys of modern coding for ya...
-			'
-			buf.Push( "LOCAL_WHOLE_STATIC_LIBRARIES := mx2_sdl2 mx2_admob" )
+			If whole_libs
+				'
+				'This keeps the JNI functions in sdl2 and admob alive: ugly, ugly stuff but that's the joys of modern coding for ya...
+				'
+				buf.Push( "LOCAL_WHOLE_STATIC_LIBRARIES :="+whole_libs )
+			Endif
 
 			buf.Push( "LOCAL_SHARED_LIBRARIES := \" )
 			For Local dll:=Eachin DLL_FILES