widl: Add support for standard target options to allow building the right typelib kind when cross-compiling.
This commit is contained in:
parent
b3a0833972
commit
f914b57277
|
@ -183,7 +183,7 @@ filter: dummy
|
||||||
$(WIDL) $(IDLFLAGS) -s -S $@ $<
|
$(WIDL) $(IDLFLAGS) -s -S $@ $<
|
||||||
|
|
||||||
.idl.tlb:
|
.idl.tlb:
|
||||||
$(WIDL) $(IDLFLAGS) -t -T $@ $<
|
$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
|
||||||
|
|
||||||
.c.ln:
|
.c.ln:
|
||||||
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
|
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
|
||||||
|
|
|
@ -53,33 +53,35 @@
|
||||||
static const char usage[] =
|
static const char usage[] =
|
||||||
"Usage: widl [options...] infile.idl\n"
|
"Usage: widl [options...] infile.idl\n"
|
||||||
" or: widl [options...] --dlldata-only name1 [name2...]\n"
|
" or: widl [options...] --dlldata-only name1 [name2...]\n"
|
||||||
" -c Generate client stub\n"
|
" -b arch Set the target architecture\n"
|
||||||
" -C file Name of client stub file (default is infile_c.c)\n"
|
" -c Generate client stub\n"
|
||||||
" -d n Set debug level to 'n'\n"
|
" -C file Name of client stub file (default is infile_c.c)\n"
|
||||||
" -D id[=val] Define preprocessor identifier id=val\n"
|
" -d n Set debug level to 'n'\n"
|
||||||
" --dlldata=file Name of the dlldata file (default is dlldata.c)\n"
|
" -D id[=val] Define preprocessor identifier id=val\n"
|
||||||
" -E Preprocess only\n"
|
" --dlldata=file Name of the dlldata file (default is dlldata.c)\n"
|
||||||
" -h Generate headers\n"
|
" -E Preprocess only\n"
|
||||||
" -H file Name of header file (default is infile.h)\n"
|
" -h Generate headers\n"
|
||||||
" -I path Set include search dir to path (multiple -I allowed)\n"
|
" -H file Name of header file (default is infile.h)\n"
|
||||||
" --local-stubs=file Write empty stubs for call_as/local methods to file\n"
|
" -I path Set include search dir to path (multiple -I allowed)\n"
|
||||||
" -N Do not preprocess input\n"
|
" --local-stubs=file Write empty stubs for call_as/local methods to file\n"
|
||||||
" --oldnames Use old naming conventions\n"
|
" -m32, -m64 Set the kind of typelib to build (Win32 or Win64)\n"
|
||||||
" -p Generate proxy\n"
|
" -N Do not preprocess input\n"
|
||||||
" -P file Name of proxy file (default is infile_p.c)\n"
|
" --oldnames Use old naming conventions\n"
|
||||||
" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n"
|
" -p Generate proxy\n"
|
||||||
|
" -P file Name of proxy file (default is infile_p.c)\n"
|
||||||
|
" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n"
|
||||||
" --prefix-client=p Prefix names of client stubs with 'p'\n"
|
" --prefix-client=p Prefix names of client stubs with 'p'\n"
|
||||||
" --prefix-server=p Prefix names of server functions with 'p'\n"
|
" --prefix-server=p Prefix names of server functions with 'p'\n"
|
||||||
" -s Generate server stub\n"
|
" -s Generate server stub\n"
|
||||||
" -S file Name of server stub file (default is infile_s.c)\n"
|
" -S file Name of server stub file (default is infile_s.c)\n"
|
||||||
" -t Generate typelib\n"
|
" -t Generate typelib\n"
|
||||||
" -T file Name of typelib file (default is infile.tlb)\n"
|
" -T file Name of typelib file (default is infile.tlb)\n"
|
||||||
" -u Generate interface identifiers file\n"
|
" -u Generate interface identifiers file\n"
|
||||||
" -U file Name of interface identifiers file (default is infile_i.c)\n"
|
" -U file Name of interface identifiers file (default is infile_i.c)\n"
|
||||||
" -V Print version and exit\n"
|
" -V Print version and exit\n"
|
||||||
" -W Enable pedantic warnings\n"
|
" -W Enable pedantic warnings\n"
|
||||||
" --win32 Only generate 32-bit code\n"
|
" --win32 Only generate 32-bit code\n"
|
||||||
" --win64 Only generate 64-bit code\n"
|
" --win64 Only generate 64-bit code\n"
|
||||||
"Debug level 'n' is a bitmask with following meaning:\n"
|
"Debug level 'n' is a bitmask with following meaning:\n"
|
||||||
" * 0x01 Tell which resource is parsed (verbose mode)\n"
|
" * 0x01 Tell which resource is parsed (verbose mode)\n"
|
||||||
" * 0x02 Dump internal structures\n"
|
" * 0x02 Dump internal structures\n"
|
||||||
|
@ -92,7 +94,6 @@ static const char usage[] =
|
||||||
static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSION "\n"
|
static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSION "\n"
|
||||||
"Copyright 2002 Ove Kaaven\n";
|
"Copyright 2002 Ove Kaaven\n";
|
||||||
|
|
||||||
int win32 = 1;
|
|
||||||
int debuglevel = DEBUGLEVEL_NONE;
|
int debuglevel = DEBUGLEVEL_NONE;
|
||||||
int parser_debug, yy_flex_debug;
|
int parser_debug, yy_flex_debug;
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char short_options[] =
|
static const char short_options[] =
|
||||||
"cC:d:D:EhH:I:NpP:sS:tT:uU:VW";
|
"b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "dlldata", 1, 0, DLLDATA_OPTION },
|
{ "dlldata", 1, 0, DLLDATA_OPTION },
|
||||||
{ "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION },
|
{ "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION },
|
||||||
|
@ -227,6 +228,45 @@ static void add_widl_version_define(void)
|
||||||
wpp_add_define("__WIDL__", NULL);
|
wpp_add_define("__WIDL__", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the target platform */
|
||||||
|
static void set_target( const char *target )
|
||||||
|
{
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
syskind_t kind;
|
||||||
|
} cpu_names[] =
|
||||||
|
{
|
||||||
|
{ "i386", SYS_WIN32 },
|
||||||
|
{ "i486", SYS_WIN32 },
|
||||||
|
{ "i586", SYS_WIN32 },
|
||||||
|
{ "i686", SYS_WIN32 },
|
||||||
|
{ "i786", SYS_WIN32 },
|
||||||
|
{ "x86_64", SYS_WIN64 },
|
||||||
|
{ "sparc", SYS_WIN32 },
|
||||||
|
{ "alpha", SYS_WIN32 },
|
||||||
|
{ "powerpc", SYS_WIN32 }
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int i;
|
||||||
|
char *p, *spec = xstrdup( target );
|
||||||
|
|
||||||
|
/* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
|
||||||
|
|
||||||
|
if (!(p = strchr( spec, '-' ))) error( "Invalid target specification '%s'\n", target );
|
||||||
|
*p++ = 0;
|
||||||
|
for (i = 0; i < sizeof(cpu_names)/sizeof(cpu_names[0]); i++)
|
||||||
|
{
|
||||||
|
if (!strcmp( cpu_names[i].name, spec ))
|
||||||
|
{
|
||||||
|
typelib_kind = cpu_names[i].kind;
|
||||||
|
free( spec );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
error( "Unrecognized CPU '%s'\n", spec );
|
||||||
|
}
|
||||||
|
|
||||||
/* clean things up when aborting on a signal */
|
/* clean things up when aborting on a signal */
|
||||||
static void exit_on_signal( int sig )
|
static void exit_on_signal( int sig )
|
||||||
{
|
{
|
||||||
|
@ -481,6 +521,9 @@ int main(int argc,char *argv[])
|
||||||
do_win32 = 0;
|
do_win32 = 0;
|
||||||
do_win64 = 1;
|
do_win64 = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
set_target( optarg );
|
||||||
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
do_everything = 0;
|
do_everything = 0;
|
||||||
do_client = 1;
|
do_client = 1;
|
||||||
|
@ -508,6 +551,11 @@ int main(int argc,char *argv[])
|
||||||
case 'I':
|
case 'I':
|
||||||
wpp_add_include_path(optarg);
|
wpp_add_include_path(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
if (!strcmp( optarg, "32" )) typelib_kind = SYS_WIN32;
|
||||||
|
else if (!strcmp( optarg, "64" )) typelib_kind = SYS_WIN64;
|
||||||
|
else error( "Invalid -m argument '%s'\n", optarg );
|
||||||
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
no_preprocess = 1;
|
no_preprocess = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,7 +34,6 @@ extern int debuglevel;
|
||||||
#define DEBUGLEVEL_PPLEX 0x0010
|
#define DEBUGLEVEL_PPLEX 0x0010
|
||||||
#define DEBUGLEVEL_PPTRACE 0x0020
|
#define DEBUGLEVEL_PPTRACE 0x0020
|
||||||
|
|
||||||
extern int win32;
|
|
||||||
extern int pedantic;
|
extern int pedantic;
|
||||||
extern int do_everything;
|
extern int do_everything;
|
||||||
extern int do_header;
|
extern int do_header;
|
||||||
|
|
|
@ -31,6 +31,10 @@ will print a help message.
|
||||||
.B General options:
|
.B General options:
|
||||||
.IP "\fB-V\fR"
|
.IP "\fB-V\fR"
|
||||||
Print version number and exit.
|
Print version number and exit.
|
||||||
|
.IP "\fB-b \fIcpu-manufacturer[-kernel]-os\fR"
|
||||||
|
Set the target architecture when cross-compiling. The target
|
||||||
|
specification is in the standard autoconf format as returned by
|
||||||
|
config.sub.
|
||||||
.PP
|
.PP
|
||||||
.B Header options:
|
.B Header options:
|
||||||
.IP "\fB-h\fR"
|
.IP "\fB-h\fR"
|
||||||
|
@ -47,6 +51,8 @@ Generate a type library.
|
||||||
.IP "\fB-T \fIfile\fR"
|
.IP "\fB-T \fIfile\fR"
|
||||||
Define the name of the type library to be generated.
|
Define the name of the type library to be generated.
|
||||||
The default filename is \fIinfile\fR.tlb.
|
The default filename is \fIinfile\fR.tlb.
|
||||||
|
.IP "\fB-m32, -m64\fR"
|
||||||
|
Generate a Win32, respectively Win64, type library.
|
||||||
.PP
|
.PP
|
||||||
.B UUID file options:
|
.B UUID file options:
|
||||||
.IP "\fB-u\fR"
|
.IP "\fB-u\fR"
|
||||||
|
|
Loading…
Reference in New Issue