Add #compileflags as an option to makegen.conf
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
// Release , should be backwards compatible with any minor version
|
// Release , should be backwards compatible with any minor version
|
||||||
#define MAKEGEN_VERSION_RELEASE 0
|
#define MAKEGEN_VERSION_RELEASE 0
|
||||||
// Minor changes, should be compatible with any other minor version with same major and release.
|
// 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))
|
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
||||||
|
|
||||||
const static unsigned int FLAG_HELP = BIT(0);
|
const static unsigned int FLAG_HELP = BIT(0);
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ ConfigFile ConfigFile::Load()
|
|||||||
vec = &conf.includedirs;
|
vec = &conf.includedirs;
|
||||||
loadFlag = FLAG_VECTOR;
|
loadFlag = FLAG_VECTOR;
|
||||||
}
|
}
|
||||||
|
else if(line == "#compileflags")
|
||||||
|
{
|
||||||
|
vec = &conf.flags;
|
||||||
|
loadFlag = FLAG_VECTOR;
|
||||||
|
}
|
||||||
else if(line == "#srcdirs")
|
else if(line == "#srcdirs")
|
||||||
{
|
{
|
||||||
vec = &conf.srcdirs;
|
vec = &conf.srcdirs;
|
||||||
@@ -155,6 +160,7 @@ ConfigFile ConfigFile::Gen()
|
|||||||
InputMultiple("Enter include directory:", conf.includedirs,true);
|
InputMultiple("Enter include directory:", conf.includedirs,true);
|
||||||
InputMultiple("Enter source directories:", conf.srcdirs,true);
|
InputMultiple("Enter source directories:", conf.srcdirs,true);
|
||||||
InputMultiple("Enter preprocessor definitions:", conf.defines,false);
|
InputMultiple("Enter preprocessor definitions:", conf.defines,false);
|
||||||
|
InputMultiple("Enter compile flags:", conf.flags,false);
|
||||||
LOG_INFO("Enter output directory (default: bin):");
|
LOG_INFO("Enter output directory (default: bin):");
|
||||||
std::getline(std::cin, conf.outputdir);
|
std::getline(std::cin, conf.outputdir);
|
||||||
if(conf.outputdir == "")
|
if(conf.outputdir == "")
|
||||||
@@ -201,6 +207,11 @@ void ConfigFile::Save() const
|
|||||||
{
|
{
|
||||||
file << *it << std::endl;
|
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 << outputdir << std::endl;
|
file << outputdir << std::endl;
|
||||||
file << "#projectname" << std::endl;
|
file << "#projectname" << std::endl;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class ConfigFile
|
|||||||
std::vector<std::string> includedirs;
|
std::vector<std::string> includedirs;
|
||||||
std::vector<std::string> srcdirs;
|
std::vector<std::string> srcdirs;
|
||||||
std::vector<std::string> defines;
|
std::vector<std::string> defines;
|
||||||
|
std::vector<std::string> flags;
|
||||||
std::string outputdir;
|
std::string outputdir;
|
||||||
std::string outputname;
|
std::string outputname;
|
||||||
std::string projectname;
|
std::string projectname;
|
||||||
|
|||||||
+7
-1
@@ -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 << "# 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 << "# 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 << "# https://github.com/Thraix/MakeGen" << std::endl;
|
||||||
outputFile << "CC=@g++" << std::endl;
|
outputFile << "CC=@g++ $(CFLAGS)" << std::endl;
|
||||||
if(!conf.executable)
|
if(!conf.executable)
|
||||||
{
|
{
|
||||||
if(conf.shared)
|
if(conf.shared)
|
||||||
@@ -53,6 +53,12 @@ void Makefile::Save(const ConfigFile& conf)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
outputFile << "CO=@g++ -o" << std::endl;
|
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 << "BIN=" << conf.outputdir << std::endl;
|
||||||
outputFile << "OBJPATH=$(BIN)intermediates" << std::endl;
|
outputFile << "OBJPATH=$(BIN)intermediates" << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user