diff options
-rw-r--r-- | android/custom_rules.xml | 12 | ||||
-rw-r--r-- | docs/android_toolchain_windows.txt | 28 | ||||
-rw-r--r-- | tools/android/aapt.exe | bin | 0 -> 128512 bytes | |||
-rw-r--r-- | tools/autobuild/build.sh | 5 | ||||
-rw-r--r-- | tools/autobuild/ndk_helper.sh | 6 |
5 files changed, 45 insertions, 6 deletions
diff --git a/android/custom_rules.xml b/android/custom_rules.xml index b25868950f..7c8a58b202 100644 --- a/android/custom_rules.xml +++ b/android/custom_rules.xml @@ -7,6 +7,10 @@ <equals arg1="${arch}" arg2="multiarch"/> </condition> + <condition property="ndk.buildcommand.suffix" value=".cmd" else=""> + <os family="windows" /> + </condition> + <target name="-setup-architectures"> <if condition="${build.type.multi}"> @@ -28,7 +32,7 @@ <property name="jni.absolute.dir" location="jni" /> <target name="clean" depends="android_rules.clean"> - <exec executable="${ndk.dir}/ndk-build" failonerror="true"> + <exec executable="${ndk.dir}/ndk-build${ndk.buildcommand.suffix}" failonerror="true"> <arg value="clean"/> </exec> </target> @@ -42,7 +46,7 @@ <exec executable="touch"> <arg value="${jni.absolute.dir}/com/mapswithme/core/jni_helper.cpp"/> </exec> - <exec executable="${ndk.dir}/ndk-build" failonerror="true"> + <exec executable="${ndk.dir}/ndk-build${ndk.buildcommand.suffix}" failonerror="true"> <arg value="NDK_DEBUG=0"/> <arg value="PRODUCTION=1"/> <arg value="V=1"/> @@ -118,7 +122,7 @@ <exec executable="touch"> <arg value="${jni.absolute.dir}/com/mapswithme/core/jni_helper.cpp"/> </exec> - <exec executable="${ndk.dir}/ndk-build" failonerror="true"> + <exec executable="${ndk.dir}/ndk-build${ndk.buildcommand.suffix}" failonerror="true"> <arg value="NDK_DEBUG=0"/> <arg value="V=1"/> </exec> @@ -135,7 +139,7 @@ <exec executable="touch"> <arg value="${jni.absolute.dir}/com/mapswithme/core/jni_helper.cpp"/> </exec> - <exec executable="${ndk.dir}/ndk-build" failonerror="true"> + <exec executable="${ndk.dir}/ndk-build${ndk.buildcommand.suffix}" failonerror="true"> <arg value="NDK_DEBUG=1"/> <arg value="V=1"/> </exec> diff --git a/docs/android_toolchain_windows.txt b/docs/android_toolchain_windows.txt new file mode 100644 index 0000000000..eb335e6699 --- /dev/null +++ b/docs/android_toolchain_windows.txt @@ -0,0 +1,28 @@ +0. Install Android SDK to the path without spaces (e.g. C:\Projects\android-sdk) with platform-tools and latest Android API +1. Fix aapt tool in Android SDK, it's needed to create apks where some files are not compressed: + - Rename file android-sdk\platform-tools\aapt.exe to aapt2.exe + - Copy aapt.exe from repository omim/tools/android/aapt.exe to android-sdk\platform-tools\ folder +2. Install Android NDK to the path without spaces (e.g. C:\Projects\android-ndk) +3. Install msysgit to the path without spaces (e.g. C:\Projects\Git) +4. Install Apache ant to the path without spaces (e.g. C:\Projects\apache-ant) +5. Install mingw build of QT to the path without spaces (e.g. C:\Projects\Qt) +6. Install JDK and JRE +7. Launch GitBash console from msysgit +8. Create symlink to 'make' binary: + $ ln -s /c/Qt/SDK/mingw/bin/mingw32-make.exe /bin/make +9. Update PATH environment variable: + - Path to qmake for mingw build of QT + - Path to ant + $ export PATH=/c/Projects/Qt/Desktop/Qt/<version>/mingw/bin:/c/Projects/apache-ant/bin:$PATH +10.Set JAVA_HOME environment variable to JDK location + $ export JAVA_HOME='C:\Program Files (x86)\Java\jdk1.6.0_37' +11.Update symlinks to assets (this should be done when new asset is added or modified): + $ cd omim/tools/android + $ ./update_assets.sh # or bash update_assets.sh +12.Build omim static libraries and apk from GitBash: + $ cd omim/android/MapsWithMePro + $ ant debug + # You can also build release version or production version with 'ant release' or 'ant production' + +Bonus: PATH and JAVA_HOME can be set automatically when launching GitBash. To do that, insert export commands from 9. and 10. to C:\Users\<Your User>\.bashrc +You can also automatically open GitBash on the repository folder (to perform build and git tasks) by adding 'cd /c/Projects/omim' to .bashrc diff --git a/tools/android/aapt.exe b/tools/android/aapt.exe Binary files differnew file mode 100644 index 0000000000..21e94a99dd --- /dev/null +++ b/tools/android/aapt.exe diff --git a/tools/autobuild/build.sh b/tools/autobuild/build.sh index e7004fd8a4..570b6bb72d 100644 --- a/tools/autobuild/build.sh +++ b/tools/autobuild/build.sh @@ -9,9 +9,12 @@ source "$LOCAL_DIRNAME/detect_qmake.sh" # Prints number of cores to stdout GetCPUCores() { case "$OSTYPE" in + # it's GitBash under Windows + msys) echo $NUMBER_OF_PROCESSORS + ;; linux-gnu) grep -c ^processor /proc/cpuinfo 2>/dev/null ;; - darwin*) sysctl -n hw.ncpu + darwin*) sysctl -n hw.ncpu ;; *) echo "Unsupported platform in $0" exit 1 diff --git a/tools/autobuild/ndk_helper.sh b/tools/autobuild/ndk_helper.sh index 6e52f2e8b3..ff15078856 100644 --- a/tools/autobuild/ndk_helper.sh +++ b/tools/autobuild/ndk_helper.sh @@ -27,6 +27,10 @@ GetNdkHost() echo "darwin-x86" return 0 fi - # TODO add Windows + if [[ "$OSTYPE" == "msys" ]]; then + echo windows + return 0 + fi + echo "ERROR: Can't detect your host OS" return 1 } |