summaryrefslogtreecommitdiff
path: root/src/tasks.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-11-14 18:06:58 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2021-11-20 19:05:09 +0100
commit0159b72dbf048b0aa7d7b9ae85715205cb801e50 (patch)
tree74c1f613cc768c962a621c377ac1d59e40280a67 /src/tasks.cc
parent3c29644d3bc8c4daad68ab92003a9e754f39de2a (diff)
Evaluate externals in configure step end read from config map during compilation.
Diffstat (limited to 'src/tasks.cc')
-rw-r--r--src/tasks.cc77
1 files changed, 59 insertions, 18 deletions
diff --git a/src/tasks.cc b/src/tasks.cc
index 8efc98e..8a85fc8 100644
--- a/src/tasks.cc
+++ b/src/tasks.cc
@@ -16,6 +16,7 @@
#include "task_ar.h"
#include "task_so.h"
#include "rebuild.h"
+#include "configure.h"
const std::deque<Target>& getTargets(const Settings& settings)
{
@@ -23,9 +24,9 @@ const std::deque<Target>& getTargets(const Settings& settings)
static std::deque<Target> targets;
if(!initialised)
{
-
- // Generate externals
- std::vector<ExternalConfiguration> externalConfigs;
+ // TODO: Centralize
+ // Resolv externals
+ ExternalConfigurations externalConfigs;
for(std::size_t i = 0; i < numExternalConfigFiles; ++i)
{
auto newExternalConfigs = externalConfigFiles[i].cb();
@@ -34,6 +35,7 @@ const std::deque<Target>& getTargets(const Settings& settings)
newExternalConfigs.end());
}
+ const auto& extMap = configuration().externals;
for(std::size_t i = 0; i < numConfigFiles; ++i)
{
std::string path =
@@ -46,7 +48,6 @@ const std::deque<Target>& getTargets(const Settings& settings)
for(auto& config : configs)
{
-
// Resolv config externals
for(const auto& external : config.externals)
{
@@ -56,18 +57,60 @@ const std::deque<Target>& getTargets(const Settings& settings)
if(externalConfig.name == external)
{
found = true;
- config.cflags.insert(config.cflags.end(),
- externalConfig.cflags.begin(),
- externalConfig.cflags.end());
- config.cxxflags.insert(config.cxxflags.end(),
- externalConfig.cxxflags.begin(),
- externalConfig.cxxflags.end());
- config.ldflags.insert(config.ldflags.end(),
- externalConfig.ldflags.begin(),
- externalConfig.ldflags.end());
- config.asmflags.insert(config.asmflags.end(),
- externalConfig.asmflags.begin(),
- externalConfig.asmflags.end());
+ 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)
@@ -75,10 +118,8 @@ const std::deque<Target>& getTargets(const Settings& settings)
std::cout << "External '" << external << "' not found.\n";
exit(1);
}
-
}
-
targets.push_back({config, path});
}
}