blob: b5db954cfdfe2b70d8f93a3be71124238864ed16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
#
# android.cmake to build the FLTK AndroidStudio project using CMake
# Written by Matthias Melcher
#
# Copyright 1998-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
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please see the following page on how to report bugs and issues:
#
# https://www.fltk.org/bugs.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
)
# TODO: where should we create config.h?
macro(CREATE_ANDROID_IDE_FOR_TEST NAME SOURCES LIBRARIES)
# 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_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
"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$")
string(APPEND ANDROID_APP_SOURCES " \"\${FLTK_DIR}/test/${src_cxx}\"\n")
endforeach(src)
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
)
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)
|