1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/tools/llvm-rc/WindresOpts.td
Martin Storsjö 2a1f29ca9f [llvm-rc] Add a GNU windres-like frontend to llvm-rc
This primarily parses a different set of options and invokes the same
resource compiler as llvm-rc normally. Additionally, it can convert
directly to an object file (which in MSVC style setups is done with the
separate cvtres tool, or by the linker).

(GNU windres also supports other conversions; from coff object file back
to .res, and from .res or object file back to .rc form; that's not yet
implemented.)

The other bigger complication lies in being able to imply or pass the
intended target triple, to let clang find the corresponding mingw sysroot
for finding include files, and for specifying the default output object
machine format.

It can be implied from the tool triple prefix, like
`<triple>-[llvm-]windres` or picked up from the windres option e.g.
`-F pe-x86-64`. In GNU windres, that option takes BFD style format names
such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
Windows on ARM, there's no such canonical name for the ARM targets.
Therefore, as an LLVM specific extension, this option is extended to
allow passing full triples, too.

Differential Revision: https://reviews.llvm.org/D100756
2021-04-26 22:04:29 +03:00

63 lines
2.1 KiB
TableGen

include "llvm/Option/OptParser.td"
multiclass Long<string name, string help> {
def NAME: Separate<["--"], name>;
def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
HelpText<help>;
}
multiclass LongAlias<string name, Option orig> {
def NAME: Separate<["--"], name>, Alias<orig>;
def NAME # _eq: Joined<["--"], name # "=">, Alias<orig>;
}
multiclass LongShort<string short, string long, string help> {
def NAME: Separate<["--"], long>;
def NAME # _eq: Joined<["--"], long # "=">, Alias<!cast<Separate>(NAME)>,
HelpText<help>;
def NAME # _short: JoinedOrSeparate<["-"], short>, Alias<!cast<Separate>(NAME)>;
}
multiclass F<string short, string long, string help> {
def NAME: Flag<["-"], short>;
def NAME # _long: Flag<["--"], long>, Alias<!cast<Flag>(NAME)>,
HelpText<help>;
}
defm input : LongShort<"i", "input", "Input file">;
defm output : LongShort<"o", "output", "Output file">;
defm input_format : LongShort<"J", "input-format", "Input format">;
defm output_format : LongShort<"O", "output-format", "Output format">;
defm preprocessor : Long<"preprocessor", "Custom preprocessor command">;
defm preprocessor_arg : Long<"preprocessor-arg", "Preprocessor command argument">;
defm target : LongShort<"F", "target", "Target BFD format name">;
defm include_dir : LongShort<"I", "include-dir", "Include directory">;
defm include_alias : LongAlias<"include", include_dir>;
defm define : LongShort<"D", "define", "Define to pass to the preprocessor">;
defm undef : LongShort<"U", "undefine", "Undefine to pass to the preprocessor">;
defm codepage : LongShort<"c", "codepage", "Default codepage to use">;
defm language : LongShort<"l", "language", "Default language to use (0x0-0xffff)">;
defm verbose : F<"v", "verbose", "Enable verbose output">;
defm version : F<"V", "version", "Display version">;
defm help : F<"h", "help", "Display this message and exit">;
// Print (but do not run) the commands to run for preprocessing
def _HASH_HASH_HASH : Flag<["-"], "###">;
def no_preprocess : Flag<["--"], "no-preprocess">;
// Unimplemented options for compatibility
def use_temp_file: Flag<["--"], "use-temp-file">;