diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-11-21 11:13:28 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-11-21 13:26:29 +0100 |
commit | a7869c0bd65faacdd008284df9ab07de7df3d445 (patch) | |
tree | 8d83ab0b23cd504ddf5c5eeddf5a322fd81db3ed /src/configure.cc | |
parent | 28531aed4d1654cdb6f590e92448bc0ba3ab755b (diff) |
Bundle flags in struct for easier passing around.
Diffstat (limited to 'src/configure.cc')
-rw-r--r-- | src/configure.cc | 64 |
1 files changed, 23 insertions, 41 deletions
diff --git a/src/configure.cc b/src/configure.cc index 98f68d7..cc963f8 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -325,7 +325,6 @@ int regenerateCache(const Settings& default_settings, std::string build_ar = locate(build_arch, ar_prog); std::string build_ld = locate(build_arch, ld_prog); - // TODO: Centralize // Resolv externals ExternalConfigurations externalConfigs; for(std::size_t i = 0; i < numExternalConfigFiles; ++i) @@ -379,69 +378,52 @@ int regenerateCache(const Settings& default_settings, } istr << " },\n"; - istr << " .externals = {\n"; + istr << " .externals = {\n"; for(const auto& externalConfig : externalConfigs) { - if(!externalConfig.cflags.empty()) - { - istr << " { \"" << externalConfig.name << "-cflags\",\n"; - istr << " {\n"; - for(const auto& cflag : externalConfig.cflags) - { - istr << " \"" << cflag << "\",\n"; - } - istr << " },\n"; - istr << " },\n"; - } + istr << " { \"" << externalConfig.name << "\", {\n"; - if(!externalConfig.cxxflags.empty()) + if(!externalConfig.flags.cxxflags.empty()) { - istr << " { \"" << externalConfig.name << "-cxxflags\",\n"; - istr << " {\n"; - for(const auto& cxxflag : externalConfig.cxxflags) + istr << " .cxxflags = {"; + for(const auto& flag : externalConfig.flags.cxxflags) { - istr << " \"" << cxxflag << "\",\n"; + istr << "\"" << flag << "\","; } - istr << " },\n"; - istr << " },\n"; + istr << "},\n"; } - if(!externalConfig.ldflags.empty()) + if(!externalConfig.flags.cflags.empty()) { - istr << " { \"" << externalConfig.name << "-ldflags\",\n"; - istr << " {\n"; - for(const auto& ldflag : externalConfig.ldflags) + istr << " .cflags = {"; + for(const auto& flag : externalConfig.flags.cflags) { - istr << " \"" << ldflag << "\",\n"; + istr << "\"" << flag << "\","; } - istr << " },\n"; - istr << " },\n"; + istr << "},\n"; } - if(!externalConfig.libs.empty()) + if(!externalConfig.flags.ldflags.empty()) { - istr << " { \"" << externalConfig.name << "-libs\",\n"; - istr << " {\n"; - for(const auto& lib : externalConfig.libs) + istr << " .ldflags = {"; + for(const auto& flag : externalConfig.flags.ldflags) { - istr << " \"" << lib << "\",\n"; + istr << "\"" << flag << "\","; } - istr << " },\n"; - istr << " },\n"; + istr << "},\n"; } - if(!externalConfig.asmflags.empty()) + if(!externalConfig.flags.asmflags.empty()) { - istr << " { \"" << externalConfig.name << "-asmflags\",\n"; - istr << " {\n"; - for(const auto& asmflag : externalConfig.asmflags) + istr << " .asmflags = {"; + for(const auto& flag : externalConfig.flags.asmflags) { - istr << " \"" << asmflag << "\",\n"; + istr << "\"" << flag << "\","; } - istr << " },\n"; - istr << " },\n"; + istr << "},\n"; } + istr << " }},\n"; } istr << " },\n"; |