1    /* 
     2     *  Copyright (c) 2009-2018 Texas Instruments Incorporated
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     *
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     *
    11     * */
    12    /*
    13     *  ======== Win32.xdc ========
    14     */
    15    
    16    /*!
    17     *  ======== Win32 ========
    18     *  Microsoft Windows 32-bit target using the Visual C/C++ compiler
    19     *
    20     *  This target can be configured to be used with different versions of
    21     *  Microsoft Visual C/C++ and different installations of Platform SDK (or a
    22     *  newer equivalent Windows SDK). The optional Platform SDK is needed only
    23     *  for building applications that use Windows API.
    24     *  The target `Win32` contains default configurations for Visual C/C++
    25     *  versions 8.0, and 14.0, but in order to support future versions of
    26     *  Visual C/C++ and different Windows SDK installations, there
    27     *  is a parameter {@link #sdkPath}, which users can set in their `config.bld`
    28     *  files to enable usage of this target with their installations.
    29     *
    30     *  Unlike the Visual C/C++ 6.x tool chain, this compiler complies very
    31     *  closely with the C/C++ language specification.  This target may be
    32     *  necessary in situations that take full advantage of the C++ language.
    33     */
    34    metaonly module Win32 inherits microsoft.targets.ITarget {
    35    
    36        override readonly config string name                = "Win32";
    37        override readonly config string os                  = "Windows";
    38        override readonly config string suffix              = "86W";
    39        override readonly config string isa                 = "x86";
    40        override readonly config xdc.bld.ITarget.Model model = {
    41            endian: "little"
    42        };
    43    
    44        override readonly config string rts = "microsoft.targets.rts";
    45    
    46        override config string platform     = "host.platforms.PC";
    47        override config string execExt      = ".exe";
    48    
    49        /*!
    50         *  ======== path ========
    51         *  Path components added during execution of commands
    52         */
    53        readonly config string path =
    54            "$(rootDir)/VC/bin;$(rootDir)/Common7/IDE";
    55    
    56        /*!
    57         *  ======== SDKPath ========
    58         *
    59         *  A structure type that defines Windows SDK paths to be used for building
    60         *  Windows applications with this target.
    61         *
    62         *  A Windows SDK installation is needed for building programs that use
    63         *  Windows API. However, Windows SDK installations can be anywhere on the
    64         *  disk and also include SDK version numbers (10.0.10586.0 for example).
    65         *  Therefore, these paths can't be derived from the target's rootDir.
    66         *
    67         *  @field(includePath) Absolute path to the Include directory of a Windows
    68         *  SDK installation. Windows SDK is required if the target is used to build
    69         *  executables that use Windows API.
    70         *
    71         *  @field(libraryPath) Absolute path to the Lib directory of a Windows
    72         *  SDK installation.
    73         *
    74         *  @field(libs) List of Windows SDK libraries to be added to the linker
    75         * command line.
    76         */
    77        struct SDKPath {
    78            string includePath[];
    79            string libraryPath[];
    80            string libs;
    81        };
    82    
    83        /*!
    84         *  ======== sdkPath ========
    85         *  Location of the header and library files in a Windows SDK installation
    86         *
    87         *  This parameter contains paths to the optional Windows SDK.
    88         *
    89         *  @a(Examples)
    90         *  If the content of `sdkPath`, set in `config.bld` is
    91         *  @p(code)
    92         *      Win32.sdkPath = {
    93         *          includePath: "C:/PROGRA~2/WI3CF2~1/10/Include/10.0.10586.0/ucrt",
    94         *          libraryPath: "C:/PROGRA~2/WI3CF2~1/10/Lib/10.0.10586.0/um/x86";
    95         *          libs: " libucrt.lib setargv.obj oldnames.lib ole32.lib
    96         * oleaut32.lib olepro32.lib uuid.lib kernel32.lib user32.lib gdi32.lib
    97         * advapi32.lib shell32.lib comctl32.lib mfc70.lib ucrt.lib"
    98         *      };
    99         *  the contents of `includePath`, `libraryPath` and `libs` are added to
   100         *  appropriate command lines.
   101         *
   102         *  If Windows SDK is not installed or needed, sdkPath's `includePath` and
   103         *  `libraryPath` should be empty.
   104         *  @p
   105         *
   106         */
   107        config SDKPath sdkPath = {
   108            includePath: [],
   109            libraryPath: [],
   110            libs: "ole32.lib oleaut32.lib olepro32.lib uuid.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib comctl32.lib"
   111        };
   112    
   113        /*!
   114         *  ======== profiles ========
   115         *  Standard options profiles are overwritten because we can't use 'MTs'
   116         *  and -D_DEBUG=1. Both of them added the debug version of the C runtime
   117         *  library to the manifest.
   118         */
   119        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   120            ["debug", {
   121                compileOpts: {
   122                    copts: "-Z7 -Odi -MTd",
   123                    defs:  "",
   124                },
   125                linkOpts: "-debug msvcrtd.lib vcruntimed.lib ucrtd.lib oldnames.lib",
   126            }],
   127    
   128            ["release", {
   129                compileOpts: {
   130                    copts: "-O2 -MT",
   131                    defs:  "",
   132                },
   133                linkOpts: "msvcrt.lib vcruntime.lib ucrt.lib oldnames.lib",
   134            }],
   135        ];
   136    
   137        /*!
   138         *  ======== ar ========
   139         *  The archiver command and all required options
   140         *  @p(dlist)
   141         *      -`-nologo`
   142         *          don't display archiver copyright
   143         */
   144        override readonly config xdc.bld.ITarget2.Command ar = {
   145            cmd: "$(rootDir)/VC/bin/lib.exe -nologo",
   146            opts: ""
   147        };
   148    
   149        /*!
   150         *  ======== cc ========
   151         *  The compile command and all required options
   152         *  @p(dlist)
   153         *      -`-W3`
   154         *          enable all warnings recommended for production purposes.
   155         *      -`-c`
   156         *          don't link
   157         *      -`-nologo`
   158         *          don't display compiler copyright
   159         *      -`-Zp1`
   160         *          Packs structure members on 1-byte boundry
   161         */
   162        override readonly config xdc.bld.ITarget2.Command cc = {
   163            cmd: "$(rootDir)/VC/bin/cl.exe -nologo -c",
   164            opts: '-Zp1 -W3 -D_DLL -DWINVER=_WIN32_WINNT_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -DWIN32 -DEXPORT=""'
   165        };
   166    
   167        /*!
   168         *  ======== asm ========
   169         *  The assemble command and all required options
   170         *  @p(dlist)
   171         *      -`-c`
   172         *          don't link
   173         *      -`-nologo`
   174         *          don't display macro assembler copyright
   175         */
   176        override readonly config xdc.bld.ITarget2.Command asm = {
   177            cmd: "$(rootDir)/VC/bin/ml -c",
   178            opts: "-nologo"
   179        };
   180    
   181        /*!
   182         *  ======== lnk ========
   183         *  The linker command and all required options
   184         *  @p(dlist)
   185         *      -`-nologo`
   186         *          Don't display linker copyright
   187         */
   188        override readonly config xdc.bld.ITarget2.Command lnk = {
   189            cmd: "$(rootDir)/VC/bin/link",
   190            opts: "-nologo"
   191        };
   192    
   193        /*!
   194         *  ======== ccOpts ========
   195         *  User modifiable default options.
   196         *  @p(dlist)
   197         *      -`-G5` (removed because it is incompatible with VC8.0)
   198         *          Optimizes code to favor the Pentium processor
   199         *      -`-Ob1`
   200         *          Expand only functions marked as inline or, in a C++
   201         *          member function, defined within a class declaration
   202         *      -`-Gs`
   203         *          Probe stack to automatically grow stack as necessary
   204         *      -`-GX` (removed because it is incompatible with VC8.0)
   205         *          Enables synchronous exception handling
   206         *      -`-WL`
   207         *          Write errors/warnings on a single output line
   208         */
   209        override config xdc.bld.ITarget2.Options ccOpts = {
   210            prefix: "-Ob1 -Gs",
   211            suffix: "-Dfar= "
   212        };
   213    
   214        /*!
   215         *  ======== lnkOpts ========
   216         *  User modifiable linker options
   217         *  @p(dlist)
   218         *      -`-libpath`
   219         *              directories to search for toolchain specific libraries
   220         *      -`-nodefaultlib`
   221         *              don't search for default libraries when linking; all
   222         *              libraries used must be explicitly named
   223         *      -`-incremental:no`
   224         *              link for execution (no subsequent link will occur)
   225         *      -`-machine:ix86`
   226         *              link for the Intel x86 architecture
   227         *      -`-map:$(XDCCFGDIR)/$@.map`
   228         *              output any link map information to the specified file
   229         *              ($(XDCCFGDIR) is usually package/cfg)
   230         *      -`-pdb:$(XDCCFGDIR)/$@.pdb`
   231         *              output any program debug information to the specified file
   232         *              ($(XDCCFGDIR) is usually package/cfg)
   233         */
   234        override config xdc.bld.ITarget2.Options lnkOpts = {
   235            prefix: "-libpath:$(rootDir)/VC/lib -libpath:$(rootDir)/VC/atlmfc/lib",
   236            suffix: "-map:$(XDCCFGDIR)/$@.map -pdb:$(XDCCFGDIR)/$@.pdb -machine:ix86 -nodefaultlib -incremental:no"
   237        };
   238    
   239        /*!
   240         *  ======== includeOpts ========
   241         *  User modifiable include paths
   242         *  @p(dlist)
   243         *      -`-I$(rootDir)/$(compilerDir)/include`
   244         *          include compiler specific headers
   245         */
   246        override config string includeOpts = "-I$(rootDir)/VC/include -I$(rootDir)/VC/atlmfc/include";
   247    }
   248    /*
   249     *  @(#) microsoft.targets; 1, 0, 2, 0,0; 9-28-2018 17:07:52; /db/ztree/library/trees/xdctargets/xdctargets-r12/src/ xlibrary
   250    
   251     */
   252