logic: Added PCH support to CDB source groups (issue #311)
* added PCH Flags list and checkbox to reuse compiler flags and cdb flags to source group setup * added UI tests for C++ and CDB source groups
This commit is contained in:
@@ -21,6 +21,7 @@ void SourceGroupSettingsCxxCdb::load(std::shared_ptr<const ConfigManager> config
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCxxPchOptions::load(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
|
||||
|
||||
@@ -33,6 +34,7 @@ void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCxxPchOptions::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
|
||||
|
||||
@@ -46,6 +48,7 @@ bool SourceGroupSettingsCxxCdb::equals(std::shared_ptr<SourceGroupSettings> othe
|
||||
return (
|
||||
otherCxxCdb &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithCxxPchOptions::equals(otherCxxCdb) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherCxxCdb) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxCdb) &&
|
||||
m_compilationDatabasePath == otherCxxCdb->m_compilationDatabasePath
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_CDB_H
|
||||
|
||||
#include "SourceGroupSettingsCxx.h"
|
||||
#include "SourceGroupSettingsWithCxxPchOptions.h"
|
||||
#include "SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "FilePath.h"
|
||||
|
||||
class SourceGroupSettingsCxxCdb
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithCxxPchOptions
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithIndexedHeaderPaths
|
||||
{
|
||||
|
||||
@@ -1,24 +1,31 @@
|
||||
#include "SourceGroupSettingsWithCxxPchOptions.h"
|
||||
|
||||
#include "ProjectSettings.h"
|
||||
#include "utility.h"
|
||||
#include "utilityFile.h"
|
||||
|
||||
bool SourceGroupSettingsWithCxxPchOptions::equals(std::shared_ptr<SourceGroupSettingsWithCxxPchOptions> other) const
|
||||
{
|
||||
return (
|
||||
other &&
|
||||
m_pchInputFilePath == other->m_pchInputFilePath
|
||||
m_pchInputFilePath == other->m_pchInputFilePath &&
|
||||
utility::isPermutation(m_pchFlags, other->m_pchFlags) &&
|
||||
m_useCompilerFlags == other->m_useCompilerFlags
|
||||
);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCxxPchOptions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
|
||||
{
|
||||
setPchInputFilePathFilePath(config->getValueOrDefault(key + "/pch_input_file_path", FilePath(L"")));
|
||||
setPchFlags(config->getValuesOrDefaults(key + "/pch_flags/pch_flag", std::vector<std::wstring>()));
|
||||
setUseCompilerFlags(config->getValueOrDefault(key + "/pch_flags/use_compiler_flags", false));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCxxPchOptions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/pch_input_file_path", getPchInputFilePath().wstr());
|
||||
config->setValues(key + "/pch_flags/pch_flag", getPchFlags());
|
||||
config->setValue(key + "/pch_flags/use_compiler_flags", getUseCompilerFlags());
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsWithCxxPchOptions::getPchDependenciesDirectoryPath() const
|
||||
@@ -40,3 +47,23 @@ void SourceGroupSettingsWithCxxPchOptions::setPchInputFilePathFilePath(const Fil
|
||||
{
|
||||
m_pchInputFilePath = path;
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithCxxPchOptions::getUseCompilerFlags() const
|
||||
{
|
||||
return m_useCompilerFlags;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCxxPchOptions::setUseCompilerFlags(bool useCompilerFlags)
|
||||
{
|
||||
m_useCompilerFlags = useCompilerFlags;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsWithCxxPchOptions::getPchFlags() const
|
||||
{
|
||||
return m_pchFlags;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCxxPchOptions::setPchFlags(const std::vector<std::wstring>& pchFlags)
|
||||
{
|
||||
m_pchFlags = pchFlags;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,20 @@ public:
|
||||
FilePath getPchInputFilePathExpandedAndAbsolute() const;
|
||||
void setPchInputFilePathFilePath(const FilePath& path);
|
||||
|
||||
std::vector<std::wstring> getPchFlags() const;
|
||||
void setPchFlags(const std::vector<std::wstring>& pchFlags);
|
||||
|
||||
bool getUseCompilerFlags() const;
|
||||
void setUseCompilerFlags(bool useCompilerFlags);
|
||||
|
||||
protected:
|
||||
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
|
||||
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
|
||||
|
||||
private:
|
||||
FilePath m_pchInputFilePath;
|
||||
std::vector<std::wstring> m_pchFlags;
|
||||
bool m_useCompilerFlags = true;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H
|
||||
|
||||
Reference in New Issue
Block a user