diff --git a/src/Common.h b/src/Common.h index 492b16b..447511b 100755 --- a/src/Common.h +++ b/src/Common.h @@ -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); diff --git a/src/ConfigFile.cpp b/src/ConfigFile.cpp index 0ffc607..d8dc51f 100755 --- a/src/ConfigFile.cpp +++ b/src/ConfigFile.cpp @@ -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; diff --git a/src/ConfigFile.h b/src/ConfigFile.h index 8c045ee..2a5788c 100755 --- a/src/ConfigFile.h +++ b/src/ConfigFile.h @@ -11,6 +11,7 @@ class ConfigFile std::vector includedirs; std::vector srcdirs; std::vector defines; + std::vector flags; std::string outputdir; std::string outputname; std::string projectname; diff --git a/src/Makefile.cpp b/src/Makefile.cpp index 6705c4b..8241f5c 100755 --- a/src/Makefile.cpp +++ b/src/Makefile.cpp @@ -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;