Add support for adding linking flags
This commit is contained in:
+2
-1
@@ -18,5 +18,6 @@
|
|||||||
<projectname>MakeGen</projectname>
|
<projectname>MakeGen</projectname>
|
||||||
<srcdir>src/</srcdir>
|
<srcdir>src/</srcdir>
|
||||||
</configuration>
|
</configuration>
|
||||||
<version>v1.3.0</version>
|
<target>Release</target>
|
||||||
|
<version>v1.3.1</version>
|
||||||
</makegen>
|
</makegen>
|
||||||
|
|||||||
+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 3
|
#define MAKEGEN_VERSION_RELEASE 3
|
||||||
// Minor changes, generally bug fixes
|
// Minor changes, generally bug fixes
|
||||||
#define MAKEGEN_VERSION_MINOR 0
|
#define MAKEGEN_VERSION_MINOR 1
|
||||||
|
|
||||||
#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))
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -17,11 +17,10 @@ Generating config files
|
|||||||
|
|
||||||
Modifying config settings
|
Modifying config settings
|
||||||
add Add values to config settings which support multiple arguments
|
add Add values to config settings which support multiple arguments
|
||||||
remove Remove values to config settings which support multiple
|
remove Remove values from config settings which support multiple
|
||||||
arguments
|
arguments
|
||||||
set Set value to config settings which support only one argument
|
set Set value to config settings which support only one argument
|
||||||
|
|
||||||
|
|
||||||
Querying config settings
|
Querying config settings
|
||||||
get Get value of the config setting)");
|
get Get value of the config setting)");
|
||||||
}
|
}
|
||||||
@@ -52,7 +51,8 @@ Valid settings are:
|
|||||||
librarydir Library directory
|
librarydir Library directory
|
||||||
includedir Include directory
|
includedir Include directory
|
||||||
define Preprocessor define
|
define Preprocessor define
|
||||||
cflag g++ compiler flags
|
cflag g++ compiler flag
|
||||||
|
lflag g++ linking flag
|
||||||
dependency Project which current project depends on)");
|
dependency Project which current project depends on)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,8 @@ Valid settings are
|
|||||||
librarydir Library directory
|
librarydir Library directory
|
||||||
includedir Include directory
|
includedir Include directory
|
||||||
define Preprocessor define
|
define Preprocessor define
|
||||||
cflag g++ compiler flags
|
cflag g++ compiler flag
|
||||||
|
lflag g++ linking flag
|
||||||
dependency Project which current project depends on)");
|
dependency Project which current project depends on)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +106,8 @@ Valid settings are:
|
|||||||
librarydir Library directory
|
librarydir Library directory
|
||||||
includedir Include directory
|
includedir Include directory
|
||||||
define Preprocessor define
|
define Preprocessor define
|
||||||
cflag g++ compiler flags
|
cflag g++ compiler flag
|
||||||
|
lflag g++ linking flag
|
||||||
dependency Project which current project depends on
|
dependency Project which current project depends on
|
||||||
outputdir Directory of the compiled output
|
outputdir Directory of the compiled output
|
||||||
outputname Name of the output executable/library
|
outputname Name of the output executable/library
|
||||||
@@ -131,6 +133,7 @@ ConfigSetting ConfigCLI::CLIStringToSetting(const std::string& s)
|
|||||||
{"includedir", ConfigSetting::IncludeDir},
|
{"includedir", ConfigSetting::IncludeDir},
|
||||||
{"define", ConfigSetting::Define},
|
{"define", ConfigSetting::Define},
|
||||||
{"cflag", ConfigSetting::CFlag},
|
{"cflag", ConfigSetting::CFlag},
|
||||||
|
{"lflag", ConfigSetting::LFlag},
|
||||||
{"dependency", ConfigSetting::Dependency},
|
{"dependency", ConfigSetting::Dependency},
|
||||||
{"genhfile", ConfigSetting::GenerateHFile},
|
{"genhfile", ConfigSetting::GenerateHFile},
|
||||||
};
|
};
|
||||||
|
|||||||
+7
-2
@@ -18,7 +18,7 @@ struct ConfigCache
|
|||||||
enum class ConfigSetting
|
enum class ConfigSetting
|
||||||
{
|
{
|
||||||
// vectors
|
// vectors
|
||||||
Library = 0, LibraryDir = 1, IncludeDir = 2, Define = 3, CFlag = 4, Dependency = 5,
|
Library = 0, LibraryDir = 1, IncludeDir = 2, Define = 3, Dependency = 4, CFlag = 5, LFlag = 6,
|
||||||
// Strings
|
// Strings
|
||||||
SourceDir = 32, OutputDir = 33, OutputName = 34, OutputType = 35, ProjectName = 36, HFileName = 37,
|
SourceDir = 32, OutputDir = 33, OutputName = 34, OutputType = 35, ProjectName = 36, HFileName = 37,
|
||||||
// Bools
|
// Bools
|
||||||
@@ -57,6 +57,8 @@ struct ConfigUtils
|
|||||||
return "define";
|
return "define";
|
||||||
case ConfigSetting::CFlag:
|
case ConfigSetting::CFlag:
|
||||||
return "cflag";
|
return "cflag";
|
||||||
|
case ConfigSetting::LFlag:
|
||||||
|
return "lflag";
|
||||||
case ConfigSetting::GenerateHFile:
|
case ConfigSetting::GenerateHFile:
|
||||||
return "generatehfile";
|
return "generatehfile";
|
||||||
case ConfigSetting::Invalid:
|
case ConfigSetting::Invalid:
|
||||||
@@ -66,7 +68,6 @@ struct ConfigUtils
|
|||||||
|
|
||||||
static bool IsDirectory(ConfigSetting setting)
|
static bool IsDirectory(ConfigSetting setting)
|
||||||
{
|
{
|
||||||
// Library, LibraryDir, IncludeDir, Define, CFlag, Dependency,
|
|
||||||
switch(setting)
|
switch(setting)
|
||||||
{
|
{
|
||||||
case ConfigSetting::SourceDir:
|
case ConfigSetting::SourceDir:
|
||||||
@@ -82,6 +83,7 @@ struct ConfigUtils
|
|||||||
case ConfigSetting::Library:
|
case ConfigSetting::Library:
|
||||||
case ConfigSetting::Define:
|
case ConfigSetting::Define:
|
||||||
case ConfigSetting::CFlag:
|
case ConfigSetting::CFlag:
|
||||||
|
case ConfigSetting::LFlag:
|
||||||
case ConfigSetting::GenerateHFile:
|
case ConfigSetting::GenerateHFile:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
@@ -107,6 +109,7 @@ struct ConfigUtils
|
|||||||
case ConfigSetting::Library:
|
case ConfigSetting::Library:
|
||||||
case ConfigSetting::Define:
|
case ConfigSetting::Define:
|
||||||
case ConfigSetting::CFlag:
|
case ConfigSetting::CFlag:
|
||||||
|
case ConfigSetting::LFlag:
|
||||||
case ConfigSetting::GenerateHFile:
|
case ConfigSetting::GenerateHFile:
|
||||||
case ConfigSetting::Invalid:
|
case ConfigSetting::Invalid:
|
||||||
return false;
|
return false;
|
||||||
@@ -123,6 +126,7 @@ struct ConfigUtils
|
|||||||
case ConfigSetting::Library:
|
case ConfigSetting::Library:
|
||||||
case ConfigSetting::Define:
|
case ConfigSetting::Define:
|
||||||
case ConfigSetting::CFlag:
|
case ConfigSetting::CFlag:
|
||||||
|
case ConfigSetting::LFlag:
|
||||||
return true;
|
return true;
|
||||||
case ConfigSetting::SourceDir:
|
case ConfigSetting::SourceDir:
|
||||||
case ConfigSetting::OutputDir:
|
case ConfigSetting::OutputDir:
|
||||||
@@ -153,6 +157,7 @@ struct ConfigUtils
|
|||||||
case ConfigSetting::Library:
|
case ConfigSetting::Library:
|
||||||
case ConfigSetting::Define:
|
case ConfigSetting::Define:
|
||||||
case ConfigSetting::CFlag:
|
case ConfigSetting::CFlag:
|
||||||
|
case ConfigSetting::LFlag:
|
||||||
case ConfigSetting::Invalid:
|
case ConfigSetting::Invalid:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,12 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
|
|||||||
outputFile << "-L./" << *it << " ";
|
outputFile << "-L./" << *it << " ";
|
||||||
}
|
}
|
||||||
outputFile << std::endl;
|
outputFile << std::endl;
|
||||||
|
std::vector<std::string>& lflags = conf.GetSettingVectorString(ConfigSetting::LFlag);
|
||||||
outputFile << "LDFLAGS=";
|
outputFile << "LDFLAGS=";
|
||||||
|
for(auto it = lflags.begin(); it != lflags.end(); ++it)
|
||||||
|
{
|
||||||
|
outputFile << *it << " ";
|
||||||
|
}
|
||||||
for(auto it = libdirs.begin(); it != libdirs.end(); ++it)
|
for(auto it = libdirs.begin(); it != libdirs.end(); ++it)
|
||||||
{
|
{
|
||||||
outputFile << "-Wl,-rpath=" << *it << " ";
|
outputFile << "-Wl,-rpath=" << *it << " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user