Add #compileflags as an option to makegen.conf

This commit is contained in:
Thraix
2019-01-09 21:22:25 +01:00
parent 6a6b9aa9e4
commit ab3f4dfaaa
4 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
// Release , should be backwards compatible with any minor version
#define MAKEGEN_VERSION_RELEASE 0
// Minor changes, should be compatible with any other minor version with same major and release.
#define MAKEGEN_VERSION_MINOR 6
#define MAKEGEN_VERSION_MINOR 7
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
const static unsigned int FLAG_HELP = BIT(0);
+11
View File
@@ -44,6 +44,11 @@ ConfigFile ConfigFile::Load()
vec = &conf.includedirs;
loadFlag = FLAG_VECTOR;
}
else if(line == "#compileflags")
{
vec = &conf.flags;
loadFlag = FLAG_VECTOR;
}
else if(line == "#srcdirs")
{
vec = &conf.srcdirs;
@@ -155,6 +160,7 @@ ConfigFile ConfigFile::Gen()
InputMultiple("Enter include directory:", conf.includedirs,true);
InputMultiple("Enter source directories:", conf.srcdirs,true);
InputMultiple("Enter preprocessor definitions:", conf.defines,false);
InputMultiple("Enter compile flags:", conf.flags,false);
LOG_INFO("Enter output directory (default: bin):");
std::getline(std::cin, conf.outputdir);
if(conf.outputdir == "")
@@ -201,6 +207,11 @@ void ConfigFile::Save() const
{
file << *it << std::endl;
}
file << "#compileflags" << std::endl;
for(auto it = flags.begin();it!=flags.end();++it)
{
file << *it << std::endl;
}
file << "#outputdir" << std::endl;
file << outputdir << std::endl;
file << "#projectname" << std::endl;
+1
View File
@@ -11,6 +11,7 @@ class ConfigFile
std::vector<std::string> includedirs;
std::vector<std::string> srcdirs;
std::vector<std::string> defines;
std::vector<std::string> flags;
std::string outputdir;
std::string outputname;
std::string projectname;
+7 -1
View File
@@ -43,7 +43,7 @@ void Makefile::Save(const ConfigFile& conf)
outputFile << "# This Makefile was generated using MakeGen "<< MAKEGEN_VERSION<< " made by Tim Håkansson" << std::endl;
outputFile << "# and is licensed under MIT. Full source of the project can be found at" << std::endl;
outputFile << "# https://github.com/Thraix/MakeGen" << std::endl;
outputFile << "CC=@g++" << std::endl;
outputFile << "CC=@g++ $(CFLAGS)" << std::endl;
if(!conf.executable)
{
if(conf.shared)
@@ -53,6 +53,12 @@ void Makefile::Save(const ConfigFile& conf)
}
else
outputFile << "CO=@g++ -o" << std::endl;
outputFile << "CFLAGS=";
for(auto it = conf.flags.begin();it!=conf.flags.end();++it)
{
outputFile << *it << " ";
}
outputFile << std::endl;
outputFile << "BIN=" << conf.outputdir << std::endl;
outputFile << "OBJPATH=$(BIN)intermediates" << std::endl;