1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 ext.IOS = [:]
  27 
  28 if (BUILD_CLOSED) {
  29     fetchExternalTools('IOS',
  30       ["ios-libs-08.tgz"],
  31       rootProject.CROSS_TOOLS_DIR, rootProject.IS_IMPORT_CROSS_TOOLS)
  32 }
  33 
  34 // TODO Check for presence of iOS tools
  35 IOS.canBuild = IS_MAC
  36 if (!IOS.canBuild) return;
  37 
  38 IOS.compileSwing = false;
  39 IOS.compileSWT = false;
  40 IOS.compileFXPackager = false;
  41 
  42 defineProperty("USE_LIPO", "false")
  43 IOS.useLipo = Boolean.parseBoolean(USE_LIPO)
  44 
  45 defineProperty("GENERATE_SYMBOLS", "false")
  46 IOS.generateSymbols = Boolean.parseBoolean(GENERATE_SYMBOLS)
  47 
  48 defineProperty("BUILD_IOS_TOOLS", "true")
  49 ext.IS_BUILD_IOS_TOOLS = Boolean.parseBoolean(BUILD_IOS_TOOLS)
  50 
  51 IOS.generateSymbolsExcludes = [
  52     "libprism_sw.a",
  53     "libdecora_sse_armv7.a"
  54 ]
  55 
  56 defineProperty("IOS_VERSION", "7.0")
  57 
  58 // Lambda for naming the generated libs
  59 IOS.library = { name -> return "lib${name}.a" as String }
  60 
  61 IOS.libDest = "lib"
  62 
  63 IOS.jfxrtJarExcludes = [
  64     "**/*.hlsl",
  65     "com/sun/glass/ui/win",
  66     "com/sun/prism/d3d",
  67     "com/sun/prism/es2/gl/win",
  68     "com/sun/prism/null3d",
  69     "com/sun/scenario/effect/impl/hw/d3d",
  70 
  71     "com/sun/glass/events/mac",
  72     "com/sun/glass/ui/mac",
  73     "com/sun/prism/es2/gl/mac",
  74     "com/sun/glass/ui/android",
  75     "com/sun/glass/ui/gtk",
  76 
  77     "com/sun/glass/ui/lens",
  78     "com/sun/prism/es2/gl/eglfb",
  79     "com/sun/prism/es2/gl/eglx11",
  80     "com/sun/prism/es2/gl/x11",
  81 
  82     "com/sun/glass/ui/swt", // SWT glass
  83 
  84     "javafx/embed/swing", // Swing Interop
  85 
  86     "javafx/embed/swt", // SWT Interop
  87 ]
  88 
  89 def archArm = "armv7"
  90 def archArm64 = "arm64"
  91 def archX86 = "i386"
  92 def archX86_64 = "x86_64"
  93 def iPhoneOS = "iPhoneOS"
  94 def iPhoneSim = "iPhoneSimulator"
  95 
  96 String sdkPath(String platform) {
  97     return "/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${IOS_VERSION}.sdk";
  98 }
  99 
 100 def linkFlags = [
 101     "-static",
 102     "-framework", "Foundation",
 103     "-framework", "CoreGraphics",
 104     "-framework", "CoreText",
 105     "-framework", "UIKit",
 106     "-framework", "QuartzCore",
 107     "-framework", "OpenGLES"].flatten()
 108 
 109 def ccFlags = [
 110     "-miphoneos-version-min=6.0", "-fmessage-length=0", "-std=c99", "-fno-common",
 111     "-Wall", "-fno-strict-aliasing", "-fwrapv", "-fpascal-strings", "-fobjc-abi-version=2", "-fobjc-legacy-dispatch",
 112     "-I$JDK_HOME/include", "-I$JDK_HOME/include/darwin", "-c",
 113     IS_DEBUG_NATIVE ? ["-O0", "-DDEBUG", "-g"] : ["-O3", "-DNDEBUG"]].flatten()
 114 
 115 def compiler = "clang"
 116 def linker = "libtool"
 117 
 118 IOS.javafxPlatformProperties ="""javafx.platform=ios
 119 ios.javax.xml.stream.XMLInputFactory=com.sun.xml.stream.ZephyrParserFactory
 120 ios.javax.xml.stream.XMLOutputFactory=com.sun.xml.stream.ZephyrWriterFactory
 121 ios.javax.xml.stream.XMLEventFactory=com.sun.xml.stream.events.ZephyrEventFactory
 122 ios.jfxmedia.platforms=IOSPlatform
 123 ios.glass.platform=ios
 124 ios.prism.allowhidpi=true
 125 ios.prism.mintexturesize=16
 126 ios.prism.verbose=true
 127 ios.prism.static.libraries=true
 128 ios.prism.useNativeIIO=false"""
 129 
 130 IOS.glass = [:]
 131 IOS.glass.variants = ["arm", "arm64", "x86", "x86_64"];
 132 IOS.glass.javahInclude = [
 133     "com/sun/glass/events/**",
 134     "com/sun/glass/ui/*",
 135     "com/sun/glass/ui/ios/*"]
 136 IOS.glass.lib = "glass"
 137 
 138 IOS.glass.arm = [:]
 139 IOS.glass.arm.nativeSource = file("modules/graphics/src/main/native-glass/ios")
 140 IOS.glass.arm.compiler = compiler
 141 IOS.glass.arm.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 142 IOS.glass.arm.linker = linker
 143 IOS.glass.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags, "-L${sdkPath(iPhoneOS)}/usr/lib"].flatten()
 144 IOS.glass.arm.lib = "glass_${archArm}"
 145 
 146 IOS.glass.arm64 = [:]
 147 IOS.glass.arm64.nativeSource = file("modules/graphics/src/main/native-glass/ios")
 148 IOS.glass.arm64.compiler = compiler
 149 IOS.glass.arm64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 150 IOS.glass.arm64.linker = linker
 151 IOS.glass.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags, "-L${sdkPath(iPhoneOS)}/usr/lib"].flatten()
 152 IOS.glass.arm64.lib = "glass_${archArm64}"
 153 
 154 IOS.glass.x86 = [:]
 155 IOS.glass.x86.nativeSource = file("modules/graphics/src/main/native-glass/ios")
 156 IOS.glass.x86.compiler = compiler
 157 IOS.glass.x86.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 158 IOS.glass.x86.linker = linker
 159 IOS.glass.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags, "-L${sdkPath(iPhoneSim)}/usr/lib"].flatten()
 160 IOS.glass.x86.lib = "glass_${archX86}"
 161 
 162 IOS.glass.x86_64 = [:]
 163 IOS.glass.x86_64.nativeSource = file("modules/graphics/src/main/native-glass/ios")
 164 IOS.glass.x86_64.compiler = compiler
 165 IOS.glass.x86_64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 166 IOS.glass.x86_64.linker = linker
 167 IOS.glass.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags, "-L${sdkPath(iPhoneSim)}/usr/lib"].flatten()
 168 IOS.glass.x86_64.lib = "glass_${archX86_64}"
 169 
 170 IOS.extensions = [:]
 171 IOS.extensions.variants = ["arm", "arm64", "x86", "x86_64"];
 172 IOS.extensions.javahSource = files("modules/extensions/build/classes/ios")
 173 IOS.extensions.javahClasspath = files("modules/extensions/build/classes/ios/")
 174 IOS.extensions.javahInclude = ["com/sun/javafx/ext/device/ios/**/*"]
 175 IOS.extensions.lib = "extensions_ios"
 176 
 177 IOS.extensions.arm = [:]
 178 IOS.extensions.arm.nativeSource = file("modules/extensions/src/ios/native-device/ios")
 179 IOS.extensions.arm.compiler = compiler
 180 IOS.extensions.arm.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 181 IOS.extensions.arm.linker = linker
 182 IOS.extensions.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags, "-L${sdkPath(iPhoneOS)}/usr/lib"].flatten()
 183 IOS.extensions.arm.lib = "extensions_ios_${archArm}"
 184 
 185 IOS.extensions.arm64 = [:]
 186 IOS.extensions.arm64.nativeSource = file("modules/extensions/src/ios/native-device/ios")
 187 IOS.extensions.arm64.compiler = compiler
 188 IOS.extensions.arm64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 189 IOS.extensions.arm64.linker = linker
 190 IOS.extensions.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags, "-L${sdkPath(iPhoneOS)}/usr/lib"].flatten()
 191 IOS.extensions.arm64.lib = "extensions_ios_${archArm64}"
 192 
 193 IOS.extensions.x86 = [:]
 194 IOS.extensions.x86.nativeSource = file("modules/extensions/src/ios/native-device/ios")
 195 IOS.extensions.x86.compiler = compiler
 196 IOS.extensions.x86.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 197 IOS.extensions.x86.linker = linker
 198 IOS.extensions.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags, "-L${sdkPath(iPhoneSim)}/usr/lib"].flatten()
 199 IOS.extensions.x86.lib = "extensions_ios_${archX86}"
 200 
 201 IOS.extensions.x86_64 = [:]
 202 IOS.extensions.x86_64.nativeSource = file("modules/extensions/src/ios/native-device/ios")
 203 IOS.extensions.x86_64.compiler = compiler
 204 IOS.extensions.x86_64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 205 IOS.extensions.x86_64.linker = linker
 206 IOS.extensions.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags, "-L${sdkPath(iPhoneSim)}/usr/lib"].flatten()
 207 IOS.extensions.x86_64.lib = "extensions_ios_${archX86_64}"
 208 
 209 IOS.decora = [:]
 210 IOS.decora.variants = ["arm", "arm64"];
 211 IOS.decora.lib = "decora_sse"
 212 
 213 IOS.decora.arm = [:]
 214 IOS.decora.arm.compiler = compiler
 215 IOS.decora.arm.ccFlags = [ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS), "-ffast-math"].flatten()
 216 IOS.decora.arm.linker = linker
 217 IOS.decora.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 218 IOS.decora.arm.lib = "decora_sse_${archArm}"
 219 
 220 IOS.decora.arm64 = [:]
 221 IOS.decora.arm64.compiler = compiler
 222 IOS.decora.arm64.ccFlags = [ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS), "-ffast-math"].flatten()
 223 IOS.decora.arm64.linker = linker
 224 IOS.decora.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 225 IOS.decora.arm64.lib = "decora_sse_${archArm64}"
 226 
 227 IOS.prism = [:]
 228 IOS.prism.lib = "prism_common"
 229 IOS.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
 230 IOS.prism.variants = ["arm", "arm64", "x86", "x86_64"];
 231 
 232 IOS.prism.arm = [:]
 233 IOS.prism.arm.nativeSource = file("modules/graphics/src/main/native-prism")
 234 IOS.prism.arm.compiler = compiler
 235 IOS.prism.arm.ccFlags = [ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS), "-DINLINE=inline"].flatten()
 236 IOS.prism.arm.linker = linker
 237 IOS.prism.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 238 IOS.prism.arm.lib = "prism_common_${archArm}"
 239 
 240 IOS.prism.arm64 = [:]
 241 IOS.prism.arm64.nativeSource = file("modules/graphics/src/main/native-prism")
 242 IOS.prism.arm64.compiler = compiler
 243 IOS.prism.arm64.ccFlags = [ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS), "-DINLINE=inline"].flatten()
 244 IOS.prism.arm64.linker = linker
 245 IOS.prism.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 246 IOS.prism.arm64.lib = "prism_common_${archArm64}"
 247 
 248 IOS.prism.x86 = [:]
 249 IOS.prism.x86.nativeSource = file("modules/graphics/src/main/native-prism")
 250 IOS.prism.x86.compiler = compiler
 251 IOS.prism.x86.ccFlags = [ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim), "-DINLINE=inline"].flatten()
 252 IOS.prism.x86.linker = linker
 253 IOS.prism.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 254 IOS.prism.x86.lib = "prism_common_${archX86}"
 255 
 256 IOS.prism.x86_64 = [:]
 257 IOS.prism.x86_64.nativeSource = file("modules/graphics/src/main/native-prism")
 258 IOS.prism.x86_64.compiler = compiler
 259 IOS.prism.x86_64.ccFlags = [ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim), "-DINLINE=inline"].flatten()
 260 IOS.prism.x86_64.linker = linker
 261 IOS.prism.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 262 IOS.prism.x86_64.lib = "prism_common_${archX86_64}"
 263 
 264 IOS.prismSW = [:]
 265 IOS.prismSW.lib = "prism_sw"
 266 IOS.prismSW.javahInclude = ["com/sun/pisces/**/*"]
 267 IOS.prismSW.variants = ["arm", "arm64", "x86", "x86_64"];
 268 
 269 IOS.prismSW.arm = [:]
 270 IOS.prismSW.arm.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 271 IOS.prismSW.arm.compiler = compiler
 272 IOS.prismSW.arm.ccFlags = [IOS.prism.arm.ccFlags].flatten()
 273 IOS.prismSW.arm.linker = linker
 274 IOS.prismSW.arm.linkFlags = [IOS.prism.arm.linkFlags].flatten()
 275 IOS.prismSW.arm.lib = "prism_sw_${archArm}"
 276 
 277 IOS.prismSW.arm64 = [:]
 278 IOS.prismSW.arm64.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 279 IOS.prismSW.arm64.compiler = compiler
 280 IOS.prismSW.arm64.ccFlags = [IOS.prism.arm64.ccFlags].flatten()
 281 IOS.prismSW.arm64.linker = linker
 282 IOS.prismSW.arm64.linkFlags = [IOS.prism.arm64.linkFlags].flatten()
 283 IOS.prismSW.arm64.lib = "prism_sw_${archArm64}"
 284 
 285 IOS.prismSW.x86 = [:]
 286 IOS.prismSW.x86.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 287 IOS.prismSW.x86.compiler = compiler
 288 IOS.prismSW.x86.ccFlags = [IOS.prism.x86.ccFlags].flatten()
 289 IOS.prismSW.x86.linker = linker
 290 IOS.prismSW.x86.linkFlags = [IOS.prism.x86.linkFlags].flatten()
 291 IOS.prismSW.x86.lib = "prism_sw_${archX86}"
 292 
 293 IOS.prismSW.x86_64 = [:]
 294 IOS.prismSW.x86_64.nativeSource = file("modules/graphics/src/main/native-prism-sw")
 295 IOS.prismSW.x86_64.compiler = compiler
 296 IOS.prismSW.x86_64.ccFlags = [IOS.prism.x86_64.ccFlags].flatten()
 297 IOS.prismSW.x86_64.linker = linker
 298 IOS.prismSW.x86_64.linkFlags = [IOS.prism.x86_64.linkFlags].flatten()
 299 IOS.prismSW.x86_64.lib = "prism_sw_${archX86_64}"
 300 
 301 IOS.iio = [:]
 302 IOS.iio.lib = "javafx_iio"
 303 IOS.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
 304 IOS.iio.variants = ["arm", "arm64", "x86", "x86_64"];
 305 
 306 IOS.iio.arm = [:]
 307 IOS.iio.arm.nativeSource = [
 308     file("modules/graphics/src/main/native-iio"),
 309     file("modules/graphics/src/main/native-iio/ios"),
 310     file("modules/graphics/src/main/native-iio/libjpeg7")]
 311 IOS.iio.arm.compiler = compiler
 312 IOS.iio.arm.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS), "-ffast-math"].flatten()
 313 IOS.iio.arm.linker = linker
 314 IOS.iio.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 315 IOS.iio.arm.lib = "javafx_iio_${archArm}"
 316 
 317 IOS.iio.arm64 = [:]
 318 IOS.iio.arm64.nativeSource = [IOS.iio.arm.nativeSource].flatten()
 319 IOS.iio.arm64.compiler = compiler
 320 IOS.iio.arm64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS), "-ffast-math"].flatten()
 321 IOS.iio.arm64.linker = linker
 322 IOS.iio.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 323 IOS.iio.arm64.lib = "javafx_iio_${archArm64}"
 324 
 325 IOS.iio.x86 = [:]
 326 IOS.iio.x86.nativeSource = [IOS.iio.arm.nativeSource].flatten()
 327 IOS.iio.x86.compiler = compiler
 328 IOS.iio.x86.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim), "-ffast-math"].flatten()
 329 IOS.iio.x86.linker = linker
 330 IOS.iio.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 331 IOS.iio.x86.lib = "javafx_iio_${archX86}"
 332 
 333 IOS.iio.x86_64 = [:]
 334 IOS.iio.x86_64.nativeSource = [IOS.iio.arm.nativeSource].flatten()
 335 IOS.iio.x86_64.compiler = compiler
 336 IOS.iio.x86_64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim), "-ffast-math"].flatten()
 337 IOS.iio.x86_64.linker = linker
 338 IOS.iio.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 339 IOS.iio.x86_64.lib = "javafx_iio_${archX86_64}"
 340 
 341 IOS.prismES2 = [:]
 342 IOS.prismES2.lib = "prism_es2"
 343 IOS.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
 344 IOS.prismES2.variants = ["arm", "arm64", "x86", "x86_64"];
 345 
 346 IOS.prismES2.arm = [:]
 347 IOS.prismES2.arm.nativeSource = [
 348     file("modules/graphics/src/main/native-prism-es2"),
 349     file("modules/graphics/src/main/native-prism-es2/GL"),
 350     file("modules/graphics/src/main/native-prism-es2/ios")
 351 ]
 352 IOS.prismES2.arm.compiler = compiler
 353 IOS.prismES2.arm.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 354 IOS.prismES2.arm.linker = linker
 355 IOS.prismES2.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 356 IOS.prismES2.arm.lib = "prism_es2_${archArm}"
 357 
 358 IOS.prismES2.arm64 = [:]
 359 IOS.prismES2.arm64.nativeSource = [IOS.prismES2.arm.nativeSource].flatten()
 360 IOS.prismES2.arm64.compiler = compiler
 361 IOS.prismES2.arm64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 362 IOS.prismES2.arm64.linker = linker
 363 IOS.prismES2.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 364 IOS.prismES2.arm64.lib = "prism_es2_${archArm64}"
 365 
 366 IOS.prismES2.x86 = [:]
 367 IOS.prismES2.x86.nativeSource = [IOS.prismES2.arm.nativeSource].flatten()
 368 IOS.prismES2.x86.compiler = compiler
 369 IOS.prismES2.x86.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 370 IOS.prismES2.x86.linker = linker
 371 IOS.prismES2.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 372 IOS.prismES2.x86.lib = "prism_es2_${archX86}"
 373 
 374 IOS.prismES2.x86_64 = [:]
 375 IOS.prismES2.x86_64.nativeSource = [IOS.prismES2.arm.nativeSource].flatten()
 376 IOS.prismES2.x86_64.compiler = compiler
 377 IOS.prismES2.x86_64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 378 IOS.prismES2.x86_64.linker = linker
 379 IOS.prismES2.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 380 IOS.prismES2.x86_64.lib = "prism_es2_${archX86_64}"
 381 
 382 def closedDir = file("$projectDir/../rt-closed")
 383 IOS.font = [:]
 384 IOS.font.lib = "javafx_font"
 385 IOS.font.javahInclude = [
 386         "com/sun/javafx/font/**/*",
 387         "com/sun/javafx/text/**/*"]
 388 IOS.font.variants = ["arm", "arm64", "x86", "x86_64"];
 389 
 390 IOS.font.arm = [:]
 391 IOS.font.arm.nativeSource = [file("modules/graphics/src/main/native-font")]
 392 IOS.font.arm.compiler = compiler
 393 IOS.font.arm.ccFlags = ["-DJFXFONT_PLUS", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 394 IOS.font.arm.linker = linker
 395 IOS.font.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 396 IOS.font.arm.lib = "javafx_font_${archArm}"
 397 
 398 IOS.font.arm64 = [:]
 399 IOS.font.arm64.nativeSource = [IOS.font.arm.nativeSource].flatten()
 400 IOS.font.arm64.compiler = compiler
 401 IOS.font.arm64.ccFlags = ["-DJFXFONT_PLUS", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 402 IOS.font.arm64.linker = linker
 403 IOS.font.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 404 IOS.font.arm64.lib = "javafx_font_${archArm64}"
 405 
 406 IOS.font.x86 = [:]
 407 IOS.font.x86.nativeSource = [IOS.font.arm.nativeSource].flatten()
 408 IOS.font.x86.compiler = compiler
 409 IOS.font.x86.ccFlags = ["-DJFXFONT_PLUS", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 410 IOS.font.x86.linker = linker
 411 IOS.font.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 412 IOS.font.x86.lib = "javafx_font_${archX86}"
 413 
 414 IOS.font.x86_64 = [:]
 415 IOS.font.x86_64.nativeSource = [IOS.font.arm.nativeSource].flatten()
 416 IOS.font.x86_64.compiler = compiler
 417 IOS.font.x86_64.ccFlags = ["-DJFXFONT_PLUS", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 418 IOS.font.x86_64.linker = linker
 419 IOS.font.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 420 IOS.font.x86_64.lib = "javafx_font_${archX86_64}"
 421 
 422 IOS.fontT2K = [:]
 423 IOS.fontT2K.lib = "javafx_font_t2k"
 424 IOS.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"]
 425 IOS.fontT2K.variants = ["arm", "arm64", "x86", "x86_64"];
 426 
 427 IOS.fontT2K.arm = [:]
 428 IOS.fontT2K.arm.nativeSource = [
 429         file("$closedDir/javafx-font-t2k-native/src"),
 430         file("$closedDir/javafx-font-t2k-native/src/layout")]
 431 IOS.fontT2K.arm.compiler = compiler
 432 IOS.fontT2K.arm.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 433 IOS.fontT2K.arm.linker = linker
 434 IOS.fontT2K.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 435 IOS.fontT2K.arm.lib = "javafx_font_t2k_${archArm}"
 436 
 437 IOS.fontT2K.arm64 = [:]
 438 IOS.fontT2K.arm64.nativeSource = [IOS.fontT2K.arm.nativeSource].flatten()
 439 IOS.fontT2K.arm64.compiler = compiler
 440 IOS.fontT2K.arm64.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 441 IOS.fontT2K.arm64.linker = linker
 442 IOS.fontT2K.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 443 IOS.fontT2K.arm64.lib = "javafx_font_t2k_${archArm64}"
 444 
 445 IOS.fontT2K.x86 = [:]
 446 IOS.fontT2K.x86.nativeSource = [IOS.fontT2K.arm.nativeSource].flatten()
 447 IOS.fontT2K.x86.compiler = compiler
 448 IOS.fontT2K.x86.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 449 IOS.fontT2K.x86.linker = linker
 450 IOS.fontT2K.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 451 IOS.fontT2K.x86.lib = "javafx_font_t2k_${archX86}"
 452 
 453 IOS.fontT2K.x86_64 = [:]
 454 IOS.fontT2K.x86_64.nativeSource = [IOS.fontT2K.arm.nativeSource].flatten()
 455 IOS.fontT2K.x86_64.compiler = compiler
 456 IOS.fontT2K.x86_64.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 457 IOS.fontT2K.x86_64.linker = linker
 458 IOS.fontT2K.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 459 IOS.fontT2K.x86_64.lib = "javafx_font_t2k_${archX86_64}"
 460 
 461 IOS.webview = [:]
 462 IOS.webview.lib = "javafx_ios_webnode"
 463 IOS.webview.javahInclude = ["javafx/scene/web/*"]
 464 IOS.webview.variants = ["arm", "arm64", "x86", "x86_64"];
 465 
 466 IOS.webview.arm = [:]
 467 IOS.webview.arm.nativeSource = file("modules/web/src/ios/native")
 468 IOS.webview.arm.compiler = compiler
 469 IOS.webview.arm.ccFlags = [ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 470 IOS.webview.arm.linker = linker
 471 IOS.webview.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 472 IOS.webview.arm.lib = "javafx_ios_webnode_${archArm}"
 473 
 474 IOS.webview.arm64 = [:]
 475 IOS.webview.arm64.nativeSource = file("modules/web/src/ios/native")
 476 IOS.webview.arm64.compiler = compiler
 477 IOS.webview.arm64.ccFlags = [ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 478 IOS.webview.arm64.linker = linker
 479 IOS.webview.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 480 IOS.webview.arm64.lib = "javafx_ios_webnode_${archArm64}"
 481 
 482 IOS.webview.x86 = [:]
 483 IOS.webview.x86.nativeSource = [IOS.webview.arm.nativeSource].flatten()
 484 IOS.webview.x86.compiler = compiler
 485 IOS.webview.x86.ccFlags = [ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 486 IOS.webview.x86.linker = linker
 487 IOS.webview.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 488 IOS.webview.x86.lib = "javafx_ios_webnode_${archX86}"
 489 
 490 IOS.webview.x86_64 = [:]
 491 IOS.webview.x86_64.nativeSource = [IOS.webview.arm.nativeSource].flatten()
 492 IOS.webview.x86_64.compiler = compiler
 493 IOS.webview.x86_64.ccFlags = [ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 494 IOS.webview.x86_64.linker = linker
 495 IOS.webview.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 496 IOS.webview.x86_64.lib = "javafx_ios_webnode_${archX86_64}"
 497 
 498 project(":web") {
 499     apply plugin: 'java'
 500 
 501     compileJava {
 502         sourceSets.main.java.srcDirs = ['src/ios/java'];
 503     }
 504 
 505     sourceSets {
 506         main {
 507             java {
 508                 srcDirs= ['src/ios/java']
 509             }
 510         }
 511     }
 512     dependencies {
 513          compile files("../graphics/build/classes/ios");
 514      }
 515 
 516     afterEvaluate {
 517         sourceSets.main.java.srcDirs = ['src/ios/java'];
 518         def compileWebJavaIos = task("compileWebJavaIos",
 519             type: JavaCompile, group: "Build") {
 520 
 521             dependsOn(project(":graphics").classes, project(":base").classes)
 522             description = "Task compiles web component for iOS."
 523             classpath = files(
 524                 project(":controls").sourceSets.main.java.outputDir,
 525                 project(":graphics").sourceSets.main.java.outputDir,
 526                 project(":base").sourceSets.main.java.outputDir
 527             )
 528             destinationDir = file("modules/web/build/classes/ios")
 529             sourceSets.main.java.outputDir = destinationDir
 530             dependencyCacheDir = file("modules/web/build/dependency-cache")
 531             source file("modules/web/src/ios/java")
 532             doLast {
 533                 copy {
 534                     from "modules/web/src/ios/resources"
 535                     into "modules/web/build/resources/ios"
 536                 }
 537             }
 538         }
 539 
 540         def jarWebJavaIos = task("jarWebJavaIos",
 541             type: Jar, group: "Build") {
 542             description = "Creates web.jar for iOS."
 543             dependsOn(compileWebJavaIos)
 544             archiveName = "web.jar"
 545             includeEmptyDirs = false
 546             destinationDir = project.file("build/libs/ios")
 547             from("build/classes/ios")
 548         }
 549 
 550         addNative(project, "webview")
 551         javahIosWebview.dependsOn(compileWebJavaIos)
 552         javahIosWebview.classpath += files(project(":base").sourceSets.main.java.outputDir,
 553                              project(":graphics").sourceSets.main.java.outputDir,
 554                              project(":controls").sourceSets.main.java.outputDir)
 555 
 556         jfxrtIos {
 557             from ("modules/web/build/classes/ios", "modules/web/build/resources/main");
 558             exclude("com/sun/webkit", "com/sun/javafx/webkit");
 559         }
 560 
 561         sdkIos  {
 562             dependsOn(jarWebJavaIos)
 563             doLast {
 564                 def props = project.ext["IOS"]
 565                 copy {
 566                     if (props.useLipo) {
 567                         from ("modules/web/build/libs/webview/ios/${props.library(props.webview.lib)}")
 568                     } else {
 569                         from ("modules/web/build/libs/webview/ios")
 570                     }
 571                     into ("build/ios-sdk/rt/${props.libDest}")
 572                 }
 573             }
 574         }
 575     }
 576 }
 577 
 578 IOS.media = [:]
 579 IOS.media.lib = "jfxmedia"
 580 IOS.media.javahSource = files("modules/media/build/classes/main")
 581 IOS.media.javahClasspath = files("modules/media/build/classes/main")
 582 IOS.media.javahInclude = ["com/sun/media/jfxmediaimpl/*"]
 583 IOS.media.variants = ["arm", "arm64", "x86", "x86_64"];
 584 
 585 IOS.media.arm = [:]
 586 IOS.media.arm.nativeSource = [
 587     file("modules/media/src/main/native/jfxmedia/platform/ios"),
 588     file("modules/media/src/main/native/jfxmedia/platform/ios/jni")
 589 ]
 590 IOS.media.arm.compiler = compiler
 591 IOS.media.arm.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm, "-isysroot", sdkPath(iPhoneOS)].flatten()
 592 IOS.media.arm.linker = linker
 593 IOS.media.arm.linkFlags = ["-arch_only", archArm, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 594 IOS.media.arm.lib = "jfxmedia_${archArm}"
 595 
 596 IOS.media.arm64 = [:]
 597 IOS.media.arm64.nativeSource = [IOS.media.arm.nativeSource].flatten()
 598 IOS.media.arm64.compiler = compiler
 599 IOS.media.arm64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archArm64, "-isysroot", sdkPath(iPhoneOS)].flatten()
 600 IOS.media.arm64.linker = linker
 601 IOS.media.arm64.linkFlags = ["-arch_only", archArm64, "-syslibroot", sdkPath(iPhoneOS), linkFlags].flatten()
 602 IOS.media.arm64.lib = "jfxmedia_${archArm64}"
 603 
 604 IOS.media.x86 = [:]
 605 IOS.media.x86.nativeSource = [IOS.media.arm.nativeSource].flatten()
 606 IOS.media.x86.compiler = compiler
 607 IOS.media.x86.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86, "-isysroot", sdkPath(iPhoneSim)].flatten()
 608 IOS.media.x86.linker = linker
 609 IOS.media.x86.linkFlags = ["-arch_only", archX86, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 610 IOS.media.x86.lib = "jfxmedia_${archX86}"
 611 
 612 IOS.media.x86_64 = [:]
 613 IOS.media.x86_64.nativeSource = [IOS.media.arm.nativeSource].flatten()
 614 IOS.media.x86_64.compiler = compiler
 615 IOS.media.x86_64.ccFlags = ["-x", "objective-c", ccFlags, "-arch", archX86_64, "-isysroot", sdkPath(iPhoneSim)].flatten()
 616 IOS.media.x86_64.linker = linker
 617 IOS.media.x86_64.linkFlags = ["-arch_only", archX86_64, "-syslibroot", sdkPath(iPhoneSim), linkFlags].flatten()
 618 IOS.media.x86_64.lib = "jfxmedia_${archX86_64}"
 619 
 620 project(":media") {
 621     afterEvaluate {
 622         addNative(project, "media")
 623 
 624         sdkIos  {
 625             doLast {
 626                 def props = project.ext["IOS"]
 627                 copy {
 628                     if (props.useLipo) {
 629                         from ("modules/media/build/libs/media/ios/${props.library(props.media.lib)}")
 630                     } else {
 631                         from ("modules/media/build/libs/media/ios")
 632                     }
 633                     into ("build/ios-sdk/rt/${props.libDest}")
 634                 }
 635             }
 636         }
 637     }
 638 }
 639 
 640 project(":extensions") {
 641     apply plugin: 'java'
 642 
 643     compileJava {
 644         destinationDir = file("build/classes/ios")
 645         source file("src/ios/java")
 646     }
 647 
 648     jar {
 649         from("build/classes/ios")
 650     }
 651 
 652     afterEvaluate {
 653 
 654         addNative(project, "extensions")
 655         javahIosExtensions.classpath += files(project(":base").sourceSets.main.java.outputDir,
 656                              project(":graphics").sourceSets.main.java.outputDir)
 657 
 658         sdkIos  {
 659             doLast {
 660                 def props = project.ext["IOS"]
 661                 copy {
 662                     if (props.useLipo) {
 663                         from ("modules/extensions/build/libs/extensions/ios/${props.library(props.extensions.lib)}")
 664                     } else {
 665                         from ("modules/extensions/build/libs/extensions/ios")
 666                     }
 667                     into ("build/ios-sdk/rt/${props.libDest}")
 668                 }
 669             }
 670         }
 671     }
 672 }