mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:02:02 +00:00
[rbuild]
msvc backend: - Start implementing real support for vcxproj files - Fix generating sln files - Move msvc rules in a separate folder - Various fixes svn path=/trunk/; revision=47511
This commit is contained in:
parent
5fafb51079
commit
9598f59dec
21 changed files with 1367 additions and 445 deletions
|
@ -83,8 +83,6 @@ MSVCBackend::MSVCBackend(Project &project,
|
|||
|
||||
void MSVCBackend::Process()
|
||||
{
|
||||
bool only_msvc_headers = false;
|
||||
|
||||
while ( m_configurations.size () > 0 )
|
||||
{
|
||||
const MSVCConfiguration* cfg = m_configurations.back();
|
||||
|
@ -92,17 +90,17 @@ void MSVCBackend::Process()
|
|||
delete cfg;
|
||||
}
|
||||
|
||||
m_configurations.push_back ( new MSVCConfiguration( Debug ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Release ));
|
||||
// m_configurations.push_back ( new MSVCConfiguration( Speed ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( RosBuild ));
|
||||
|
||||
if (!only_msvc_headers)
|
||||
//Don't generate configurations that require WDK if it can't be found
|
||||
if(getenv ( "BASEDIR" ) != NULL)
|
||||
{
|
||||
m_configurations.push_back ( new MSVCConfiguration( Debug, ReactOSHeaders ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Release, ReactOSHeaders ));
|
||||
// m_configurations.push_back ( new MSVCConfiguration( Speed, ReactOSHeaders ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Debug ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Release ));
|
||||
}
|
||||
m_configurations.push_back ( new MSVCConfiguration( RosBuild ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Debug, ReactOSHeaders ));
|
||||
m_configurations.push_back ( new MSVCConfiguration( Release, ReactOSHeaders ));
|
||||
// m_configurations.push_back ( new MSVCConfiguration( Speed ));
|
||||
// m_configurations.push_back ( new MSVCConfiguration( Speed, ReactOSHeaders ));
|
||||
|
||||
if ( configuration.CleanAsYouGo ) {
|
||||
_clean_project_files();
|
||||
|
@ -117,34 +115,45 @@ void MSVCBackend::Process()
|
|||
filename_sln += "_auto.sln";
|
||||
printf ( "Creating MSVC workspace: %s\n", filename_sln.c_str() );
|
||||
|
||||
//Write a property page for each configuration
|
||||
for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
|
||||
if (configuration.VSProjectVersion == "10.00")
|
||||
{
|
||||
MSVCConfiguration* cfg = m_configurations[icfg];
|
||||
|
||||
//RosBuild doesn't need a property page
|
||||
if(cfg->optimization == RosBuild)
|
||||
continue;
|
||||
|
||||
string filename_props( cfg->name );
|
||||
filename_props += ".vsprops";
|
||||
//Write the propery pages files
|
||||
PropsMaker propsMaker( configuration, &ProjectNode, filename_props, cfg );
|
||||
PropsMaker propsMaker( &ProjectNode, "reactos.props", m_configurations );
|
||||
propsMaker._generate_props( _get_solution_version(), _get_studio_version() );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Write a property page for each configuration
|
||||
for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
|
||||
{
|
||||
MSVCConfiguration* cfg = m_configurations[icfg];
|
||||
|
||||
//RosBuild doesn't need a property page
|
||||
if(cfg->optimization == RosBuild)
|
||||
continue;
|
||||
|
||||
//Write the propery pages files
|
||||
string filename_props( cfg->name );
|
||||
|
||||
filename_props = filename_props + ".vsprops";
|
||||
VSPropsMaker propsMaker( configuration, &ProjectNode, filename_props, cfg );
|
||||
propsMaker._generate_props( _get_solution_version(), _get_studio_version() );
|
||||
}
|
||||
}
|
||||
// Write out the project files
|
||||
ProcessModules();
|
||||
|
||||
// Write the solution file
|
||||
SlnMaker slnMaker( configuration, ProjectNode, m_configurations, filename_sln );
|
||||
slnMaker._generate_sln ( _get_solution_version(), _get_studio_version() );
|
||||
|
||||
printf ( "Done.\n" );
|
||||
}
|
||||
|
||||
void MSVCBackend::ProcessModules()
|
||||
{
|
||||
string filename_sln ( ProjectNode.name );
|
||||
|
||||
filename_sln += "_auto.sln";
|
||||
|
||||
// Write the solution file
|
||||
SlnMaker slnMaker( configuration, m_configurations, filename_sln, _get_solution_version(), _get_studio_version() );
|
||||
|
||||
for(std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p)
|
||||
{
|
||||
Module &module = *p->second;
|
||||
|
@ -156,17 +165,21 @@ void MSVCBackend::ProcessModules()
|
|||
if (configuration.VSProjectVersion == "10.00")
|
||||
{
|
||||
string vcxproj_file = VcxprojFileName(module);
|
||||
projMaker = new VCXProjMaker( configuration, m_configurations, vcxproj_file );
|
||||
projMaker = new VCXProjMaker( configuration, m_configurations, vcxproj_file, module );
|
||||
}
|
||||
else
|
||||
{
|
||||
string vcproj_file = VcprojFileName(module);
|
||||
projMaker = new VCProjMaker( configuration, m_configurations, vcproj_file );
|
||||
projMaker = new VCProjMaker( configuration, m_configurations, vcproj_file, module );
|
||||
}
|
||||
|
||||
projMaker->_generate_proj_file ( module );
|
||||
|
||||
slnMaker._add_project(*projMaker, module);
|
||||
|
||||
delete projMaker;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool FileExists(string &filename)
|
||||
|
@ -262,6 +275,25 @@ void MSVCBackend::OutputFolders()
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string
|
||||
MSVCBackend::UserFileName ( const Module& module, std::string vcproj_file ) const
|
||||
{
|
||||
string computername;
|
||||
string username;
|
||||
|
||||
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 != ""))
|
||||
return vcproj_file + "." + computername + "." + username + ".user";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string
|
||||
MSVCBackend::SuoFileName ( const Module& module ) const
|
||||
{
|
||||
|
@ -416,25 +448,10 @@ MSVCBackend::_clean_project_files ( void )
|
|||
vector<string> out;
|
||||
printf("Cleaning project %s %s %s\n", module.name.c_str (), module.output->relative_path.c_str (), NcbFileName ( module ).c_str () );
|
||||
|
||||
string basepath = module.output->relative_path;
|
||||
remove ( NcbFileName ( module ).c_str () );
|
||||
remove ( SlnFileName ( module ).c_str () );
|
||||
remove ( SuoFileName ( module ).c_str () );
|
||||
string vcproj_file_user = UserFileName(module, VcprojFileName ( module ));
|
||||
if(vcproj_file_user != "")
|
||||
remove ( vcproj_file_user.c_str () );
|
||||
|
||||
if ( configuration.VSProjectVersion == "10.00" )
|
||||
remove ( VcxprojFileName ( module ).c_str () );
|
||||
else
|
||||
remove ( VcprojFileName ( module ).c_str () );
|
||||
|
||||
string username = getenv ( "USERNAME" );
|
||||
string computername = getenv ( "COMPUTERNAME" );
|
||||
string vcproj_file_user = "";
|
||||
#if 0
|
||||
if ((computername != "") && (username != ""))
|
||||
vcproj_file_user = VcprojFileName ( module ) + "." + computername + "." + username + ".user";
|
||||
|
||||
remove ( vcproj_file_user.c_str () );
|
||||
#endif
|
||||
_get_object_files ( module, out );
|
||||
_get_def_files ( module, out );
|
||||
for ( size_t j = 0; j < out.size (); j++)
|
||||
|
|
|
@ -106,6 +106,7 @@ class MSVCBackend : public Backend
|
|||
std::string VcxprojFileName ( const Module& module ) const;
|
||||
std::string SlnFileName ( const Module& module ) const;
|
||||
std::string SuoFileName ( const Module& module ) const;
|
||||
std::string UserFileName ( const Module& module, std::string vcproj_file ) const;
|
||||
std::string NcbFileName ( const Module& module ) const;
|
||||
|
||||
std::vector<MSVCConfiguration*> m_configurations;
|
||||
|
@ -141,6 +142,8 @@ class ProjMaker
|
|||
virtual void _generate_proj_file ( const Module& module ) = 0;
|
||||
virtual void _generate_user_configuration ();
|
||||
|
||||
std::string VcprojFileName ( const Module& module ) const;
|
||||
|
||||
protected:
|
||||
Configuration configuration;
|
||||
std::vector<MSVCConfiguration*> m_configurations;
|
||||
|
@ -148,20 +151,24 @@ class ProjMaker
|
|||
FILE* OUT;
|
||||
|
||||
std::vector<std::string> header_files;
|
||||
std::vector<std::string> source_files;
|
||||
std::vector<std::string> resource_files;
|
||||
std::vector<std::string> generated_files;
|
||||
std::vector<std::string> defines;
|
||||
std::vector<std::string> includes;
|
||||
std::vector<std::string> includes_ros;
|
||||
std::vector<std::string> libraries;
|
||||
std::set<std::string> common_defines;
|
||||
|
||||
std::string baseaddr;
|
||||
BinaryType binaryType;
|
||||
|
||||
std::string VcprojFileName ( const Module& module ) const;
|
||||
std::string _get_vc_dir ( void ) const;
|
||||
|
||||
std::string _strip_gcc_deffile(std::string Filename, std::string sourcedir, std::string objdir);
|
||||
std::string _get_solution_version ( void );
|
||||
std::string _get_studio_version ( void );
|
||||
std::string _replace_str( std::string string1, const std::string &find_str, const std::string &replace_str);
|
||||
std::string _get_file_path( FileLocation* file, std::string relative_path);
|
||||
|
||||
void _collect_files(const Module& module);
|
||||
void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
|
||||
void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
|
||||
};
|
||||
|
@ -170,13 +177,14 @@ class VCProjMaker : public ProjMaker
|
|||
{
|
||||
public:
|
||||
VCProjMaker ( );
|
||||
VCProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
|
||||
VCProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename, const Module& module );
|
||||
virtual ~VCProjMaker ();
|
||||
|
||||
void _generate_proj_file ( const Module& module );
|
||||
void _generate_user_configuration ();
|
||||
|
||||
private:
|
||||
|
||||
void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
|
||||
void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
|
||||
std::string _get_file_path( FileLocation* file, std::string relative_path);
|
||||
|
@ -186,13 +194,15 @@ class VCXProjMaker : public ProjMaker
|
|||
{
|
||||
public:
|
||||
VCXProjMaker ( );
|
||||
VCXProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
|
||||
VCXProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename, const Module& module );
|
||||
virtual ~VCXProjMaker ();
|
||||
|
||||
void _generate_proj_file ( const Module& module );
|
||||
void _generate_user_configuration ();
|
||||
|
||||
private:
|
||||
std::string _get_configuration_type ();
|
||||
void _generate_item_group (std::vector<std::string>);
|
||||
void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
|
||||
void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
|
||||
};
|
||||
|
@ -200,38 +210,30 @@ class VCXProjMaker : public ProjMaker
|
|||
class SlnMaker
|
||||
{
|
||||
public:
|
||||
SlnMaker ( Configuration& buildConfig, Project& ProjectNode, const std::vector<MSVCConfiguration*>& configurations, std::string filename_sln );
|
||||
SlnMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& configurations, std::string filename_sln, std::string solution_version, std::string studio_version);
|
||||
~SlnMaker ();
|
||||
|
||||
void _generate_sln ( std::string solution_version, std::string studio_version );
|
||||
|
||||
void _add_project(ProjMaker &project, Module &module);
|
||||
private:
|
||||
Configuration m_configuration;
|
||||
Project* m_ProjectNode;
|
||||
std::vector<MSVCConfiguration*> m_configurations;
|
||||
FILE* OUT;
|
||||
std::vector<Module*> modules;
|
||||
|
||||
void _generate_sln_header ( std::string solution_version, std::string studio_version );
|
||||
void _generate_sln_footer ( );
|
||||
//void _generate_rules_file ( FILE* OUT );
|
||||
void _generate_sln_project (
|
||||
const Module& module,
|
||||
std::string vcproj_file,
|
||||
std::string sln_guid,
|
||||
std::string vcproj_guid,
|
||||
const std::vector<Library*>& libraries );
|
||||
void _generate_sln_configurations ( std::string vcproj_guid );
|
||||
};
|
||||
|
||||
class PropsMaker
|
||||
class VSPropsMaker
|
||||
{
|
||||
public:
|
||||
PropsMaker ( Configuration& buildConfig,
|
||||
VSPropsMaker ( Configuration& buildConfig,
|
||||
Project* ProjectNode,
|
||||
std::string filename_props,
|
||||
MSVCConfiguration* msvc_configs);
|
||||
|
||||
~PropsMaker ();
|
||||
~VSPropsMaker ();
|
||||
|
||||
void _generate_props ( std::string solution_version, std::string studio_version );
|
||||
|
||||
|
@ -253,3 +255,28 @@ class PropsMaker
|
|||
void _generate_footer();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class PropsMaker
|
||||
{
|
||||
public:
|
||||
PropsMaker ( Project* ProjectNode,
|
||||
std::string filename_props,
|
||||
std::vector<MSVCConfiguration*> configurations);
|
||||
|
||||
~PropsMaker ();
|
||||
|
||||
void _generate_props ( std::string solution_version, std::string studio_version );
|
||||
|
||||
private:
|
||||
Project* m_ProjectNode;
|
||||
FILE* OUT;
|
||||
std::vector<MSVCConfiguration*> m_configurations;
|
||||
|
||||
void _generate_macro(std::string Name, std::string Value);
|
||||
void _generate_global_includes(bool debug, bool use_ros_headers);
|
||||
void _generate_global_definitions(bool debug, bool use_ros_headers);
|
||||
void _generate_header();
|
||||
void _generate_footer();
|
||||
|
||||
};
|
|
@ -238,3 +238,93 @@ ProjMaker::_replace_str(std::string string1, const std::string &find_str, const
|
|||
|
||||
return string1;
|
||||
}
|
||||
|
||||
|
||||
std::string
|
||||
ProjMaker::_get_file_path( FileLocation* file, std::string relative_path)
|
||||
{
|
||||
if (file->directory == SourceDirectory)
|
||||
{
|
||||
// We want the full path here for directory support later on
|
||||
return Path::RelativeFromDirectory (file->relative_path, relative_path );
|
||||
}
|
||||
else if(file->directory == IntermediateDirectory)
|
||||
{
|
||||
return std::string("$(RootIntDir)\\") + file->relative_path;
|
||||
}
|
||||
else if(file->directory == OutputDirectory)
|
||||
{
|
||||
return std::string("$(RootOutDir)\\") + file->relative_path;
|
||||
}
|
||||
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
void
|
||||
ProjMaker::_collect_files(const Module& module)
|
||||
{
|
||||
size_t i;
|
||||
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 (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 );
|
||||
else
|
||||
source_files.push_back ( file );
|
||||
}
|
||||
const vector<Include*>& incs = data.includes;
|
||||
for ( i = 0; i < incs.size(); i++ )
|
||||
{
|
||||
includes.push_back ( _get_file_path(incs[i]->directory, module.output->relative_path) );
|
||||
}
|
||||
const vector<Library*>& libs = data.libraries;
|
||||
for ( i = 0; i < libs.size(); i++ )
|
||||
{
|
||||
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;
|
||||
for ( i = 0; i < defs.size(); i++ )
|
||||
{
|
||||
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||
continue;
|
||||
|
||||
if( module.isUnicode && (defs[i]->name == "UNICODE" || defs[i]->name == "_UNICODE"))
|
||||
continue;
|
||||
|
||||
if ( defs[i]->value != "" )
|
||||
defines.push_back( defs[i]->name + "=" + defs[i]->value );
|
||||
else
|
||||
defines.push_back( defs[i]->name );
|
||||
}
|
||||
for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
|
||||
{
|
||||
Property& prop = *p->second;
|
||||
if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) )
|
||||
baseaddr = prop.value;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
197
reactos/tools/rbuild/backend/msvc/propsmaker.cpp
Normal file
197
reactos/tools/rbuild/backend/msvc/propsmaker.cpp
Normal file
|
@ -0,0 +1,197 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "msvc.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::set;
|
||||
|
||||
typedef set<string> StringSet;
|
||||
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif//OUT
|
||||
|
||||
|
||||
PropsMaker::PropsMaker (Project* ProjectNode,
|
||||
std::string filename_props,
|
||||
std::vector<MSVCConfiguration*> configurations)
|
||||
{
|
||||
m_ProjectNode = ProjectNode;
|
||||
m_configurations = configurations;
|
||||
|
||||
OUT = fopen ( filename_props.c_str(), "wb" );
|
||||
|
||||
if ( !OUT )
|
||||
{
|
||||
printf ( "Could not create file '%s'.\n", filename_props.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
PropsMaker::~PropsMaker ( )
|
||||
{
|
||||
fclose ( OUT );
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_header()
|
||||
{
|
||||
fprintf ( OUT, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");
|
||||
fprintf ( OUT, "<Project ");
|
||||
fprintf ( OUT, "DefaultTargets=\"Build\" ");
|
||||
fprintf ( OUT, "ToolsVersion=\"4.0\" ");
|
||||
fprintf ( OUT, "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_footer()
|
||||
{
|
||||
fprintf ( OUT, "</Project>\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_macro(std::string Name, std::string Value)
|
||||
{
|
||||
fprintf ( OUT, "\t\t<%s>%s</%s>\r\n", Name.c_str(), Value.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_global_includes(bool debug, bool use_ros_headers)
|
||||
{
|
||||
fprintf ( OUT, "\t\t<globalIncludes>");
|
||||
|
||||
const IfableData& data = m_ProjectNode->non_if_data;
|
||||
//const vector<File*>& files = data.files;
|
||||
size_t i;
|
||||
const vector<Include*>& incs = data.includes;
|
||||
for ( i = 0; i < incs.size(); i++ )
|
||||
{
|
||||
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, "\"$(RootSrcDir)\\");
|
||||
else if (incs[i]->directory->directory == IntermediateDirectory)
|
||||
fprintf ( OUT, "\"$(RootIntDir)\\");
|
||||
else if (incs[i]->directory->directory == OutputDirectory)
|
||||
fprintf ( OUT, "\"$(RootOutDir)\\");
|
||||
else
|
||||
continue;
|
||||
|
||||
fprintf ( OUT, incs[i]->directory->relative_path.c_str());
|
||||
fprintf ( OUT, "\" ; ");
|
||||
}
|
||||
|
||||
fprintf ( OUT, "\"$(RootIntDir)\\include\" ; ");
|
||||
fprintf ( OUT, "\"$(RootIntDir)\\include\\reactos\" ; ");
|
||||
|
||||
if ( !use_ros_headers )
|
||||
{
|
||||
// Add WDK or PSDK paths, if user provides them
|
||||
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, "\t</globalIncludes>\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_global_definitions(bool debug, bool use_ros_headers)
|
||||
{
|
||||
fprintf ( OUT, "\t\t<globalDefines>");
|
||||
|
||||
// Always add _CRT_SECURE_NO_WARNINGS to disable warnings about not
|
||||
// using the safe functions introduced in MSVC8.
|
||||
fprintf ( OUT, "_CRT_SECURE_NO_WARNINGS ; ") ;
|
||||
|
||||
if ( debug )
|
||||
{
|
||||
fprintf ( OUT, "_DEBUG ; ");
|
||||
}
|
||||
|
||||
if ( !use_ros_headers )
|
||||
{
|
||||
// this is a define in MinGW w32api, but not Microsoft's headers
|
||||
fprintf ( OUT, "STDCALL=__stdcall ; ");
|
||||
}
|
||||
|
||||
const IfableData& data = m_ProjectNode->non_if_data;
|
||||
const vector<Define*>& defs = data.defines;
|
||||
size_t i;
|
||||
|
||||
for ( i = 0; i < defs.size(); i++ )
|
||||
{
|
||||
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||
continue;
|
||||
|
||||
if ( defs[i]->value != "" )
|
||||
fprintf ( OUT, "%s=%s",defs[i]->name.c_str(), defs[i]->value.c_str());
|
||||
else
|
||||
fprintf ( OUT, defs[i]->name.c_str());
|
||||
fprintf ( OUT, " ; ");
|
||||
}
|
||||
|
||||
fprintf ( OUT, "\t</globalDefines>\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_props ( std::string solution_version, std::string studio_version )
|
||||
{
|
||||
|
||||
string srcdir = Environment::GetSourcePath();
|
||||
string intdir = Environment::GetIntermediatePath ();
|
||||
string outdir = Environment::GetOutputPath ();
|
||||
string rosbedir = Environment::GetVariable("_ROSBE_BASEDIR");
|
||||
|
||||
if ( intdir == "obj-i386" )
|
||||
intdir = srcdir + "\\obj-i386"; /* append relative dir from project dir */
|
||||
|
||||
if ( outdir == "output-i386" )
|
||||
outdir = srcdir + "\\output-i386";
|
||||
|
||||
_generate_header();
|
||||
|
||||
fprintf ( OUT, "\t<PropertyGroup Label=\"UserMacros\">\r\n");
|
||||
_generate_macro("RootSrcDir", srcdir);
|
||||
_generate_macro("RootOutDir", outdir);
|
||||
_generate_macro("RootIntDir", intdir);
|
||||
_generate_macro("Tools", "$(RootOutDir)\\tools");
|
||||
_generate_macro("RosBE", rosbedir);
|
||||
fprintf ( OUT, "\t</PropertyGroup>\r\n");
|
||||
|
||||
for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
|
||||
{
|
||||
MSVCConfiguration* cfg = m_configurations[icfg];
|
||||
|
||||
if(cfg->optimization == RosBuild)
|
||||
continue;
|
||||
|
||||
fprintf ( OUT, "\t<PropertyGroup Condition=\"'$(Configuration)'=='%s'\">\r\n", cfg->name.c_str() );
|
||||
_generate_global_includes(cfg->optimization == Debug, cfg->headers == ReactOSHeaders);
|
||||
_generate_global_definitions(cfg->optimization == Debug, cfg->headers == ReactOSHeaders);
|
||||
fprintf ( OUT, "\t</PropertyGroup>\r\n");
|
||||
}
|
||||
|
||||
_generate_footer();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project=".\s_as_mscpp.props" />
|
||||
<Import Project=".\spec.props" />
|
||||
<PropertyGroup>
|
||||
<IncludePath>$(globalIncludes);$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(globalIncludes);$(ProjectIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>$(ProjectDefines);$(globalDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<IgnoreStandardIncludePath>true</IgnoreStandardIncludePath>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
</ClCompile>
|
||||
<s_as_mscpp>
|
||||
<sIncPaths>$(globalIncludes);$(ProjectIncludes)</sIncPaths>
|
||||
<sPPDefs>__ASM__</sPPDefs>
|
||||
</s_as_mscpp>
|
||||
<Pspec>
|
||||
<includes>$(globalIncludes);$(ProjectIncludes)</includes>
|
||||
</Pspec>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(globalIncludes);$(ProjectIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
6
reactos/tools/rbuild/backend/msvc/rules/reactos.targets
Normal file
6
reactos/tools/rbuild/backend/msvc/rules/reactos.targets
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project=".\s_as_mscpp.targets" />
|
||||
<Import Project=".\spec.targets" />
|
||||
</Project>
|
||||
|
21
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.props
Normal file
21
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.props
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup
|
||||
Condition="'$(s_as_mscppBeforeTargets)' == '' and '$(s_as_mscppAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
|
||||
<s_as_mscppBeforeTargets>Midl</s_as_mscppBeforeTargets>
|
||||
<s_as_mscppAfterTargets>CustomBuild</s_as_mscppAfterTargets>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<s_as_mscppDependsOn
|
||||
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(s_as_mscppDependsOn)</s_as_mscppDependsOn>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<s_as_mscpp>
|
||||
<sOutF>$(IntDir)%(Filename).obj</sOutF>
|
||||
<sIncPaths>$(globalIncludes)</sIncPaths>
|
||||
<CommandLineTemplate>cl /nologo /E [sIncPaths] [sPPDefs] "%(FullPath)" | "$(RosBE)\i386\bin\as" -o [sOutF]</CommandLineTemplate>
|
||||
<Outputs>%(sOutF)</Outputs>
|
||||
<ExecutionDescription>Assembling </ExecutionDescription>
|
||||
</s_as_mscpp>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
84
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.targets
Normal file
84
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.targets
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<PropertyPageSchema
|
||||
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
|
||||
<AvailableItemName
|
||||
Include="s_as_mscpp">
|
||||
<Targets>_s_as_mscpp</Targets>
|
||||
</AvailableItemName>
|
||||
</ItemGroup>
|
||||
<UsingTask
|
||||
TaskName="s_as_mscpp"
|
||||
TaskFactory="XamlTaskFactory"
|
||||
AssemblyName="Microsoft.Build.Tasks.v4.0">
|
||||
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
|
||||
</UsingTask>
|
||||
<Target
|
||||
Name="_s_as_mscpp"
|
||||
BeforeTargets="$(s_as_mscppBeforeTargets)"
|
||||
AfterTargets="$(s_as_mscppAfterTargets)"
|
||||
Condition="'@(s_as_mscpp)' != ''"
|
||||
DependsOnTargets="$(s_as_mscppDependsOn);Computes_as_mscppOutput"
|
||||
Outputs="@(s_as_mscpp->Metadata('Outputs')->Distinct())"
|
||||
Inputs="@(s_as_mscpp);%(s_as_mscpp.AdditionalDependencies);$(MSBuildProjectFile)">
|
||||
<ItemGroup
|
||||
Condition="'@(SelectedFiles)' != ''">
|
||||
<s_as_mscpp
|
||||
Remove="@(s_as_mscpp)"
|
||||
Condition="'%(Identity)' != '@(SelectedFiles)'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<s_as_mscpp_tlog
|
||||
Include="%(s_as_mscpp.Outputs)"
|
||||
Condition="'%(s_as_mscpp.Outputs)' != '' and '%(s_as_mscpp.ExcludedFromBuild)' != 'true'">
|
||||
<Source>@(s_as_mscpp, '|')</Source>
|
||||
</s_as_mscpp_tlog>
|
||||
</ItemGroup>
|
||||
<Message
|
||||
Importance="High"
|
||||
Text="%(s_as_mscpp.ExecutionDescription)" />
|
||||
<WriteLinesToFile
|
||||
Condition="'@(s_as_mscpp_tlog)' != '' and '%(s_as_mscpp_tlog.ExcludedFromBuild)' != 'true'"
|
||||
File="$(IntDir)$(ProjectName).write.1.tlog"
|
||||
Lines="^%(s_as_mscpp_tlog.Source);@(s_as_mscpp_tlog->'%(Fullpath)')" />
|
||||
<s_as_mscpp
|
||||
Condition="'@(s_as_mscpp)' != '' and '%(s_as_mscpp.ExcludedFromBuild)' != 'true'"
|
||||
CommandLineTemplate="%(s_as_mscpp.CommandLineTemplate)"
|
||||
sOutF="%(s_as_mscpp.sOutF)"
|
||||
sIncPaths="%(s_as_mscpp.sIncPaths)"
|
||||
sPPDefs="%(s_as_mscpp.sPPDefs)"
|
||||
AdditionalOptions="%(s_as_mscpp.AdditionalOptions)"
|
||||
Inputs="@(s_as_mscpp)" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<ComputeLinkInputsTargets>
|
||||
$(ComputeLinkInputsTargets);
|
||||
Computes_as_mscppOutput;
|
||||
</ComputeLinkInputsTargets>
|
||||
<ComputeLibInputsTargets>
|
||||
$(ComputeLibInputsTargets);
|
||||
Computes_as_mscppOutput;
|
||||
</ComputeLibInputsTargets>
|
||||
</PropertyGroup>
|
||||
<Target
|
||||
Name="Computes_as_mscppOutput"
|
||||
Condition="'@(s_as_mscpp)' != ''">
|
||||
<ItemGroup>
|
||||
<s_as_mscppDirsToMake
|
||||
Condition="'@(s_as_mscpp)' != '' and '%(s_as_mscpp.ExcludedFromBuild)' != 'true'"
|
||||
Include="%(s_as_mscpp.Outputs)" />
|
||||
<Link
|
||||
Include="%(s_as_mscppDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<Lib
|
||||
Include="%(s_as_mscppDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<ImpLib
|
||||
Include="%(s_as_mscppDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
</ItemGroup>
|
||||
<MakeDir
|
||||
Directories="@(s_as_mscppDirsToMake->'%(RootDir)%(Directory)')" />
|
||||
</Target>
|
||||
</Project>
|
145
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.xml
Normal file
145
reactos/tools/rbuild/backend/msvc/rules/s_as_mscpp.xml
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
|
||||
<Rule
|
||||
Name="s_as_mscpp"
|
||||
PageTemplate="tool"
|
||||
DisplayName="s (gnu_as mscpp)"
|
||||
Order="200">
|
||||
<Rule.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="s_as_mscpp" />
|
||||
</Rule.DataSource>
|
||||
<Rule.Categories>
|
||||
<Category
|
||||
Name="General">
|
||||
<Category.DisplayName>
|
||||
<sys:String>General</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
<Category
|
||||
Name="Command Line"
|
||||
Subtype="CommandLine">
|
||||
<Category.DisplayName>
|
||||
<sys:String>Command Line</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
</Rule.Categories>
|
||||
<StringListProperty
|
||||
Name="Inputs"
|
||||
Category="Command Line"
|
||||
IsRequired="true"
|
||||
Switch=" ">
|
||||
<StringListProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="s_as_mscpp"
|
||||
SourceType="Item" />
|
||||
</StringListProperty.DataSource>
|
||||
</StringListProperty>
|
||||
<StringProperty
|
||||
Name="sOutF"
|
||||
HelpContext="0"
|
||||
DisplayName="Obj File"
|
||||
Description="Obj File (-o [file])"
|
||||
Switch=""[value]"" />
|
||||
<StringListProperty
|
||||
Name="sIncPaths"
|
||||
HelpContext="0"
|
||||
DisplayName="Inc Paths"
|
||||
Description="Include serach paths (/I [path])"
|
||||
Switch="/I "[value]"" />
|
||||
<StringListProperty
|
||||
Name="sPPDefs"
|
||||
HelpContext="0"
|
||||
DisplayName="Preproc Defs"
|
||||
Description="Preprocessor Definitions (/D [symbol])"
|
||||
Switch="/D "[value]"" />
|
||||
<StringProperty
|
||||
Name="CommandLineTemplate"
|
||||
DisplayName="Command Line"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<DynamicEnumProperty
|
||||
Name="s_as_mscppBeforeTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute Before</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^s_as_mscppBeforeTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<DynamicEnumProperty
|
||||
Name="s_as_mscppAfterTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute After</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^s_as_mscppAfterTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType=""
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<StringListProperty
|
||||
Name="Outputs"
|
||||
DisplayName="Outputs"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringProperty
|
||||
Name="ExecutionDescription"
|
||||
DisplayName="Execution Description"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringListProperty
|
||||
Name="AdditionalDependencies"
|
||||
DisplayName="Additional Dependencies"
|
||||
IncludeInCommandLine="False"
|
||||
Visible="false" />
|
||||
<StringProperty
|
||||
Subtype="AdditionalOptions"
|
||||
Name="AdditionalOptions"
|
||||
Category="Command Line">
|
||||
<StringProperty.DisplayName>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.DisplayName>
|
||||
<StringProperty.Description>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.Description>
|
||||
</StringProperty>
|
||||
</Rule>
|
||||
<ItemType
|
||||
Name="s_as_mscpp"
|
||||
DisplayName="s (gnu_as mscpp)" />
|
||||
<FileExtension
|
||||
Name="*.s"
|
||||
ContentType="s_as_mscpp" />
|
||||
<ContentType
|
||||
Name="s_as_mscpp"
|
||||
DisplayName="s (gnu_as mscpp)"
|
||||
ItemType="s_as_mscpp" />
|
||||
</ProjectSchemaDefinitions>
|
38
reactos/tools/rbuild/backend/msvc/rules/spec.props
Normal file
38
reactos/tools/rbuild/backend/msvc/rules/spec.props
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup
|
||||
Condition="'$(specBeforeTargets)' == '' and '$(specAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
|
||||
<specBeforeTargets>Midl</specBeforeTargets>
|
||||
<specAfterTargets>Pspec</specAfterTargets>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<specDependsOn
|
||||
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(specDependsOn)</specDependsOn>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<spec>
|
||||
<DefFile>$(IntDir)%(Filename).def</DefFile>
|
||||
<StubsFile>$(IntDir)%(Filename).stubs.c</StubsFile>
|
||||
<CommandLineTemplate>"$(Tools)\winebuild\winebuild.exe" -F $(TargetFileName) -o [DefFile] --def -k -E [inputs] | "$(Tools)\winebuild\winebuild.exe" -F $(TargetFileName) -o [StubsFile] --pedll -k -E [inputs]</CommandLineTemplate>
|
||||
<Outputs>[DefFile]</Outputs>
|
||||
<ExecutionDescription>Generating module definition file</ExecutionDescription>
|
||||
</spec>
|
||||
</ItemDefinitionGroup>
|
||||
<PropertyGroup
|
||||
Condition="'$(PspecBeforeTargets)' == '' and '$(PspecAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
|
||||
<PspecBeforeTargets>spec</PspecBeforeTargets>
|
||||
<PspecAfterTargets>CustomBuild</PspecAfterTargets>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PspecDependsOn
|
||||
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(PspecDependsOn)</PspecDependsOn>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Pspec>
|
||||
<Specfile>$(IntDir)%(Filename).spec</Specfile>
|
||||
<CommandLineTemplate>cl /nologo /EP [includes] [inputs] > [Specfile]</CommandLineTemplate>
|
||||
<Outputs>[Specfile]</Outputs>
|
||||
<ExecutionDescription>Generating module definition file</ExecutionDescription>
|
||||
</Pspec>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
159
reactos/tools/rbuild/backend/msvc/rules/spec.targets
Normal file
159
reactos/tools/rbuild/backend/msvc/rules/spec.targets
Normal file
|
@ -0,0 +1,159 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<PropertyPageSchema
|
||||
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
|
||||
<AvailableItemName
|
||||
Include="spec">
|
||||
<Targets>_spec</Targets>
|
||||
</AvailableItemName>
|
||||
<AvailableItemName
|
||||
Include="Pspec">
|
||||
<Targets>_Pspec</Targets>
|
||||
</AvailableItemName>
|
||||
</ItemGroup>
|
||||
<UsingTask
|
||||
TaskName="spec"
|
||||
TaskFactory="XamlTaskFactory"
|
||||
AssemblyName="Microsoft.Build.Tasks.v4.0">
|
||||
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
|
||||
</UsingTask>
|
||||
<UsingTask
|
||||
TaskName="Pspec"
|
||||
TaskFactory="XamlTaskFactory"
|
||||
AssemblyName="Microsoft.Build.Tasks.v4.0">
|
||||
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
|
||||
</UsingTask>
|
||||
<Target
|
||||
Name="_spec"
|
||||
BeforeTargets="$(specBeforeTargets)"
|
||||
AfterTargets="$(specAfterTargets)"
|
||||
Condition="'@(spec)' != ''"
|
||||
DependsOnTargets="$(specDependsOn);ComputespecOutput"
|
||||
Outputs="@(spec->Metadata('Outputs')->Distinct())"
|
||||
Inputs="@(spec);%(spec.AdditionalDependencies);$(MSBuildProjectFile)">
|
||||
<ItemGroup
|
||||
Condition="'@(SelectedFiles)' != ''">
|
||||
<spec
|
||||
Remove="@(spec)"
|
||||
Condition="'%(Identity)' != '@(SelectedFiles)'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<spec_tlog
|
||||
Include="%(spec.Outputs)"
|
||||
Condition="'%(spec.Outputs)' != '' and '%(spec.ExcludedFromBuild)' != 'true'">
|
||||
<Source>@(spec, '|')</Source>
|
||||
</spec_tlog>
|
||||
</ItemGroup>
|
||||
<Message
|
||||
Importance="High"
|
||||
Text="%(spec.ExecutionDescription)" />
|
||||
<WriteLinesToFile
|
||||
Condition="'@(spec_tlog)' != '' and '%(spec_tlog.ExcludedFromBuild)' != 'true'"
|
||||
File="$(IntDir)$(ProjectName).write.1.tlog"
|
||||
Lines="^%(spec_tlog.Source);@(spec_tlog->'%(Fullpath)')" />
|
||||
<spec
|
||||
Condition="'@(spec)' != '' and '%(spec.ExcludedFromBuild)' != 'true'"
|
||||
CommandLineTemplate="%(spec.CommandLineTemplate)"
|
||||
DefFile="%(spec.DefFile)"
|
||||
StubsFile="%(spec.StubsFile)"
|
||||
AdditionalOptions="%(spec.AdditionalOptions)"
|
||||
Inputs="@(spec)" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<ComputeLinkInputsTargets>
|
||||
$(ComputeLinkInputsTargets);
|
||||
ComputespecOutput;
|
||||
</ComputeLinkInputsTargets>
|
||||
<ComputeLibInputsTargets>
|
||||
$(ComputeLibInputsTargets);
|
||||
ComputespecOutput;
|
||||
</ComputeLibInputsTargets>
|
||||
</PropertyGroup>
|
||||
<Target
|
||||
Name="ComputespecOutput"
|
||||
Condition="'@(spec)' != ''">
|
||||
<ItemGroup>
|
||||
<specDirsToMake
|
||||
Condition="'@(spec)' != '' and '%(spec.ExcludedFromBuild)' != 'true'"
|
||||
Include="%(spec.Outputs)" />
|
||||
<Link
|
||||
Include="%(specDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<Lib
|
||||
Include="%(specDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<ImpLib
|
||||
Include="%(specDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
</ItemGroup>
|
||||
<MakeDir
|
||||
Directories="@(specDirsToMake->'%(RootDir)%(Directory)')" />
|
||||
</Target>
|
||||
<Target
|
||||
Name="_Pspec"
|
||||
BeforeTargets="$(PspecBeforeTargets)"
|
||||
AfterTargets="$(PspecAfterTargets)"
|
||||
Condition="'@(Pspec)' != ''"
|
||||
DependsOnTargets="$(PspecDependsOn);ComputePspecOutput"
|
||||
Outputs="@(Pspec->Metadata('Outputs')->Distinct())"
|
||||
Inputs="@(Pspec);%(Pspec.AdditionalDependencies);$(MSBuildProjectFile)">
|
||||
<ItemGroup
|
||||
Condition="'@(SelectedFiles)' != ''">
|
||||
<Pspec
|
||||
Remove="@(Pspec)"
|
||||
Condition="'%(Identity)' != '@(SelectedFiles)'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Pspec_tlog
|
||||
Include="%(Pspec.Outputs)"
|
||||
Condition="'%(Pspec.Outputs)' != '' and '%(Pspec.ExcludedFromBuild)' != 'true'">
|
||||
<Source>@(Pspec, '|')</Source>
|
||||
</Pspec_tlog>
|
||||
</ItemGroup>
|
||||
<Message
|
||||
Importance="High"
|
||||
Text="%(Pspec.ExecutionDescription)" />
|
||||
<WriteLinesToFile
|
||||
Condition="'@(Pspec_tlog)' != '' and '%(Pspec_tlog.ExcludedFromBuild)' != 'true'"
|
||||
File="$(IntDir)$(ProjectName).write.1.tlog"
|
||||
Lines="^%(Pspec_tlog.Source);@(Pspec_tlog->'%(Fullpath)')" />
|
||||
<Pspec
|
||||
Condition="'@(Pspec)' != '' and '%(Pspec.ExcludedFromBuild)' != 'true'"
|
||||
CommandLineTemplate="%(Pspec.CommandLineTemplate)"
|
||||
includes="%(Pspec.includes)"
|
||||
Specfile="%(Pspec.Specfile)"
|
||||
AdditionalOptions="%(Pspec.AdditionalOptions)"
|
||||
Inputs="@(Pspec)" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<ComputeLinkInputsTargets>
|
||||
$(ComputeLinkInputsTargets);
|
||||
ComputePspecOutput;
|
||||
</ComputeLinkInputsTargets>
|
||||
<ComputeLibInputsTargets>
|
||||
$(ComputeLibInputsTargets);
|
||||
ComputePspecOutput;
|
||||
</ComputeLibInputsTargets>
|
||||
</PropertyGroup>
|
||||
<Target
|
||||
Name="ComputePspecOutput"
|
||||
Condition="'@(Pspec)' != ''">
|
||||
<ItemGroup>
|
||||
<PspecDirsToMake
|
||||
Condition="'@(Pspec)' != '' and '%(Pspec.ExcludedFromBuild)' != 'true'"
|
||||
Include="%(Pspec.Outputs)" />
|
||||
<Link
|
||||
Include="%(PspecDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<Lib
|
||||
Include="%(PspecDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
<ImpLib
|
||||
Include="%(PspecDirsToMake.Identity)"
|
||||
Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
|
||||
</ItemGroup>
|
||||
<MakeDir
|
||||
Directories="@(PspecDirsToMake->'%(RootDir)%(Directory)')" />
|
||||
</Target>
|
||||
</Project>
|
274
reactos/tools/rbuild/backend/msvc/rules/spec.xml
Normal file
274
reactos/tools/rbuild/backend/msvc/rules/spec.xml
Normal file
|
@ -0,0 +1,274 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
|
||||
<Rule
|
||||
Name="spec"
|
||||
PageTemplate="tool"
|
||||
DisplayName="Spec"
|
||||
Order="200">
|
||||
<Rule.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="spec" />
|
||||
</Rule.DataSource>
|
||||
<Rule.Categories>
|
||||
<Category
|
||||
Name="General">
|
||||
<Category.DisplayName>
|
||||
<sys:String>General</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
<Category
|
||||
Name="Command Line"
|
||||
Subtype="CommandLine">
|
||||
<Category.DisplayName>
|
||||
<sys:String>Command Line</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
</Rule.Categories>
|
||||
<StringListProperty
|
||||
Name="Inputs"
|
||||
Category="Command Line"
|
||||
IsRequired="true"
|
||||
Switch=" ">
|
||||
<StringListProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="spec"
|
||||
SourceType="Item" />
|
||||
</StringListProperty.DataSource>
|
||||
</StringListProperty>
|
||||
<StringProperty
|
||||
Name="DefFile"
|
||||
HelpContext="0"
|
||||
DisplayName="DefFile"
|
||||
Description="The path of the def file"
|
||||
Switch=""[value]"" />
|
||||
<StringProperty
|
||||
Name="StubsFile"
|
||||
HelpContext="0"
|
||||
DisplayName="StubsFile"
|
||||
Description="The path of the spec file"
|
||||
Switch=""[value]"" />
|
||||
<StringProperty
|
||||
Name="CommandLineTemplate"
|
||||
DisplayName="Command Line"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<DynamicEnumProperty
|
||||
Name="specBeforeTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute Before</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^specBeforeTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<DynamicEnumProperty
|
||||
Name="specAfterTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute After</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^specAfterTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType=""
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<StringListProperty
|
||||
Name="Outputs"
|
||||
DisplayName="Outputs"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringProperty
|
||||
Name="ExecutionDescription"
|
||||
DisplayName="Execution Description"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringListProperty
|
||||
Name="AdditionalDependencies"
|
||||
DisplayName="Additional Dependencies"
|
||||
IncludeInCommandLine="False"
|
||||
Visible="false" />
|
||||
<StringProperty
|
||||
Subtype="AdditionalOptions"
|
||||
Name="AdditionalOptions"
|
||||
Category="Command Line">
|
||||
<StringProperty.DisplayName>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.DisplayName>
|
||||
<StringProperty.Description>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.Description>
|
||||
</StringProperty>
|
||||
</Rule>
|
||||
<ItemType
|
||||
Name="spec"
|
||||
DisplayName="Spec" />
|
||||
<FileExtension
|
||||
Name="*.spec"
|
||||
ContentType="spec" />
|
||||
<ContentType
|
||||
Name="spec"
|
||||
DisplayName="Spec"
|
||||
ItemType="spec" />
|
||||
<Rule
|
||||
Name="Pspec"
|
||||
PageTemplate="tool"
|
||||
DisplayName="pspec"
|
||||
Order="200">
|
||||
<Rule.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="Pspec" />
|
||||
</Rule.DataSource>
|
||||
<Rule.Categories>
|
||||
<Category
|
||||
Name="General">
|
||||
<Category.DisplayName>
|
||||
<sys:String>General</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
<Category
|
||||
Name="Command Line"
|
||||
Subtype="CommandLine">
|
||||
<Category.DisplayName>
|
||||
<sys:String>Command Line</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
</Rule.Categories>
|
||||
<StringListProperty
|
||||
Name="Inputs"
|
||||
Category="Command Line"
|
||||
IsRequired="true"
|
||||
Switch=" ">
|
||||
<StringListProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType="Pspec"
|
||||
SourceType="Item" />
|
||||
</StringListProperty.DataSource>
|
||||
</StringListProperty>
|
||||
<StringListProperty
|
||||
Name="includes"
|
||||
HelpContext="0"
|
||||
DisplayName="includes"
|
||||
Switch="/I "[value]"" />
|
||||
<StringProperty
|
||||
Name="Specfile"
|
||||
HelpContext="0"
|
||||
DisplayName="Spec file"
|
||||
Description="Spec file"
|
||||
Switch=""[value]"" />
|
||||
<StringProperty
|
||||
Name="CommandLineTemplate"
|
||||
DisplayName="Command Line"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<DynamicEnumProperty
|
||||
Name="PspecBeforeTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute Before</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run before.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^PspecBeforeTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<DynamicEnumProperty
|
||||
Name="PspecAfterTargets"
|
||||
Category="General"
|
||||
EnumProvider="Targets"
|
||||
IncludeInCommandLine="False">
|
||||
<DynamicEnumProperty.DisplayName>
|
||||
<sys:String>Execute After</sys:String>
|
||||
</DynamicEnumProperty.DisplayName>
|
||||
<DynamicEnumProperty.Description>
|
||||
<sys:String>Specifies the targets for the build customization to run after.</sys:String>
|
||||
</DynamicEnumProperty.Description>
|
||||
<DynamicEnumProperty.ProviderSettings>
|
||||
<NameValuePair
|
||||
Name="Exclude"
|
||||
Value="^PspecAfterTargets|^Compute" />
|
||||
</DynamicEnumProperty.ProviderSettings>
|
||||
<DynamicEnumProperty.DataSource>
|
||||
<DataSource
|
||||
Persistence="ProjectFile"
|
||||
ItemType=""
|
||||
HasConfigurationCondition="true" />
|
||||
</DynamicEnumProperty.DataSource>
|
||||
</DynamicEnumProperty>
|
||||
<StringListProperty
|
||||
Name="Outputs"
|
||||
DisplayName="Outputs"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringProperty
|
||||
Name="ExecutionDescription"
|
||||
DisplayName="Execution Description"
|
||||
Visible="False"
|
||||
IncludeInCommandLine="False" />
|
||||
<StringListProperty
|
||||
Name="AdditionalDependencies"
|
||||
DisplayName="Additional Dependencies"
|
||||
IncludeInCommandLine="False"
|
||||
Visible="false" />
|
||||
<StringProperty
|
||||
Subtype="AdditionalOptions"
|
||||
Name="AdditionalOptions"
|
||||
Category="Command Line">
|
||||
<StringProperty.DisplayName>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.DisplayName>
|
||||
<StringProperty.Description>
|
||||
<sys:String>Additional Options</sys:String>
|
||||
</StringProperty.Description>
|
||||
</StringProperty>
|
||||
</Rule>
|
||||
<ItemType
|
||||
Name="Pspec"
|
||||
DisplayName="pspec" />
|
||||
<FileExtension
|
||||
Name="*.pspec"
|
||||
ContentType="Pspec" />
|
||||
<ContentType
|
||||
Name="Pspec"
|
||||
DisplayName="pspec"
|
||||
ItemType="Pspec" />
|
||||
</ProjectSchemaDefinitions>
|
|
@ -42,12 +42,12 @@ using std::set;
|
|||
|
||||
|
||||
SlnMaker::SlnMaker ( Configuration& buildConfig,
|
||||
Project& ProjectNode,
|
||||
const std::vector<MSVCConfiguration*>& configurations,
|
||||
std::string filename_sln )
|
||||
std::string filename_sln,
|
||||
std::string solution_version,
|
||||
std::string studio_version)
|
||||
{
|
||||
m_configuration = buildConfig;
|
||||
m_ProjectNode = &ProjectNode;
|
||||
m_configurations = configurations;
|
||||
|
||||
OUT = fopen ( filename_sln.c_str(), "wb" );
|
||||
|
@ -56,10 +56,13 @@ SlnMaker::SlnMaker ( Configuration& buildConfig,
|
|||
{
|
||||
printf ( "Could not create file '%s'.\n", filename_sln.c_str() );
|
||||
}
|
||||
|
||||
_generate_sln_header( solution_version, studio_version);
|
||||
}
|
||||
|
||||
SlnMaker::~SlnMaker()
|
||||
{
|
||||
_generate_sln_footer ( );
|
||||
fclose ( OUT );
|
||||
}
|
||||
|
||||
|
@ -73,35 +76,6 @@ SlnMaker::_generate_sln_header ( std::string solution_version, std::string studi
|
|||
fprintf ( OUT, "\r\n" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SlnMaker::_generate_sln_project (
|
||||
const Module& module,
|
||||
std::string vcproj_file,
|
||||
std::string sln_guid,
|
||||
std::string vcproj_guid,
|
||||
const std::vector<Library*>& libraries )
|
||||
{
|
||||
vcproj_file = DosSeparator ( std::string(".\\") + vcproj_file );
|
||||
|
||||
fprintf ( OUT, "Project(\"%s\") = \"%s\", \"%s\", \"%s\"\r\n", sln_guid.c_str() , module.name.c_str(), vcproj_file.c_str(), vcproj_guid.c_str() );
|
||||
/*
|
||||
//FIXME: only omit ProjectDependencies in VS 2005 when there are no dependencies
|
||||
//NOTE: VS 2002 do not use ProjectSection; it uses GlobalSection instead
|
||||
if ((configuration.VSProjectVersion == "7.10") || (libraries.size() > 0)) {
|
||||
fprintf ( OUT, "\tProjectSection(ProjectDependencies) = postProject\r\n" );
|
||||
for ( size_t i = 0; i < libraries.size(); i++ )
|
||||
{
|
||||
const Module& module = *libraries[i]->importedModule;
|
||||
fprintf ( OUT, "\t\t%s = %s\r\n", module.guid.c_str(), module.guid.c_str() );
|
||||
}
|
||||
fprintf ( OUT, "\tEndProjectSection\r\n" );
|
||||
}
|
||||
*/
|
||||
fprintf ( OUT, "EndProject\r\n" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SlnMaker::_generate_sln_footer ( )
|
||||
{
|
||||
|
@ -112,11 +86,9 @@ SlnMaker::_generate_sln_footer ( )
|
|||
fprintf ( OUT, "\tEndGlobalSection\r\n" );
|
||||
|
||||
fprintf ( OUT, "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n" );
|
||||
for( std::map<std::string, Module*>::const_iterator p = m_ProjectNode->modules.begin(); p != m_ProjectNode->modules.end(); ++ p )
|
||||
for ( size_t i = 0; i < modules.size (); i++)
|
||||
{
|
||||
Module& module = *p->second;
|
||||
std::string guid = module.guid;
|
||||
_generate_sln_configurations ( guid.c_str() );
|
||||
_generate_sln_configurations ( modules[i]->guid.c_str() );
|
||||
}
|
||||
fprintf ( OUT, "\tEndGlobalSection\r\n" );
|
||||
/*
|
||||
|
@ -153,20 +125,13 @@ SlnMaker::_generate_sln_configurations ( std::string vcproj_guid )
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
SlnMaker::_generate_sln ( std::string solution_version, std::string studio_version )
|
||||
void
|
||||
SlnMaker::_add_project(ProjMaker &project, Module &module)
|
||||
{
|
||||
string sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
|
||||
vector<string> guids;
|
||||
|
||||
_generate_sln_header( solution_version, studio_version);
|
||||
// TODO FIXME - is it necessary to sort them?
|
||||
for( std::map<std::string, Module*>::const_iterator p = m_ProjectNode->modules.begin(); p != m_ProjectNode->modules.end(); ++ p )
|
||||
{
|
||||
Module& module = *p->second;
|
||||
fprintf ( OUT, "Project(\"%s\") = \"%s\", \".\\%s\",\"%s\"\n", sln_guid.c_str(), module.name.c_str() , project.VcprojFileName(module).c_str() , module.guid.c_str());
|
||||
fprintf ( OUT, "EndProject\r\n" );
|
||||
|
||||
//std::string vcproj_file =
|
||||
_generate_sln_project ( module, module.name, sln_guid, module.guid, module.non_if_data.libraries );
|
||||
}
|
||||
_generate_sln_footer ( );
|
||||
modules.push_back(&module);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ VCProjMaker::VCProjMaker ( )
|
|||
|
||||
VCProjMaker::VCProjMaker ( Configuration& buildConfig,
|
||||
const std::vector<MSVCConfiguration*>& msvc_configs,
|
||||
std::string filename )
|
||||
std::string filename,
|
||||
const Module& module)
|
||||
{
|
||||
configuration = buildConfig;
|
||||
m_configurations = msvc_configs;
|
||||
|
@ -73,6 +74,21 @@ VCProjMaker::VCProjMaker ( Configuration& buildConfig,
|
|||
{
|
||||
printf ( "Could not create file '%s'.\n", vcproj_file.c_str() );
|
||||
}
|
||||
|
||||
// Set the binary type
|
||||
string module_type = GetExtension(*module.output);
|
||||
|
||||
if ((module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"))
|
||||
binaryType = Lib;
|
||||
else if ((module_type == ".dll") || (module_type == ".cpl"))
|
||||
binaryType = Dll;
|
||||
else if ((module_type == ".exe") || (module_type == ".scr"))
|
||||
binaryType = Exe;
|
||||
else if (module_type == ".sys")
|
||||
binaryType = Sys;
|
||||
else
|
||||
binaryType = BinUnknown;
|
||||
|
||||
}
|
||||
|
||||
VCProjMaker::~VCProjMaker()
|
||||
|
@ -80,117 +96,16 @@ VCProjMaker::~VCProjMaker()
|
|||
fclose ( OUT );
|
||||
}
|
||||
|
||||
std::string
|
||||
VCProjMaker::_get_file_path( FileLocation* file, std::string relative_path)
|
||||
{
|
||||
if (file->directory == SourceDirectory)
|
||||
{
|
||||
// We want the full path here for directory support later on
|
||||
return Path::RelativeFromDirectory (file->relative_path, relative_path );
|
||||
}
|
||||
else if(file->directory == IntermediateDirectory)
|
||||
{
|
||||
return std::string("$(RootIntDir)\\") + file->relative_path;
|
||||
}
|
||||
else if(file->directory == OutputDirectory)
|
||||
{
|
||||
return std::string("$(RootOutDir)\\") + file->relative_path;
|
||||
}
|
||||
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
VCProjMaker::_generate_proj_file ( const Module& module )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
// make sure the containers are empty
|
||||
header_files.clear();
|
||||
includes.clear();
|
||||
libraries.clear();
|
||||
common_defines.clear();
|
||||
|
||||
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
|
||||
|
||||
string path_basedir = module.GetPathToBaseDir ();
|
||||
|
||||
bool include_idl = false;
|
||||
|
||||
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 (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 );
|
||||
else
|
||||
source_files.push_back ( file );
|
||||
}
|
||||
const vector<Include*>& incs = data.includes;
|
||||
for ( i = 0; i < incs.size(); i++ )
|
||||
{
|
||||
string path = _get_file_path(incs[i]->directory, module.output->relative_path);
|
||||
|
||||
if ( module.type != RpcServer && module.type != RpcClient )
|
||||
{
|
||||
if ( path.find ("/include/reactos/idl") != string::npos)
|
||||
{
|
||||
include_idl = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
includes.push_back ( path );
|
||||
}
|
||||
const vector<Library*>& libs = data.libraries;
|
||||
for ( i = 0; i < libs.size(); i++ )
|
||||
{
|
||||
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;
|
||||
for ( i = 0; i < defs.size(); i++ )
|
||||
{
|
||||
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||
continue;
|
||||
|
||||
if ( defs[i]->value[0] )
|
||||
common_defines.insert( defs[i]->name + "=" + defs[i]->value );
|
||||
else
|
||||
common_defines.insert( defs[i]->name );
|
||||
}
|
||||
for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
|
||||
{
|
||||
Property& prop = *p->second;
|
||||
if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) )
|
||||
baseaddr = prop.value;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
_collect_files(module);
|
||||
|
||||
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
|
||||
fprintf ( OUT, "<VisualStudioProject\r\n" );
|
||||
|
@ -211,27 +126,13 @@ VCProjMaker::_generate_proj_file ( const Module& module )
|
|||
|
||||
fprintf ( OUT, "\t<ToolFiles>\r\n" );
|
||||
fprintf ( OUT, "\t\t<ToolFile\r\n" );
|
||||
fprintf ( OUT, "\t\t\tRelativePath=\"%s%s\"\r\n", path_basedir.c_str(), "tools\\rbuild\\backend\\msvc\\s_as_mscpp.rules" );
|
||||
fprintf ( OUT, "\t\t\tRelativePath=\"%s%s\"\r\n", path_basedir.c_str(), "tools\\rbuild\\backend\\msvc\\rules\\s_as_mscpp.rules" );
|
||||
fprintf ( OUT, "\t\t/>\r\n" );
|
||||
fprintf ( OUT, "\t\t<ToolFile\r\n" );
|
||||
fprintf ( OUT, "\t\t\tRelativePath=\"%s%s\"\r\n", path_basedir.c_str(), "tools\\rbuild\\backend\\msvc\\spec.rules" );
|
||||
fprintf ( OUT, "\t\t\tRelativePath=\"%s%s\"\r\n", path_basedir.c_str(), "tools\\rbuild\\backend\\msvc\\rules\\spec.rules" );
|
||||
fprintf ( OUT, "\t\t/>\r\n" );
|
||||
fprintf ( OUT, "\t</ToolFiles>\r\n" );
|
||||
|
||||
// Set the binary type
|
||||
string module_type = GetExtension(*module.output);
|
||||
BinaryType binaryType;
|
||||
if ((module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"))
|
||||
binaryType = Lib;
|
||||
else if ((module_type == ".dll") || (module_type == ".cpl"))
|
||||
binaryType = Dll;
|
||||
else if ((module_type == ".exe") || (module_type == ".scr"))
|
||||
binaryType = Exe;
|
||||
else if (module_type == ".sys")
|
||||
binaryType = Sys;
|
||||
else
|
||||
binaryType = BinUnknown;
|
||||
|
||||
// Write out all the configurations
|
||||
fprintf ( OUT, "\t<Configurations>\r\n" );
|
||||
for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
|
||||
|
@ -389,9 +290,8 @@ VCProjMaker::_generate_proj_file ( const Module& module )
|
|||
fprintf ( OUT, "\t\t\tFilter=\"h;hpp;hxx;hm;inl\">\r\n" );
|
||||
for ( i = 0; i < header_files.size(); i++ )
|
||||
{
|
||||
const string& header_file = header_files[i];
|
||||
fprintf ( OUT, "\t\t\t<File\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", header_file.c_str() );
|
||||
fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", header_files[i].c_str() );
|
||||
fprintf ( OUT, "\t\t\t</File>\r\n" );
|
||||
}
|
||||
fprintf ( OUT, "\t\t</Filter>\r\n" );
|
||||
|
@ -402,9 +302,8 @@ VCProjMaker::_generate_proj_file ( const Module& module )
|
|||
fprintf ( OUT, "\t\t\tFilter=\"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\">\r\n" );
|
||||
for ( i = 0; i < resource_files.size(); i++ )
|
||||
{
|
||||
const string& resource_file = resource_files[i];
|
||||
fprintf ( OUT, "\t\t\t<File\r\n" );
|
||||
fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", resource_file.c_str() );
|
||||
fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", resource_files[i].c_str() );
|
||||
fprintf ( OUT, "\t\t\t</File>\r\n" );
|
||||
}
|
||||
fprintf ( OUT, "\t\t</Filter>\r\n" );
|
||||
|
@ -481,8 +380,8 @@ void VCProjMaker::_generate_standard_configuration( const Module& module,
|
|||
|
||||
fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", CfgType );
|
||||
|
||||
fprintf ( OUT, "\t\t\tInheritedPropertySheets=\"%s%s.vsprops\"\r\n", path_basedir.c_str (), cfg.name.c_str ());
|
||||
fprintf ( OUT, "\t\t\tCharacterSet=\"2\"\r\n" );
|
||||
fprintf ( OUT, "\t\t\tInheritedPropertySheets=\"%s\\%s.vsprops\"\r\n", path_basedir.c_str (), cfg.name.c_str ());
|
||||
fprintf ( OUT, "\t\t\tCharacterSet=\"%s\"\r\n", module.isUnicode ? "1" : "2" );
|
||||
fprintf ( OUT, "\t\t\t>\r\n" );
|
||||
|
||||
fprintf ( OUT, "\t\t\t<Tool\r\n" );
|
||||
|
@ -491,12 +390,7 @@ void VCProjMaker::_generate_standard_configuration( const Module& module,
|
|||
fprintf ( OUT, "./;" );
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
const std::string& include = includes[i];
|
||||
if ( strcmp ( include.c_str(), "." ) )
|
||||
{
|
||||
fprintf ( OUT, "%s", include.c_str() );
|
||||
fprintf ( OUT, ";" );
|
||||
}
|
||||
fprintf ( OUT, "%s;", includes[i].c_str() );
|
||||
}
|
||||
fprintf ( OUT, "$(globalIncludes);\"\r\n");
|
||||
fprintf ( OUT, "\t\t\t\tsPPDefs=\"__ASM__\"\r\n" );
|
||||
|
@ -508,12 +402,7 @@ void VCProjMaker::_generate_standard_configuration( const Module& module,
|
|||
fprintf ( OUT, "./;" );
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
const std::string& include = includes[i];
|
||||
if ( strcmp ( include.c_str(), "." ) )
|
||||
{
|
||||
fprintf ( OUT, "%s", include.c_str() );
|
||||
fprintf ( OUT, ";" );
|
||||
}
|
||||
fprintf ( OUT, "%s;", includes[i].c_str() );
|
||||
}
|
||||
fprintf ( OUT, "$(globalIncludes);\"\r\n");
|
||||
fprintf ( OUT, "\t\t\t\tsPPDefs=\"__ASM__\"\r\n" );
|
||||
|
@ -528,20 +417,10 @@ void VCProjMaker::_generate_standard_configuration( const Module& module,
|
|||
fprintf ( OUT, "./;" );
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
const std::string& include = includes[i];
|
||||
if ( strcmp ( include.c_str(), "." ) )
|
||||
{
|
||||
if ( multiple_includes )
|
||||
fprintf ( OUT, ";" );
|
||||
fprintf ( OUT, "%s", include.c_str() );
|
||||
multiple_includes = true;
|
||||
}
|
||||
fprintf ( OUT, "%s;", includes[i].c_str() );
|
||||
}
|
||||
if ( include_idl )
|
||||
{
|
||||
if ( multiple_includes )
|
||||
fprintf ( OUT, ";" );
|
||||
|
||||
if ( configuration.UseConfigurationInPath )
|
||||
{
|
||||
fprintf ( OUT, "$(int)\\include\\reactos\\idl%s\\$(ConfigurationName)\r\n", vcdir.c_str ());
|
||||
|
@ -554,24 +433,17 @@ void VCProjMaker::_generate_standard_configuration( const Module& module,
|
|||
|
||||
fprintf ( OUT, "\"\r\n" );
|
||||
|
||||
StringSet defines = common_defines;
|
||||
fprintf ( OUT, "\t\t\t\tPreprocessorDefinitions=\"" );
|
||||
for ( i = 0; i < defines.size(); i++ )
|
||||
{
|
||||
fprintf ( OUT, "%s ; ", _replace_str(defines[i], "\"","").c_str() );
|
||||
}
|
||||
|
||||
if ( binaryType == Lib || binaryType == Exe )
|
||||
{
|
||||
defines.insert ( "_LIB" );
|
||||
}
|
||||
fprintf ( OUT, "_LIB ; " );
|
||||
else
|
||||
{
|
||||
defines.insert ( "_WINDOWS" );
|
||||
defines.insert ( "_USRDLL" );
|
||||
}
|
||||
fprintf ( OUT, "_WINDOWS ; _USRDLL ;" );
|
||||
|
||||
fprintf ( OUT, "\t\t\t\tPreprocessorDefinitions=\"" );
|
||||
for ( StringSet::iterator it1=defines.begin(); it1!=defines.end(); it1++ )
|
||||
{
|
||||
string unescaped = *it1;
|
||||
fprintf ( OUT, "%s ; ", _replace_str(unescaped, "\"","").c_str() );
|
||||
}
|
||||
fprintf ( OUT, "\"\r\n" );
|
||||
|
||||
//disable precompiled headers for now
|
||||
|
|
|
@ -53,7 +53,8 @@ VCXProjMaker::VCXProjMaker ( )
|
|||
|
||||
VCXProjMaker::VCXProjMaker ( Configuration& buildConfig,
|
||||
const std::vector<MSVCConfiguration*>& msvc_configs,
|
||||
std::string filename )
|
||||
std::string filename,
|
||||
const Module& module)
|
||||
{
|
||||
configuration = buildConfig;
|
||||
m_configurations = msvc_configs;
|
||||
|
@ -65,157 +66,10 @@ VCXProjMaker::VCXProjMaker ( Configuration& buildConfig,
|
|||
{
|
||||
printf ( "Could not create file '%s'.\n", vcproj_file.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
VCXProjMaker::~VCXProjMaker()
|
||||
{
|
||||
fclose ( OUT );
|
||||
}
|
||||
|
||||
void
|
||||
VCXProjMaker::_generate_proj_file ( const Module& module )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
string computername;
|
||||
string username;
|
||||
|
||||
// make sure the containers are empty
|
||||
header_files.clear();
|
||||
includes.clear();
|
||||
includes_ros.clear();
|
||||
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 intenv = Environment::GetIntermediatePath ();
|
||||
string outenv = Environment::GetOutputPath ();
|
||||
string outdir;
|
||||
string intdir;
|
||||
string vcdir;
|
||||
|
||||
if ( intenv == "obj-i386" )
|
||||
intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
|
||||
else
|
||||
intdir = intenv;
|
||||
|
||||
if ( outenv == "output-i386" )
|
||||
outdir = path_basedir + "output-i386";
|
||||
else
|
||||
outdir = outenv;
|
||||
|
||||
if ( configuration.UseVSVersionInPath )
|
||||
{
|
||||
vcdir = DEF_SSEP + _get_vc_dir();
|
||||
}
|
||||
|
||||
bool include_idl = false;
|
||||
|
||||
vector<string> source_files, resource_files;
|
||||
vector<const IfableData*> ifs_list;
|
||||
ifs_list.push_back ( &module.project.non_if_data );
|
||||
ifs_list.push_back ( &module.non_if_data );
|
||||
|
||||
while ( ifs_list.size() )
|
||||
{
|
||||
const IfableData& data = *ifs_list.back();
|
||||
ifs_list.pop_back();
|
||||
const vector<File*>& files = data.files;
|
||||
for ( i = 0; i < files.size(); i++ )
|
||||
{
|
||||
if (files[i]->file.directory != SourceDirectory)
|
||||
continue;
|
||||
|
||||
// We want the full path here for directory support later on
|
||||
string path = Path::RelativeFromDirectory (
|
||||
files[i]->file.relative_path,
|
||||
module.output->relative_path );
|
||||
string file = path + std::string("\\") + files[i]->file.name;
|
||||
|
||||
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 );
|
||||
else
|
||||
source_files.push_back ( file );
|
||||
}
|
||||
const vector<Include*>& incs = data.includes;
|
||||
for ( i = 0; i < incs.size(); i++ )
|
||||
{
|
||||
string path = Path::RelativeFromDirectory (
|
||||
incs[i]->directory->relative_path,
|
||||
module.output->relative_path );
|
||||
if ( module.type != RpcServer && module.type != RpcClient )
|
||||
{
|
||||
if ( path.find ("/include/reactos/idl") != string::npos)
|
||||
{
|
||||
include_idl = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// switch between general headers and ros headers
|
||||
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 (strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ))
|
||||
// not crt include
|
||||
includes_ros.push_back ( path );
|
||||
}
|
||||
else
|
||||
{
|
||||
includes.push_back ( path );
|
||||
}
|
||||
}
|
||||
const vector<Library*>& libs = data.libraries;
|
||||
for ( i = 0; i < libs.size(); i++ )
|
||||
{
|
||||
string libpath = outdir + "\\" + libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
|
||||
libraries.push_back ( libpath );
|
||||
}
|
||||
const vector<Define*>& defs = data.defines;
|
||||
for ( i = 0; i < defs.size(); i++ )
|
||||
{
|
||||
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||
continue;
|
||||
|
||||
if ( defs[i]->value[0] )
|
||||
common_defines.insert( defs[i]->name + "=" + defs[i]->value );
|
||||
else
|
||||
common_defines.insert( defs[i]->name );
|
||||
}
|
||||
for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
|
||||
{
|
||||
Property& prop = *p->second;
|
||||
if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) )
|
||||
baseaddr = prop.value;
|
||||
}
|
||||
}
|
||||
/* include intermediate path for reactos.rc */
|
||||
string version = intdir + "\\include";
|
||||
includes.push_back (version);
|
||||
version += "\\reactos";
|
||||
includes.push_back (version);
|
||||
|
||||
// Set the binary type
|
||||
string module_type = GetExtension(*module.output);
|
||||
BinaryType binaryType;
|
||||
|
||||
if ((module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"))
|
||||
binaryType = Lib;
|
||||
else if ((module_type == ".dll") || (module_type == ".cpl"))
|
||||
|
@ -226,13 +80,76 @@ VCXProjMaker::_generate_proj_file ( const Module& module )
|
|||
binaryType = Sys;
|
||||
else
|
||||
binaryType = BinUnknown;
|
||||
}
|
||||
|
||||
string include_string;
|
||||
VCXProjMaker::~VCXProjMaker()
|
||||
{
|
||||
fclose ( OUT );
|
||||
}
|
||||
|
||||
void
|
||||
VCXProjMaker::_generate_item_group (std::vector<std::string> files)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for( i = 0; i<files.size(); i++)
|
||||
{
|
||||
std::string extension = GetExtension(files[i]);
|
||||
|
||||
if( extension == ".c" || extension == ".cpp")
|
||||
fprintf ( OUT, "\t\t<ClCompile Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else if( extension == ".s")
|
||||
fprintf ( OUT, "\t\t<s_as_mscpp Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else if( extension == ".spec")
|
||||
fprintf ( OUT, "\t\t<spec Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else if( extension == ".pspec")
|
||||
fprintf ( OUT, "\t\t<pspec Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else if( extension == ".rc")
|
||||
fprintf ( OUT, "\t\t<ResourceCompile Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else if( extension == ".h")
|
||||
fprintf ( OUT, "\t\t<ClInclude Include=\"%s\" />\r\n", files[i].c_str());
|
||||
else
|
||||
fprintf ( OUT, "\t\t<None Include=\"%s\" />\r\n", files[i].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
VCXProjMaker::_get_configuration_type ()
|
||||
{
|
||||
switch (binaryType)
|
||||
{
|
||||
case Exe:
|
||||
return "Application";
|
||||
case Dll:
|
||||
case Sys:
|
||||
return "DynamicLibrary";
|
||||
case Lib:
|
||||
return "StaticLibrary";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VCXProjMaker::_generate_proj_file ( const Module& module )
|
||||
{
|
||||
string path_basedir = module.GetPathToBaseDir ();
|
||||
size_t i;
|
||||
string vcdir;
|
||||
|
||||
if ( configuration.UseVSVersionInPath )
|
||||
{
|
||||
vcdir = DEF_SSEP + _get_vc_dir();
|
||||
}
|
||||
|
||||
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
|
||||
|
||||
_collect_files(module);
|
||||
|
||||
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"utf-8\"?>\r\n" );
|
||||
fprintf ( OUT, "<Project " );
|
||||
fprintf ( OUT, "DefaultTargets=\"Build\" " ); //FIXME: what's Build??
|
||||
fprintf ( OUT, "ToolsVersion=\"4.0\" " ); //FIXME: Is it always 4.0??
|
||||
fprintf ( OUT, "ToolsVersion=\"4.0\" " ); //version 4 is the one bundled with .net framework 4
|
||||
fprintf ( OUT, "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n" );
|
||||
|
||||
if (configuration.VSProjectVersion.empty())
|
||||
|
@ -245,15 +162,11 @@ VCXProjMaker::_generate_proj_file ( const Module& module )
|
|||
const MSVCConfiguration& cfg = *m_configurations[icfg];
|
||||
|
||||
if ( cfg.optimization == RosBuild )
|
||||
{
|
||||
_generate_makefile_configuration( module, cfg );
|
||||
}
|
||||
else
|
||||
{
|
||||
_generate_standard_configuration( module, cfg, binaryType );
|
||||
}
|
||||
}
|
||||
fprintf ( OUT, "\t</ItemGroup>\r\n" );
|
||||
fprintf ( OUT, "\t</ItemGroup>\r\n\r\n" );
|
||||
|
||||
// Write out the global info
|
||||
fprintf ( OUT, "\t<PropertyGroup Label=\"Globals\">\r\n" );
|
||||
|
@ -261,9 +174,88 @@ VCXProjMaker::_generate_proj_file ( const Module& module )
|
|||
fprintf ( OUT, "\t\t<Keyword>%s</Keyword>\r\n", "Win32Proj" ); //FIXME: Win32Proj???
|
||||
fprintf ( OUT, "\t\t<RootNamespace>%s</RootNamespace>\r\n", module.name.c_str() ); //FIXME: shouldn't this be the soltion name?
|
||||
fprintf ( OUT, "\t</PropertyGroup>\r\n" );
|
||||
fprintf ( OUT, "</Project>" );
|
||||
fprintf ( OUT, "\r\n" );
|
||||
|
||||
fprintf ( OUT, "\t<PropertyGroup Label=\"Configuration\">\r\n");
|
||||
if( binaryType != BinUnknown)
|
||||
fprintf ( OUT, "\t\t<ConfigurationType>%s</ConfigurationType>\r\n" , _get_configuration_type().c_str());
|
||||
fprintf ( OUT, "\t\t<CharacterSet>%s</CharacterSet>\r\n", module.isUnicode ? "Unicode" : "MultiByte");
|
||||
fprintf ( OUT, "\t</PropertyGroup>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n" );
|
||||
fprintf ( OUT, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n" );
|
||||
fprintf ( OUT, "\t<ImportGroup Label=\"PropertySheets\">\r\n");
|
||||
fprintf ( OUT, "\t\t<Import Project=\"%s\\reactos.props\" />\r\n", path_basedir.c_str());
|
||||
fprintf ( OUT, "\t\t<Import Project=\"%s\\tools\\rbuild\\backend\\msvc\\rules\\reactos.defaults.props\" />\r\n", path_basedir.c_str());
|
||||
fprintf ( OUT, "\t</ImportGroup>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t<PropertyGroup>\r\n");
|
||||
fprintf ( OUT, "\t\t<OutDir>$(RootOutDir)\\%s%s\\$(Configuration)\\</OutDir>\r\n", module.output->relative_path.c_str (), vcdir.c_str ());
|
||||
fprintf ( OUT, "\t\t<IntDir>$(RootIntDir)\\%s%s\\$(Configuration)\\</IntDir>\r\n", module.output->relative_path.c_str (), vcdir.c_str ());
|
||||
|
||||
if( includes.size() != 0)
|
||||
{
|
||||
fprintf( OUT, "\t\t<ProjectIncludes>");
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
fprintf ( OUT, "%s;", includes[i].c_str() );
|
||||
fprintf( OUT, "</ProjectIncludes>\r\n");
|
||||
}
|
||||
|
||||
if(defines.size() != 0)
|
||||
{
|
||||
fprintf( OUT, "\t\t<ProjectDefines>");
|
||||
for ( i = 0; i < defines.size(); i++ )
|
||||
fprintf ( OUT, "%s;", defines[i].c_str() );
|
||||
fprintf( OUT, "</ProjectDefines>\r\n");
|
||||
}
|
||||
|
||||
fprintf ( OUT, "\t</PropertyGroup>\r\n\r\n");
|
||||
|
||||
fprintf ( OUT, "\t<ItemDefinitionGroup>\r\n");
|
||||
fprintf ( OUT, "\t\t<ClCompile>\r\n");
|
||||
if ( module.cplusplus )
|
||||
fprintf ( OUT, "\t\t\t<CompileAs>CompileAsCpp</CompileAs>\r\n");
|
||||
fprintf ( OUT, "\t\t</ClCompile>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t\t<Link>\r\n");
|
||||
if(libraries.size() != 0)
|
||||
{
|
||||
fprintf ( OUT, "\t\t\t<AdditionalDependencies>");
|
||||
for ( i = 0; i < libraries.size(); i++ )
|
||||
{
|
||||
string libpath = libraries[i].c_str();
|
||||
libpath = libpath.erase (0, libpath.find_last_of ("\\") + 1 );
|
||||
fprintf ( OUT, "%s;", libpath.c_str() );
|
||||
}
|
||||
fprintf ( OUT, "%%(AdditionalDependencies)</AdditionalDependencies>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t\t\t<AdditionalLibraryDirectories>");
|
||||
for ( i = 0; i < libraries.size(); i++ )
|
||||
{
|
||||
string libpath = libraries[i].c_str();
|
||||
libpath = libpath.substr (0, libpath.find_last_of ("\\") );
|
||||
fprintf ( OUT, "%s;", libpath.c_str() );
|
||||
}
|
||||
fprintf ( OUT, "%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n");
|
||||
}
|
||||
|
||||
if( module.CRT != "msvcrt")
|
||||
fprintf ( OUT, "\t\t\t<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t\t</Link>\r\n");
|
||||
fprintf ( OUT, "\t</ItemDefinitionGroup>\r\n");
|
||||
|
||||
fprintf ( OUT, "\t<ItemGroup>\r\n");
|
||||
_generate_item_group(header_files);
|
||||
_generate_item_group(source_files);
|
||||
_generate_item_group(resource_files);
|
||||
_generate_item_group(generated_files);
|
||||
fprintf ( OUT, "\t</ItemGroup>\r\n\r\n");
|
||||
|
||||
fprintf ( OUT, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n");
|
||||
fprintf ( OUT, "\t<Import Project=\"%s\\tools\\rbuild\\backend\\msvc\\rules\\reactos.targets\" />\r\n", path_basedir.c_str());
|
||||
|
||||
fprintf ( OUT, "</Project>\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -23,7 +23,7 @@ typedef set<string> StringSet;
|
|||
#undef OUT
|
||||
#endif//OUT
|
||||
|
||||
PropsMaker::PropsMaker ( Configuration& buildConfig,
|
||||
VSPropsMaker::VSPropsMaker ( Configuration& buildConfig,
|
||||
Project* ProjectNode,
|
||||
std::string filename_props,
|
||||
MSVCConfiguration* msvc_configs)
|
||||
|
@ -46,13 +46,13 @@ PropsMaker::PropsMaker ( Configuration& buildConfig,
|
|||
}
|
||||
}
|
||||
|
||||
PropsMaker::~PropsMaker ( )
|
||||
VSPropsMaker::~VSPropsMaker ( )
|
||||
{
|
||||
fclose ( OUT );
|
||||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_header()
|
||||
VSPropsMaker::_generate_header()
|
||||
{
|
||||
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
|
||||
fprintf ( OUT, "<VisualStudioPropertySheet\r\n" );
|
||||
|
@ -64,7 +64,7 @@ PropsMaker::_generate_header()
|
|||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_tools_defaults()
|
||||
VSPropsMaker::_generate_tools_defaults()
|
||||
{
|
||||
fprintf ( OUT, "\t<Tool\r\n");
|
||||
fprintf ( OUT, "\t\tName=\"VCCLCompilerTool\"\r\n");
|
||||
|
@ -119,7 +119,7 @@ PropsMaker::_generate_tools_defaults()
|
|||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_macro(std::string Name,
|
||||
VSPropsMaker::_generate_macro(std::string Name,
|
||||
std::string Value,
|
||||
bool EvairomentVariable)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ PropsMaker::_generate_macro(std::string Name,
|
|||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_global_includes()
|
||||
VSPropsMaker::_generate_global_includes()
|
||||
{
|
||||
//Generate global includes
|
||||
//they will be used by the c compiler, the resource compiler
|
||||
|
@ -190,7 +190,7 @@ PropsMaker::_generate_global_includes()
|
|||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_global_definitions()
|
||||
VSPropsMaker::_generate_global_definitions()
|
||||
{
|
||||
fprintf ( OUT, "\t<UserMacro\r\n");
|
||||
fprintf ( OUT, "\t\tName=\"globalDefines\"\r\n");
|
||||
|
@ -220,7 +220,7 @@ PropsMaker::_generate_global_definitions()
|
|||
if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
|
||||
continue;
|
||||
|
||||
if ( defs[i]->value[0] )
|
||||
if ( defs[i]->value != "" )
|
||||
fprintf ( OUT, "%s=%s",defs[i]->name.c_str(), defs[i]->value.c_str());
|
||||
else
|
||||
fprintf ( OUT, defs[i]->name.c_str());
|
||||
|
@ -233,14 +233,14 @@ PropsMaker::_generate_global_definitions()
|
|||
}
|
||||
|
||||
void
|
||||
PropsMaker::_generate_footer()
|
||||
VSPropsMaker::_generate_footer()
|
||||
{
|
||||
fprintf ( OUT, "</VisualStudioPropertySheet>\r\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PropsMaker::_generate_props ( std::string solution_version,
|
||||
VSPropsMaker::_generate_props ( std::string solution_version,
|
||||
std::string studio_version )
|
||||
{
|
||||
_generate_header();
|
||||
|
|
|
@ -138,7 +138,7 @@ GetSubPath (
|
|||
return FixSeparator(path + cSep + att_value);
|
||||
}
|
||||
|
||||
static string
|
||||
string
|
||||
GetExtension ( const string& filename )
|
||||
{
|
||||
size_t index = filename.find_last_of ( '/' );
|
||||
|
|
|
@ -1087,6 +1087,9 @@ GetSubPath (
|
|||
const std::string& path,
|
||||
const std::string& att_value );
|
||||
|
||||
extern std::string
|
||||
GetExtension ( const std::string& filename );
|
||||
|
||||
extern std::string
|
||||
GetExtension ( const FileLocation& file );
|
||||
|
||||
|
|
|
@ -184,6 +184,7 @@ RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
|
|||
genguid.cpp \
|
||||
msvc.cpp \
|
||||
projmaker.cpp \
|
||||
propsmaker.cpp \
|
||||
slnmaker.cpp \
|
||||
vcprojmaker.cpp \
|
||||
vcxprojmaker.cpp \
|
||||
|
@ -471,6 +472,10 @@ $(RBUILD_MSVC_INT_)vspropsmaker.o: $(RBUILD_MSVC_BASE_)vspropsmaker.cpp $(RBUILD
|
|||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MSVC_INT_)propsmaker.o: $(RBUILD_MSVC_BASE_)propsmaker.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
|
||||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MSVC_INT_)slnmaker.o: $(RBUILD_MSVC_BASE_)slnmaker.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
|
||||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue