view buildSrc/win.gradle @ 7887:08fef750e7dd

RT-38431: Use consistent ACC in callback Reviewed-by: anthony, msladecek
author kcr
date Wed, 27 Aug 2014 08:40:45 -0700
parents 65ed4256d047
children 8335da240a33
line wrap: on
line source
/*
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

ext.WIN = [:]

WIN.canBuild = IS_WINDOWS
if (!WIN.canBuild) return;

WIN.compileSwing = true;
WIN.compileSWT = true;
WIN.compileFXPackager = true;
WIN.compileDesignTime = true;

WIN.includeNull3d = true

// Lambda for naming the generated libs
WIN.library = { name -> return "${name}.dll" as String }

WIN.libDest = "bin"

def ccFlags = ["/nologo", "/W3", "/EHsc", "/c",
        "/D_STATIC_CPPLIB", "/D_DISABLE_DEPRECATE_STATIC_CPPLIB", "/DINLINE=__inline",
        "/DUNICODE", "/D_UNICODE", "/DWIN32", "/DIAL", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
        "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
        IS_DEBUG_NATIVE ? ["/MDd", "/Od", "/Zi", "/DDEBUG"] : ["/O2", "/MD", "/DNDEBUG"]].flatten();

def linkFlags = ["/nologo", "/dll", "/manifest", "/opt:REF", "/incremental:no"];
if (IS_DEBUG_NATIVE) linkFlags.add("/debug");

setupTools("windows_tools",
    { propFile ->
        // Create the properties file
        ByteArrayOutputStream results = new ByteArrayOutputStream();
        String winsdkDir = System.getenv().get("WINSDK_DIR");
        exec({
            environment([
                    "WINSDKPATH" : winsdkDir == null ? "" : winsdkDir,
                    "CONF"       : "/$CONF", // TODO does this mean the generated properties must be reset when in a different configuration?
                    "VCARCH"     : IS_64 ? "amd64" : "x86",
                    "SDKARCH"    : IS_64 ? "/x64" : "/x86",
            ]);
            commandLine("cmd", "/q", "/c", "buildSrc\\genVSproperties.bat");
            setStandardOutput(results);
        });
        BufferedReader reader = new BufferedReader(new StringReader(results.toString().trim()));
        reader.readLine();
        reader.readLine();
        String line;
        while ((line = reader.readLine()) != null && !line.startsWith("######")) {
            line = line.replace("\\", "/").replace("/@@ENDOFLINE@@", "").replace("@@ENDOFLINE@@", "").replace("//", "/").replace("windows.vs.", "WINDOWS_VS_");
            propFile << line << "\r\n";
        }
    },
    { properties ->
        defineProperty("WINDOWS_VS_VSINSTALLDIR", properties, "c:/Program Files (x86)/Microsoft Visual Studio 10.0");
        defineProperty("WINDOWS_SDK_DIR", properties, System.getenv().get("WINSDK_DIR"))
        defineProperty("WINDOWS_VS_VCINSTALLDIR", properties, "$WINDOWS_VS_VSINSTALLDIR/VC")
        defineProperty("WINDOWS_VS_DEVENVDIR", properties, "$WINDOWS_VS_VSINSTALLDIR/Common7/IDE")
        defineProperty("WINDOWS_VS_DEVENVCMD", properties, "$WINDOWS_VS_DEVENVDIR/VCExpress.exe")
        defineProperty("WINDOWS_VS_MSVCDIR", properties, WINDOWS_VS_VCINSTALLDIR)
        defineProperty("WINDOWS_DXSDK_DIR", properties, System.getenv().get("DXSDK_DIR"))
        defineProperty("WINDOWS_VS_INCLUDE", properties, "$WINDOWS_VS_VCINSTALLDIR/INCLUDE;" + "$WINDOWS_SDK_DIR/include;")
        defineProperty("WINDOWS_VS_VER", properties, "70")
        defineProperty("WINDOWS_VS_LIB", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;" + "$WINDOWS_SDK_DIR/lib;")
        defineProperty("WINDOWS_VS_LIBPATH", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;")
        def parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : "";
        defineProperty("WINDOWS_VS_PATH", properties, parfaitPath + "$WINDOWS_VS_DEVENVDIR;" +
                "$WINDOWS_VS_VSINSTALLDIR/VC/BIN;" +
                "$WINDOWS_VS_VSINSTALLDIR/Common7/Tools;" +
                "$WINDOWS_VS_VCINSTALLDIR/VCPackages;" +
                "$WINDOWS_SDK_DIR/bin/NETFX 4.0 Tools;" +
                "$WINDOWS_SDK_DIR/bin;" +
                System.getenv().get("PATH"))
    }
)

ext.WINDOWS_NATIVE_COMPILE_ENVIRONMENT = [
        "VCINSTALLDIR"         : WINDOWS_VS_VCINSTALLDIR,
        "VSINSTALLDIR"         : WINDOWS_VS_VSINSTALLDIR,
        "DEVENVDIR"            : WINDOWS_VS_DEVENVDIR,
        "MSVCDIR"              : WINDOWS_VS_MSVCDIR,
        "PATH"                 : WINDOWS_VS_PATH,
        "INCLUDE"              : WINDOWS_VS_INCLUDE,
        "LIB"                  : WINDOWS_VS_LIB,
        "LIBPATH"              : WINDOWS_VS_LIBPATH,
        "DXSDK_DIR"            : WINDOWS_DXSDK_DIR
];

String msvcBinDir = (IS_64
                  ? "$WINDOWS_VS_VSINSTALLDIR/VC/BIN/amd64"
                  : "$WINDOWS_VS_VSINSTALLDIR/VC/BIN")
def compiler = IS_COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe")
def linker = IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe")
ext.RC = cygpath("$WINDOWS_SDK_DIR/Bin/RC.Exe")
def rcCompiler = cygpath("$WINDOWS_SDK_DIR/Bin/RC.Exe")
ext.FXC = cygpath("$WINDOWS_DXSDK_DIR/utilities/bin/x86/fxc.exe")
ext.MC = cygpath("$WINDOWS_SDK_DIR/Bin/mt.exe")
// This next line is based on a line in the ant build scripts, but doesn't seem to point to the right place
//ext.MSVCR = cygpath("${WINDOWS_VS_MSVCDIR}/redist/${IS_64 ? 'x64' : 'x86'}/Microsoft.VC${WINDOWS_VS_VER}.CRT/msvcr${WINDOWS_VS_VER}.dll")

def rcFlags = [
    "/d", "\"JFX_COMPANY=${COMPANY_NAME}\"",
    "/d", "\"JFX_COMPONENT=${PRODUCT_NAME} ${PLATFORM_NAME} binary\"",
    "/d", "\"JFX_NAME=${PRODUCT_NAME} ${PLATFORM_NAME} ${jfxReleaseMajorVersion}\"",
    "/d", "\"JFX_VER=${jfxReleaseMajorVersion}.${jfxReleaseMinorVersion}.${jfxReleaseMicroVersion}.${PROMOTED_BUILD_NUMBER}\"",
    "/d", "\"JFX_BUILD_ID=${RAW_VERSION}-${RELEASE_MILESTONE}-b${PROMOTED_BUILD_NUMBER}\"",
    "/d", "\"JFX_COPYRIGHT=Copyright \u00A9 ${Calendar.getInstance().get(Calendar.YEAR)}\"",
    "/d", "\"JFX_FVER=${jfxReleaseMajorVersion},${jfxReleaseMinorVersion},${jfxReleaseMicroVersion},${PROMOTED_BUILD_NUMBER}\"",
    "/d", "\"JFX_FTYPE=0x2L\"",
    "/nologo"
];

def defaultRcSource = file("modules/graphics/src/main/resources/version.rc");

WIN.glass = [:]
WIN.glass.javahInclude = [
    "com/sun/glass/events/**",
    "com/sun/glass/ui/*",
    "com/sun/glass/ui/win/*"]
WIN.glass.nativeSource = file("modules/graphics/src/main/native-glass/win")
WIN.glass.compiler = compiler
WIN.glass.rcCompiler = rcCompiler;
WIN.glass.rcSource = file("modules/graphics/src/main/native-glass/win/GlassResources.rc");
WIN.glass.rcFlags = [
    "/I", file("modules/graphics/src/main/resources"),
    "/d", "JFX_FNAME=glass.dll",
    "/d", "JFX_INTERNAL_NAME=glass",
    rcFlags].flatten();
WIN.glass.ccFlags = [ccFlags, "/WX"].flatten()
WIN.glass.linker = linker
WIN.glass.linkFlags = [linkFlags, "delayimp.lib", "gdi32.lib", "urlmon.lib", "Comdlg32.lib",
        "winmm.lib", "imm32.lib", "shell32.lib", "Uiautomationcore.lib", "dwmapi.lib",
        "/DELAYLOAD:user32.dll", "/DELAYLOAD:urlmon.dll", "/DELAYLOAD:winmm.dll", "/DELAYLOAD:shell32.dll",
        "/DELAYLOAD:Uiautomationcore.dll", "/DELAYLOAD:dwmapi.dll"].flatten()
WIN.glass.lib = "glass"

WIN.decora = [:]
WIN.decora.compiler = compiler
WIN.decora.ccFlags = ["/arch:SSE", "/fp:fast", ccFlags].flatten()
WIN.decora.linker = linker
WIN.decora.linkFlags = [linkFlags].flatten()
WIN.decora.lib = "decora_sse"
WIN.decora.rcCompiler = rcCompiler;
WIN.decora.rcSource = defaultRcSource
WIN.decora.rcFlags = ["/d", "JFX_FNAME=decora_sse.dll", "/d", "JFX_INTERNAL_NAME=decora", rcFlags].flatten()

WIN.prism = [:]
WIN.prism.javahInclude = ["com/sun/prism/impl/**/*", "com/sun/prism/PresentableState*"]
WIN.prism.nativeSource = file("modules/graphics/src/main/native-prism")
WIN.prism.compiler = compiler
WIN.prism.ccFlags = [ccFlags].flatten()
WIN.prism.linker = linker
WIN.prism.linkFlags = [linkFlags].flatten()
WIN.prism.lib = "prism_common"
WIN.prism.rcCompiler = rcCompiler;
WIN.prism.rcSource = defaultRcSource
WIN.prism.rcFlags = ["/d", "JFX_FNAME=prism_common.dll", "/d", "JFX_INTERNAL_NAME=prism", rcFlags].flatten()

