2 #pragma warning ( disable : 4786 )
20 typedef set
<string
> StringSet
;
27 PropsMaker::PropsMaker (Project
* ProjectNode
,
28 std::string filename_props
,
29 std::vector
<MSVCConfiguration
*> configurations
)
31 m_ProjectNode
= ProjectNode
;
32 m_configurations
= configurations
;
34 OUT
= fopen ( filename_props
.c_str(), "wb" );
38 printf ( "Could not create file '%s'.\n", filename_props
.c_str() );
42 PropsMaker::~PropsMaker ( )
48 PropsMaker::_generate_header()
50 fprintf ( OUT
, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");
51 fprintf ( OUT
, "<Project ");
52 fprintf ( OUT
, "DefaultTargets=\"Build\" ");
53 fprintf ( OUT
, "ToolsVersion=\"4.0\" ");
54 fprintf ( OUT
, "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n");
58 PropsMaker::_generate_footer()
60 fprintf ( OUT
, "</Project>\r\n");
64 PropsMaker::_generate_macro(std::string Name
, std::string Value
)
66 fprintf ( OUT
, "\t\t<%s>%s</%s>\r\n", Name
.c_str(), Value
.c_str(), Name
.c_str());
70 PropsMaker::_generate_global_includes(bool debug
, bool use_ros_headers
)
72 fprintf ( OUT
, "\t\t<globalIncludes>");
74 const IfableData
& data
= m_ProjectNode
->non_if_data
;
75 //const vector<File*>& files = data.files;
77 const vector
<Include
*>& incs
= data
.includes
;
78 for ( i
= 0; i
< incs
.size(); i
++ )
80 if ((incs
[i
]->directory
->relative_path
== "include\\crt" ||
81 incs
[i
]->directory
->relative_path
== "include\\ddk" ||
82 incs
[i
]->directory
->relative_path
== "include\\GL" ||
83 incs
[i
]->directory
->relative_path
== "include\\psdk") &&
89 if(incs
[i
]->directory
->directory
== SourceDirectory
)
90 fprintf ( OUT
, "\"$(RootSrcDir)\\");
91 else if (incs
[i
]->directory
->directory
== IntermediateDirectory
)
92 fprintf ( OUT
, "\"$(RootIntDir)\\");
93 else if (incs
[i
]->directory
->directory
== OutputDirectory
)
94 fprintf ( OUT
, "\"$(RootOutDir)\\");
98 fprintf ( OUT
, "%s\" ; ", incs
[i
]->directory
->relative_path
.c_str());
101 fprintf ( OUT
, "\"$(RootIntDir)\\include\" ; ");
102 fprintf ( OUT
, "\"$(RootIntDir)\\include\\reactos\" ; ");
104 if ( !use_ros_headers
)
106 // Add WDK or PSDK paths, if user provides them
107 if (getenv ( "BASEDIR" ) != NULL
)
109 string WdkBase
= getenv ( "BASEDIR" );
110 fprintf ( OUT
, "\"%s\\inc\\api\" ; ", WdkBase
.c_str());
111 fprintf ( OUT
, "\"%s\\inc\\crt\" ; ", WdkBase
.c_str());
112 fprintf ( OUT
, "\"%s\\inc\\ddk\" ; ", WdkBase
.c_str());
115 fprintf ( OUT
, "\t</globalIncludes>\r\n");
119 PropsMaker::_generate_global_definitions(bool debug
, bool use_ros_headers
)
121 fprintf ( OUT
, "\t\t<globalDefines>");
123 // Always add _CRT_SECURE_NO_WARNINGS to disable warnings about not
124 // using the safe functions introduced in MSVC8.
125 fprintf ( OUT
, "_CRT_SECURE_NO_WARNINGS ; ") ;
129 fprintf ( OUT
, "_DEBUG ; ");
132 if ( !use_ros_headers
)
134 // this is a define in MinGW w32api, but not Microsoft's headers
135 fprintf ( OUT
, "STDCALL=__stdcall ; ");
138 const IfableData
& data
= m_ProjectNode
->non_if_data
;
139 const vector
<Define
*>& defs
= data
.defines
;
142 for ( i
= 0; i
< defs
.size(); i
++ )
144 if ( defs
[i
]->backend
!= "" && defs
[i
]->backend
!= "msvc" )
147 if ( defs
[i
]->value
!= "" )
148 fprintf ( OUT
, "%s=%s ; ",defs
[i
]->name
.c_str(), defs
[i
]->value
.c_str());
150 fprintf ( OUT
, "%s ; ", defs
[i
]->name
.c_str());
153 fprintf ( OUT
, "\t</globalDefines>\r\n");
157 PropsMaker::_generate_props ( std::string solution_version
, std::string studio_version
)
160 string srcdir
= Environment::GetSourcePath();
161 string intdir
= Environment::GetIntermediatePath ();
162 string outdir
= Environment::GetOutputPath ();
163 string rosbedir
= Environment::GetVariable("_ROSBE_BASEDIR");
165 if ( intdir
== "obj-i386" )
166 intdir
= srcdir
+ "\\obj-i386"; /* append relative dir from project dir */
168 if ( outdir
== "output-i386" )
169 outdir
= srcdir
+ "\\output-i386";
173 fprintf ( OUT
, "\t<PropertyGroup Label=\"UserMacros\">\r\n");
174 _generate_macro("RootSrcDir", srcdir
);
175 _generate_macro("RootOutDir", outdir
);
176 _generate_macro("RootIntDir", intdir
);
177 _generate_macro("Tools", "$(RootOutDir)\\tools");
178 _generate_macro("RosBE", rosbedir
);
179 fprintf ( OUT
, "\t</PropertyGroup>\r\n");
181 for ( size_t icfg
= 0; icfg
< m_configurations
.size(); icfg
++ )
183 MSVCConfiguration
* cfg
= m_configurations
[icfg
];
185 if(cfg
->optimization
== RosBuild
)
188 fprintf ( OUT
, "\t<PropertyGroup Condition=\"'$(Configuration)'=='%s'\">\r\n", cfg
->name
.c_str() );
189 _generate_global_includes(cfg
->optimization
== Debug
, cfg
->headers
== ReactOSHeaders
);
190 _generate_global_definitions(cfg
->optimization
== Debug
, cfg
->headers
== ReactOSHeaders
);
191 fprintf ( OUT
, "\t</PropertyGroup>\r\n");