mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
- Include support for makefile configurations.
- Add a new makefile config to the global configuration called RosBuild - Use the new makefile config to process and external batch file which make use of rbuild. - Split and partially rewrite _generate_vcproj. Configurations are now written in support functions. - Remove the creation of .vcproj.user files. They're rather pointless for our needs - Start to add support for VS2010 (make msvc10), it's very incomplete at the moment so don't bother trying it. After this commit, you can now use Visual Studio to build individual reactos components. Run 'make msvc9', open up any vcproj file, select the RosBuild config and hit the build/rebuild button. Working build features are 'build', 'rebuild' and 'clean' svn path=/trunk/; revision=44343
This commit is contained in:
parent
26b1e5ce54
commit
9d7f91d6ca
7 changed files with 784 additions and 431 deletions
|
@ -70,6 +70,7 @@ void MSVCBackend::Process()
|
|||
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)
|
||||
{
|
||||
|
@ -123,6 +124,8 @@ void MSVCBackend::ProcessModules()
|
|||
|
||||
if (configuration.VSProjectVersion == "6.00")
|
||||
_generate_dsp ( module );
|
||||
else if (configuration.VSProjectVersion == "10.00")
|
||||
_generate_vcxproj ( module );
|
||||
else
|
||||
_generate_vcproj ( module );
|
||||
}
|
||||
|
@ -285,10 +288,12 @@ std::string MSVCBackend::_get_vc_dir ( void ) const
|
|||
return "vc70";
|
||||
else if ( configuration.VSProjectVersion == "7.10" )
|
||||
return "vc71";
|
||||
else if ( configuration.VSProjectVersion == "9.00" )
|
||||
return "vc9";
|
||||
else /* must be VS2005 */
|
||||
else if ( configuration.VSProjectVersion == "8.00" )
|
||||
return "vc8";
|
||||
else if ( configuration.VSProjectVersion == "10.00" )
|
||||
return "vc10";
|
||||
else /* default to VS2008 */
|
||||
return "vc9";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "../backend.h"
|
||||
|
||||
|
||||
class FileUnit
|
||||
{
|
||||
public:
|
||||
|
@ -34,9 +35,28 @@ class FileUnit
|
|||
|
||||
enum OptimizationType
|
||||
{
|
||||
RosBuild,
|
||||
Debug,
|
||||
Release,
|
||||
Speed
|
||||
Speed,
|
||||
};
|
||||
|
||||
enum ConfigurationType
|
||||
{
|
||||
ConfigUnknown,
|
||||
ConfigApp,
|
||||
ConfigDll,
|
||||
ConfigEmpty,
|
||||
ConfigLib
|
||||
};
|
||||
|
||||
enum BinaryType
|
||||
{
|
||||
BinUnknown,
|
||||
Lib,
|
||||
Dll,
|
||||
Exe,
|
||||
Sys
|
||||
};
|
||||
|
||||
enum HeadersType
|
||||
|
@ -123,7 +143,23 @@ class MSVCBackend : public Backend
|
|||
|
||||
std::string _get_vc_dir ( void ) const;
|
||||
|
||||
// These are used in both _generate_vcproj and _generate_standard_configuration
|
||||
std::vector<std::string> header_files;
|
||||
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;
|
||||
|
||||
void _generate_standard_configuration(
|
||||
FILE* OUT,
|
||||
const Module& module,
|
||||
const MSVCConfiguration& cfg,
|
||||
BinaryType binaryType );
|
||||
void _generate_makefile_configuration( FILE* OUT, const Module& module, const MSVCConfiguration& cfg );
|
||||
|
||||
void _generate_vcproj ( const Module& module );
|
||||
void _generate_vcxproj ( const Module& module );
|
||||
|
||||
void _generate_sln_header ( FILE* OUT );
|
||||
void _generate_sln_footer ( FILE* OUT );
|
||||
|
|
File diff suppressed because it is too large
Load diff
177
reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp
Normal file
177
reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Ged Murphy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
void
|
||||
MSVCBackend::_generate_vcxproj ( const Module& module )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
string vcproj_file = VcprojFileName(module);
|
||||
string computername;
|
||||
string username;
|
||||
string intermediatedir = "";
|
||||
|
||||
if (getenv ( "USERNAME" ) != NULL)
|
||||
username = getenv ( "USERNAME" );
|
||||
if (getenv ( "COMPUTERNAME" ) != NULL)
|
||||
computername = getenv ( "COMPUTERNAME" );
|
||||
else if (getenv ( "HOSTNAME" ) != NULL)
|
||||
computername = getenv ( "HOSTNAME" );
|
||||
|
||||
printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
|
||||
FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
|
||||
|
||||
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);
|
||||
|
||||
string include_string;
|
||||
|
||||
fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
|
||||
}
|
|
@ -229,6 +229,7 @@ RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
|
|||
msvc.cpp \
|
||||
msvcmaker.cpp \
|
||||
vcprojmaker.cpp \
|
||||
vcxprojmaker.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_SOURCES = \
|
||||
|
@ -530,6 +531,10 @@ $(RBUILD_MSVC_INT_)vcprojmaker.o: $(RBUILD_MSVC_BASE_)vcprojmaker.cpp $(RBUILD_H
|
|||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_MSVC_INT_)vcxprojmaker.o: $(RBUILD_MSVC_BASE_)vcxprojmaker.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
|
||||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_TEST_TARGET): $(RBUILD_TEST_OBJECTS) $(INFLIB_HOST_OBJECTS) $(RBUILD_HEADERS) | $(RBUILD_OUT)
|
||||
$(ECHO_HOSTLD)
|
||||
${host_gpp} $(RBUILD_TEST_OBJECTS) $(INFLIB_HOST_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rbuild", "rbuild.vcproj", "{D9305AFB-499E-49F1-A865-99DD7E19E762}"
|
||||
EndProject
|
||||
Global
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="9.00"
|
||||
Name="rbuild"
|
||||
ProjectGUID="{D9305AFB-499E-49F1-A865-99DD7E19E762}"
|
||||
RootNamespace="rbuild"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
@ -75,6 +76,8 @@
|
|||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\Release/rbuild.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -95,9 +98,6 @@
|
|||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
|
@ -166,6 +166,8 @@
|
|||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/rbuild.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -186,9 +188,6 @@
|
|||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
|
@ -335,6 +334,10 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\backend\msvc\vcxprojmaker.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="mingw"
|
||||
|
|
Loading…
Reference in a new issue