[PATCH] cmake: Work around MSYS unable to call android.bat. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- Subject: [PATCH] cmake: Work around MSYS unable to call android.bat.
- From: Peter Wang <tjaden@xxxxxxxxxx>
- Date: Tue, 12 Nov 2013 19:38:57 +1100
---
android/Activity.cmake | 2 +-
android/Example.cmake | 2 +-
cmake/AndroidApp.cmake | 15 +++++++++++++--
misc/android1.bat.in | 3 +++
4 files changed, 18 insertions(+), 4 deletions(-)
create mode 100644 misc/android1.bat.in
diff --git a/android/Activity.cmake b/android/Activity.cmake
index 314e6ab..c4a6d52 100644
--- a/android/Activity.cmake
+++ b/android/Activity.cmake
@@ -13,7 +13,7 @@ set(ACTIVITY_SOURCES
add_custom_command(
OUTPUT ${ACTIVITY_DIR}/local.properties
- COMMAND ${ANDROID_TOOL} update project -p ${ACTIVITY_DIR}
+ COMMAND ${ANDROID_COMMAND} update project -p ${ACTIVITY_DIR}
)
configure_file(
diff --git a/android/Example.cmake b/android/Example.cmake
index 5d28bb0..b952717 100644
--- a/android/Example.cmake
+++ b/android/Example.cmake
@@ -17,7 +17,7 @@ set(EXAMPLE_SOURCES
add_custom_command(
OUTPUT ${EXAMPLE_DIR}/local.properties
- COMMAND ${ANDROID_TOOL} update project -p ${EXAMPLE_DIR}
+ COMMAND ${ANDROID_COMMAND} update project -p ${EXAMPLE_DIR}
)
configure_file(
diff --git a/cmake/AndroidApp.cmake b/cmake/AndroidApp.cmake
index ba35820..a09a2ab 100644
--- a/cmake/AndroidApp.cmake
+++ b/cmake/AndroidApp.cmake
@@ -1,7 +1,6 @@
find_program(ANDROID_TOOL android CMAKE_FIND_ROOT_PATH_BOTH)
find_program(NDK_BUILD ndk-build CMAKE_FIND_ROOT_PATH_BOTH)
find_program(ANT ant CMAKE_FIND_ROOT_PATH_BOTH)
-set(ANT_COMMAND "${ANT}" -noinput -nouserlib -noclasspath -quiet)
if(NOT ANDROID_TOOL)
message(FATAL_ERROR "android tool not found")
@@ -13,6 +12,18 @@ if(NOT ANT)
message(FATAL_ERROR "ant not found")
endif()
+if(MINGW)
+ configure_file(
+ "${CMAKE_SOURCE_DIR}/misc/android1.bat.in"
+ "${CMAKE_BINARY_DIR}/android1.bat"
+ )
+ set(ANDROID_COMMAND cmd.exe /c "${CMAKE_BINARY_DIR}/android1.bat")
+else()
+ set(ANDROID_COMMAND "${ANDROID_TOOL}")
+endif(MINGW)
+
+set(ANT_COMMAND "${ANT}" -noinput -nouserlib -noclasspath -quiet)
+
function(add_android_app prog sources lib_targets stl)
set(prog_target ${prog})
@@ -65,7 +76,7 @@ function(add_android_app prog sources lib_targets stl)
add_custom_command(
OUTPUT ${project_sources}
COMMAND ${CMAKE_SOURCE_DIR}/misc/make_android_project.py
- "--android-tool=${ANDROID_TOOL}"
+ "--android-tool=${ANDROID_COMMAND}"
-p "${project_dir}"
-n "${prog}"
-k "${package}"
diff --git a/misc/android1.bat.in b/misc/android1.bat.in
new file mode 100644
index 0000000..b1edf0f
--- /dev/null
+++ b/misc/android1.bat.in
@@ -0,0 +1,3 @@
+@echo off
+call "${ANDROID_TOOL}" %1 %2 %3 %4 %5 %6 %7 %8 %9
+exit /b %errorlevel%
--
1.7.12.1
--eFhZ9nN2iUMtJZjH--