Subversion Repositories gelsvn

Rev

Rev 217 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
217 bj 1
.:: 3/13/2002 ::.
2
 
107 bj 3
The Makefile, Project and Workspace Creator.
4
Designed by Justin Michel (michel_j@ociweb.com) and Chad Elliott.
5
Implemented by Chad Elliott (elliott_c@ociweb.com).
6
 
7
A single tool (MPC) can be used to generate tool specific input (i.e.
8
Makefile, dsp, vcproj, etc).  The generator takes platform and building
9
tool generic files (mpc files) as input which describe basic information
10
needed to generate a "project" file for various build tools.  These tools
11
include Make, NMake, Visual C++ 6, Visual C++ 7, etc.
12
 
13
One of the many unique and useful features of the Makefile, Project and
14
Workspace Creator is that the project definition files can employ the idea
15
of inheritance.  This feature allows a user to set up a basic base project
16
(mpb file) that can contain information that is applicable to all
17
sub-projects.  Things such as include paths, library paths and inter-project
18
dependencies could be described in this base project and any project that
19
inherits from it would contain this information as well.
20
 
21
Another set of files, known as template input files (mpd files), provides
22
the generator with the necessary information to fill platform and build tool
23
specific information for dynamic and static library and binary executable
24
projects.
25
 
26
Together, the generic input files and the template input files are applied
27
toward a platform and build specific template (mpd file) to create the final
28
product (a build tool specific input file).  These templates contain
29
"variables" that are filled in by the project creator with information
30
gathered through the mpc and mpd files and possibly by default values set
31
within the template itself.
32
 
33
Workspaces are defined by providing a list of mpc files in a single (mwc)
34
file.  For each mpc file specified, the workspace creator (mwc.pl) calls
35
upon the project creator to generate the project.  After all of the projects
36
are successfully generated, the tool specific workspace is generated
37
containing the projects and any defined inter-project dependency information
38
(if supported by the build tool).  If no workspace files are provided to the
39
workspace creator, then the current directory is traversed and any mpc files
40
located will be part of the workspace that is generated.
41
 
42
 
43
Workspace Declarations
44
----------------------
45
 
46
workspace(workspace_name) {
47
  file.mpc
48
  directory
49
  relative/path/to/another/mwc_file
50
}
51
 
52
Workspaces can contain individual mpc files, directories or other mwc files.
53
In the case of a directory, the workspace creator will traverse it and use
54
any mpc files that are found.  If another workspace file is listed in the
55
workspace files, it will be aggregated into the workspace with paths relative
56
to the directory in which the main workspace is found.  These "aggregated"
57
workspaces should not inherit from any other base workspace.  The workspace
58
files should have an 'mwc' extension.
59
 
60
You can exclude directories from a workspace using the 'exclude' scope
61
operator:
62
 
63
workspace {
64
  dir1
65
  dir2
66
 
67
  // exclude this_dir for all project types
68
  exclude {
69
    dir2/this_dir
70
  }
71
 
72
  // exclude other_dir for vc6, vc71 and vc8 types
73
  exclude(vc6, vc71, vc8) {
74
    dir2/other_dir
75
  }
76
 
77
  // exclude unix_only for every type except gnuace and make
78
  exclude(!gnuace, !make) {
79
    dir2/unix_only
80
  }
81
 
82
  dir3
83
}
84
 
85
 
86
Project Declarations
87
--------------------
88
 
89
project(project_name) : baseproject, anotherbaseproject {
90
  exename   = foo
91
  includes += "."
92
  libpaths  = directory
93
 
94
  Source_Files {
95
    file1.cpp
96
    file2.cpp
97
    .
98
    .
99
    fileN.cpp
100
  }
101
 
102
  Header_Files {
103
    file1.h
104
    file2.h
105
    .
106
    .
107
    fileN.h
108
  }
109
}
110
 
111
 
