1 /*
   2  * Copyright (c) 2013, 2017, 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.WIN = [:]
  27 
  28 WIN.canBuild = IS_WINDOWS
  29 if (!WIN.canBuild) return;
  30 
  31 WIN.compileSwing = true;
  32 WIN.compileSWT = true;
  33 WIN.compileFXPackager = true;
  34 
  35 WIN.includeNull3d = true
  36 
  37 // Lambda for naming the generated libs
  38 WIN.library = { name -> return "${name}.dll" as String }
  39 
  40 WIN.libDest = "bin"
  41 WIN.modLibDest = "lib"
  42 
  43 setupTools("windows_tools",
  44     { propFile ->
  45         // Create the properties file
  46         ByteArrayOutputStream results = new ByteArrayOutputStream();
  47         String winsdkDir = System.getenv().get("WINSDK_DIR");
  48         exec({
  49             environment([
  50                     "WINSDKPATH" : winsdkDir == null ? "" : winsdkDir,
  51                     "CONF"       : "/$CONF", // TODO does this mean the generated properties must be reset when in a different configuration?
  52                     "VCARCH"     : IS_64 ? "amd64" : "x86",
  53                     "SDKARCH"    : IS_64 ? "/x64" : "/x86",
  54             ]);
  55             commandLine("cmd", "/q", "/c", "buildSrc\\genVSproperties.bat");
  56             setStandardOutput(results);
  57         });
  58         BufferedReader reader = new BufferedReader(new StringReader(results.toString().trim()));
  59         reader.readLine();
  60         reader.readLine();
  61         String line;
  62         while ((line = reader.readLine()) != null && !line.startsWith("######")) {
  63             line = line.replace("\\", "/").replace("/@@ENDOFLINE@@", "").replace("@@ENDOFLINE@@", "").replace("//", "/").replace("windows.vs.", "WINDOWS_VS_");
  64             propFile << line << "\r\n";
  65         }
  66     },
  67     { properties ->
  68         defineProperty("WINDOWS_VS_VSINSTALLDIR", properties, "c:/Program Files (x86)/Microsoft Visual Studio/2017/Professional");
  69         defineProperty("WINDOWS_VS_WINSDKDLLINSTALLDIR", properties, "c:/Program Files (x86)/Windows Kits/10/Redist/ucrt/DLLs");
  70         defineProperty("WINDOWS_SDK_DIR", properties, System.getenv().get("WINSDK_DIR"))
  71         defineProperty("WINDOWS_SDK_VERSION", properties, "")
  72         defineProperty("WINDOWS_VS_VCINSTALLDIR", properties, "$WINDOWS_VS_VSINSTALLDIR/VC")
  73         defineProperty("WINDOWS_VS_DEVENVDIR", properties, "$WINDOWS_VS_VSINSTALLDIR/Common7/IDE")
  74         defineProperty("WINDOWS_VS_DEVENVCMD", properties, "$WINDOWS_VS_DEVENVDIR/VCExpress.exe")
  75         defineProperty("WINDOWS_VS_MSVCDIR", properties, WINDOWS_VS_VCINSTALLDIR)
  76         defineProperty("WINDOWS_DXSDK_DIR", properties, System.getenv().get("DXSDK_DIR"))
  77         defineProperty("WINDOWS_VS_INCLUDE", properties, "$WINDOWS_VS_VCINSTALLDIR/INCLUDE;" + "$WINDOWS_SDK_DIR/include;")
  78         defineProperty("WINDOWS_VS_VER", properties, "150")
  79         defineProperty("WINDOWS_VS_LIB", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;" + "$WINDOWS_SDK_DIR/lib;")
  80         defineProperty("WINDOWS_VS_LIBPATH", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;")
  81         def parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
  82         defineProperty("WINDOWS_VS_PATH", properties, parfaitPath + "$WINDOWS_VS_DEVENVDIR;" +
  83                 "$WINDOWS_VS_VSINSTALLDIR/VC/BIN;" +
  84                 "$WINDOWS_VS_VSINSTALLDIR/Common7/Tools;" +
  85                 "$WINDOWS_VS_VCINSTALLDIR/VCPackages;" +
  86                 "$WINDOWS_SDK_DIR/bin/NETFX 4.0 Tools;" +
  87                 "$WINDOWS_SDK_DIR/bin;" +
  88                 System.getenv().get("PATH"))
  89     }
  90 )
  91 
  92 if (WINDOWS_SDK_DIR == null || WINDOWS_SDK_DIR == "") {
  93     throw new GradleException("FAIL: WINSDK_DIR not defined");
  94 }
  95 
  96 // Define set of flags shared for all targets that support debug compilation
  97 def ccDebugFlags =
  98     IS_DEBUG_NATIVE ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD", "/DNDEBUG"]
  99 
 100 def winVsVer = Integer.parseInt(WINDOWS_VS_VER)
 101 if (winVsVer >= 120) {
 102     // Serialize access to PDB file for debug builds if on VS2013 or later
 103     if (IS_DEBUG_NATIVE) ccDebugFlags += "/FS"
 104 }
 105 
 106 
 107 // Common set of flags for all modules except fxpackager
 108 def ccFlags = ["/nologo", "/W3", "/EHsc", "/c",
 109         "/D_STATIC_CPPLIB", "/D_DISABLE_DEPRECATE_STATIC_CPPLIB", "/DINLINE=__inline",
 110         "/DUNICODE", "/D_UNICODE", "/DWIN32", "/DIAL", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
 111         "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 112         ccDebugFlags].flatten();
 113 
 114 def linkFlags = ["/nologo", "/dll", "/manifest", "/opt:REF", "/incremental:no", "/dynamicbase", "/nxcompat"];
 115 if (!IS_64) linkFlags.add("/safeseh");
 116 if (IS_DEBUG_NATIVE) linkFlags.add("/debug");
 117 
 118 // Remove C++ static linking if not on VS2010
 119 if (WINDOWS_VS_VER != "100") {
 120     ccFlags -= ["/D_STATIC_CPPLIB", "/D_DISABLE_DEPRECATE_STATIC_CPPLIB"]
 121 }
 122 
 123 ext.WINDOWS_NATIVE_COMPILE_ENVIRONMENT = [
 124         "VCINSTALLDIR"         : WINDOWS_VS_VCINSTALLDIR,
 125         "VSINSTALLDIR"         : WINDOWS_VS_VSINSTALLDIR,
 126         "DEVENVDIR"            : WINDOWS_VS_DEVENVDIR,
 127         "MSVCDIR"              : WINDOWS_VS_MSVCDIR,
 128         "VS_VER"               : WINDOWS_VS_VER,
 129         "PATH"                 : WINDOWS_VS_PATH,
 130         "INCLUDE"              : WINDOWS_VS_INCLUDE,
 131         "LIB"                  : WINDOWS_VS_LIB,
 132         "LIBPATH"              : WINDOWS_VS_LIBPATH,
 133         "DXSDK_DIR"            : WINDOWS_DXSDK_DIR
 134 ];
 135 def msvcVer = System.getenv("MSVC_VER") ?: "14.10.25017"
 136 def msvcBinDir = ""
 137 if (winVsVer == 150) {
 138     msvcBinDir = (IS_64
 139                       ? "$WINDOWS_VS_VSINSTALLDIR/VC/Tools/MSVC/$msvcVer/bin/HostX64/x64"
 140                       : "$WINDOWS_VS_VSINSTALLDIR/VC/Tools/MSVC/$msvcVer/bin/HostX86/x86")
 141 } else if (winVsVer <= 120) {
 142     msvcBinDir = (IS_64
 143                       ? "$WINDOWS_VS_VSINSTALLDIR/VC/BIN/amd64"
 144                       : "$WINDOWS_VS_VSINSTALLDIR/VC/BIN")
 145 }
 146 def compiler = IS_COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe")
 147 def linker = IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe")
 148 def winSdkBinDir = "$WINDOWS_SDK_DIR/Bin"
 149 if (WINDOWS_VS_VER != "100") {
 150     winSdkBinDir += "/" + (IS_64 ? "x64" : "x86")
 151 }
 152 
 153 if (!file(cygpath("$winSdkBinDir/RC.Exe")).exists()) {
 154     winSdkBinDir = "$WINDOWS_SDK_DIR/Bin/$WINDOWS_SDK_VERSION"
 155     if (WINDOWS_VS_VER != "100") {
 156         winSdkBinDir += "/" + (IS_64 ? "x64" : "x86")
 157     }
 158 }
 159 println "winSdkBinDir=$winSdkBinDir"
 160 
 161 ext.RC = cygpath("$winSdkBinDir/rc.exe")
 162 def rcCompiler = RC
 163 ext.FXC = cygpath("$winSdkBinDir/fxc.exe")
 164 
 165 if (!file(FXC).exists()) {
 166     if (WINDOWS_DXSDK_DIR == null || WINDOWS_DXSDK_DIR == "") {
 167         throw new GradleException("FAIL: DXSDK_DIR not defined");
 168     }
 169     ext.FXC = cygpath("$WINDOWS_DXSDK_DIR/utilities/bin/x86/fxc.exe")
 170 }
 171 
 172 ext.MC = cygpath("$winSdkBinDir/mt.exe")
 173 
 174 if (!file(RC).exists()) throw new GradleException("FAIL: cannot find RC: " + RC)
 175 if (!file(FXC).exists()) throw new GradleException("FAIL: cannot find FXC: " + FXC)
 176 
 177 def msvcRedistVer = System.getenv("MSVC_REDIST_VER") ?: "14.10.25008"
 178 String msvcRedstDir = (IS_64
 179                   ? "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/MSVC/$msvcRedistVer/x64"
 180                   : "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/MSVC/$msvcRedistVer/x86")
 181 
 182 String winSdkDllDir = (IS_64
 183                   ? "$WINDOWS_VS_WINSDKDLLINSTALLDIR/x64"
 184                   : "$WINDOWS_VS_WINSDKDLLINSTALLDIR/x86")
 185 
 186 def WINDOWS_DLL_VER = WINDOWS_VS_VER
 187 ext.MSVCR = null
 188 ext.MSVCP = null
 189 
 190 def windowsCRTVer = System.getenv("WINDOWS_CRT_VER") ?: "150"
 191 if (WINDOWS_VS_VER == "150") {
 192     WINDOWS_DLL_VER = "140"
 193     ext.MSVCR = cygpath("${msvcRedstDir}/Microsoft.VC${windowsCRTVer}.CRT/vcruntime${WINDOWS_DLL_VER}.dll")
 194     ext.MSVCP = cygpath("${msvcRedstDir}/Microsoft.VC${windowsCRTVer}.CRT/msvcp${WINDOWS_DLL_VER}.dll")
 195 }
 196 
 197 def vs2017DllPath = cygpath("${msvcRedstDir}/Microsoft.VC${windowsCRTVer}.CRT")
 198 if (file(vs2017DllPath).exists()) {
 199     ext.WIN.VS2017DLLNames = [
 200         "concrt140.dll",
 201         "msvcp140.dll",
 202         "vcruntime140.dll"
 203     ];
 204     ext.WIN.VS2017DLLs = []
 205     ext.WIN.VS2017DLLNames.each { vsdll->
 206         ext.WIN.VS2017DLLs += "$vs2017DllPath/$vsdll"
 207     }
 208 }
 209 else {
 210     ext.WIN.VS2017DLLNames = [
 211         ];
 212     ext.WIN.VS2017DLLs = [
 213         ];
 214 }
 215 
 216 def WinSDKDLLsPath = cygpath("${winSdkDllDir}")
 217 if (file(WinSDKDLLsPath).exists()) {
 218     ext.WIN.WinSDKDLLNames = [
 219         "api-ms-win-core-console-l1-1-0.dll",
 220         "api-ms-win-core-datetime-l1-1-0.dll",
 221         "api-ms-win-core-debug-l1-1-0.dll",
 222         "api-ms-win-core-errorhandling-l1-1-0.dll",
 223         "api-ms-win-core-file-l1-1-0.dll",
 224         "api-ms-win-core-file-l1-2-0.dll",
 225         "api-ms-win-core-file-l2-1-0.dll",
 226         "api-ms-win-core-handle-l1-1-0.dll",
 227         "api-ms-win-core-heap-l1-1-0.dll",
 228         "api-ms-win-core-interlocked-l1-1-0.dll",
 229         "api-ms-win-core-libraryloader-l1-1-0.dll",
 230         "api-ms-win-core-localization-l1-2-0.dll",
 231         "api-ms-win-core-memory-l1-1-0.dll",
 232         "api-ms-win-core-namedpipe-l1-1-0.dll",
 233         "api-ms-win-core-processenvironment-l1-1-0.dll",
 234         "api-ms-win-core-processthreads-l1-1-0.dll",
 235         "api-ms-win-core-processthreads-l1-1-1.dll",
 236         "api-ms-win-core-profile-l1-1-0.dll",
 237         "api-ms-win-core-rtlsupport-l1-1-0.dll",
 238         "api-ms-win-core-string-l1-1-0.dll",
 239         "api-ms-win-core-synch-l1-1-0.dll",
 240         "api-ms-win-core-synch-l1-2-0.dll",
 241         "api-ms-win-core-sysinfo-l1-1-0.dll",
 242         "api-ms-win-core-timezone-l1-1-0.dll",
 243         "api-ms-win-core-util-l1-1-0.dll",
 244         "api-ms-win-crt-conio-l1-1-0.dll",
 245         "api-ms-win-crt-convert-l1-1-0.dll",
 246         "api-ms-win-crt-environment-l1-1-0.dll",
 247         "api-ms-win-crt-filesystem-l1-1-0.dll",
 248         "api-ms-win-crt-heap-l1-1-0.dll",
 249         "api-ms-win-crt-locale-l1-1-0.dll",
 250         "api-ms-win-crt-math-l1-1-0.dll",
 251         "api-ms-win-crt-multibyte-l1-1-0.dll",
 252         "api-ms-win-crt-private-l1-1-0.dll",
 253         "api-ms-win-crt-process-l1-1-0.dll",
 254         "api-ms-win-crt-runtime-l1-1-0.dll",
 255         "api-ms-win-crt-stdio-l1-1-0.dll",
 256         "api-ms-win-crt-string-l1-1-0.dll",
 257         "api-ms-win-crt-time-l1-1-0.dll",
 258         "api-ms-win-crt-utility-l1-1-0.dll",
 259         "ucrtbase.dll"
 260     ];
 261     ext.WIN.WinSDKDLLs = []
 262     ext.WIN.WinSDKDLLNames.each { winsdkdll->
 263         ext.WIN.WinSDKDLLs += "$WinSDKDLLsPath/$winsdkdll"
 264     }
 265 }
 266 else {
 267     ext.WIN.WinSDKDLLNames = [
 268     ];
 269     ext.WIN.WinSDKDLLs = [
 270     ];
 271 }
 272 
 273 // Product version variables passed to RC:
 274 def rcVer = "$RELEASE_VERSION"
 275 def rcVerMajor = Integer.parseInt(jfxReleaseMajorVersion)
 276 def rcVerMinor = Integer.parseInt(jfxReleaseMinorVersion)
 277 def rcVerSecurity = Integer.parseInt(jfxReleaseSecurityVersion)
 278 def rcVerPatch = Integer.parseInt(jfxReleasePatchVersion)
 279 def rcVerFile = "${rcVerMajor},${rcVerMinor},${rcVerSecurity},${rcVerPatch}"
 280 def rcVerBuild = "$RELEASE_VERSION_LONG"
 281 def rcVerCopyrYear = "${Calendar.getInstance().get(Calendar.YEAR)}"
 282 
 283 def rcFlags = [
 284     "/d", "\"JFX_COMPANY=${COMPANY_NAME}\"",
 285     "/d", "\"JFX_COMPONENT=${PRODUCT_NAME} ${PLATFORM_NAME} binary\"",
 286     "/d", "\"JFX_NAME=${PRODUCT_NAME} ${PLATFORM_NAME} ${rcVerMajor}\"",
 287     "/d", "\"JFX_VER=${rcVer}\"",
 288     "/d", "\"JFX_BUILD_ID=${rcVerBuild}\"",
 289     "/d", "\"JFX_COPYRIGHT=Copyright \u00A9 ${rcVerCopyrYear}\"",
 290     "/d", "\"JFX_FVER=${rcVerFile}\"",
 291     "/d", "\"JFX_FTYPE=0x2L\"",
 292     "/nologo"
 293 ];
 294 
 295 def defaultRcSource = file("${project("graphics").projectDir}/src/main/resources/version.rc");
 296 
 297 WIN.glass = [:]
 298 WIN.glass.javahInclude = [
 299     "com/sun/glass/events/**",
 300     "com/sun/glass/ui/*",
 301     "com/sun/glass/ui/win/*"]
 302 WIN.glass.nativeSource = file("${project("graphics").projectDir}/src/main/native-glass/win")
 303 WIN.glass.compiler = compiler
 304 WIN.glass.rcCompiler = rcCompiler;
 305 WIN.glass.rcSource = file("${project("graphics").projectDir}/src/main/native-glass/win/GlassResources.rc");
 306 WIN.glass.rcFlags = [
 307     "/I", file("${project("graphics").projectDir}/src/main/resources"),
 308     "/d", "JFX_FNAME=glass.dll",
 309     "/d", "JFX_INTERNAL_NAME=glass",
 310     rcFlags].flatten();
 311 WIN.glass.ccFlags = [ccFlags, "/WX"].flatten()
 312 if (WINDOWS_VS_VER != "100") WIN.glass.ccFlags -= ["/WX"]
 313 WIN.glass.linker = linker
 314 WIN.glass.linkFlags = [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
 315         "winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib",
 316         "/DELAYLOAD:user32.dll", "/DELAYLOAD:urlmon.dll", "/DELAYLOAD:winmm.dll", "/DELAYLOAD:shell32.dll",
 317         "/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"].flatten()
 318 WIN.glass.lib = "glass"
 319 
 320 WIN.decora = [:]
 321 WIN.decora.compiler = compiler
 322 WIN.decora.ccFlags = [IS_64 ? [] : ["/arch:SSE"], "/fp:fast", ccFlags].flatten()
 323 WIN.decora.linker = linker
 324 WIN.decora.linkFlags = [linkFlags].flatten()
 325 WIN.decora.lib = "decora_sse"
 326 WIN.decora.rcCompiler = rcCompiler;
 327 WIN.decora.rcSource = defaultRcSource
 328 WIN.decora.rcFlags = ["/d", "JFX_FNAME=decora_sse.dll", "/d", "JFX_INTERNAL_NAME=decora", rcFlags].flatten()
 329 
 330 WIN.prism = [:]
 331 WIN.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
 332 WIN.prism.nativeSource = file("${project("graphics").projectDir}/src/main/native-prism")
 333 WIN.prism.compiler = compiler
 334 WIN.prism.ccFlags = [ccFlags].flatten()
 335 WIN.prism.linker = linker
 336 WIN.prism.linkFlags = [linkFlags].flatten()
 337 WIN.prism.lib = "prism_common"
 338 WIN.prism.rcCompiler = rcCompiler;
 339 WIN.prism.rcSource = defaultRcSource
 340 WIN.prism.rcFlags = ["/d", "JFX_FNAME=prism_common.dll", "/d", "JFX_INTERNAL_NAME=prism", rcFlags].flatten()
 341 
 342 WIN.prismSW = [:]
 343 WIN.prismSW.javahInclude = ["com/sun/pisces/**/*"]
 344 WIN.prismSW.nativeSource = file("${project("graphics").projectDir}/src/main/native-prism-sw")
 345 WIN.prismSW.compiler = compiler
 346 WIN.prismSW.ccFlags = [ccFlags].flatten()
 347 WIN.prismSW.linker = linker
 348 WIN.prismSW.linkFlags = [linkFlags].flatten()
 349 WIN.prismSW.lib = "prism_sw"
 350 WIN.prismSW.rcCompiler = rcCompiler;
 351 WIN.prismSW.rcSource = defaultRcSource
 352 WIN.prismSW.rcFlags = ["/d", "JFX_FNAME=prism_sw.dll", "/d", "JFX_INTERNAL_NAME=prismSW", rcFlags].flatten()
 353 
 354 WIN.prismD3D = [:]
 355 WIN.prismD3D.javahInclude = ["com/sun/prism/d3d/**/*"]
 356 WIN.prismD3D.nativeSource = [
 357     file("${project("graphics").projectDir}/src/main/native-prism-d3d"),
 358     file("${project("graphics").projectDir}/src/main/native-prism-d3d/hlsl")]
 359 WIN.prismD3D.compiler = compiler
 360 WIN.prismD3D.ccFlags = [ccFlags, "/Ibuild/headers/PrismD3D"].flatten()
 361 WIN.prismD3D.linker = linker
 362 WIN.prismD3D.linkFlags = [linkFlags, "user32.lib"].flatten()
 363 WIN.prismD3D.lib = "prism_d3d"
 364 WIN.prismD3D.rcCompiler = rcCompiler;
 365 WIN.prismD3D.rcSource = defaultRcSource
 366 WIN.prismD3D.rcFlags = ["/d", "JFX_FNAME=prism_d3d.dll", "/d", "JFX_INTERNAL_NAME=prismD3D", rcFlags].flatten();
 367 
 368 WIN.launcher = [:]
 369 WIN.launcher.compiler = compiler
 370 WIN.launcher.ccFlags = ["/nologo", "/W3", "/MT", "/EHsc", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE", "/DWIN32",
 371         "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN", "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 372         ccDebugFlags].flatten();
 373 WIN.launcher.linker = linker
 374 WIN.launcher.linkFlags = ["/link", "/nologo", "/WX", "/SUBSYSTEM:WINDOWS", "user32.lib", "shell32.lib", "advapi32.lib"]
 375 if (IS_DEBUG_NATIVE) WIN.launcher.linkFlags.add("/debug");
 376 
 377 WIN.launcherlibrary = [:]
 378 WIN.launcherlibrary.compiler = compiler
 379 WIN.launcherlibrary.ccFlags = ["/nologo", "/W3",
 380         // "/WX",
 381         "/EHsc", "/c", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE", "/DWIN32",
 382         "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN", "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 383         ccDebugFlags].flatten();
 384 WIN.launcherlibrary.linker = linker
 385 WIN.launcherlibrary.linkFlags = ["/nologo", "/WX", "/DLL", "/SUBSYSTEM:WINDOWS", "user32.lib", "shell32.lib", "advapi32.lib", "ole32.lib"]
 386 if (IS_DEBUG_NATIVE) WIN.launcherlibrary.linkFlags.add("/debug");
 387 
 388 WIN.fxpackager = [:]
 389 WIN.fxpackager.nativeSource = [
 390     file("${project("fxpackager").projectDir}/src/main/native/javapackager/win")]
 391 WIN.fxpackager.compiler = compiler
 392 WIN.fxpackager.ccFlags = ["/nologo", "/W3", "/EHsc", "/MT", "/GS",  "/DUNICODE", "/D_UNICODE",
 393                     "/DWIN32", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
 394                     "/D_WIN32_WINDOWS=0X0500", "/D_WIN32_WINNT=0X0500",
 395                     "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 396                     "/O2", "-c"]
 397 WIN.fxpackager.linker = linker
 398 WIN.fxpackager.linkFlags = ["/nologo", "/SUBSYSTEM:CONSOLE", "/opt:REF", "/incremental:no", "/manifest", "kernel32.lib", "advapi32.lib"];
 399 WIN.fxpackager.rcSource = file("${project("fxpackager").projectDir}/src/main/native/javapackager/win/javapackager.rc")
 400 WIN.fxpackager.rcCompiler = rcCompiler
 401 WIN.fxpackager.rcFlags = [
 402     "/l", "0x409",
 403     "/d", "JFX_FNAME=javapackager.exe",
 404     "/d", "JFX_INTERNAL_NAME=javapackager",
 405     rcFlags].flatten();
 406 
 407 WIN.iio = [:]
 408 WIN.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
 409 WIN.iio.nativeSource = [
 410     file("${project("graphics").projectDir}/src/main/native-iio"),
 411     file("${project("graphics").projectDir}/src/main/native-iio/libjpeg7")]
 412 WIN.iio.compiler = compiler
 413 WIN.iio.ccFlags = [ccFlags].flatten()
 414 WIN.iio.linker = linker
 415 WIN.iio.linkFlags = [linkFlags].flatten()
 416 WIN.iio.lib = "javafx_iio"
 417 WIN.iio.rcCompiler = rcCompiler;
 418 WIN.iio.rcSource = defaultRcSource
 419 WIN.iio.rcFlags = ["/d", "JFX_FNAME=javafx_iio.dll", "/d", "JFX_INTERNAL_NAME=iio", rcFlags].flatten();
 420 
 421 WIN.prismES2 = [:]
 422 WIN.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
 423 WIN.prismES2.nativeSource = [
 424     file("${project("graphics").projectDir}/src/main/native-prism-es2"),
 425     file("${project("graphics").projectDir}/src/main/native-prism-es2/GL"),
 426     file("${project("graphics").projectDir}/src/main/native-prism-es2/windows")
 427 ]
 428 WIN.prismES2.compiler = compiler
 429 WIN.prismES2.ccFlags = ["/Ob1", "/GF", "/Gy", "/GS", "/DWIN32", ccFlags].flatten()
 430 WIN.prismES2.linker = linker
 431 WIN.prismES2.linkFlags = [linkFlags, "/SUBSYSTEM:WINDOWS", "opengl32.lib", "gdi32.lib", "user32.lib", "kernel32.lib"].flatten()
 432 WIN.prismES2.lib = "prism_es2"
 433 WIN.prismES2.rcCompiler = rcCompiler;
 434 WIN.prismES2.rcSource = defaultRcSource
 435 WIN.prismES2.rcFlags = ["/d", "JFX_FNAME=prism_es2.dll", "/d", "JFX_INTERNAL_NAME=prismES2", rcFlags].flatten();
 436 
 437 def closedDir = file("$projectDir/../rt-closed")
 438 WIN.font = [:]
 439 WIN.font.javahInclude = [
 440         "com/sun/javafx/font/**/*",
 441         "com/sun/javafx/text/**/*"]
 442 WIN.font.nativeSource = [file("${project("graphics").projectDir}/src/main/native-font")]
 443 WIN.font.compiler = compiler
 444 WIN.font.ccFlags = ["/DJFXFONT_PLUS", "/D_WIN32_WINNT=0x0601", ccFlags].flatten()
 445 WIN.font.ccFlags -= ["/DUNICODE", "/D_UNICODE"]
 446 WIN.font.linker = linker
 447 WIN.font.linkFlags = [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib", "dwrite.lib", "d2d1.lib", "windowscodecs.lib", "ole32.lib"].flatten()
 448 WIN.font.lib = "javafx_font"
 449 WIN.font.rcCompiler = rcCompiler;
 450 WIN.font.rcSource = defaultRcSource
 451 WIN.font.rcFlags = ["/d", "JFX_FNAME=javafx_font.dll", "/d", "JFX_INTERNAL_NAME=font", rcFlags].flatten();
 452 
 453 WIN.media = [:]
 454 WIN.media.rcCompiler = rcCompiler
 455 WIN.media.rcSource = defaultRcSource
 456 WIN.media.glibRcFile = "glib-lite.res"
 457 WIN.media.gstreamerRcFile = "gstreamer-lite.res"
 458 WIN.media.fxpluginsRcFile = "fxplugins.res"
 459 WIN.media.jfxmediaRcFile = "jfxmedia.res"
 460 WIN.media.glibRcFlags = ["/d", "JFX_FNAME=glib-lite.dll", "/d", "JFX_INTERNAL_NAME=glib", rcFlags].flatten()
 461 WIN.media.gstreamerRcFlags = ["/d", "JFX_FNAME=gstreamer-lite.dll", "/d", "JFX_INTERNAL_NAME=gstreamer", rcFlags].flatten()
 462 WIN.media.fxpluginsRcFlags = ["/d", "JFX_FNAME=fxplugins.dll", "/d", "JFX_INTERNAL_NAME=fxplugins", rcFlags].flatten()
 463 WIN.media.jfxmediaRcFlags = ["/d", "JFX_FNAME=jfxmedia.dll", "/d", "JFX_INTERNAL_NAME=jfxmedia", rcFlags].flatten()
 464 def parfaitPath = System.getenv("PARFAIT_PATH");
 465 WIN.media.compiler = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-cl.exe" : "cl.exe";
 466 WIN.media.linker = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-link.exe" : "link.exe";
 467 WIN.media.ar = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-lib.exe" : "lib.exe";
 468 
 469 WIN.webkit = [:]
 470 WIN.webkit.rcCompiler = rcCompiler
 471 WIN.webkit.rcSource = defaultRcSource
 472 WIN.webkit.rcFlags = ["/d", "JFX_FNAME=jfxwebkit.dll", "/d", "JFX_INTERNAL_NAME=webkit", rcFlags].flatten();