mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
prompt to configure for Mingw after building project files
svn path=/trunk/; revision=17468
This commit is contained in:
parent
5e348c00c1
commit
b1db227eed
1 changed files with 43 additions and 22 deletions
|
@ -26,9 +26,12 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "msvc.h"
|
#include "msvc.h"
|
||||||
|
#include "../mingw/mingw.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
char get_key(char *valid,char *prompt); //FIXME
|
||||||
|
bool spawn_new(const string& cmd); //FIXME
|
||||||
void gen_guid();
|
void gen_guid();
|
||||||
|
|
||||||
static class MSVCFactory : public Backend::Factory
|
static class MSVCFactory : public Backend::Factory
|
||||||
|
@ -53,6 +56,9 @@ MSVCBackend::MSVCBackend(Project &project,
|
||||||
|
|
||||||
void MSVCBackend::Process()
|
void MSVCBackend::Process()
|
||||||
{
|
{
|
||||||
|
bool exec = false;
|
||||||
|
const char rbuild_mingw[] = "output-i386\\tools\\rbuild\\rbuild.exe mingw";
|
||||||
|
|
||||||
string filename = ProjectNode.name + ".sln";
|
string filename = ProjectNode.name + ".sln";
|
||||||
|
|
||||||
cout << "Creating MSVC project: " << filename << endl;
|
cout << "Creating MSVC project: " << filename << endl;
|
||||||
|
@ -84,21 +90,25 @@ void MSVCBackend::Process()
|
||||||
m_devFile << " EndGlobalSection" << endl;
|
m_devFile << " EndGlobalSection" << endl;
|
||||||
m_devFile << "EndGlobal" << endl;
|
m_devFile << "EndGlobal" << endl;
|
||||||
|
|
||||||
OutputFolders();
|
|
||||||
|
|
||||||
m_devFile << endl << endl;
|
m_devFile << endl << endl;
|
||||||
|
|
||||||
OutputFileUnits();
|
|
||||||
|
|
||||||
m_devFile.close();
|
m_devFile.close();
|
||||||
|
|
||||||
|
gen_guid();
|
||||||
|
|
||||||
// The MSVC build still needs the mingw backend.
|
// The MSVC build still needs the mingw backend.
|
||||||
|
ProcessModules();
|
||||||
|
|
||||||
cout << "Done." << endl << endl;
|
cout << "Done." << endl << endl;
|
||||||
|
|
||||||
cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;
|
cout << "Don't expect the MSVC backend to work yet. "<< endl << endl;
|
||||||
|
|
||||||
gen_guid();
|
if(get_key("yn","Would you like to configure for a Mingw build as well? (y/n)") == 'y')
|
||||||
|
{
|
||||||
|
exec = spawn_new(rbuild_mingw);
|
||||||
|
if (!exec)
|
||||||
|
printf("\nError invoking rbuild\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSVCBackend::ProcessModules()
|
void MSVCBackend::ProcessModules()
|
||||||
|
@ -206,20 +216,31 @@ void MSVCBackend::OutputFolders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSVCBackend::OutputFileUnits()
|
|
||||||
{
|
|
||||||
for(size_t i = 0; i < m_fileUnits.size(); i++)
|
|
||||||
{
|
|
||||||
m_devFile << "[Unit" << i + 1 << "]" << endl;
|
|
||||||
|
|
||||||
|
char get_key(char *valid,char *prompt)
|
||||||
|
{
|
||||||
|
int ch,okay;
|
||||||
|
|
||||||
m_devFile << "FileName=" << m_fileUnits[i].filename << endl;
|
while (1) {
|
||||||
m_devFile << "CompileCpp=1" << endl;
|
if (prompt) printf("%s ",prompt);
|
||||||
m_devFile << "Folder=" << m_fileUnits[i].folder << endl;
|
fflush(stdout);
|
||||||
m_devFile << "Compile=1" << endl;
|
while (ch = getchar(), ch == ' ' || ch == '\t');
|
||||||
m_devFile << "Link=1" << endl;
|
if (ch == EOF) exit(1);
|
||||||
m_devFile << "Priority=1000" << endl;
|
if (!strchr(valid,okay = ch)) okay = 0;
|
||||||
m_devFile << "OverrideBuildCmd=0" << endl;
|
while (ch = getchar(), ch != '\n' && ch != EOF);
|
||||||
m_devFile << "BuildCmd=" << endl << endl;;
|
if (ch == EOF) exit(1);
|
||||||
|
if (okay) return okay;
|
||||||
|
printf("Invalid input.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool spawn_new( const string& cmd )
|
||||||
|
{
|
||||||
|
string command = ssprintf (
|
||||||
|
"%s",
|
||||||
|
cmd.c_str (),
|
||||||
|
NUL,
|
||||||
|
NUL );
|
||||||
|
int exitcode = system ( command.c_str () );
|
||||||
|
return (exitcode == 0);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue