mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +00:00
Remove the devcpp backend.
svn path=/trunk/; revision=44403
This commit is contained in:
parent
bb32402355
commit
628ba3758a
5 changed files with 5 additions and 377 deletions
|
@ -1,249 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Trevor McCort
|
||||
* Copyright (C) 2005 Casper S. Hornstrup
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "devcpp.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static class DevCppFactory : public Backend::Factory
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppFactory() : Factory("devcpp", "Dev C++") {}
|
||||
Backend *operator() (Project &project,
|
||||
Configuration& configuration)
|
||||
{
|
||||
return new DevCppBackend(project, configuration);
|
||||
}
|
||||
|
||||
} factory;
|
||||
|
||||
|
||||
DevCppBackend::DevCppBackend(Project &project,
|
||||
Configuration& configuration) : Backend(project, configuration)
|
||||
{
|
||||
m_unitCount = 0;
|
||||
}
|
||||
|
||||
void DevCppBackend::Process()
|
||||
{
|
||||
string filename = ProjectNode.name + ".dev";
|
||||
|
||||
cout << "Creating Dev-C++ project: " << filename << endl;
|
||||
|
||||
ProcessModules();
|
||||
|
||||
m_devFile.open(filename.c_str());
|
||||
|
||||
if(!m_devFile.is_open())
|
||||
{
|
||||
cout << "Could not open file." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
m_devFile << "[Project]" << endl;
|
||||
|
||||
m_devFile << "FileName=" << filename << endl
|
||||
<< "Name=" << ProjectNode.name << endl
|
||||
<< "UnitCount=" << m_unitCount << endl
|
||||
<< "Type=1" << endl
|
||||
<< "Ver=1" << endl
|
||||
<< "ObjFiles=" << endl
|
||||
<< "Includes=" << endl
|
||||
<< "Libs=" << endl
|
||||
<< "PrivateResource=" << endl
|
||||
<< "ResourceIncludes=" << endl
|
||||
<< "MakeIncludes=" << endl
|
||||
<< "Compiler=" << endl
|
||||
<< "CppCompiler=" << endl
|
||||
<< "Linker=" << endl
|
||||
<< "IsCpp=1" << endl
|
||||
<< "Icon=" << endl
|
||||
<< "ExeOutput=" << endl
|
||||
<< "ObjectOutput=" << endl
|
||||
<< "OverrideOutput=0" << endl
|
||||
<< "OverrideOutputName=" << endl
|
||||
<< "HostApplication=" << endl
|
||||
<< "CommandLine=" << endl
|
||||
<< "UseCustomMakefile=1" << endl
|
||||
<< "CustomMakefile=" << ProjectNode.makefile << endl
|
||||
<< "IncludeVersionInto=0" << endl
|
||||
<< "SupportXPThemes=0" << endl
|
||||
<< "CompilerSet=0" << endl
|
||||
|
||||
<< "CompilerSettings=0000000000000000000000" << endl;
|
||||
|
||||
OutputFolders();
|
||||
|
||||
m_devFile << endl << endl;
|
||||
|
||||
OutputFileUnits();
|
||||
|
||||
m_devFile.close();
|
||||
|
||||
// Dev-C++ needs a makefile, so use the MinGW backend to create one.
|
||||
|
||||
cout << "Creating Makefile: " << ProjectNode.makefile << endl;
|
||||
|
||||
Backend *backend = Backend::Factory::Create("mingw",
|
||||
ProjectNode,
|
||||
configuration );
|
||||
backend->Process();
|
||||
delete backend;
|
||||
|
||||
cout << "Done." << endl << endl;
|
||||
|
||||
cout << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the "
|
||||
<< "parsing required for large projects can take quite awhile."
|
||||
<< endl << endl
|
||||
<< "(Tools->Editor Options->Class browsing->Enable class browsing check box)"
|
||||
<< endl << endl;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessModules()
|
||||
{
|
||||
for(std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p)
|
||||
{
|
||||
Module &module = *p->second;
|
||||
|
||||
for(size_t k = 0; k < module.non_if_data.files.size(); k++)
|
||||
{
|
||||
File &file = *module.non_if_data.files[k];
|
||||
|
||||
ProcessFile( file.file.relative_path + sSep + file.file.name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileExists(string &filename)
|
||||
{
|
||||
ifstream file(filename.c_str());
|
||||
|
||||
if(!file.is_open())
|
||||
return false;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DevCppBackend::ProcessFile(string filepath)
|
||||
{
|
||||
// Remove the .\ at the start of the filenames
|
||||
if ((filepath[0] == '.') && (filepath[1] == '\\')) filepath.erase(0, 2);
|
||||
|
||||
if(!FileExists(filepath))
|
||||
return;
|
||||
|
||||
// Change the \ to /
|
||||
|
||||
for(size_t i = 0; i < filepath.length(); i++)
|
||||
{
|
||||
if(filepath[i] == '/')
|
||||
filepath[i] = '\\';
|
||||
}
|
||||
|
||||
|
||||
// Remove the filename from the path
|
||||
string folder = "";
|
||||
|
||||
size_t pos = filepath.rfind(string("\\"), filepath.length() - 1);
|
||||
|
||||
if(pos != string::npos)
|
||||
{
|
||||
folder = filepath;
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
}
|
||||
|
||||
FileUnit fileUnit;
|
||||
fileUnit.filename = filepath;
|
||||
fileUnit.folder = folder;
|
||||
|
||||
m_fileUnits.push_back(fileUnit);
|
||||
|
||||
if(folder != "")
|
||||
AddFolders(folder);
|
||||
|
||||
m_unitCount++;
|
||||
}
|
||||
|
||||
bool DevCppBackend::CheckFolderAdded(string &folder)
|
||||
{
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(m_folders[i] == folder)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DevCppBackend::AddFolders(string &folder)
|
||||
{
|
||||
// Check if this folder was already added. true if it was, false otherwise.
|
||||
if(CheckFolderAdded(folder))
|
||||
return;
|
||||
|
||||
m_folders.push_back(folder);
|
||||
|
||||
size_t pos = folder.rfind(string("\\"), folder.length() - 1);
|
||||
|
||||
if(pos == string::npos)
|
||||
return;
|
||||
|
||||
folder.erase(pos, folder.length() - pos);
|
||||
AddFolders(folder);
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFolders()
|
||||
{
|
||||
m_devFile << "Folders=";
|
||||
|
||||
for(size_t i = 0; i < m_folders.size(); i++)
|
||||
{
|
||||
if(i > 0)
|
||||
m_devFile << ",";
|
||||
|
||||
m_devFile << m_folders[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DevCppBackend::OutputFileUnits()
|
||||
{
|
||||
for(size_t i = 0; i < m_fileUnits.size(); i++)
|
||||
{
|
||||
m_devFile << "[Unit" << i + 1 << "]" << endl;
|
||||
|
||||
|
||||
m_devFile << "FileName=" << m_fileUnits[i].filename << endl;
|
||||
m_devFile << "CompileCpp=1" << endl;
|
||||
m_devFile << "Folder=" << m_fileUnits[i].folder << endl;
|
||||
m_devFile << "Compile=1" << endl;
|
||||
m_devFile << "Link=1" << endl;
|
||||
m_devFile << "Priority=1000" << endl;
|
||||
m_devFile << "OverrideBuildCmd=0" << endl;
|
||||
m_devFile << "BuildCmd=" << endl << endl;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Trevor McCort
|
||||
* Copyright (C) 2005 Casper S. Hornstrup
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __DEVCPP_H__
|
||||
#define __DEVCPP_H__
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../backend.h"
|
||||
|
||||
class FileUnit
|
||||
{
|
||||
public:
|
||||
std::string filename;
|
||||
std::string folder;
|
||||
};
|
||||
|
||||
class DevCppBackend : public Backend
|
||||
{
|
||||
public:
|
||||
|
||||
DevCppBackend(Project &project,
|
||||
Configuration& configuration);
|
||||
virtual ~DevCppBackend() {}
|
||||
|
||||
virtual void Process();
|
||||
|
||||
private:
|
||||
|
||||
void ProcessModules();
|
||||
void ProcessFile(std::string filename);
|
||||
|
||||
bool CheckFolderAdded(std::string &folder);
|
||||
void AddFolders(std::string &folder);
|
||||
|
||||
void OutputFolders();
|
||||
void OutputFileUnits();
|
||||
|
||||
std::vector<FileUnit> m_fileUnits;
|
||||
std::vector<std::string> m_folders;
|
||||
|
||||
int m_unitCount;
|
||||
|
||||
std::ofstream m_devFile;
|
||||
};
|
||||
|
||||
#endif // __DEVCPP_H__
|
||||
|
|
@ -388,6 +388,8 @@ main ( int argc, char** argv )
|
|||
if ( RootXmlFile.length () == 0 )
|
||||
throw MissingArgumentException ( "-r" );
|
||||
|
||||
DWORD start = GetTickCount();
|
||||
|
||||
string projectFilename ( RootXmlFile );
|
||||
|
||||
printf ( "Reading build files..." );
|
||||
|
@ -402,6 +404,9 @@ main ( int argc, char** argv )
|
|||
project.ExecuteInvocations ();
|
||||
project.GetBackend().Process();
|
||||
|
||||
DWORD end = GetTickCount();
|
||||
printf("time - %lu.%d\n", (end - start) / 1000, (end - start) % 1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch ( Exception& ex )
|
||||
|
|
|
@ -84,24 +84,6 @@ $(RBUILD_TESTS_OUT): | $(RBUILD_OUT)
|
|||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
RBUILD_DEVCPP_BASE = $(RBUILD_BACKEND_BASE_)devcpp
|
||||
RBUILD_DEVCPP_BASE_ = $(RBUILD_DEVCPP_BASE)$(SEP)
|
||||
RBUILD_DEVCPP_INT = $(INTERMEDIATE_)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_INT_ = $(RBUILD_DEVCPP_INT)$(SEP)
|
||||
RBUILD_DEVCPP_OUT = $(OUTPUT_)$(RBUILD_DEVCPP_BASE)
|
||||
RBUILD_DEVCPP_OUT_ = $(RBUILD_DEVCPP_OUT)$(SEP)
|
||||
|
||||
$(RBUILD_DEVCPP_INT): | $(RBUILD_BACKEND_INT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
|
||||
ifneq ($(INTERMEDIATE),$(OUTPUT))
|
||||
$(RBUILD_DEVCPP_OUT): | $(RBUILD_BACKEND_OUT)
|
||||
$(ECHO_MKDIR)
|
||||
${mkdir} $@
|
||||
endif
|
||||
|
||||
RBUILD_CODEBLOCKS_BASE = $(RBUILD_BACKEND_BASE_)codeblocks
|
||||
RBUILD_CODEBLOCKS_BASE_ = $(RBUILD_CODEBLOCKS_BASE)$(SEP)
|
||||
RBUILD_CODEBLOCKS_INT = $(INTERMEDIATE_)$(RBUILD_CODEBLOCKS_BASE)
|
||||
|
@ -204,10 +186,6 @@ RBUILD_BACKEND_MINGW_BASE_SOURCES = $(addprefix $(RBUILD_MINGW_BASE_), \
|
|||
rule.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_BASE_SOURCES = $(addprefix $(RBUILD_DEVCPP_BASE_), \
|
||||
devcpp.cpp \
|
||||
)
|
||||
|
||||
RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES = $(addprefix $(RBUILD_CODEBLOCKS_BASE_), \
|
||||
codeblocks.cpp \
|
||||
)
|
||||
|
@ -235,7 +213,6 @@ RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
|
|||
|
||||
RBUILD_BACKEND_SOURCES = \
|
||||
$(RBUILD_BACKEND_MINGW_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_DEVCPP_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_MSVC_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES) \
|
||||
$(RBUILD_BACKEND_DEPMAP_BASE_SOURCES) \
|
||||
|
@ -276,9 +253,6 @@ RBUILD_SOURCES = \
|
|||
RBUILD_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(RBUILD_SOURCES:.cpp=.o))
|
||||
|
||||
RBUILD_BACKEND_DEVCPP_HEADERS = \
|
||||
devcpp.h
|
||||
|
||||
RBUILD_BACKEND_MSVCCPP_HEADERS = \
|
||||
msvc.h
|
||||
|
||||
|
@ -301,7 +275,6 @@ RBUILD_BACKEND_MINGW_HEADERS = \
|
|||
|
||||
RBUILD_BACKEND_HEADERS = \
|
||||
backend.h \
|
||||
$(addprefix devcpp$(SEP), $(RBUILD_BACKEND_DEVCPP_HEADERS)) \
|
||||
$(addprefix msvc$(SEP), $(RBUILD_BACKEND_MSVC_HEADERS)) \
|
||||
$(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS)) \
|
||||
$(addprefix codeblocks$(SEP), $(RBUILD_BACKEND_CODEBLOCKS_HEADERS)) \
|
||||
|
@ -496,10 +469,6 @@ $(RBUILD_MINGW_INT_)rule.o: $(RBUILD_MINGW_BASE_)rule.cpp $(RBUILD_HEADERS) | $(
|
|||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_DEVCPP_INT_)devcpp.o: $(RBUILD_DEVCPP_BASE_)devcpp.cpp $(RBUILD_HEADERS) | $(RBUILD_DEVCPP_INT)
|
||||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(RBUILD_CODEBLOCKS_INT_)codeblocks.o: $(RBUILD_CODEBLOCKS_BASE_)codeblocks.cpp $(RBUILD_HEADERS) | $(RBUILD_CODEBLOCKS_INT)
|
||||
$(ECHO_HOSTCC)
|
||||
${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
|
||||
|
|
|
@ -199,38 +199,6 @@
|
|||
<Filter
|
||||
Name="backends"
|
||||
>
|
||||
<Filter
|
||||
Name="devcpp"
|
||||
>
|
||||
<File
|
||||
RelativePath="backend\devcpp\devcpp.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="backend\devcpp\devcpp.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="msvc"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue