Skip to content

Commit

Permalink
fix(conan) : fix conan option prefixed by dependency in conan v2
Browse files Browse the repository at this point in the history
update version t 1.10.1
  • Loading branch information
Stéphane Leduc committed Oct 7, 2024
1 parent 179e737 commit 0047018
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion remaken.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TARGET = remaken
VERSION=1.10.0
VERSION=1.10.1

CONFIG += c++1z
CONFIG += console
Expand Down
32 changes: 23 additions & 9 deletions src/tools/ConanSystemTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ void ConanSystemTool::install(const Dependency & dependency)
std::string conanOptionPrefix = optionInfos.front();
optionInfos.erase(optionInfos.begin());
if (optionInfos.empty()) {
optionsArgs.push_back("-o " + option);
if (m_conanVersion >= 2) {
optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option);
}
else
{
optionsArgs.push_back("-o " + option); // conan v1
}
} else {
if (conanOptionPrefix.find(separator) != std::string::npos) {
optionsArgs.push_back("-o " + conanOptionPrefix + ":" + optionInfos.front());
Expand Down Expand Up @@ -226,11 +232,16 @@ void ConanSystemTool::install(const Dependency & dependency)
result = bp::system(command.c_str());
}
else {
std::string buildMode = "shared=True";
std::string buildMode = "";
if (m_conanVersion >= 2) {
buildMode = dependency.getName() + "/*:";
}
if (dependency.getMode() == "static") {
buildMode = "shared=False";
buildMode += "shared=False";
}
else {
buildMode += "shared=True";
}

std::string command = m_systemInstallerPath.generic_string(utf8) + " install " + "-o " + buildMode + " " + boost::algorithm::join(settingsArgs, " ") + " -s " + buildType + " -s " + cppStd + " -pr " + profileName + " " + buildForceDep + " " + boost::algorithm::join(optionsArgs, " ") + " " + source;
if (m_options.getVerbose()) {
std::cout << command.c_str() << std::endl;
Expand Down Expand Up @@ -690,7 +701,12 @@ std::vector<fs::path> ConanSystemTool::retrievePaths(const Dependency & dependen
if (dependency.hasOptions()) {
boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';});
for (const auto & option: options) {
optionsArgs.push_back("-o " + option);
if (m_conanVersion >= 2) {
optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option);
}
else {
optionsArgs.push_back("-o " + option);
}
}
}
std::string profileName = m_options.getConanProfile();
Expand All @@ -717,7 +733,7 @@ std::vector<fs::path> ConanSystemTool::retrievePaths(const Dependency & dependen
}
}
else {
std::string buildMode = "";//dependency.getName() + ":";
std::string buildMode = "";
if (dependency.getMode() == "static") {
buildMode += "shared=False";
}
Expand Down Expand Up @@ -769,11 +785,10 @@ std::vector<fs::path> ConanSystemTool::retrievePaths(const Dependency & dependen
if (m_options.getVerbose()) {
std::cout << command.c_str() << std::endl;
}
// SLETODO : issue with : bp::std_out > bp::null => use std::system (ok with it)
result = std::system(command.c_str());
}
else {
std::string buildMode = "";//dependency.getName() + ":";
std::string buildMode = dependency.getName() + "/*:";
if (dependency.getMode() == "static") {
buildMode += "shared=False";
}
Expand All @@ -787,7 +802,6 @@ std::vector<fs::path> ConanSystemTool::retrievePaths(const Dependency & dependen
if (m_options.getVerbose()) {
std::cout << command.c_str() << std::endl;
}
// SLETODO : issue with redirect : bp::std_out > bp::null => use std::system (ok with it)
result = std::system(command.c_str());
}
if (result != 0) {
Expand Down

0 comments on commit 0047018

Please sign in to comment.