217 bj 112
MPC expects all files to be listed with forward slashes (/) if a file name
113
contains a directory.  Providing files with back slashes (\) can cause
114
unexpected results during generation.
115
 
107 bj 116
When listing files within components (Source_Files, Header_Files, etc.), you
117
can use wild cards (*?[]) to include groups of files as can be done in shells.
118
You can exclude files by preceding the name (or wild card) with the '!', but
119
this sort of exclusion only pertains to files that exist in the directory at
120
the time of project generation.  There is an additional syntax similar to
121
the '!' ('^') which works the same as the '!' except that after all of the
122
source files are added to the list (after automatic custom generated files
123
are added) these files are explicitly removed from the list.
124
 
125
The (project_name) part of the project declaration is optional.  If it is
126
left off, the project name will default to the name of the mpc file without
127
the extension.  Inheritance is optional.
128
 
129
If the project name or workspace name contains an asterisk (*) then the
130
default project (workspace) name will be used in its place.  For example, if
131
the mpc file is named example.mpc and it contains the following:
132
 
133
project(*client) {
134
 
135
The project name will be example_client.  If the any part of the modified
136
project (workspace) name contains a capital letter then each word will be
137
capitalized.  For instance, if the above mpc file example was named
138
Example.mpc, then the modified project name would be Example_Client.
139
 
140
If the value set for exename contains an asterisk then the asterisk portion
141
of the name will be replaced with the current project name.  The same logic
142
applies to sharedname and staticname.
143
 
144
If multiple projects are going to be contained within a single workspace
145
(using mwc.pl), there can be no duplication of project names.  This is
146
disallowed due to limitations of some workspace tools.
147
 
148
Project Keywords
149
----------------
150
exename         Specifies the name of the executable that will be created
151
sharedname      Specifies the name of the shared library that will be created
152
staticname      Specifies the name of the static library that will be created
217 bj 153
buildflags      This keyword can only be used as a source component scoped
154
                setting (ie. inside the scope of Source_Files).  It
155
                specifies additional build flags that will be passed to the
156
                compiler as the source files are being compiled.
107 bj 157
dllout          If defined, specifies where the dynamic libraries will be
158
                placed.  This overrides libout in the dynamic case.
159
libout          Specifies where the dynamic and static libraries will be placed
160
install         Specifies where executables will be installed
161
pch_header      Specifies the precompiled header file name
162
pch_source      Specifies the precompiled source file name
163
postbuild       If this is defined in the project, the value will be
164
                interpreted as commands to run after the project has been
165
                successfully built.  The <%..%> construct can be used within
166
                this value to access template variables and functions of the
167
                template parser. In addition, the following pseudo variables
168
                can be used.
169
 
170
                  <%cat%>   - Platform non-specific command to cat a file.
217 bj 171
                  <%cmp%>   - Platform non-specific compare command.
107 bj 172
                  <%cp%>    - Platform non-specific copy command.
173
                  <%mkdir%> - Platform non-specific mkdir command.
174
                  <%mv%>    - Platform non-specific move command.
217 bj 175
                  <%os%>    - Returns either win32 or unix.
107 bj 176
                  <%rm%>    - Platform non-specific delete command.
177
                  <%nul%>   - Platform non-specific null device.
178
                  <%gt%>    - Project non-specific greater than sign.
179
                  <%lt%>    - Project non-specific less than sign.
180
                  <%and%>   - Project non-specific and sign.
181
                  <%or%>    - Project non-specific or sign.
182
                  <%quote%> - Project non-specific double quote.
217 bj 183
prebuild        This is similar to postbuild except that it will be
184
                performed before the build instead of after.
107 bj 185
recurse         If set to 1, MPC will recurse into directories listed under
186
                component listings and add any component corresponding files
187
                to the list.  This keyword can be used as a global project
188
                setting or a component scoped setting.
189
version         Specifies the version number for the library or executable
190
macros          These values will be passed as macros to the compiler.
191
libpaths        Specifies 1 or more locations to find libraries
192
includes        Specifies 1 or more locations to find include files
193
libs            Specifies 1 or more libraries to link into the exe or library
194
lit_libs        Specifies 1 or more libraries to link into the exe or library.
195
                If libraries receive a library decorator, then these will not.
196
pure_libs       Specifies 1 or more libraries to link into the exe or library.
197
                If libraries receive a library decorator, then these will not.
198
                If libraries receive a file extension, then these will not.
199
after           Specifies that this project must be built after 1 or more
200
                project names listed.
201
custom_only     Create a project that contains only custom generation
202
                targets (any file type described by a Define_Custom section).
203
dynamicflags    Specifies preprocessor flags needed for dynamic libraries
204
staticflags     Specifies preprocessor flags needed for static libraries
205
 
206
verbatim        This allows arbitrary information to be place in a generated
207
                project file.  The syntax is as follows:
208
 
209
                verbatim(<project type>, <location>) {
210
                  ..
211
                  ..
212
                }
213
 
214
                When MPC is generating a project of type <project type> and
215
                comes upon a marker that matches the <location> name, it
216
                will place the text found inside the construct directly into
217
                the generated project.  If you need to preserve white space,
218
                the line or lines should be placed inside double quotes.
219
 
220
specific        This scope allows assignments that are specific to a
221
                particular project type.  The syntax is as follows:
222
 
223
                specific(<project type> [, <project type> ...]) {
224
                  lit_libs += c
225
                  ...
226
                }
227
 
228
                or
229
 
230
                specific(<project type> [, <project type> ...]) {
231
                  lit_libs += c
232
                  ...
233
                } else {
234
                  list_libs += c_other
235
                  ...
236
                }
237
 
238
                If the else is provided, it is required to be on
239
                the same line as the closing curly brace.  You may
240
                also negate the project type (using '!') which will cause
241
                the specific to be evaluated for all types except the type
242
                specified.
243
 
244
                If a keyword is not recognized as a valid MPC keyword, it is
245
                interpreted as a template value modifier.  In this
246
                situation, this construct has the exact same restrictions as
247
                the -value_template command line option.  See the USAGE file
248
                for more information.
249
 
217 bj 250
expand          This scope allows the specification for a variable that is
251
                found within $() to be expanded from the list of possible
252
                values.  These possible values can contain environment
253
                variables (specified by $VAR_NAME) and plain text.  If a
254
                possible value contains an environment variable and that
255
                variable is defined then this value is used to expand the
256
                $() variable.  If the environment variable is not defined
257
                then this possible value is not used.  The syntax is as
258
                follows:
259
 
260
                expand(<variable name>) {
261
                  <possible value 1>
262
                  .
263
                  .
264
                  <possible value n>
265
                }
266
 
107 bj 267
conditional     This scope allows addition of source files conditionally
268
                based on a particular project type.  The syntax is as
269
                follows:
270
 
271
                conditional(<project type> [, <project type> ...]) {
272
                  source1.cpp
273
                  ...
274
                }
275
 
276
                or
277
 
278
                conditional(<project type> [, <project type> ...]) {
279
                  source1.cpp
280
                  ...
281
                } else {
282
                  source2.cpp
283
                  ...
284
                }
285
 
286
                If the else is provided, it is required to be on
287
                the same line as the closing curly brace.  You may
288
                also negate the project type (using '!') which will cause
289
                the conditional to be evaluated for all types except the
290
                type specified.
291
 
292
requires        Specifies which features should be enabled in order to
293
                generate the project file.
294
avoids          Specifies which features should be disabled in order to
295
                generate the project file.
296
 
297
Custom File Definitions
298
-----------------------
299
In order to support a variety of custom build rules, MPC allows you to
300
define your own custom file types.  Below is an example of a custom
301
definition.
302
 
303
project {
304
  Define_Custom(MOC) {
305
    automatic        = 0
306
    command          = $(QTDIR)/bin/moc
307
    postcommand      = echo <%quote%>#include <%lt%>some.h<%gt%><%quote%> <%gt%> <%temporary%> <%and%> \
308
                       <%cat%> <%output%> <%gt%><%gt%> <%temporary%> <%and%> \
309
                       <%mv%> <%temporary%> <%output%>
310
    output_option    = -o
311
    inputext         = .h
312
    pre_extension    = _moc
313
    source_outputext = .cpp
314
  }
315
 
316
  MOC_Files {
317
    QtReactor.h
318
  }
319
 
320
  Source_Files {
321
    QtReactor_moc.cpp
322
  }
323
}
324
 
325
The above example defines a custom file type "MOC" which describes basic
326
information about how to process the input files and what output files are
327
created.  Once the custom file type is defined, MOC_Files can be defined in
328
order to specify the input files for this new file type.
329
 
330
Here is a list of keywords that can be used within the scope of
331
Define_Custom:
332
 
333
automatic           If set to 1, then attempt to automatically determine
334
                    which files belong to the set of input files for the
335
                    custom type.  If set to 0, then no files are
336
                    automatically added to the input files.  If omitted,
337
                    then automatic is assumed to be 1.  Custom file types
338
                    that are automatic will have the side effect of possibly
339
                    adding files to Source_Files, Inline_Files, Header_Files
340
                    Template_Files, Resource_Files and Documentation_Files
341
                    depending on which extension types the command generates.
342
dependent           If this is given a value, then a dependency upon that
343
                    value will be given to all of the generated files.
344
                    The default for this is unset and no dependency will be
345
                    generated.
346
command             The name of the command that should be used to process
347
                    the input files for the custom type.
348
commandflags        Any options that should be passed to the command go here.
349
inputext            This is a comma separated list of input file extensions
350
                    that belong to the command.
351
keyword             This is a special assignment that takes the form of the
352
                    following:
353
 
354
                    keyword newname = existing_custom_name
355
 
356
                    This has the effect of mapping newname to be the
357
                    same as existing_custom_name.  existing_custom_name,
358
                    which is optional, corresponds to one of the keywords
359
                    available within a Define_Custom scope (except for
360
                    keyword).  This function puts newname into the project
361
                    level scope such that it can be used outside of the
362
                    scope of the particular custom file type being defined.
363
                    It should be noted that the mapped keywords can not be
364
                    used within the scope of a 'specific' clause.  It does
365
                    not cause an error, but it has absolutely no affect.
366
                    If existing_custom_name is not supplied, then the only
367
                    way to utilize the newname value is from within the
368
                    template code. ex. <%newname%>
369
libpath             If the command requires an additional library path, add
370
                    it here.
371
output_option       If the command takes an option to specify only a single
372
                    file output name, then set it here.  Otherwise, this
373
                    should be omitted.
374
pch_postrule        If this is set to 1, then a rule will be added to the
375
                    custom rule that will modify the source output files to
376
                    include the precompiled header file.
377
postcommand         Allows a user to execute arbitrary commands after
378
                    the main command is run to generate the output file.
379
                    The following pseudo variables can be accessed from
380
                    within the postcommand assignment:
381
                    <%input%>     - The input file for the original command.
382
                    <%output%>    - The output created by the original command.
383
                    <%input_basename%>  - The basename of the input file.
384
                    <%input_noext%>     - The input file with no extension.
385
                    <%output_basename%> - The basename of the output file.
386
                    <%output_noext%>    - The output file with no extension.
387
                      The output file can be referenced as a generic output
388
                      file using <%output%> or can be referenced as a
389
                      component file (if it matches the particular type)
390
                      using one of the following:
391
 
392
                        <%source_file%>
393
                        <%template_file%>
394
                        <%header_file%>
395
                        <%inline_file%>
396
                        <%documentation_file%>
397
                        <%resource_file%>
398
 
399
                      The output file without an extension can be referenced
400
                      as a generic output file using <%output_noext%> or can
401
                      be referenced as a component file (if it matches the
402
                      particular type) using one of the following:
403
 
404
                        <%source_file_noext%>
405
                        <%template_file_noext%>
406
                        <%header_file_noext%>
407
                        <%inline_file_noext%>
408
                        <%documentation_file_noext%>
409
                        <%resource_file_noext%>
410
 
411
                      The following are also available for use within the
412
                      postcommand setting.  They return the extension (if
413
                      there is any) of the input and output files
414
                      respectively:
415
 
416
                        <%input_ext%>
417
                        <%output_ext%>
418
 
419
                    The following pseudo template variables are valid for
420
                    use within the command, commandflags, dependent,
421
                    postcommand and output_option settings:
422
 
423
                    <%temporary%> - A temporary file name.
424
                    <%cat%>       - Platform non-specific command to cat a file.
425
                    <%cp%>        - Platform non-specific copy command.
426
                    <%mkdir%>     - Platform non-specific mkdir command.
427
                    <%mv%>        - Platform non-specific move command.
428
                    <%rm%>        - Platform non-specific delete command.
429
                    <%nul%>       - Platform non-specific null device.
430
                    <%gt%>        - Project non-specific greater than sign.
431
                    <%lt%>        - Project non-specific less than sign.
432
                    <%and%>       - Project non-specific and sign.
433
                    <%or%>        - Project non-specific or sign.
434
                    <%quote%>     - Project non-specific double quote.
435
 
436
                    If any referenced pseudo template variable does
437
                    not contain a value, then the particular setting
438
                    (command, commandflags, dependent, postcommand or
439
                    output_option) will not be used.
440
pre_extension       If the command produces multiple files of the same
441
                    extension, this comma separated list can be used to
442
                    specify them.  For example, tao_idl creates two types of
443
                    files per extension (C.h, S.h, C.cpp, S.cpp, etc).
444
source_pre_extension        This is the same as pre_extension except that it
445
                            only applies to source_outputext.
446
inline_pre_extension        This is the same as pre_extension except that it
447
                            only applies to inline_outputext.
448
header_pre_extension        This is the same as pre_extension except that it
449
                            only applies to header_outputext.
450
template_pre_extension      This is the same as pre_extension except that it
451
                            only applies to template_outputext.
452
resource_pre_extension      This is the same as pre_extension except that it
453
                            only applies to resource_outputext.
454
documentation_pre_extension This is the same as pre_extension except that it
455
                            only applies to documentation_outputext.
217 bj 456
generic_pre_extension       This is the same as pre_extension except that it
457
                            only applies to generic_outputext.
107 bj 458
pre_filename        This is similar to pre_extension except that the values
459
                    are prepended to the file name instead of the extension.
460
source_pre_filename         This is the same as pre_filename except that it
217 bj 461
                            only applies to source files.
107 bj 462
inline_pre_filename         This is the same as pre_filename except that it
217 bj 463
                            only applies to inline files.
107 bj 464
header_pre_filename         This is the same as pre_filename except that it
217 bj 465
                            only applies to header files.
107 bj 466
template_pre_filename       This is the same as pre_filename except that it
217 bj 467
                            only applies to template files.
107 bj 468
resource_pre_filename       This is the same as pre_filename except that it
217 bj 469
                            only applies to resource files.
107 bj 470
documentation_pre_filename  This is the same as pre_filename except that it
217 bj 471
                            only applies to documentation files.
472
generic_pre_filename        This is the same as pre_filename except that it
473
                            only applies to generic files.
107 bj 474
source_outputext    This is a comma separated list of possible source file
475
                    output extensions.  If the command does not produce
476
                    source files, then this can be omitted.
477
inline_outputext    This is a comma separated list of possible inline file
478
                    output extensions.  If the command does not produce
479
                    inline files, then this can be omitted.
480
header_outputext    This is a comma separated list of possible header file
481
                    output extensions.  If the command does not produce
482
                    header files, then this can be omitted.
483
template_outputext  This is a comma separated list of possible template file
484
                    output extensions.  If the command does not produce
485
                    template files, then this can be omitted.
486
resource_outputext  This is a comma separated list of possible resource file
487
                    output extensions.  If the command does not produce
488
                    resource files, then this can be omitted.
489
documentation_outputext  This is a comma separated list of possible
490
                         documentation file output extensions.  If the
491
                         command does not produce documentation files, then
492
                         this can be omitted.
493
generic_outputext   If the command does not generate any of the other output
494
                    types listed above, then the extensions should be listed
495
                    under this.
496
 
497
If the custom output can not be represented with the above output extension
498
keywords (*_outputext) and you have knowledge of the output files a priori,
499
you can represent them with the '>>' construct.
500
 
501
Below is an example that demonstrates the use of '>>'.  The command takes an
502
input file name of foo.prp and produces two files that have completely
503
unrelated filenames (i.e. foo !~ hello).
504
 
505
project {
506
  Define_Custom(Quogen) {
507
    automatic           = 0
508
    command             = perl quogen.pl
509
    commandflags        = --debuglevel=1 --language=c++ \
510
                          --kernel_language=c++
511
    inputext            = .prp
512
    keyword quogenflags = commandflags
513
  }
514
 
515
  Quogen_Files {
516
    foo.prp >> hello.h hello.cpp
517
  }
518
 
519
  Source_Files {
520
    hello.cpp
521
  }
522
}
523
 
524
You can use the '<<' construct to represent dependencies for specific custom
525
input file.  For instance, in the above example, assume that foo.prp depends
526
upon foo.in, we would represent this by adding << foo.in as shown below.
527
 
528
  Quogen_Files {
529
    foo.prp >> hello.h hello.cpp << foo.in
530
  }
531
 
532
There is a construct that can be used within a Define_Custom section
533
called 'optional' and can be used to represent optional custom output
534
dependent upon particular command line parameters passed to the custom
535
command.
536
 
537
project {
538
  Define_Custom(TEST) {
539
    optional(keyword) {
540
      flag_keyword(option) += value [, value]
541
    }
542
  }
543
}
544
 
545
In the above example, keyword can be any of the pre_extension, pre_filename
546
or keywords that end in _outputext.  flag_keyword can be any of the custom
547
definition keywords, however only commandflags really make any sense.
548
Inside the parenthesis, the flag_keyword value is searched for the 'option'
549
value.  If it is found, then the 'value' after the += is added to the list
550
specified by 'keyword'.  This can also be negated by prefixing 'option' with
551
an exclamation point (!).
552
 
553
project {
554
  Define_Custom(IDL) {
555
    source_pre_extension = C, S
556
    optional(source_pre_extension) {
557
      commandflags(-GA) += A
558
    }
559
  }
560
}
561
 
562
In the preceding example, the source_pre_extension contains C and S.  The
563
optional clause can be read as follows: If 'commandflags' contains -GA then
564
add A to source_pre_extension.
565
 
566
Particular output extensions are not required.  However at least one output
567
extension type is required in order for MPC to generate a target.  Within
568
graphical build environments, the custom input file will be listed
569
regardless of the presence of an extension definition.  In this case, the
570
input file will be "excluded" from the build.
571
 
572
For custom file types, there are a few keywords that can be used within the
573
custom file type input lists: command, commandflags, dependent, gendir and
574
postcommand.  These keywords (except for gendir) can be used to augment or
575
override the values of the same name defined in a Define_Custom section.
576
gendir can be used to specify the directory in which the generated
577
output will go.  Below is an example:
578
 
579
  MOC_Files {
580
    commandflags += -nw
581
    gendir = moc_generated
582
    QtReactor.h
583
  }
584
 
585
  Source_Files {
586
    moc_generated/QtReactor_moc.cpp
587
  }
588
 
589
In the above example, the generated file (QtReactor_moc.cpp) is placed in
590
the moc_generated directory and the -nw option is added to commandflags.
591
It should be noted that if the custom file definition does not set the
592
output_option then you must provide the necessary options in
593
commandflags to ensure that the generated output goes into the directory
594
specified by gendir.
595
 
596
The following example illustrates the use of the keyword mapping capability
597
of the Define_Custom:
598
 
599
project {
600
  Define_Custom(CIDL) {
601
    automatic         = 0;
602
    command           =  $(CIAO_ROOT)/bin/cidlc
603
    commandflags      = -I$(TAO_ROOT)/tao -I$(TAO_ROOT)/orbsvcs/orbsvcs --
604
    inputext          = .cidl
605
    source_outputext  = _svnt.cpp
606
    generic_outputext = E.idl
607
 
608
    // Allow cidlflags to be used outside the scope of CIDL_Files
609
    keyword cidlflags = commandflags
610
  }
611
 
612
  // This will get added to all commandflags for CIDL_Files
613
  cidlflags += --some_option
614
 
615
  CIDL_Files {
616
    // This will have a combination of the original commandflags plus
617
    // the value added to cidlflags above.
618
    file.cidl
619
  }
620
 
621
  CIDL_Files {
622
    // This will have a combination of the original commandflags plus
623
    // the value added to cidlflags above plus the value added to
624
    // cidlflags here.
625
    cidlflags += --another_option
626
    another_file.cidl
627
  }
628
}
629
 
630
Special type of feature project
631
-------------------------------
632
A feature project contains information as a project would, but can only
633
be a base project and will only be added to a sub project if the features
634
that it requires (or avoids) are present.
635
 
636
A feature definition requires at least one feature name.  A name by itself
637
specifies that the feature is required.  A '!' in front of the feature name
638
indicates that the feature must be disabled.  There may be more than one
639
feature listed between the parenthesis and they must be comma separated.
640
 
641
The following feature definition requires that the qt feature be enabled.
642
 
643
feature(qt) {
644
  Define_Custom(MOC) {
645
    automatic        = 0
646
    command          = $(QTDIR)/bin/moc
647
    output_option    = -o
648
    inputext         = .h
649
    pre_extension    = _moc
650
    source_outputext = .cpp
651
  }
652
 
653
  MOC_Files {
654
    QtSpecific.h
655
  }
656
 
657
  Source_Files {
658
    QtSpecific_moc.cpp
659
  }
660
}
661
 
662
Assuming that the above feature definition is stored in a file named
663
qt_specific.mpb, an mpc project could inherit from it and would only receive
664
the feature definition if the qt feature was enabled.
665
 
666
project: qt_specific {
667
  ...
668
}
669
 
670
 
671
Feature Files
672
-------------
673
Features are enabled and disable within feature files or through the use of
674
the -features option (see USAGE for more details).  The first feature file
675
read is always global.features found in the config directory.  The second
676
feature file read is the project type name with .features appended
677
(ex. vc71.features, make.features, etc.) which must be located in the same
678
directory as the global.features file.  Lastly, the file specified by the
679
-feature_file option is read if this option is used.
680
 
681
Each successive feature file has precedence over the previous.  That is,
682
if a feature has already been set previously it is overridden.  The
683
-features option has precedence over feature files.
684
 
685
Special Keywords Available to Templates
686
---------------------------------------
687
project_name    This contains the name of the project.
688
project_file    This contains the name of the output file.
689
guid            This is used by the VC7 project and workspace creator.
690
configurations  When used within a foreach context, this info (each
691
                configuration) is gathered for use with the VC7 workspace
692
                creator.
693
flag_overrides  Used to determine flags that have been overridden on a per
694
                file basis.
695
custom_types    The list of custom file types that may have been defined
696
                in the mpc file or a base project.
697
fornotlast      Insert the text on every foreach iteration except the last.
698
forlast         Insert the text only on the last foreach iteration.
699
fornotfirst     Insert the text on every foreach iteration except the first.
700
forfirst        Insert the text only on the first foreach iteration.
217 bj 701
forcount        By default, a one based index number of the foreach
702
                iterations.  The base can be modified by providing a base
703
                number in the foreach as in the following examples:
107 bj 704
 
217 bj 705
<%foreach(4, includes)%>
706
  ...
707
<%endfor%>
708
 
709
 
710
<%foreach(include, 4, includes)%>
711
  ...
712
<%endfor%>
713
 
107 bj 714
Project Variable and Template Input Variable Interaction
715
--------------------------------------------------------
716
Project variables and template input variables are separate entities and in
717
the context of the TemplateParser, template input variables have precedence
718
over project variables.
719
 
720
This means that if the project keyword 'libout' is set in an MPC project and
721
is set as a template input variable, the template input variable value will
722
be used.  There are exceptions to this rule.  The following list shows the
723
project keywords that have their MPC project value appended to the template
724
input value (if there is a template input value).
725
 
726
libpaths
727
includes
728
libs
729
lit_libs
730
pure_libs
731
dynamicflags
732
staticflags
733
requires
734
avoids
735
macros
736
 
737
Workspaces
738
----------
739
Workspaces (mwc files) can have assignments similar to projects.  There are
740
currently only two assignments allowed.
741
 
742
The first is 'cmdline'.  The values given to the cmdline assignment will be
743
processed as command line options, but only to the projects that are
744
contained within the workspace (or the scope of the assignment).  The only
217 bj 745
valid command line options for cmdline are -base, -genins, -global, -include,
746
-language, -ti, -template, -static, -relative, -notoplevel, -value_template
107 bj 747
and -value_project.
748
 
749
The second assignment is 'implicit'.  This assignment takes two different
750
types of values.  It takes a boolean value (0 or 1) to indicate that an
751
implicit project should be created in directories that contain no mpc file,
752
but contain project related files (source, headers, etc.).  The default
753
value for implicit is 0.  It also takes a character string that represents a
754
base project (similar to the -base option).  In this case, implicit is
755
enabled and each implicitly generate project file will have the base project
756
or base projects (when addition is used) when the project is created.
757
 
758
Defaulting Behavior
759
-------------------
760
1) If a project name is not specified
761
 
