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     def VS2017DLLs = [
 200         "concrt140.dll",
 201         "msvcp140.dll",
 202         "vcruntime140.dll"
 203     ];
 204     ext.WIN.VS2017DLLs = []
 205         VS2017DLLs.each { vsdll->
 206             ext.WIN.VS2017DLLs += "$vs2017DllPath/$vsdll"
 207         }
 208 }
 209 else {
 210     ext.WIN.VS2017DLLs = [
 211         ];
 212 }
 213 
 214 def WinSDKDLLsPath = cygpath("${winSdkDllDir}")
 215 if (file(WinSDKDLLsPath).exists()) {
 216     def WinSDKDLLs = [
 217         "api-ms-win-core-console-l1-1-0.dll",
 218         "api-ms-win-core-datetime-l1-1-0.dll",
 219         "api-ms-win-core-debug-l1-1-0.dll",
 220         "api-ms-win-core-errorhandling-l1-1-0.dll",
 221         "api-ms-win-core-file-l1-1-0.dll",
 222         "api-ms-win-core-file-l1-2-0.dll",
 223         "api-ms-win-core-file-l2-1-0.dll",
 224         "api-ms-win-core-handle-l1-1-0.dll",
 225         "api-ms-win-core-heap-l1-1-0.dll",
 226         "api-ms-win-core-interlocked-l1-1-0.dll",
 227         "api-ms-win-core-libraryloader-l1-1-0.dll",
 228         "api-ms-win-core-localization-l1-2-0.dll",
 229         "api-ms-win-core-memory-l1-1-0.dll",
 230         "api-ms-win-core-namedpipe-l1-1-0.dll",
 231         "api-ms-win-core-processenvironment-l1-1-0.dll",
 232         "api-ms-win-core-processthreads-l1-1-0.dll",
 233         "api-ms-win-core-processthreads-l1-1-1.dll",
 234         "api-ms-win-core-profile-l1-1-0.dll",
 235         "api-ms-win-core-rtlsupport-l1-1-0.dll",
 236         "api-ms-win-core-string-l1-1-0.dll",
 237         "api-ms-win-core-synch-l1-1-0.dll",
 238         "api-ms-win-core-synch-l1-2-0.dll",
 239         "api-ms-win-core-sysinfo-l1-1-0.dll",
 240         "api-ms-win-core-timezone-l1-1-0.dll",
 241         "api-ms-win-core-util-l1-1-0.dll",
 242         "api-ms-win-crt-conio-l1-1-0.dll",
 243         "api-ms-win-crt-convert-l1-1-0.dll",
 244         "api-ms-win-crt-environment-l1-1-0.dll",
 245         "api-ms-win-crt-filesystem-l1-1-0.dll",
 246         "api-ms-win-crt-heap-l1-1-0.dll",
 247         "api-ms-win-crt-locale-l1-1-0.dll",
 248         "api-ms-win-crt-math-l1-1-0.dll",
 249         "api-ms-win-crt-multibyte-l1-1-0.dll",
 250         "api-ms-win-crt-private-l1-1-0.dll",
 251         "api-ms-win-crt-process-l1-1-0.dll",
 252         "api-ms-win-crt-runtime-l1-1-0.dll",
 253         "api-ms-win-crt-stdio-l1-1-0.dll",
 254         "api-ms-win-crt-string-l1-1-0.dll",
 255         "api-ms-win-crt-time-l1-1-0.dll",
 256         "api-ms-win-crt-utility-l1-1-0.dll",
 257         "ucrtbase.dll"
 258     ];
 259     ext.WIN.WinSDKDLLs = []
 260         WinSDKDLLs.each { winsdkdll->
 261             ext.WIN.WinSDKDLLs += "$WinSDKDLLsPath/$winsdkdll"
 262         }
 263 }
 264 else {
 265     ext.WIN.WinSDKDLLs = [
 266     ];
 267 }
 268 
 269 // Product version variables passed to RC:
 270 def rcVer = "$RELEASE_VERSION"
 271 def rcVerMajor = Integer.parseInt(jfxReleaseMajorVersion)
 272 def rcVerMinor = Integer.parseInt(jfxReleaseMinorVersion)
 273 def rcVerSecurity = Integer.parseInt(jfxReleaseSecurityVersion)
 274 def rcVerPatch = Integer.parseInt(jfxReleasePatchVersion)
 275 def rcVerFile = "${rcVerMajor},${rcVerMinor},${rcVerSecurity},${rcVerPatch}"
 276 def rcVerBuild = "$RELEASE_VERSION_LONG"
 277 def rcVerCopyrYear = "${Calendar.getInstance().get(Calendar.YEAR)}"
 278 
 279 def rcFlags = [
 280     "/d", "\"JFX_COMPANY=${COMPANY_NAME}\"",
 281     "/d", "\"JFX_COMPONENT=${PRODUCT_NAME} ${PLATFORM_NAME} binary\"",
 282     "/d", "\"JFX_NAME=${PRODUCT_NAME} ${PLATFORM_NAME} ${rcVerMajor}\"",
 283     "/d", "\"JFX_VER=${rcVer}\"",
 284     "/d", "\"JFX_BUILD_ID=${rcVerBuild}\"",
 285     "/d", "\"JFX_COPYRIGHT=Copyright \u00A9 ${rcVerCopyrYear}\"",
 286     "/d", "\"JFX_FVER=${rcVerFile}\"",
 287     "/d", "\"JFX_FTYPE=0x2L\"",
 288     "/nologo"
 289 ];
 290 
 291 def defaultRcSource = file("${project("graphics").projectDir}/src/main/resources/version.rc");
 292 
 293 WIN.glass = [:]
 294 WIN.glass.javahInclude = [
 295     "com/sun/glass/events/**",
 296     "com/sun/glass/ui/*",
 297     "com/sun/glass/ui/win/*"]
 298 WIN.glass.nativeSource = file("${project("graphics").projectDir}/src/main/native-glass/win")
 299 WIN.glass.compiler = compiler
 300 WIN.glass.rcCompiler = rcCompiler;
 301 WIN.glass.rcSource = file("${project("graphics").projectDir}/src/main/native-glass/win/GlassResources.rc");
 302 WIN.glass.rcFlags = [
 303     "/I", file("${project("graphics").projectDir}/src/main/resources"),
 304     "/d", "JFX_FNAME=glass.dll",
 305     "/d", "JFX_INTERNAL_NAME=glass",
 306     rcFlags].flatten();
 307 WIN.glass.ccFlags = [ccFlags, "/WX"].flatten()
 308 if (WINDOWS_VS_VER != "100") WIN.glass.ccFlags -= ["/WX"]
 309 WIN.glass.linker = linker
 310 WIN.glass.linkFlags = [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
 311         "winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib",
 312         "/DELAYLOAD:user32.dll", "/DELAYLOAD:urlmon.dll", "/DELAYLOAD:winmm.dll", "/DELAYLOAD:shell32.dll",
 313         "/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"].flatten()
 314 WIN.glass.lib = "glass"
 315 
 316 WIN.decora = [:]
 317 WIN.decora.compiler = compiler
 318 WIN.decora.ccFlags = [IS_64 ? [] : ["/arch:SSE"], "/fp:fast", ccFlags].flatten()
 319 WIN.decora.linker = linker
 320 WIN.decora.linkFlags = [linkFlags].flatten()
 321 WIN.decora.lib = "decora_sse"
 322 WIN.decora.rcCompiler = rcCompiler;
 323 WIN.decora.rcSource = defaultRcSource
 324 WIN.decora.rcFlags = ["/d", "JFX_FNAME=decora_sse.dll", "/d", "JFX_INTERNAL_NAME=decora", rcFlags].flatten()
 325 
 326 WIN.prism = [:]
 327 WIN.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
 328 WIN.prism.nativeSource = file("${project("graphics").projectDir}/src/main/native-prism")
 329 WIN.prism.compiler = compiler
 330 WIN.prism.ccFlags = [ccFlags].flatten()
 331 WIN.prism.linker = linker
 332 WIN.prism.linkFlags = [linkFlags].flatten()
 333 WIN.prism.lib = "prism_common"
 334 WIN.prism.rcCompiler = rcCompiler;
 335 WIN.prism.rcSource = defaultRcSource
 336 WIN.prism.rcFlags = ["/d", "JFX_FNAME=prism_common.dll", "/d", "JFX_INTERNAL_NAME=prism", rcFlags].flatten()
 337 
 338 WIN.prismSW = [:]
 339 WIN.prismSW.javahInclude = ["com/sun/pisces/**/*"]
 340 WIN.prismSW.nativeSource = file("${project("graphics").projectDir}/src/main/native-prism-sw")
 341 WIN.prismSW.compiler = compiler
 342 WIN.prismSW.ccFlags = [ccFlags].flatten()
 343 WIN.prismSW.linker = linker
 344 WIN.prismSW.linkFlags = [linkFlags].flatten()
 345 WIN.prismSW.lib = "prism_sw"
 346 WIN.prismSW.rcCompiler = rcCompiler;
 347 WIN.prismSW.rcSource = defaultRcSource
 348 WIN.prismSW.rcFlags = ["/d", "JFX_FNAME=prism_sw.dll", "/d", "JFX_INTERNAL_NAME=prismSW", rcFlags].flatten()
 349 
 350 WIN.prismD3D = [:]
 351 WIN.prismD3D.javahInclude = ["com/sun/prism/d3d/**/*"]
 352 WIN.prismD3D.nativeSource = [
 353     file("${project("graphics").projectDir}/src/main/native-prism-d3d"),
 354     file("${project("graphics").projectDir}/src/main/native-prism-d3d/hlsl")]
 355 WIN.prismD3D.compiler = compiler
 356 WIN.prismD3D.ccFlags = [ccFlags, "/Ibuild/headers/PrismD3D"].flatten()
 357 WIN.prismD3D.linker = linker
 358 WIN.prismD3D.linkFlags = [linkFlags, "user32.lib"].flatten()
 359 WIN.prismD3D.lib = "prism_d3d"
 360 WIN.prismD3D.rcCompiler = rcCompiler;
 361 WIN.prismD3D.rcSource = defaultRcSource
 362 WIN.prismD3D.rcFlags = ["/d", "JFX_FNAME=prism_d3d.dll", "/d", "JFX_INTERNAL_NAME=prismD3D", rcFlags].flatten();
 363 
 364 WIN.launcher = [:]
 365 WIN.launcher.compiler = compiler
 366 WIN.launcher.ccFlags = ["/nologo", "/W3", "/MT", "/EHsc", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE", "/DWIN32",
 367         "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN", "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 368         ccDebugFlags].flatten();
 369 WIN.launcher.linker = linker
 370 WIN.launcher.linkFlags = ["/link", "/nologo", "/WX", "/SUBSYSTEM:WINDOWS", "user32.lib", "shell32.lib", "advapi32.lib"]
 371 if (IS_DEBUG_NATIVE) WIN.launcher.linkFlags.add("/debug");
 372 
 373 WIN.launcherlibrary = [:]
 374 WIN.launcherlibrary.compiler = compiler
 375 WIN.launcherlibrary.ccFlags = ["/nologo", "/W3",
 376         // "/WX",
 377         "/EHsc", "/c", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE", "/DWIN32",
 378         "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN", "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 379         ccDebugFlags].flatten();
 380 WIN.launcherlibrary.linker = linker
 381 WIN.launcherlibrary.linkFlags = ["/nologo", "/WX", "/DLL", "/SUBSYSTEM:WINDOWS", "user32.lib", "shell32.lib", "advapi32.lib", "ole32.lib"]
 382 if (IS_DEBUG_NATIVE) WIN.launcherlibrary.linkFlags.add("/debug");
 383 
 384 WIN.fxpackager = [:]
 385 WIN.fxpackager.nativeSource = [
 386     file("${project("fxpackager").projectDir}/src/main/native/javapackager/win")]
 387 WIN.fxpackager.compiler = compiler
 388 WIN.fxpackager.ccFlags = ["/nologo", "/W3", "/EHsc", "/MT", "/GS",  "/DUNICODE", "/D_UNICODE",
 389                     "/DWIN32", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
 390                     "/D_WIN32_WINDOWS=0X0500", "/D_WIN32_WINNT=0X0500",
 391                     "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
 392                     "/O2", "-c"]
 393 WIN.fxpackager.linker = linker
 394 WIN.fxpackager.linkFlags = ["/nologo", "/SUBSYSTEM:CONSOLE", "/opt:REF", "/incremental:no", "/manifest", "kernel32.lib", "advapi32.lib"];
 395 WIN.fxpackager.rcSource = file("${project("fxpackager").projectDir}/src/main/native/javapackager/win/javapackager.rc")
 396 WIN.fxpackager.rcCompiler = rcCompiler
 397 WIN.fxpackager.rcFlags = [
 398     "/l", "0x409",
 399     "/d", "JFX_FNAME=javapackager.exe",
 400     "/d", "JFX_INTERNAL_NAME=javapackager",
 401     rcFlags].flatten();
 402 
 403 WIN.iio = [:]
 404 WIN.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
 405 WIN.iio.nativeSource = [
 406     file("${project("graphics").projectDir}/src/main/native-iio"),
 407     file("${project("graphics").projectDir}/src/main/native-iio/libjpeg7")]
 408 WIN.iio.compiler = compiler
 409 WIN.iio.ccFlags = [ccFlags].flatten()
 410 WIN.iio.linker = linker
 411 WIN.iio.linkFlags = [linkFlags].flatten()
 412 WIN.iio.lib = "javafx_iio"
 413 WIN.iio.rcCompiler = rcCompiler;
 414 WIN.iio.rcSource = defaultRcSource
 415 WIN.iio.rcFlags = ["/d", "JFX_FNAME=javafx_iio.dll", "/d", "JFX_INTERNAL_NAME=iio", rcFlags].flatten();
 416 
 417 WIN.prismES2 = [:]
 418 WIN.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
 419 WIN.prismES2.nativeSource = [
 420     file("${project("graphics").projectDir}/src/main/native-prism-es2"),
 421     file("${project("graphics").projectDir}/src/main/native-prism-es2/GL"),
 422     file("${project("graphics").projectDir}/src/main/native-prism-es2/windows")
 423 ]
 424 WIN.prismES2.compiler = compiler
 425 WIN.prismES2.ccFlags = ["/Ob1", "/GF", "/Gy", "/GS", "/DWIN32", ccFlags].flatten()
 426 WIN.prismES2.linker = linker
 427 WIN.prismES2.linkFlags = [linkFlags, "/SUBSYSTEM:WINDOWS", "opengl32.lib", "gdi32.lib", "user32.lib", "kernel32.lib"].flatten()
 428 WIN.prismES2.lib = "prism_es2"
 429 WIN.prismES2.rcCompiler = rcCompiler;
 430 WIN.prismES2.rcSource = defaultRcSource
 431 WIN.prismES2.rcFlags = ["/d", "JFX_FNAME=prism_es2.dll", "/d", "JFX_INTERNAL_NAME=prismES2", rcFlags].flatten();
 432 
 433 def closedDir = file("$projectDir/../rt-closed")
 434 WIN.font = [:]
 435 WIN.font.javahInclude = [
 436         "com/sun/javafx/font/**/*",
 437         "com/sun/javafx/text/**/*"]
 438 WIN.font.nativeSource = [file("${project("graphics").projectDir}/src/main/native-font")]
 439 WIN.font.compiler = compiler
 440 WIN.font.ccFlags = ["/DJFXFONT_PLUS", "/D_WIN32_WINNT=0x0601", ccFlags].flatten()
 441 WIN.font.ccFlags -= ["/DUNICODE", "/D_UNICODE"]
 442 WIN.font.linker = linker
 443 WIN.font.linkFlags = [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib", "dwrite.lib", "d2d1.lib", "windowscodecs.lib", "ole32.lib"].flatten()
 444 WIN.font.lib = "javafx_font"
 445 WIN.font.rcCompiler = rcCompiler;
 446 WIN.font.rcSource = defaultRcSource
 447 WIN.font.rcFlags = ["/d", "JFX_FNAME=javafx_font.dll", "/d", "JFX_INTERNAL_NAME=font", rcFlags].flatten();
 448 
 449 WIN.media = [:]
 450 WIN.media.rcCompiler = rcCompiler
 451 WIN.media.rcSource = defaultRcSource
 452 WIN.media.glibRcFile = "glib-lite.res"
 453 WIN.media.gstreamerRcFile = "gstreamer-lite.res"
 454 WIN.media.fxpluginsRcFile = "fxplugins.res"
 455 WIN.media.jfxmediaRcFile = "jfxmedia.res"
 456 WIN.media.glibRcFlags = ["/d", "JFX_FNAME=glib-lite.dll", "/d", "JFX_INTERNAL_NAME=glib", rcFlags].flatten()
 457 WIN.media.gstreamerRcFlags = ["/d", "JFX_FNAME=gstreamer-lite.dll", "/d", "JFX_INTERNAL_NAME=gstreamer", rcFlags].flatten()
 458 WIN.media.fxpluginsRcFlags = ["/d", "JFX_FNAME=fxplugins.dll", "/d", "JFX_INTERNAL_NAME=fxplugins", rcFlags].flatten()
 459 WIN.media.jfxmediaRcFlags = ["/d", "JFX_FNAME=jfxmedia.dll", "/d", "JFX_INTERNAL_NAME=jfxmedia", rcFlags].flatten()
 460 def parfaitPath = System.getenv("PARFAIT_PATH");
 461 WIN.media.compiler = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-cl.exe" : "cl.exe";
 462 WIN.media.linker = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-link.exe" : "link.exe";
 463 WIN.media.ar = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-lib.exe" : "lib.exe";
 464 
 465 WIN.webkit = [:]
 466 WIN.webkit.rcCompiler = rcCompiler
 467 WIN.webkit.rcSource = defaultRcSource
 468 WIN.webkit.rcFlags = ["/d", "JFX_FNAME=jfxwebkit.dll", "/d", "JFX_INTERNAL_NAME=webkit", rcFlags].flatten();