|
|
@@ -159,6 +159,24 @@ static bool compileAndLink( |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
static std::string findTargetName( |
|
|
|
const BBParser::Variables &vars, |
|
|
|
const std::vector<SourceFile> &sources) { |
|
|
|
auto it = vars.find("target"); |
|
|
|
if (it != vars.end() && it->second.size() != 0) { |
|
|
|
return it->second[0]; |
|
|
|
} |
|
|
|
|
|
|
|
for (auto &source: sources) { |
|
|
|
const std::vector<std::string> *ptr = source.variable("target"); |
|
|
|
if (ptr != nullptr && ptr->size() != 0) { |
|
|
|
return (*ptr)[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return "target"; |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char **argv) { |
|
|
|
logger::LogContext logCtx = logger::init(); |
|
|
|
|
|
|
@@ -268,16 +286,6 @@ int main(int argc, char **argv) { |
|
|
|
parser.parse(variables); |
|
|
|
} |
|
|
|
|
|
|
|
// Find target |
|
|
|
if (target.size() == 0) { |
|
|
|
auto it = variables.find("target"); |
|
|
|
if (it == variables.end() || it->second.size() == 0) { |
|
|
|
target = "target"; |
|
|
|
} else { |
|
|
|
target = it->second[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Find source dirs |
|
|
|
std::vector<std::string> sourceDirs; |
|
|
|
{ |
|
|
@@ -295,6 +303,11 @@ int main(int argc, char **argv) { |
|
|
|
findSources(".", dir, sources, variables); |
|
|
|
} |
|
|
|
|
|
|
|
// Find target name |
|
|
|
if (target.size() == 0) { |
|
|
|
target = findTargetName(variables, sources); |
|
|
|
} |
|
|
|
|
|
|
|
switch (action) { |
|
|
|
case Action::BUILD: |
|
|
|
// TODO: Support more types than BINARY |