762
   it will be defaulted to the name of the mpc file without the extension
763
 
764
2) If a particular list is not specified (Source_Files, Header_Files, etc.)
765
 
766
   all of the files in the directory will be added to the corresponding list
767
   by extension
768
 
769
3) If the custom type is automatic and custom files (ex. idl files) exist in
770
   the directory and the custom files components (ex. IDL_Files) are left
771
   defaulted (i.e. not listed) or the custom files components are specified
772
   and none of the custom generated files are listed in the corresponding
773
   lists
774
 
775
   the custom files are added to the custom files component list if they
776
   weren't specified and all of the (would be) generated files will be added
777
   to the front of the corresponding lists (source, inline and header lists)
778
 
779
4) If files are listed in the Source_Files list and a corresponding header or
780
   inline file exists
781
 
782
   the corresponding file will be added to the corresponding list (if it
783
   isn't already there)
784
 
785
5) If a sharedname is specified and staticname is not
786
 
787
   staticname is assigned the sharedname value (the same applies if
788
   staticname is specified and sharedname is not)
789
 
790
6) If exename is specified then the project target is considered an
791
   executable.  If neither exename, sharedname or staticname are used and
792
   any of the source files listed contains a language dependent "main", then
793
   the project target is considered an executable, otherwise it is considered
794
   a library.
795
 
796
7) If pch_header is not specified and a header file matches *_pch.h
797
 
798
   it is assumed to be the precompiled header file (the same applies to
799
   pch_source)
800
 
801
Processing Order
802
----------------
803
1) Project file is read
804
2) Template input file is read
805
3) Template file is read
806
4) Output project is written