summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2019-01-17 21:29:24 +0100
committerMatthias Melcher <git@matthiasm.com>2019-01-17 21:29:24 +0100
commit2f0e45e7a7110761080e2540c95a9fc94f162f81 (patch)
tree570eb0784d32ca3f91a5c02aeb15603650999ee0
parent111985665d8ae08437d3c9d61c7975ad69c6d099 (diff)
Android CMake: icons, docs, more apps
-rw-r--r--CMake/Android/CMakeList.txt.in24
-rwxr-xr-x[-rw-r--r--]CMake/Android/hdpi.ic_launcher.pngbin3418 -> 3059 bytes
-rwxr-xr-x[-rw-r--r--]CMake/Android/mdpi.ic_launcher.pngbin2206 -> 1715 bytes
-rwxr-xr-x[-rw-r--r--]CMake/Android/xhdpi.ic_launcher.pngbin4842 -> 4082 bytes
-rwxr-xr-x[-rw-r--r--]CMake/Android/xxhdpi.ic_launcher.pngbin7718 -> 7266 bytes
-rw-r--r--CMake/android.cmake98
-rw-r--r--CMake/macros.cmake11
-rw-r--r--src/Fl_Text_Display.cxx2
-rw-r--r--test/CMakeLists.txt49
9 files changed, 62 insertions, 122 deletions
diff --git a/CMake/Android/CMakeList.txt.in b/CMake/Android/CMakeList.txt.in
index aaa992d95..7c7aeb1fa 100644
--- a/CMake/Android/CMakeList.txt.in
+++ b/CMake/Android/CMakeList.txt.in
@@ -13,25 +13,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# Modified to be a template for Android builds in FLTK
+# Copyright 2019 Matthias Melcher and others
+#
cmake_minimum_required(VERSION 3.4.1)
-set(FLTK_DIR ../../../../../../..)
-set(FLTK_IDE_DIR ../../../..)
+set(FLTK_DIR "@ANDROID_FLTK_DIR@")
+set(FLTK_IDE_DIR "../../../..")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-# FIXME: add as a second argument the binary build dir
-# so that the first argument can link directly to FLTK
-# instead of the fltk symlink, which is bad for SVN
-add_subdirectory(${FLTK_DIR}/ "${CMAKE_CURRENT_BINARY_DIR}/lib" EXCLUDE_FROM_ALL)
+# FIXME: this includes the entire CMakeLists again, creating an entire library
+# build in every target
+# TODO: create separate targets for all fltk libraries that can be easily
+# linked by all app targets
+add_subdirectory("${FLTK_DIR}/" "${CMAKE_CURRENT_BINARY_DIR}/lib" EXCLUDE_FROM_ALL)
-# run FLuid commands if any
+# run Fluid build steps for every .fl file, if any
@ANDROID_FLUID_COMMANDS@
-
-# copy source files
-@ANDROID_APP_COPY_SOURCES@
-
# now build app's shared lib
add_library(
test_@ANDROID_APP_NAME@ SHARED
@@ -48,6 +48,8 @@ set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
# add lib dependencies
+# FIXME: apps may depend on additional fltk libraries; thise dependencies
+# must be created in the CREATE_ANDROID_IDE_FOR_TEST macro
target_link_libraries(
test_@ANDROID_APP_NAME@
fltk
diff --git a/CMake/Android/hdpi.ic_launcher.png b/CMake/Android/hdpi.ic_launcher.png
index cde69bccc..1c28eb22b 100644..100755
--- a/CMake/Android/hdpi.ic_launcher.png
+++ b/CMake/Android/hdpi.ic_launcher.png
Binary files differ
diff --git a/CMake/Android/mdpi.ic_launcher.png b/CMake/Android/mdpi.ic_launcher.png
index c133a0cbd..4f12dba6a 100644..100755
--- a/CMake/Android/mdpi.ic_launcher.png
+++ b/CMake/Android/mdpi.ic_launcher.png
Binary files differ
diff --git a/CMake/Android/xhdpi.ic_launcher.png b/CMake/Android/xhdpi.ic_launcher.png
index bfa42f0e7..aa48b8524 100644..100755
--- a/CMake/Android/xhdpi.ic_launcher.png
+++ b/CMake/Android/xhdpi.ic_launcher.png
Binary files differ
diff --git a/CMake/Android/xxhdpi.ic_launcher.png b/CMake/Android/xxhdpi.ic_launcher.png
index 324e72cdd..91aad3864 100644..100755
--- a/CMake/Android/xxhdpi.ic_launcher.png
+++ b/CMake/Android/xxhdpi.ic_launcher.png
Binary files differ
diff --git a/CMake/android.cmake b/CMake/android.cmake
index 7a8064a05..7255af3fe 100644
--- a/CMake/android.cmake
+++ b/CMake/android.cmake
@@ -17,95 +17,38 @@
# http://www.fltk.org/str.php
#
+# all target modules will be added here later
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/settings.gradle.in"
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/settings.gradle"
@ONLY
)
+# configuration file for all modules
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/build.gradle.in"
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/build.gradle"
@ONLY
)
+# create a custom abi file for this setup
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/abi-version.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/FL/abi-version.h"
@ONLY
)
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/app.build.gradle.in"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/build.gradle"
- @ONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/AndroidManifest.xml.in"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/AndroidManifest.xml"
- @ONLY
-)
-
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/Roboto-Regular.ttf"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/assets/fonts/Roboto-Regular.ttf"
- COPYONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/mdpi.ic_launcher.png"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/res/mipmap-mdpi/ic_launcher.png"
- COPYONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/hdpi.ic_launcher.png"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/res/mipmap-hdpi/ic_launcher.png"
- COPYONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/xhdpi.ic_launcher.png"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/res/mipmap-xhdpi/ic_launcher.png"
- COPYONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/xxhdpi.ic_launcher.png"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png"
- COPYONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/strings.xml.in"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/res/values/strings.xml"
- @ONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/CMakeList.txt.in"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/cpp/CMakeLists.txt"
- @ONLY
-)
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/HelloAndroid.cxx.in"
- "${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/app/src/main/cpp/HelloAndroid.cxx"
- @ONLY
-)
-
+# TODO: where should we create config.h?
macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
- message(STATUS "Creating Android IDE for ${NAME}")
+ # message(STATUS "Creating Android IDE for ${NAME}")
set (ANDROID_APP_NAME ${NAME})
+ set (ANDROID_FLTK_DIR ${CMAKE_SOURCE_DIR})
set (srcs)
set (ANDROID_APP_SOURCES)
- set (ANDROID_APP_COPY_SOURCES)
set (ANDROID_FLUID_COMMANDS)
set (flsrcs) # fluid source files
foreach(src ${SOURCES})
@@ -113,24 +56,23 @@ macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
list(APPEND flsrcs ${src})
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
string(APPEND ANDROID_FLUID_COMMANDS
- "add_custom_command( OUTPUT \"${basename}.cxx\" \"${basename}.h\"\n"
- " OUTPUT \"${basename}.cxx\" \"${basename}.h\"\n"
- " COMMAND fluid -c \"\${CMAKE_CURRENT_SOURCE_DIR}/${src}\"\n"
- " DEPENDS ${src}\n"
- " MAIN_DEPENDENCY ${src}\n"
+ "add_custom_command(\n"
+ " OUTPUT \"\${FLTK_DIR}/test/${basename}.cxx\" \"\${FLTK_DIR}/test/${basename}.h\"\n"
+ " COMMAND fluid -c \"${src}\"\n"
+ " WORKING_DIRECTORY \"\${FLTK_DIR}/test\"\n"
+ " DEPENDS \"\${FLTK_DIR}/test/${src}\"\n"
+ " MAIN_DEPENDENCY \"\${FLTK_DIR}/test/${src}\"\n"
")\n\n"
)
+ file(TOUCH "${basename}.cxx")
+ file(TOUCH "${basename}.h")
+ file(TOUCH "${basename}.fl")
set(src_cxx ${basename}.cxx)
else ()
list(APPEND srcs ${src})
set(src_cxx ${src})
endif ("${src}" MATCHES "\\.fl$")
- file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/cpp/")
- # FIXME: Unix only for older version of CMake
- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
- "${CMAKE_CURRENT_SOURCE_DIR}/${src}"
- "${CMAKE_BINARY_DIR}/AndroidStudio/${ANDROID_APP_NAME}/src/main/cpp/${src}")
- string(APPEND ANDROID_APP_SOURCES " ${src_cxx}\n")
+ string(APPEND ANDROID_APP_SOURCES " \"\${FLTK_DIR}/test/${src_cxx}\"\n")
endforeach(src)
configure_file(
@@ -187,12 +129,6 @@ macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
@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)
@@ -200,7 +136,7 @@ endmacro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
macro(CREATE_ANDROID_IDE_WRAPUP)
- message(STATUS "Wrapping up Android IDE creation")
+ # message(STATUS "Wrapping up Android IDE creation")
endmacro(CREATE_ANDROID_IDE_WRAPUP)
diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index afb855687..43da7c7df 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -188,6 +188,17 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
target_link_libraries(${tname} ${LIBRARIES})
+ # CREATE_EXAMPLE can have an optional fourth argument with a list of options
+ # - the option ANDROID_OK is set if CREATE_EXAMPLE creates code for Androids
+ # builds in addition to the native build
+ if (${ARGC} GREATER 3)
+ foreach(OPTION ${ARGV3})
+ if (${OPTION} STREQUAL ANDROID_OK AND OPTION_CREATE_ANDROID_STUDIO_IDE)
+ CREATE_ANDROID_IDE_FOR_TEST(${NAME} ${SOURCES} ${LIBRARIES})
+ endif()
+ endforeach()
+ endif()
+
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
#######################################################################
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index cc0c10c98..ef5a4d04d 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -396,7 +396,7 @@ void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) {
Styles are ranged from 65 ('A') to 126.
\param styleBuffer this buffer works in parallel to the text buffer. For every
- character in the text buffer, the stye buffer has a byte at the same offset
+ character in the text buffer, the style buffer has a byte at the same offset
that contains an index into an array of possible styles.
\param styleTable a list of styles indexed by the style buffer
\param nStyles number of styles in the style table
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a1ce6d9fc..18772b1d2 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,7 +3,7 @@
#
# CMakeLists.txt used to build test and demo apps by the CMake build system
#
-# Copyright 2004-2018 by Bill Spitzak and others.
+# Copyright 2004-2019 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@@ -39,39 +39,30 @@ 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)
-CREATE_ANDROID_IDE_FOR_TEST(inactive inactive.fl fltk)
-# FIXME: fails because in the current schmeme, we can't find the .h files
-#CREATE_ANDROID_IDE_FOR_TEST(keyboard "keyboard.cxx;keyboard_ui.fl" fltk)
-endif (OPTION_CREATE_ANDROID_STUDIO_IDE)
-
-#######################################################################
+# Add the ANDROID_OK option if the example can be compiled for Android
+# as well as for other platforms.
if(NOT ANDROID)
-CREATE_EXAMPLE(adjuster adjuster.cxx fltk)
-CREATE_EXAMPLE(arc arc.cxx fltk)
-CREATE_EXAMPLE(animated animated.cxx fltk)
-CREATE_EXAMPLE(ask ask.cxx fltk)
-CREATE_EXAMPLE(bitmap bitmap.cxx fltk)
+CREATE_EXAMPLE(adjuster adjuster.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(arc arc.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(animated animated.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(ask ask.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(bitmap bitmap.cxx fltk ANDROID_OK)
CREATE_EXAMPLE(blocks blocks.cxx "fltk;${AUDIOLIBS}")
-CREATE_EXAMPLE(boxtype boxtype.cxx fltk)
-CREATE_EXAMPLE(browser browser.cxx fltk)
-CREATE_EXAMPLE(button button.cxx fltk)
-CREATE_EXAMPLE(buttons buttons.cxx fltk)
-CREATE_EXAMPLE(checkers checkers.cxx fltk)
-CREATE_EXAMPLE(clock clock.cxx fltk)
+CREATE_EXAMPLE(boxtype boxtype.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(browser browser.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(button button.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(buttons buttons.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(checkers checkers.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(clock clock.cxx fltk ANDROID_OK)
CREATE_EXAMPLE(colbrowser colbrowser.cxx "fltk;fltk_forms")
-CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk)
-CREATE_EXAMPLE(cursor cursor.cxx fltk)
-CREATE_EXAMPLE(curve curve.cxx fltk)
+CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(cursor cursor.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(curve curve.cxx fltk ANDROID_OK)
CREATE_EXAMPLE(demo demo.cxx fltk)
CREATE_EXAMPLE(device device.cxx fltk)
-CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk)
-CREATE_EXAMPLE(editor editor.cxx fltk)
-CREATE_EXAMPLE(fast_slow fast_slow.fl fltk)
+CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(editor editor.cxx fltk ANDROID_OK)
+CREATE_EXAMPLE(fast_slow fast_slow.fl fltk ANDROID_OK)
CREATE_EXAMPLE(file_chooser file_chooser.cxx "fltk;fltk_images")
CREATE_EXAMPLE(fonts fonts.cxx fltk)
CREATE_EXAMPLE(forms forms.cxx "fltk;fltk_forms")