2019-01-15 01:27:12 +03:00
|
|
|
#
|
2019-01-15 01:27:34 +03:00
|
|
|
# android.cmake to build the FLTK AndroidStudio project using CMake
|
|
|
|
# Written by Matthias Melcher
|
2019-01-15 01:27:12 +03:00
|
|
|
#
|
2019-01-15 01:27:34 +03:00
|
|
|
# Copyright 1998-2019 by Bill Spitzak and others.
|
2019-01-15 01:27:12 +03:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# file is missing or damaged, see the license at:
|
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2019-01-15 01:27:12 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2019-01-15 01:27:12 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/bugs.php
|
2019-01-15 01:27:12 +03:00
|
|
|
#
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# all target modules will be added here later
|
2019-01-15 03:22:18 +03:00
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/settings.gradle.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/settings.gradle"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# configuration file for all modules
|
2019-01-15 03:22:18 +03:00
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Android/build.gradle.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/build.gradle"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# create a custom abi file for this setup
|
2019-01-15 03:22:18 +03:00
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/abi-version.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/AndroidStudio/FL/abi-version.h"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# TODO: where should we create config.h?
|
2019-01-16 03:25:59 +03:00
|
|
|
|
|
|
|
macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# message(STATUS "Creating Android IDE for ${NAME}")
|
2019-01-17 02:49:44 +03:00
|
|
|
|
2019-01-16 03:25:59 +03:00
|
|
|
set (ANDROID_APP_NAME ${NAME})
|
2019-01-17 23:29:24 +03:00
|
|
|
set (ANDROID_FLTK_DIR ${CMAKE_SOURCE_DIR})
|
2019-01-16 03:25:59 +03:00
|
|
|
|
2019-01-17 02:49:44 +03:00
|
|
|
set (srcs)
|
|
|
|
set (ANDROID_APP_SOURCES)
|
|
|
|
set (ANDROID_FLUID_COMMANDS)
|
|
|
|
set (flsrcs) # fluid source files
|
|
|
|
foreach(src ${SOURCES})
|
|
|
|
if ("${src}" MATCHES "\\.fl$")
|
|
|
|
list(APPEND flsrcs ${src})
|
|
|
|
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
|
|
|
|
string(APPEND ANDROID_FLUID_COMMANDS
|
2019-01-17 23:29:24 +03:00
|
|
|
"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"
|
2019-01-17 02:49:44 +03:00
|
|
|
")\n\n"
|
|
|
|
)
|
2019-01-17 23:29:24 +03:00
|
|
|
file(TOUCH "${basename}.cxx")
|
|
|
|
file(TOUCH "${basename}.h")
|
|
|
|
file(TOUCH "${basename}.fl")
|
2019-01-17 02:49:44 +03:00
|
|
|
set(src_cxx ${basename}.cxx)
|
|
|
|
else ()
|
|
|
|
list(APPEND srcs ${src})
|
|
|
|
set(src_cxx ${src})
|
|
|
|
endif ("${src}" MATCHES "\\.fl$")
|
2019-01-17 23:29:24 +03:00
|
|
|
string(APPEND ANDROID_APP_SOURCES " \"\${FLTK_DIR}/test/${src_cxx}\"\n")
|
2019-01-17 02:49:44 +03:00
|
|
|
endforeach(src)
|
|
|
|
|
2019-01-16 03:25:59 +03:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2019-01-16 04:12:29 +03:00
|
|
|
file(APPEND "${CMAKE_BINARY_DIR}/AndroidStudio/settings.gradle" "include ':${ANDROID_APP_NAME}'\n")
|
|
|
|
|
2019-01-16 03:25:59 +03:00
|
|
|
endmacro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
|
|
|
|
|
|
|
|
|
2019-01-16 04:12:29 +03:00
|
|
|
macro(CREATE_ANDROID_IDE_WRAPUP)
|
|
|
|
|
2019-01-17 23:29:24 +03:00
|
|
|
# message(STATUS "Wrapping up Android IDE creation")
|
2019-01-16 04:12:29 +03:00
|
|
|
|
|
|
|
endmacro(CREATE_ANDROID_IDE_WRAPUP)
|
|
|
|
|
|
|
|
|