WIN.prismSW = [:]
WIN.prismSW.javahInclude = ["com/sun/pisces/**/*"]
WIN.prismSW.nativeSource = file("modules/graphics/src/main/native-prism-sw")
WIN.prismSW.compiler = compiler
WIN.prismSW.ccFlags = [ccFlags].flatten()
WIN.prismSW.linker = linker
WIN.prismSW.linkFlags = [linkFlags].flatten()
WIN.prismSW.lib = "prism_sw"
WIN.prismSW.rcCompiler = rcCompiler;
WIN.prismSW.rcSource = defaultRcSource
WIN.prismSW.rcFlags = ["/d", "JFX_FNAME=prism_sw.dll", "/d", "JFX_INTERNAL_NAME=prismSW", rcFlags].flatten()

WIN.prismD3D = [:]
WIN.prismD3D.javahInclude = ["com/sun/prism/d3d/**/*"]
WIN.prismD3D.nativeSource = [
    file("modules/graphics/src/main/native-prism-d3d"),
    file("modules/graphics/src/main/native-prism-d3d/hlsl")]
WIN.prismD3D.compiler = compiler
WIN.prismD3D.ccFlags = [ccFlags, "/Ibuild/headers/PrismD3D"].flatten()
WIN.prismD3D.linker = linker
WIN.prismD3D.linkFlags = [linkFlags, "user32.lib"].flatten()
WIN.prismD3D.lib = "prism_d3d"
WIN.prismD3D.rcCompiler = rcCompiler;
WIN.prismD3D.rcSource = defaultRcSource
WIN.prismD3D.rcFlags = ["/d", "JFX_FNAME=prism_d3d.dll", "/d", "JFX_INTERNAL_NAME=prismD3D", rcFlags].flatten();

