Author: gadamopoulos
Date: Sat Apr 10 11:14:18 2010
New Revision: 46809
URL:
http://svn.reactos.org/svn/reactos?rev=46809&view=rev
Log:
[rbuild]
MSVC backend:
- Fix compilation when using paths with spaces
- Fix spec and pspec rules to generate correctly the def and stubs file
- Group auto-generated files together
- Rename some user macros to more appropriate names
- Some cleanup
Modified:
trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp
trunk/reactos/tools/rbuild/backend/msvc/s_as_mscpp.rules
trunk/reactos/tools/rbuild/backend/msvc/spec.rules
trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
trunk/reactos/tools/rbuild/backend/msvc/vspropsmaker.cpp
Modified: trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/projmaker.cpp [iso-8859-1] Sat Apr 10 11:14:18
2010
@@ -69,6 +69,20 @@
ProjMaker::_generate_user_configuration()
{
#if 0
+ string computername;
+ string username;
+ string vcproj_file_user = "";
+
+ if (getenv ( "USERNAME" ) != NULL)
+ username = getenv ( "USERNAME" );
+ if (getenv ( "COMPUTERNAME" ) != NULL)
+ computername = getenv ( "COMPUTERNAME" );
+ else if (getenv ( "HOSTNAME" ) != NULL)
+ computername = getenv ( "HOSTNAME" );
+
+ if ((computername != "") && (username != ""))
+ vcproj_file_user = vcproj_file + "." + computername + "." +
username + ".user";
+
/* User configuration file */
if (vcproj_file_user != "")
{
Modified: trunk/reactos/tools/rbuild/backend/msvc/s_as_mscpp.rules
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/s_as_mscpp.rules [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/s_as_mscpp.rules [iso-8859-1] Sat Apr 10
11:14:18 2010
@@ -7,7 +7,7 @@
<CustomBuildRule
Name="s_as_mscpp"
DisplayName="s (gnu_as mscpp)"
- CommandLine="cl /nologo /E [sIncPaths] [sPPDefs] $(InputPath) |
$(RosBE)\i386\bin\as -o [sOutF]"
+ CommandLine="cl /nologo /E [sIncPaths] [sPPDefs] "$(InputPath)"
| "$(RosBE)\i386\bin\as" -o [sOutF]"
Outputs="[$sOutF]"
FileExtensions="*.s"
ExecutionDescription="Assembling "
Modified: trunk/reactos/tools/rbuild/backend/msvc/spec.rules
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/spec.rules [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/spec.rules [iso-8859-1] Sat Apr 10 11:14:18
2010
@@ -7,26 +7,33 @@
<CustomBuildRule
Name="spec"
DisplayName="Spec"
- CommandLine="$(Tools)\winebuild\winebuild.exe -o "[$Output]"
--def -k -E [inputs]"
- Outputs="[$Output]"
+ CommandLine=""$(Tools)\winebuild\winebuild.exe" -F
$(TargetFileName) -o [DefFile] --def -k -E [inputs] |
"$(Tools)\winebuild\winebuild.exe" -F $(TargetFileName) -o [StubsFile]
--pedll -k -E [inputs]"
+ Outputs="[DefFile]"
FileExtensions="*.spec"
ExecutionDescription="Generating module definition file"
<Properties>
<StringProperty
- Name="Output"
- DisplayName="Output"
+ Name="DefFile"
+ DisplayName="DefFile"
Description="The path of the def file"
- Switch="[value]"
+ Switch=""[value]""
DefaultValue="$(IntDir)\$(InputName).def"
+ />
+ <StringProperty
+ Name="StubsFile"
+ DisplayName="StubsFile"
+ Description="The path of the spec file"
+ Switch=""[value]""
+ DefaultValue="$(IntDir)\$(InputName).stubs.c"
/>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="Pspec"
DisplayName="pspec"
- CommandLine="cl /nologo /E [includes] [inputs] >
"[Specfile]" | $(Tools)\winebuild\winebuild.exe -o
"[Output]" --def -k -E "[Specfile]""
- Outputs=""[$Output]""
+ CommandLine="cl /nologo /EP [includes] [inputs] > [Specfile]"
+ Outputs="[Specfile]"
FileExtensions="*.pspec"
ExecutionDescription="Generating module definition file"
@@ -38,17 +45,10 @@
Delimited="true"
/>
<StringProperty
- Name="Output"
- DisplayName="Output"
- Description="The path to the def file"
- Switch="[value]"
- DefaultValue="$(IntDir)/$(InputName).def"
- />
- <StringProperty
Name="Specfile"
DisplayName="Spec file"
Description="Spec file"
- Switch="[value]"
+ Switch=""[value]""
DefaultValue="$(IntDir)\$(InputName).spec"
/>
</Properties>
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp [iso-8859-1] Sat Apr 10
11:14:18 2010
@@ -90,11 +90,11 @@
}
else if(file->directory == IntermediateDirectory)
{
- return std::string("$(obj)\\") + file->relative_path;
+ return std::string("$(RootIntDir)\\") + file->relative_path;
}
else if(file->directory == OutputDirectory)
{
- return std::string("$(out)\\") + file->relative_path;
+ return std::string("$(RootOutDir)\\") + file->relative_path;
}
return std::string("");
@@ -106,9 +106,6 @@
VCProjMaker::_generate_proj_file ( const Module& module )
{
size_t i;
-
- string computername;
- string username;
// make sure the containers are empty
header_files.clear();
@@ -116,42 +113,24 @@
libraries.clear();
common_defines.clear();
- if (getenv ( "USERNAME" ) != NULL)
- username = getenv ( "USERNAME" );
- if (getenv ( "COMPUTERNAME" ) != NULL)
- computername = getenv ( "COMPUTERNAME" );
- else if (getenv ( "HOSTNAME" ) != NULL)
- computername = getenv ( "HOSTNAME" );
-
- string vcproj_file_user = "";
-
- if ((computername != "") && (username != ""))
- vcproj_file_user = vcproj_file + "." + computername + "." +
username + ".user";
-
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
string path_basedir = module.GetPathToBaseDir ();
- string vcdir;
-
-
- if ( configuration.UseVSVersionInPath )
- {
- vcdir = DEF_SSEP + _get_vc_dir();
- }
bool include_idl = false;
- vector<string> source_files, resource_files;
- vector<const IfableData*> ifs_list;
-
- const IfableData& data = module.non_if_data/**ifs_list.back()*/;
+ vector<string> source_files, resource_files, generated_files;
+
+ const IfableData& data = module.non_if_data;
const vector<File*>& files = data.files;
for ( i = 0; i < files.size(); i++ )
{
string path = _get_file_path(&files[i]->file, module.output->relative_path);
string file = path + std::string("\\") + files[i]->file.name;
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if (files[i]->file.directory != SourceDirectory)
+ generated_files.push_back ( file );
+ else if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
resource_files.push_back ( file );
else if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
header_files.push_back ( file );
@@ -176,7 +155,7 @@
const vector<Library*>& libs = data.libraries;
for ( i = 0; i < libs.size(); i++ )
{
- string libpath = "$(out)\\" +
libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() +
"\\$(ConfigurationName)\\" + libs[i]->name + ".lib";
+ string libpath = "$(RootOutDir)\\" +
libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() +
"\\$(ConfigurationName)\\" + libs[i]->name + ".lib";
libraries.push_back ( libpath );
}
const vector<Define*>& defs = data.defines;
@@ -197,10 +176,20 @@
baseaddr = prop.value;
}
- if(module.IsSpecDefinitionFile())
- {
- std::string path = _get_file_path(module.importLibrary->source,
module.output->relative_path);
- source_files.push_back ( path + std::string("\\") +
module.importLibrary->source->name );
+ if(module.importLibrary)
+ {
+ std::string ImportLibraryPath = _get_file_path(module.importLibrary->source,
module.output->relative_path);
+
+ switch (module.IsSpecDefinitionFile())
+ {
+ case PSpec:
+ generated_files.push_back("$(IntDir)\\" +
ReplaceExtension(module.importLibrary->source->name,".spec"));
+ case Spec:
+ generated_files.push_back("$(IntDir)\\" +
ReplaceExtension(module.importLibrary->source->name,".stubs.c"));
+ generated_files.push_back("$(IntDir)\\" +
ReplaceExtension(module.importLibrary->source->name,".def"));
+ default:
+ source_files.push_back(ImportLibraryPath + std::string("\\") +
module.importLibrary->source->name);
+ }
}
fprintf ( OUT, "<?xml version=\"1.0\" encoding =
\"Windows-1252\"?>\r\n" );
@@ -263,6 +252,19 @@
// Write out the project files
fprintf ( OUT, "\t<Files>\r\n" );
+ // Generated files
+ fprintf ( OUT, "\t\t<Filter\r\n" );
+ fprintf ( OUT, "\t\t\tName=\"Generated Files\">\r\n" );
+ for( i = 0; i < generated_files.size(); i++)
+ {
+ string source_file = DosSeparator(generated_files[i]);
+
+ fprintf ( OUT, "\t\t\t<File\r\n");
+ fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n",
source_file.c_str() );
+ fprintf ( OUT, "\t\t\t</File>\r\n");
+ }
+ fprintf ( OUT, "\t\t</Filter>\r\n" );
+
// Source files
fprintf ( OUT, "\t\t<Filter\r\n" );
fprintf ( OUT, "\t\t\tName=\"Source Files\"\r\n" );
@@ -328,9 +330,10 @@
if ((source_file.find(".idl") != string::npos) ||
((source_file.find(".asm") != string::npos)))
{
fprintf ( OUT, "%s\t<FileConfiguration\r\n", indent_tab.c_str() );
- fprintf ( OUT, "%s\t\tName=\"", indent_tab.c_str() );
- fprintf ( OUT, config.name.c_str() );
- fprintf ( OUT, "|Win32\">\r\n" );
+ fprintf ( OUT, "%s\t\tName=\"%s|Win32\"\r\n",
indent_tab.c_str(),config.name.c_str() );
+ fprintf ( OUT,
"%s\t\tExcludedFromBuild=\"true\"\r\n",indent_tab.c_str());
+ fprintf ( OUT, ">\r\n" );
+#if 0
fprintf ( OUT, "%s\t\t<Tool\r\n", indent_tab.c_str() );
if (source_file.find(".idl") != string::npos)
{
@@ -364,6 +367,7 @@
fprintf ( OUT, "%s\t\t\tCommandLine=\"nasmw $(InputPath) -f coff -o
"$(OutDir)\\$(InputName).obj"\"\r\n", indent_tab.c_str() );
fprintf ( OUT,
"%s\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n",
indent_tab.c_str() );
}
+#endif
fprintf ( OUT, "%s\t</FileConfiguration>\r\n", indent_tab.c_str()
);
}
//}
@@ -429,6 +433,11 @@
size_t i;
string intermediatedir = "";
string importLib;
+
+ if ( configuration.UseVSVersionInPath )
+ {
+ vcdir = DEF_SSEP + _get_vc_dir();
+ }
if(module.IsSpecDefinitionFile())
{
@@ -456,23 +465,18 @@
else
CfgType = ConfigUnknown;
- if ( configuration.UseVSVersionInPath )
- {
- vcdir = DEF_SSEP + _get_vc_dir();
- }
-
fprintf ( OUT, "\t\t<Configuration\r\n" );
fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
if ( configuration.UseConfigurationInPath )
{
- fprintf ( OUT,
"\t\t\tOutputDirectory=\"$(out)\\%s%s\\$(ConfigurationName)\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
- fprintf ( OUT,
"\t\t\tIntermediateDirectory=\"$(obj)\\%s%s\\$(ConfigurationName)\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
+ fprintf ( OUT,
"\t\t\tOutputDirectory=\"$(RootOutDir)\\%s%s\\$(ConfigurationName)\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
+ fprintf ( OUT,
"\t\t\tIntermediateDirectory=\"$(RootIntDir)\\%s%s\\$(ConfigurationName)\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
}
else
{
- fprintf ( OUT, "\t\t\tOutputDirectory=\"$(out)\\%s%s\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
- fprintf ( OUT, "\t\t\tIntermediateDirectory=\"$(obj)\\%s%s\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
+ fprintf ( OUT, "\t\t\tOutputDirectory=\"$(RootOutDir)\\%s%s\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
+ fprintf ( OUT,
"\t\t\tIntermediateDirectory=\"$(RootIntDir)\\%s%s\"\r\n",
module.output->relative_path.c_str (), vcdir.c_str () );
}
fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", CfgType );
@@ -751,8 +755,6 @@
string outdir;
string intdir;
- string vcdir;
-
if ( intenv == "obj-i386" )
intdir = path_basedir + "obj-i386"; /* append relative dir from project dir
*/
@@ -763,11 +765,6 @@
outdir = path_basedir + "output-i386";
else
outdir = outenv;
-
- if ( configuration.UseVSVersionInPath )
- {
- vcdir = DEF_SSEP + _get_vc_dir();
- }
fprintf ( OUT, "\t\t<Configuration\r\n" );
fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
Modified: trunk/reactos/tools/rbuild/backend/msvc/vspropsmaker.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vspropsmaker.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vspropsmaker.cpp [iso-8859-1] Sat Apr 10
11:14:18 2010
@@ -148,31 +148,30 @@
const vector<Include*>& incs = data.includes;
for ( i = 0; i < incs.size(); i++ )
{
- if ((strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt",
11 ) ||
- strncmp(incs[i]->directory->relative_path.c_str(), "include\\ddk",
11 ) ||
- strncmp(incs[i]->directory->relative_path.c_str(), "include\\GL",
10 ) ||
- strncmp(incs[i]->directory->relative_path.c_str(),
"include\\psdk", 12 ) ||
- strncmp(incs[i]->directory->relative_path.c_str(),
"include\\reactos\\wine", 20 )) &&
+ if ((incs[i]->directory->relative_path == "include\\crt" ||
+ incs[i]->directory->relative_path == "include\\ddk" ||
+ incs[i]->directory->relative_path == "include\\GL" ||
+ incs[i]->directory->relative_path == "include\\psdk") &&
! use_ros_headers)
{
continue;
}
if(incs[i]->directory->directory == SourceDirectory)
- fprintf ( OUT, ""$(src)\\");
+ fprintf ( OUT, "$(RootSrcDir)\\");
else if (incs[i]->directory->directory == IntermediateDirectory)
- fprintf ( OUT, ""$(obj)\\");
+ fprintf ( OUT, "$(RootIntDir)\\");
else if (incs[i]->directory->directory == OutputDirectory)
- fprintf ( OUT, ""$(out)\\");
+ fprintf ( OUT, "$(RootOutDir)\\");
else
continue;
fprintf ( OUT, incs[i]->directory->relative_path.c_str());
- fprintf ( OUT, "" ; ");
- }
-
- fprintf ( OUT, ""$(obj)\\include" ; ");
- fprintf ( OUT, ""$(obj)\\include\\reactos" ; ");
+ fprintf ( OUT, " ; ");
+ }
+
+ fprintf ( OUT, "$(RootIntDir)\\include ; ");
+ fprintf ( OUT, "$(RootIntDir)\\include\\reactos ; ");
if ( !use_ros_headers )
{
@@ -180,9 +179,9 @@
if (getenv ( "BASEDIR" ) != NULL)
{
string WdkBase = getenv ( "BASEDIR" );
- fprintf ( OUT, ""%s\\inc\\api" ; ", WdkBase.c_str());
- fprintf ( OUT, ""%s\\inc\\crt" ; ", WdkBase.c_str());
- fprintf ( OUT, ""%s\\inc\\ddk" ; ", WdkBase.c_str());
+ fprintf ( OUT, "%s\\inc\\api ; ", WdkBase.c_str());
+ fprintf ( OUT, "%s\\inc\\crt ; ", WdkBase.c_str());
+ fprintf ( OUT, "%s\\inc\\ddk ; ", WdkBase.c_str());
}
}
fprintf ( OUT, "\"\r\n");
@@ -193,9 +192,6 @@
void
PropsMaker::_generate_global_definitions()
{
-
- string global_defines = "";
-
fprintf ( OUT, "\t<UserMacro\r\n");
fprintf ( OUT, "\t\tName=\"globalDefines\"\r\n");
fprintf ( OUT, "\t\tValue=\"");
@@ -262,10 +258,10 @@
outdir = srcdir + "\\output-i386";
//Generate global macros
- _generate_macro("src", srcdir, true);
- _generate_macro("out", outdir, true);
- _generate_macro("obj", intdir, true);
- _generate_macro("Tools", "$(out)\\tools", true);
+ _generate_macro("RootSrcDir", srcdir, true);
+ _generate_macro("RootOutDir", outdir, true);
+ _generate_macro("RootIntDir", intdir, true);
+ _generate_macro("Tools", "$(RootOutDir)\\tools", true);
_generate_macro("RosBE", rosbedir, true);
_generate_global_includes();