update_vcproj.py reads
the sources setup which is generated by the
operasetup script and updates the source
file entries in a Visual Studio 2005 or 2008 project file according to
the source's configuration.
<Configurations> section which contains all
available configurations for the project. The configurations of this
section are parsed and if a single file is updated with an
individual configuration, a <FileConfiguration>
section is added for all found configurations.
<Files> section, which contains all source
files. The files are organized in "Filter" entries.<Files> node should have a
top-level <Filter> node with name "Source
Files". If that filter is not available, the scripts
fails with an error message.<Configurations> are expected to
use "core/pch.h" as precompiled header
file. I.e. all configurations should set the attributes| UsePrecompiledHeader | "Use Precompiled Header File" (this corresponds to the compiler command line argument " /Yu" or the xml attribute value
"2"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch.h" |
| PrecompiledHeaderFile | should specify in which file the precompiled header file
is stored. wingogi uses the following value:
"$(IntDir)/wingogi/wingogi.pch". |
#include "core/pch.h" statement is then processed
by including the precompiled header file.
#include "core/pch.h"and is configured as
| UsePrecompiledHeader | "Create Precompiled Header File" (this corresponds to the compiler command line argument " /Yc" or the xml attribute value
"1"). |
|---|
module.sources file."core/pch_jumbo.h"
and core/pch_system_includes.h. For each precompiled
header file a source-file is needed that includes the header
file. The source-file should be configured like
| UsePrecompiledHeader | "Create Precompiled Header File" (this corresponds to the compiler command line argument " /Yc" or the xml attribute value
"1"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch_jumbo.h"
respectively "core/pch_system_includes.h" |
| PrecompiledHeaderFile | should specify in which file the precompiled header file
is stored. wingogi uses the following value
for "core/pch_jumbo.h":
"$(IntDir)/wingogi/wingogi_jumbo.pch". |
module.sources file.
The script recognizes source-file entries with "Create
Precompiled Header File" option
for "core/pch_jumbo.h"
and "core/pch_system_includes.h" and uses the
corresponding PrecompiledHeaderThrough
and PrecompiledHeaderFile settings to update the
file-configuration for jumbo
compile units or source files with option
system_includes.
Source Files"
filter node in the following way:
<Filter> node with the name of the
sub-directory. The parent node of a filter is the filter node of
the parent directory. The parent node of the top-level directories
(like modules/ or platforms/) is the
filter with name "Source Files".modules" as a
direct child of the filter "Source Files" and all
sub-directories in modules/ are represented by
children of that node.<File>
node with a "RelativePath" relative to the location
of the project file. The file node is child of the
<Filter> node which represents the file's
directory."core/pch_system_incudes.h", then a source-file with
option pch and
system_includes
receives the configuration
| UsePrecompiledHeader | "Use Precompiled Header File" (this corresponds to the compiler command line argument " /Yu" or the xml attribute value
"2"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch_system_includes.h" |
| PrecompiledHeaderFile | As configured for the corresponding "Create Precompiled Header File" node. |
"core/pch_system_incudes.h", then a source-file
with option pch and
system_includes
is configured to not use a precompiled header file."core/pch_jumbo.h", then a jumbo-compile-unit with
option pch receives the
configuration
| UsePrecompiledHeader | "Use Precompiled Header File" (this corresponds to the compiler command line argument " /Yu" or the xml attribute value
"2"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch_jumbo.h" |
| PrecompiledHeaderFile | As configured for the corresponding "Create Precompiled Header File" node. |
"core/pch_jumbo.h", then the jumbo-compile-unit
is configured to not use a precompiled header file.
Note: Instead of adding a source-file with option
"Create Precompiled Header File" for
"core/pch_jumbo.h"
(see above) you can use the
command line
option --pch_jumbo.
Usage:
update_vcproj.py [options] [project_file]
wingogi.vcproj is used.
--exclude_module platforms/lingogi
Note: even if force_update is specified, the project file might not be written, because its content might not have changed.
To remove the excluded files, use the
argument --remove_excluded_files.
Note: the jumbo-compile-units are generated
by operasetup.py. This script only
enables or disables the jumbo compile units. To disable jumbo
compilation, don't use the --jumbo argument.
ExcludedFromBuild. This
allows to use a jumbo compilation and still keep fast access to all
source files, but the project file will grow very big and updating
it takes much more time. With this option, only the files that are
required for the build are added to the project file, i.e. for a
jumbo-build only the jumbo compile units are added to the project
file and for a plain-build only the plain sources are added to the
project file. This keeps the project file small and thus it can also
be updated fast.
--remove_excluded_files. Both
the jumbo compile units and the plain files are added to the project
file and the files that are not used are marked with the
attribute ExcludedFromBuild. This is the default
setting.
#include "core/pch_jumbo.h"
statement. If this argument is not specified, this script parses the
specifed project file for an entry with
configuration UsePrecompiledHeader=1
and PrecompiledHeaderThrough=core/pch_jumbo.h,
i.e. create a precompiled header file
for "core/pch_jumbo.h". The filename is used for
the PrecompiledHeaderFile attribute in the project
file.
The wingogi project has two source-files which are used to generate precompiled header files:
platforms/wingogi/pch.cpp:
/* ... some copyright header ... */ #include "core/pch.h"
platforms/wingogi/pch_jumbo.cpp:
/* ... some copyright header ... */ #include "core/pch_jumbo.h"
The corresponding platforms/wingogi/module.sources file
contains entries for both files with
option no-jumbo:
pch.cpp # [no-jumbo] pch_jumbo.cpp # [no-jumbo] ...
The visual studio project file configures the default precompiled
header settings as (i.e. these setting are configured inside
the <Configurations> node of the project file):
| UsePrecompiledHeader | "Use Precompiled Header File" (this corresponds to the compiler command line argument " /Yu" or the xml attribute value
"2"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch.h" |
| PrecompiledHeaderFile | "$(IntDir)/wingogi/wingogi.pch" |
The precompiled header configuration of the
source-file platforms/wingogi/pch.cpp (i.e. in
the <FileConfiguration> node of
the <File>) is
| UsePrecompiledHeader | "Create Precompiled Header File" (this corresponds to the compiler command line argument " /Yc" or the xml attribute value
"1"). |
|---|
PrecompiledHeaderFile
and PrecompiledHeaderThrough are obtained through the
default configuration.
The precompiled header configuration of the
source-file platforms/wingogi/pch_jumbo.cpp (i.e. in
the <FileConfiguration> node of
the <File>) is
| UsePrecompiledHeader | "Create Precompiled Header File" (this corresponds to the compiler command line argument " /Yc" or the xml attribute value
"1"). |
|---|---|
| PrecompiledHeaderThrough | "core/pch_jumbo.h" |
| PrecompiledHeaderFile | "$(IntDir)/wingogi/wingogi_jumbo.pch" |
The wingogi solution file has a "sources" project which calls
the update_vcproj.py as
.\modules\hardcore\tools\update_vcproj.py --jumbo \
--exclude_module=platforms/lingogi \
--template=platforms\wingogi\build\wingogi_vc2008.vcproj.template platforms\wingogi\build\wingogi_vc2008.vcproj