1 /* 2 * Copyright (c) 2013, 2014, 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.MAC = [:] 27 28 MAC.canBuild = IS_MAC && IS_64 29 if (!MAC.canBuild) return; 30 31 // All desktop related packages should be built 32 MAC.compileSwing = true; 33 MAC.compileSWT = true; 34 MAC.compileFXPackager = true; 35 MAC.compileDesignTime = true; 36 37 MAC.includeNull3d = true 38 39 // Lambda for naming the generated libs 40 MAC.library = { name -> return "lib${name}.dylib" as String } 41 42 MAC.libDest = "lib" 43 44 // Define settings for Mac compilation. This is much easier than Windows because we know what version we're 45 // compiling against and Mac always puts it in the same place. In extreme cases you can provide your own 46 // properties in your home dir to override these settings or pass them on the command line via -P 47 defineProperty("MACOSX_MIN_VERSION", "10.7"); 48 defineProperty("MACOSX_SDK_PATH", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOSX_MIN_VERSION}.sdk"); 49 50 def commonParams = [ 51 "-mmacosx-version-min=$MACOSX_MIN_VERSION", 52 "-isysroot", "$MACOSX_SDK_PATH", 53 "-arch", "x86_64"] 54 55 def ccBaseFlags = [ 56 commonParams, 57 "-I$JDK_HOME/include", 58 "-I$JDK_HOME/include/darwin"].flatten() 59 60 61 def ccFlags = [ 62 ccBaseFlags, 63 "-std=c99", 64 "-c", 65 IS_DEBUG_NATIVE ? "-DDEBUG" : ["-O3", "-DNDEBUG"]].flatten() 66 67 def linkFlags = [ 68 commonParams, 69 "-framework", "AppKit", 70 "-framework", "ApplicationServices", 71 "-framework", "OpenGL", 72 "-framework", "QuartzCore", 73 "-framework", "Security", 74 "-dynamiclib", "-lobjc"].flatten(); 75 76 77 def compiler = IS_COMPILE_PARFAIT ? "parfait-gcc" : "gcc"; 78 def linker = IS_COMPILE_PARFAIT ? "parfait-g++" : "g++"; 79 80 MAC.glass = [:] 81 MAC.glass.javahInclude = [ 82 "com/sun/glass/events/**", 83 "com/sun/glass/ui/*", 84 "com/sun/glass/ui/mac/*"] 85 MAC.glass.nativeSource = file("modules/graphics/src/main/native-glass/mac") 86 MAC.glass.compiler = compiler 87 MAC.glass.ccFlags = [ccFlags].flatten() 88 MAC.glass.linker = linker 89 MAC.glass.linkFlags = [linkFlags].flatten() 90 MAC.glass.lib = "glass" 91 92 MAC.decora = [:] 93 MAC.decora.compiler = compiler 94 MAC.decora.ccFlags = ["-O1", "-ffast-math", "-c", ccBaseFlags].flatten() 95 MAC.decora.linker = linker 96 MAC.decora.linkFlags = ["-dynamiclib", commonParams].flatten() 97 MAC.decora.lib = "decora_sse" 98 99 MAC.prism = [:] 100 MAC.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"] 101 MAC.prism.nativeSource = file("modules/graphics/src/main/native-prism") 102 MAC.prism.compiler = compiler 103 MAC.prism.ccFlags = ["-O3", "-DINLINE=inline", "-c", ccBaseFlags].flatten() 104 MAC.prism.linker = linker 105 MAC.prism.linkFlags = ["-dynamiclib", commonParams].flatten() 106 MAC.prism.lib = "prism_common" 107 108 MAC.prismSW = [:] 109 MAC.prismSW.javahInclude = ["com/sun/pisces/**/*"] 110 MAC.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw") 111 MAC.prismSW.compiler = compiler 112 MAC.prismSW.ccFlags = [MAC.prism.ccFlags].flatten() 113 MAC.prismSW.linker = linker 114 MAC.prismSW.linkFlags = [MAC.prism.linkFlags].flatten() 115 MAC.prismSW.lib = "prism_sw" 116 117 MAC.launcher = [:] 118 MAC.launcher.compiler = compiler 119 MAC.launcher.ccFlags = [ 120 "-std=c99", 121 ccBaseFlags, 122 "-framework", "Cocoa", 123 IS_DEBUG_NATIVE ? ["-DDEBUG", "-O0"] : ["-O3", "-DNDEBUG"]].flatten() 124 MAC.launcher.linker = linker 125 MAC.launcher.linkFlags = ["-ldl"] 126 127 MAC.launcherlibrary = [:] 128 MAC.launcherlibrary.compiler = compiler 129 MAC.launcherlibrary.ccFlags = [ 130 "-c", 131 ccBaseFlags, 132 IS_DEBUG_NATIVE ? ["-DDEBUG", "-O0"] : ["-O3", "-DNDEBUG"]].flatten() 133 // 10.7 doesn't have libstdc++ as an option for stdlib, so filter it out 134 if (!(MACOSX_MIN_VERSION in ['10.7', '10.8'])) { 135 MAC.launcherlibrary.ccFlags += "-stdlib=libstdc++" 136 } 137 MAC.launcherlibrary.linker = linker 138 MAC.launcherlibrary.linkFlags = ["-ldl", "-dynamiclib", 139 "-framework", "Cocoa", 140 "-stdlib=libstdc++"] 141 142 MAC.iio = [:] 143 MAC.iio.javahInclude = ["com/sun/javafx/iio/**/*"] 144 MAC.iio.nativeSource = [ 145 file("modules/graphics/src/main/native-iio"), 146 file("modules/graphics/src/main/native-iio/libjpeg7")] 147 MAC.iio.compiler = compiler 148 MAC.iio.ccFlags = [ccFlags].flatten() 149 MAC.iio.linker = linker 150 MAC.iio.linkFlags = [linkFlags].flatten() 151 MAC.iio.lib = "javafx_iio" 152 153 MAC.prismES2 = [:] 154 MAC.prismES2.javahInclude = ["com/sun/prism/es2/**/*"] 155 MAC.prismES2.nativeSource = [ 156 file("modules/graphics/src/main/native-prism-es2"), 157 file("modules/graphics/src/main/native-prism-es2/GL"), 158 file("modules/graphics/src/main/native-prism-es2/macosx") 159 ] 160 MAC.prismES2.compiler = compiler 161 MAC.prismES2.ccFlags = ["-DMACOSX", ccFlags].flatten() 162 MAC.prismES2.linker = linker 163 MAC.prismES2.linkFlags = [linkFlags].flatten() 164 MAC.prismES2.lib = "prism_es2" 165 166 def closedDir = file("$projectDir/../rt-closed") 167 MAC.font = [:] 168 MAC.font.javahInclude = [ 169 "com/sun/javafx/font/**/*", 170 "com/sun/javafx/text/**/*"] 171 MAC.font.nativeSource = [file("modules/graphics/src/main/native-font")] 172 MAC.font.compiler = compiler 173 MAC.font.ccFlags = ["-DJFXFONT_PLUS", ccFlags].flatten() 174 MAC.font.linker = linker 175 MAC.font.linkFlags = [linkFlags].flatten() 176 MAC.font.lib = "javafx_font" 177 178 MAC.fontT2K = [:] 179 MAC.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"] 180 MAC.fontT2K.nativeSource = [ 181 file("$closedDir/javafx-font-t2k-native/src"), 182 file("$closedDir/javafx-font-t2k-native/src/layout")] 183 MAC.fontT2K.compiler = compiler 184 MAC.fontT2K.ccFlags = ["-DJFXFONT_PLUS", "-DLE_STANDALONE", ccFlags].flatten() 185 MAC.fontT2K.linker = linker 186 MAC.fontT2K.linkFlags = [linkFlags].flatten() 187 MAC.fontT2K.lib = "javafx_font_t2k" 188 189 MAC.media = [:] 190 MAC.media.compiler = compiler 191 MAC.media.linker = linker 192 MAC.media.lib = "libtool"