From b18c60eb77354174e80a53006ac933b0a80e2b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=BAlio=20Henrique?= Date: Tue, 7 Jul 2015 10:35:09 -0300 Subject: [PATCH] Added .bat file to compile on windows --- .gitignore | 5 +++ android/android.toolchain.cmake | 2 +- ...ile_android.sh => compile_android_unix.sh} | 5 ++- android/compile_android_windows.bat | 19 ++++++++++ android/main.cpp | 35 ------------------- android/project/.classpath | 9 ----- android/project/.project | 33 ----------------- .../.settings/org.eclipse.jdt.core.prefs | 4 --- android/project/local.properties | 10 ------ android/project/proguard-project.txt | 20 ----------- android/project/project.properties | 14 -------- 11 files changed, 27 insertions(+), 129 deletions(-) rename android/{compile_android.sh => compile_android_unix.sh} (76%) mode change 100755 => 100644 create mode 100644 android/compile_android_windows.bat delete mode 100644 android/main.cpp delete mode 100644 android/project/.classpath delete mode 100644 android/project/.project delete mode 100644 android/project/.settings/org.eclipse.jdt.core.prefs delete mode 100644 android/project/local.properties delete mode 100644 android/project/proguard-project.txt delete mode 100644 android/project/project.properties diff --git a/.gitignore b/.gitignore index 45d4810e..5a8afe32 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,11 @@ Makefile /android/project/gen /android/project/bin /android/project/libs +/android/project/.settings +/android/project/.classpath +/android/project/.project +/android/project/local.properties +/android/project/project.properties libs* .idea* /*.h diff --git a/android/android.toolchain.cmake b/android/android.toolchain.cmake index 6bbf9342..dae59819 100644 --- a/android/android.toolchain.cmake +++ b/android/android.toolchain.cmake @@ -1652,7 +1652,7 @@ if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" ) ANDROID_APP_PIE ) if( DEFINED ${__var} ) - if( "${__var}" MATCHES " ") + if( ${__var} MATCHES " ") set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" ) else() set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" ) diff --git a/android/compile_android.sh b/android/compile_android_unix.sh old mode 100755 new mode 100644 similarity index 76% rename from android/compile_android.sh rename to android/compile_android_unix.sh index e2eeb9f5..e85070df --- a/android/compile_android.sh +++ b/android/compile_android_unix.sh @@ -1,5 +1,5 @@ #!/bin/sh -mkdir -p ../build && cd ../build +mkdir -p ../build_android && cd ../build cmake -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=android-16 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 .. make @@ -7,13 +7,12 @@ make cd ../ cp -r libs android/project/ +cp $ANDROID_NDK/libraries/lib/libSDL2.so android/project/libs/armeabi-v7a cd android/project android update project -p . --name OTClientMob --target android-16 - ant debug cd bin - adb install -r OTClientMob-debug.apk diff --git a/android/compile_android_windows.bat b/android/compile_android_windows.bat new file mode 100644 index 00000000..4297001b --- /dev/null +++ b/android/compile_android_windows.bat @@ -0,0 +1,19 @@ +cd .. +mkdir build_android +cd build_android + +cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=android-16 -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 .. +make + +cd ../ + +ECHO D|xcopy /E /Y %ANDROID_NDK%\libraries\lib\libSDL2.so android\project\libs\armeabi-v7a +xcopy /E /Y libs android\project\libs + +cd android\project + +call android update project -p . --name OTClientMob --target android-16 +call ant debug + +cd bin +adb install -r OTClientMob-debug.apk \ No newline at end of file diff --git a/android/main.cpp b/android/main.cpp deleted file mode 100644 index 57d58cb4..00000000 --- a/android/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2010-2014 OTClient - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include - -void android_main( struct android_app* state ) { - int argc = 1; - const char* argv[1]; - argv[0] = "NULL"; - - Client client( argc, argv ); - client.terminateAndFreeMemory(); - - ANativeActivity_finish(state->activity); -} diff --git a/android/project/.classpath b/android/project/.classpath deleted file mode 100644 index 7bc01d9a..00000000 --- a/android/project/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/android/project/.project b/android/project/.project deleted file mode 100644 index b22ff796..00000000 --- a/android/project/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - NativeActivity - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/android/project/.settings/org.eclipse.jdt.core.prefs b/android/project/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b080d2dd..00000000 --- a/android/project/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/android/project/local.properties b/android/project/local.properties deleted file mode 100644 index b427df95..00000000 --- a/android/project/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk.dir=/opt/android-sdk/sdk diff --git a/android/project/proguard-project.txt b/android/project/proguard-project.txt deleted file mode 100644 index f2fe1559..00000000 --- a/android/project/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/android/project/project.properties b/android/project/project.properties deleted file mode 100644 index 9b84a6b4..00000000 --- a/android/project/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-16