WIN.launcher = [:]
WIN.launcher.compiler = compiler
WIN.launcher.ccFlags = ["/nologo", "/W3", "/EHsc", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE", "/DWIN32",
        "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN", "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32",
        "/arch:SSE", "/fp:fast", "/O2", "/MD"];
WIN.launcher.linker = linker
WIN.launcher.linkFlags = ["/link", "/nologo", "/SUBSYSTEM:WINDOWS", "user32.lib", "shell32.lib", "advapi32.lib"]

WIN.iconLauncher = [:]
WIN.iconLauncher.compiler = compiler
WIN.iconLauncher.ccFlags = ["/nologo", "/W3", "/EHsc", "/D_WINDOWS", "/DUNICODE", "/D_UNICODE",
        "/arch:SSE", "/fp:fast", "/O2"]
WIN.iconLauncher.linker = linker
WIN.iconLauncher.linkFlags = ["/link", "/nologo", "/SUBSYSTEM:CONSOLE"];

WIN.fxpackager = [:]
WIN.fxpackager.nativeSource = [
    file("modules/fxpackager/src/main/native/javapackager/win")]
WIN.fxpackager.compiler = compiler
WIN.fxpackager.ccFlags = ["/nologo", "/W3", "/EHsc", "/MT", "/GS",
                    "/DWIN32", "/D_LITTLE_ENDIAN", "/DWIN32_LEAN_AND_MEAN",
                    "/D_WIN32_WINDOWS=0X0500", "/D_WIN32_WINNT=0X0500",
                    "/I$JDK_HOME/include", "/I$JDK_HOME/include/win32", "/arch:SSE", "/fp:fast",
                    "/O2", "-c"]
