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/tasks.cc | |
parent | 28531aed4d1654cdb6f590e92448bc0ba3ab755b (diff) |
Bundle flags in struct for easier passing around.
Diffstat (limited to 'src/tasks.cc')
-rw-r--r-- | src/tasks.cc | 99 |
1 files changed, 21 insertions, 78 deletions
diff --git a/src/tasks.cc b/src/tasks.cc index 8a85fc8..3bfff8b 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -24,18 +24,7 @@ const std::deque<Target>& getTargets(const Settings& settings) static std::deque<Target> targets; if(!initialised) { - // TODO: Centralize - // Resolv externals - ExternalConfigurations externalConfigs; - for(std::size_t i = 0; i < numExternalConfigFiles; ++i) - { - auto newExternalConfigs = externalConfigFiles[i].cb(); - externalConfigs.insert(externalConfigs.end(), - newExternalConfigs.begin(), - newExternalConfigs.end()); - } - - const auto& extMap = configuration().externals; + const auto& externals = configuration().externals; for(std::size_t i = 0; i < numConfigFiles; ++i) { std::string path = @@ -47,77 +36,31 @@ const std::deque<Target>& getTargets(const Settings& settings) auto configs = configFiles[i].cb(); for(auto& config : configs) { - // Resolv config externals for(const auto& external : config.externals) { - bool found{false}; - for(const auto& externalConfig : externalConfigs) - { - if(externalConfig.name == external) - { - found = true; - try - { - auto cflags = extMap.at(external+"-cflags"); - config.cflags.insert(config.cflags.end(), - cflags.begin(), - cflags.end()); - } - catch(...) - { - } - - try - { - auto cxxflags = extMap.at(external+"-cxxflags"); - config.cxxflags.insert(config.cxxflags.end(), - cxxflags.begin(), - cxxflags.end()); - } - catch(...) - { - } - - try - { - auto ldflags = extMap.at(external+"-ldflags"); - config.ldflags.insert(config.ldflags.end(), - ldflags.begin(), - ldflags.end()); - } - catch(...) - { - } - - try - { - auto asmflags = extMap.at(external+"-asmflags"); - config.asmflags.insert(config.asmflags.end(), - asmflags.begin(), - asmflags.end()); - } - catch(...) - { - } - - try - { - auto libs = extMap.at(external+"-libs"); - //config.libs.insert(config.libs.end(), - // libs.begin(), - // libs.end()); - } - catch(...) - { - } - } - } - if(!found) + if(externals.find(external) == externals.end()) { - std::cout << "External '" << external << "' not found.\n"; - exit(1); + std::cout << "External '" << external << + "' not found cache - run configure.\n"; + continue; } + const auto& flags = externals.at(external); + config.flags.cflags.insert(config.flags.cflags.end(), + flags.cflags.begin(), + flags.cflags.end()); + config.flags.cxxflags.insert(config.flags.cxxflags.end(), + flags.cxxflags.begin(), + flags.cxxflags.end()); + config.flags.ldflags.insert(config.flags.ldflags.end(), + flags.ldflags.begin(), + flags.ldflags.end()); + config.flags.asmflags.insert(config.flags.asmflags.end(), + flags.asmflags.begin(), + flags.asmflags.end()); + //config.libs.insert(config.libs.end(), + // libs.begin(), + // libs.end()); } targets.push_back({config, path}); |