Add arguments and prearguments to executable file
This commit is contained in:
+1
-1
@@ -8,9 +8,9 @@
|
||||
<srcdir>src/</srcdir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<define>_DEBUG</define>
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/</outputdir>
|
||||
<outputname>makegen</outputname>
|
||||
|
||||
+10
-2
@@ -55,7 +55,9 @@ Valid settings are:
|
||||
lflag g++ linking flag
|
||||
dependency Project which current project depends on
|
||||
excludesource Exclude source file from compiling
|
||||
excludeheader Exclude header file from project h-file)");
|
||||
excludeheader Exclude header file from project h-file
|
||||
argument Command line argument for the executable
|
||||
preargument Command line argument before the executabe, e.g. gdb)");
|
||||
}
|
||||
|
||||
void ConfigCLI::DisplayRemoveHelp()
|
||||
@@ -74,7 +76,9 @@ Valid settings are
|
||||
lflag g++ linking flag
|
||||
dependency Project which current project depends on
|
||||
excludesource Exclude source file from compiling
|
||||
excludeheader Exclude header file from project h-file)");
|
||||
excludeheader Exclude header file from project h-file
|
||||
argument Command line argument for the executable
|
||||
preargument Command line argument before the executabe, e.g. gdb)");
|
||||
}
|
||||
|
||||
void ConfigCLI::DisplaySetHelp()
|
||||
@@ -115,6 +119,8 @@ Valid settings are:
|
||||
dependency Project which current project depends on
|
||||
excludesource Exclude source file from compiling
|
||||
excludeheader Exclude header file from project h-file
|
||||
argument Command line argument for the executable
|
||||
preargument Command line argument before the executabe, e.g. gdb
|
||||
outputdir Directory of the compiled output
|
||||
outputname Name of the output executable/library
|
||||
outputtype Type of the output, valid values are executable, sharedlibrary
|
||||
@@ -142,6 +148,8 @@ ConfigSetting ConfigCLI::CLIStringToSetting(const std::string& s)
|
||||
{"lflag", ConfigSetting::LFlag},
|
||||
{"excludesource", ConfigSetting::ExcludeSource},
|
||||
{"excludeheader", ConfigSetting::ExcludeHeader},
|
||||
{"preargument", ConfigSetting::ExecPreArgument},
|
||||
{"argument", ConfigSetting::ExecArgument},
|
||||
{"dependency", ConfigSetting::Dependency},
|
||||
{"genhfile", ConfigSetting::GenerateHFile},
|
||||
};
|
||||
|
||||
+16
-4
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "FileUtils.h"
|
||||
#include "Common.h"
|
||||
#include "FileUtils.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <map>
|
||||
@@ -18,13 +18,13 @@ struct ConfigCache
|
||||
enum class ConfigSetting
|
||||
{
|
||||
// vectors
|
||||
Library = 0, LibraryDir = 1, IncludeDir = 2, Define = 3, Dependency = 4, CFlag = 5, LFlag = 6, ExcludeSource = 7, ExcludeHeader = 8,
|
||||
Library = 0, LibraryDir = 1, IncludeDir = 2, Define = 3, Dependency = 4, CFlag = 5, LFlag = 6, ExcludeSource = 7, ExcludeHeader = 8, ExecPreArgument = 9, ExecArgument = 10,
|
||||
// Strings
|
||||
SourceDir = 32, OutputDir = 33, OutputName = 34, OutputType = 35, ProjectName = 36, HFileName = 37,
|
||||
// Bools
|
||||
GenerateHFile = 64,
|
||||
// Other
|
||||
Invalid = 1024
|
||||
Invalid = 1024
|
||||
};
|
||||
|
||||
struct ConfigUtils
|
||||
@@ -63,6 +63,10 @@ struct ConfigUtils
|
||||
return "excludesource";
|
||||
case ConfigSetting::ExcludeHeader:
|
||||
return "excludeheader";
|
||||
case ConfigSetting::ExecPreArgument:
|
||||
return "preargument";
|
||||
case ConfigSetting::ExecArgument:
|
||||
return "argument";
|
||||
case ConfigSetting::GenerateHFile:
|
||||
return "generatehfile";
|
||||
case ConfigSetting::Invalid:
|
||||
@@ -90,6 +94,8 @@ struct ConfigUtils
|
||||
case ConfigSetting::LFlag:
|
||||
case ConfigSetting::ExcludeSource:
|
||||
case ConfigSetting::ExcludeHeader:
|
||||
case ConfigSetting::ExecPreArgument:
|
||||
case ConfigSetting::ExecArgument:
|
||||
case ConfigSetting::GenerateHFile:
|
||||
return false;
|
||||
default:
|
||||
@@ -118,6 +124,8 @@ struct ConfigUtils
|
||||
case ConfigSetting::LFlag:
|
||||
case ConfigSetting::ExcludeHeader:
|
||||
case ConfigSetting::ExcludeSource:
|
||||
case ConfigSetting::ExecPreArgument:
|
||||
case ConfigSetting::ExecArgument:
|
||||
case ConfigSetting::GenerateHFile:
|
||||
case ConfigSetting::Invalid:
|
||||
return false;
|
||||
@@ -137,6 +145,8 @@ struct ConfigUtils
|
||||
case ConfigSetting::LFlag:
|
||||
case ConfigSetting::ExcludeHeader:
|
||||
case ConfigSetting::ExcludeSource:
|
||||
case ConfigSetting::ExecPreArgument:
|
||||
case ConfigSetting::ExecArgument:
|
||||
return true;
|
||||
case ConfigSetting::SourceDir:
|
||||
case ConfigSetting::OutputDir:
|
||||
@@ -170,6 +180,8 @@ struct ConfigUtils
|
||||
case ConfigSetting::LFlag:
|
||||
case ConfigSetting::ExcludeHeader:
|
||||
case ConfigSetting::ExcludeSource:
|
||||
case ConfigSetting::ExecPreArgument:
|
||||
case ConfigSetting::ExecArgument:
|
||||
case ConfigSetting::Invalid:
|
||||
return false;
|
||||
}
|
||||
|
||||
+10
-1
@@ -128,7 +128,16 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
|
||||
outputFile << "run: all" << std::endl;
|
||||
if(outputtype == "executable")
|
||||
{
|
||||
outputFile << "\t@./$(OUTPUT)" << std::endl;
|
||||
std::vector<std::string>& prearguments = conf.GetSettingVectorString(ConfigSetting::ExecPreArgument);
|
||||
std::vector<std::string>& arguments = conf.GetSettingVectorString(ConfigSetting::ExecArgument);
|
||||
|
||||
outputFile << "\t@";
|
||||
for(auto&& preargument : prearguments)
|
||||
outputFile << preargument << " ";
|
||||
outputFile << "./$(OUTPUT)";
|
||||
for(auto&& argument : arguments)
|
||||
outputFile << " " << argument;
|
||||
outputFile << std::endl;
|
||||
}
|
||||
|
||||
// Rebuild
|
||||
|
||||
+1
-1
@@ -15,8 +15,8 @@
|
||||
|
||||
void PrintHelp()
|
||||
{
|
||||
LOG_INFO("MakeGen ", MAKEGEN_VERSION);
|
||||
LOG_INFO(1+(char*)R"(
|
||||
MakeGen ", MAKEGEN_VERSIO
|
||||
|
||||
MakeGen is a utility tool to generate and run Makefiles in a simple manner.
|
||||
By default it always compiles code with parallell jobs.
|
||||
|
||||
Reference in New Issue
Block a user