WIN.fxpackager.linker = linker

WIN.iio = [:]
WIN.iio.javahInclude = ["com/sun/javafx/iio/**/*"]
WIN.iio.nativeSource = [
    file("modules/graphics/src/main/native-iio"),
    file("modules/graphics/src/main/native-iio/libjpeg7")]
WIN.iio.compiler = compiler
WIN.iio.ccFlags = [ccFlags].flatten()
WIN.iio.linker = linker
WIN.iio.linkFlags = [linkFlags].flatten()
WIN.iio.lib = "javafx_iio"
WIN.iio.rcCompiler = rcCompiler;
WIN.iio.rcSource = defaultRcSource
WIN.iio.rcFlags = ["/d", "JFX_FNAME=javafx_iio.dll", "/d", "JFX_INTERNAL_NAME=iio", rcFlags].flatten();

WIN.prismES2 = [:]
WIN.prismES2.javahInclude = ["com/sun/prism/es2/**/*"]
WIN.prismES2.nativeSource = [
    file("modules/graphics/src/main/native-prism-es2"),
    file("modules/graphics/src/main/native-prism-es2/GL"),
    file("modules/graphics/src/main/native-prism-es2/windows")
]
WIN.prismES2.compiler = compiler
WIN.prismES2.ccFlags = ["/Ob1", "/GF", "/Gy", "/GS", "/DWIN32", ccFlags].flatten()
WIN.prismES2.linker = linker
WIN.prismES2.linkFlags = [linkFlags, "/SUBSYSTEM:WINDOWS", "opengl32.lib", "gdi32.lib", "user32.lib", "kernel32.lib"].flatten()
WIN.prismES2.lib = "prism_es2"
WIN.prismES2.rcCompiler = rcCompiler;
WIN.prismES2.rcSource = defaultRcSource
WIN.prismES2.rcFlags = ["/d", "JFX_FNAME=prism_es2.dll", "/d", "JFX_INTERNAL_NAME=prismES2", rcFlags].flatten();

