Author: hpoussin
Date: Tue Jun 13 21:39:17 2006
New Revision: 22342
URL:
http://svn.reactos.ru/svn/reactos?rev=22342&view=rev
Log:
Add files to project only if the "If" condition is true.
Modified:
trunk/reactos/tools/rbuild/backend/msvc/msvc.h
trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/m…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.h (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.h Tue Jun 13 21:39:17 2006
@@ -116,6 +116,7 @@
void _get_object_files ( const Module& module, std::vector<std::string>&
out ) const;
void _install_files ( const std::string& vcdir, const std::string& config );
bool _copy_file ( const std::string& inputname, const std::string& targetname )
const;
+ const Property* _lookup_property ( const Module& module, const std::string&
name ) const;
};
#endif // __MSVC_H__
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/v…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp Tue Jun 13 21:39:17 2006
@@ -113,9 +113,15 @@
{
const IfableData& data = *ifs_list.back();
ifs_list.pop_back();
- // TODO FIXME - refactor needed - we're discarding if conditions
for ( i = 0; i < data.ifs.size(); i++ )
- ifs_list.push_back ( &data.ifs[i]->data );
+ {
+ const Property* property = _lookup_property( module, data.ifs[i]->property );
+ if ( property != NULL )
+ {
+ if ( data.ifs[i]->value == property->value || data.ifs[i]->negated )
+ ifs_list.push_back ( &data.ifs[i]->data );
+ }
+ }
const vector<File*>& files = data.files;
for ( i = 0; i < files.size(); i++ )
{
@@ -732,3 +738,23 @@
_generate_sln_footer ( OUT );
}
+const Property*
+MSVCBackend::_lookup_property ( const Module& module, const std::string& name )
const
+{
+ /* Check local values */
+ for ( size_t i = 0; i < module.non_if_data.properties.size(); i++ )
+ {
+ const Property& property = *module.non_if_data.properties[i];
+ if ( property.name == name )
+ return &property;
+ }
+ // TODO FIXME - should we check local if-ed properties?
+ for ( size_t i = 0; i < module.project.non_if_data.properties.size(); i++ )
+ {
+ const Property& property = *module.project.non_if_data.properties[i];
+ if ( property.name == name )
+ return &property;
+ }
+ // TODO FIXME - should we check global if-ed properties?
+ return NULL;
+}