diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-01-16 13:38:45 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-01-16 13:38:45 +0100 |
| commit | 78510a831d89c7985eb2894f96fcebd388e21856 (patch) | |
| tree | 0d75966614818787b416b47f6635ec3f7f610fa5 | |
| parent | d17454ac6af8b55169d3d7aefad498a133b9c0f9 (diff) | |
| parent | 563baced13e4961500dccd35b19e9b063c93dc9c (diff) | |
Merge remote-tracking branch 'origin/master'
| -rw-r--r-- | CMake/Android/AndroidManifest.xml.in | 4 | ||||
| -rw-r--r-- | CMake/Android/CMakeList.txt.in | 9 | ||||
| -rw-r--r-- | CMake/Android/HelloAndroid.cxx.in | 2 | ||||
| -rw-r--r-- | CMake/Android/app.build.gradle.in | 2 | ||||
| -rw-r--r-- | CMake/Android/settings.gradle.in | 1 | ||||
| -rw-r--r-- | CMake/Android/strings.xml.in | 2 | ||||
| -rw-r--r-- | CMake/android.cmake | 79 | ||||
| -rw-r--r-- | CMakeLists.txt | 7 | ||||
| -rw-r--r-- | test/CMakeLists.txt | 8 |
9 files changed, 105 insertions, 9 deletions
diff --git a/CMake/Android/AndroidManifest.xml.in b/CMake/Android/AndroidManifest.xml.in index e0131f422..4e5c6154b 100644 --- a/CMake/Android/AndroidManifest.xml.in +++ b/CMake/Android/AndroidManifest.xml.in @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.fltk.android_hello" + package="org.fltk.@ANDROID_APP_NAME@" android:versionCode="1" android:versionName="1.0"> <application @@ -12,7 +12,7 @@ <activity android:name="android.app.NativeActivity" android:label="@string/app_name"> <meta-data android:name="android.app.lib_name" - android:value="android-hello" /> + android:value="test_@ANDROID_APP_NAME@" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> diff --git a/CMake/Android/CMakeList.txt.in b/CMake/Android/CMakeList.txt.in index 99019b009..48f8b07f0 100644 --- a/CMake/Android/CMakeList.txt.in +++ b/CMake/Android/CMakeList.txt.in @@ -27,10 +27,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") add_subdirectory(${FLTK_DIR}/ "${CMAKE_CURRENT_BINARY_DIR}/lib" EXCLUDE_FROM_ALL) # now build app's shared lib -add_library(android-hello SHARED +add_library( + test_@ANDROID_APP_NAME@ SHARED HelloAndroid.cxx) -target_include_directories(android-hello PRIVATE +target_include_directories( + test_@ANDROID_APP_NAME@ PRIVATE ${FLTK_DIR}/ ${FLTK_IDE_DIR}/ ) @@ -40,7 +42,8 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") # add lib dependencies -target_link_libraries(android-hello +target_link_libraries( + test_@ANDROID_APP_NAME@ fltk android log diff --git a/CMake/Android/HelloAndroid.cxx.in b/CMake/Android/HelloAndroid.cxx.in index 42cdba663..e79cfcaf2 100644 --- a/CMake/Android/HelloAndroid.cxx.in +++ b/CMake/Android/HelloAndroid.cxx.in @@ -16,7 +16,7 @@ */ -#include "../../../test/button.cxx" +#include "../../../test/@ANDROID_APP_NAME@.cxx" /* diff --git a/CMake/Android/app.build.gradle.in b/CMake/Android/app.build.gradle.in index dd66c8d93..9e579a4c7 100644 --- a/CMake/Android/app.build.gradle.in +++ b/CMake/Android/app.build.gradle.in @@ -4,7 +4,7 @@ apply plugin: 'com.android.application' compileSdkVersion 25 defaultConfig { - applicationId 'org.fltk.android_hello' + applicationId 'org.fltk.@ANDROID_APP_NAME@' minSdkVersion 14 targetSdkVersion 25 externalNativeBuild { diff --git a/CMake/Android/settings.gradle.in b/CMake/Android/settings.gradle.in index 573abcb32..8b1378917 100644 --- a/CMake/Android/settings.gradle.in +++ b/CMake/Android/settings.gradle.in @@ -1,2 +1 @@ -include ':app' diff --git a/CMake/Android/strings.xml.in b/CMake/Android/strings.xml.in index e2f60e96f..351315218 100644 --- a/CMake/Android/strings.xml.in +++ b/CMake/Android/strings.xml.in @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="app_name">Hello Android</string> + <string name="app_name">@ANDROID_APP_NAME@</string> </resources> diff --git a/CMake/android.cmake b/CMake/android.cmake index 75b3d4f4d..267210553 100644 --- a/CMake/android.cmake +++ b/CMake/android.cmake @@ -96,3 +96,82 @@ configure_file( @ONLY ) + +macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES) + + message(STATUS "Creating Android IDE for ${NAME}") + set (ANDROID_APP_NAME ${NAME}) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/app.build.gradle.in" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/build.gradle" + @ONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/AndroidManifest.xml.in" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/AndroidManifest.xml" + @ONLY + ) + + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/Roboto-Regular.ttf" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/assets/fonts/Roboto-Regular.ttf" + COPYONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/mdpi.ic_launcher.png" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/res/mipmap-mdpi/ic_launcher.png" + COPYONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/hdpi.ic_launcher.png" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/res/mipmap-hdpi/ic_launcher.png" + COPYONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/xhdpi.ic_launcher.png" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/res/mipmap-xhdpi/ic_launcher.png" + COPYONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/xxhdpi.ic_launcher.png" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/res/mipmap-xxhdpi/ic_launcher.png" + COPYONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/strings.xml.in" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/res/values/strings.xml" + @ONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/CMakeList.txt.in" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/cpp/CMakeLists.txt" + @ONLY + ) + + configure_file( + "${CMAKE_SOURCE_DIR}/CMake/Android/HelloAndroid.cxx.in" + "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/cpp/HelloAndroid.cxx" + @ONLY + ) + + file(APPEND "${CMAKE_BINARY_DIR}/AndroidStudio/settings.gradle" "include ':${ANDROID_APP_NAME}'\n") + +endmacro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES) + + +macro(CREATE_ANDROID_IDE_WRAPUP) + + message(STATUS "Wrapping up Android IDE creation") + +endmacro(CREATE_ANDROID_IDE_WRAPUP) + + diff --git a/CMakeLists.txt b/CMakeLists.txt index dd67da35e..e5a1e7fa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,13 @@ if(OPTION_BUILD_EXAMPLES) endif(OPTION_BUILD_EXAMPLES) ####################################################################### +# Android Studio wrapup +####################################################################### +if (OPTION_CREATE_ANDROID_STUDIO_IDE) + CREATE_ANDROID_IDE_WRAPUP() +endif (OPTION_CREATE_ANDROID_STUDIO_IDE) + +####################################################################### # installation ####################################################################### include(CMake/install.cmake) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0ffe3f881..409f44e71 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,6 +39,14 @@ include_directories( ) ####################################################################### +## testing creation of Android Studio IDE files +if (OPTION_CREATE_ANDROID_STUDIO_IDE) +CREATE_ANDROID_IDE_FOR_TEST(arc arc.cxx fltk) +CREATE_ANDROID_IDE_FOR_TEST(hello hello.cxx fltk) +CREATE_ANDROID_IDE_FOR_TEST(input input.cxx fltk) +endif (OPTION_CREATE_ANDROID_STUDIO_IDE) + +####################################################################### if(NOT ANDROID) CREATE_EXAMPLE(adjuster adjuster.cxx fltk) CREATE_EXAMPLE(arc arc.cxx fltk) |