def closedDir = file("$projectDir/../rt-closed")
WIN.font = [:]
WIN.font.javahInclude = [
        "com/sun/javafx/font/**/*",
        "com/sun/javafx/text/**/*"]
WIN.font.nativeSource = [file("modules/graphics/src/main/native-font")]
WIN.font.compiler = compiler
WIN.font.ccFlags = ["/DJFXFONT_PLUS", ccFlags].flatten()
WIN.font.ccFlags -= ["/DUNICODE", "/D_UNICODE"]
WIN.font.linker = linker
WIN.font.linkFlags = [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib", "dwrite.lib", "d2d1.lib", "windowscodecs.lib", "ole32.lib"].flatten()
WIN.font.lib = "javafx_font"
WIN.font.rcCompiler = rcCompiler;
WIN.font.rcSource = defaultRcSource
WIN.font.rcFlags = ["/d", "JFX_FNAME=javafx_font.dll", "/d", "JFX_INTERNAL_NAME=font", rcFlags].flatten();

WIN.fontT2K = [:]
WIN.fontT2K.javahInclude = ["com/sun/javafx/font/t2k/**/*"]
WIN.fontT2K.nativeSource = [
        file("$closedDir/javafx-font-t2k-native/src"),
        file("$closedDir/javafx-font-t2k-native/src/layout")]
WIN.fontT2K.compiler = compiler
WIN.fontT2K.ccFlags = ["/DJFXFONT_PLUS", "/DLE_STANDALONE", ccFlags].flatten()
WIN.fontT2K.linker = linker
WIN.fontT2K.linkFlags = [linkFlags, "advapi32.lib", "gdi32.lib", "user32.lib"].flatten()
WIN.fontT2K.lib = "javafx_font_t2k"
WIN.fontT2K.rcCompiler = rcCompiler;
WIN.fontT2K.rcSource = defaultRcSource
WIN.fontT2K.rcFlags = ["/d", "JFX_FNAME=javafx_font_t2k.dll", "/d", "JFX_INTERNAL_NAME=fontT2K", rcFlags].flatten();

WIN.media = [:]
WIN.media.rcCompiler = rcCompiler
WIN.media.rcSource = defaultRcSource
WIN.media.glibRcFile = "glib-lite.res"
WIN.media.gstreamerRcFile = "gstreamer-lite.res"
WIN.media.fxpluginsRcFile = "fxplugins.res"
WIN.media.jfxmediaRcFile = "jfxmedia.res"
WIN.media.glibRcFlags = ["/d", "JFX_FNAME=glib-lite.dll", "/d", "JFX_INTERNAL_NAME=glib", rcFlags].flatten()
WIN.media.gstreamerRcFlags = ["/d", "JFX_FNAME=gstreamer-lite.dll", "/d", "JFX_INTERNAL_NAME=gstreamer", rcFlags].flatten()
WIN.media.fxpluginsRcFlags = ["/d", "JFX_FNAME=fxplugins.dll", "/d", "JFX_INTERNAL_NAME=fxplugins", rcFlags].flatten()
WIN.media.jfxmediaRcFlags = ["/d", "JFX_FNAME=jfxmedia.dll", "/d", "JFX_INTERNAL_NAME=jfxmedia", rcFlags].flatten()

WIN.webkit = [:]
WIN.webkit.rcCompiler = rcCompiler
WIN.webkit.rcSource = defaultRcSource
WIN.webkit.rcFlags = ["/d", "JFX_FNAME=jfxwebkit.dll", "/d", "JFX_INTERNAL_NAME=webkit", rcFlags].flatten();