Skip to content

Commit

Permalink
just use the string
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Dec 16, 2024
1 parent efb1016 commit 25874a7
Showing 1 changed file with 4 additions and 46 deletions.
50 changes: 4 additions & 46 deletions Sofa/framework/Helper/src/sofa/helper/system/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,56 +43,14 @@ using sofa::helper::system::FileSystem;
#ifdef SOFA_BUILD_CONFIGURATION
constexpr std::string_view SOFA_BUILD_CONFIGURATION_STR = sofa_tostring(SOFA_BUILD_CONFIGURATION);
#else
constexpr string_view SOFA_BUILD_CONFIGURATION_STR = "NONE";
constexpr std::string_view SOFA_BUILD_CONFIGURATION_STR = "NONE";
#endif
#ifdef SOFA_BUILD_MULTI_CONFIGURATION
constexpr std::string_view SOFA_BUILD_MULTI_CONFIGURATION_STR = sofa_tostring(SOFA_BUILD_MULTI_CONFIGURATION);
#else
constexpr string_view SOFA_BUILD_MULTI_CONFIGURATION_STR = "0";
#endif

enum class SofaBuildConfiguration
{
Release,
RelWithDebInfo,
Debug,
MinSizeRel,
NonStandard
};

constexpr SofaBuildConfiguration getSofaBuildConfiguration()
{
if constexpr (SOFA_BUILD_CONFIGURATION_STR == "Release")
{
return SofaBuildConfiguration::Release;
}
if constexpr (SOFA_BUILD_CONFIGURATION_STR == "RelWithDebInfo")
{
return SofaBuildConfiguration::RelWithDebInfo;
}
if constexpr (SOFA_BUILD_CONFIGURATION_STR == "Debug")
{
return SofaBuildConfiguration::Debug;
}
if constexpr (SOFA_BUILD_CONFIGURATION_STR == "MinSizeRel")
{
return SofaBuildConfiguration::MinSizeRel;
}

return SofaBuildConfiguration::NonStandard;
}

constexpr bool getSofaMultiConfiguration()
constexpr std::string_view GetSofaBuildConfigurationString()
{
if constexpr (SOFA_BUILD_MULTI_CONFIGURATION_STR == "1")
{
return true;
}

return false;
return SOFA_BUILD_CONFIGURATION_STR;
}


namespace sofa::helper::system
{

Expand Down Expand Up @@ -533,7 +491,7 @@ std::string PluginManager::findPlugin(const std::string& pluginName, const std::
const std::array paths =
{
dir, // Non-Multi-Config build, install
FileSystem::append(dir, SOFA_BUILD_CONFIGURATION_STR) // Multi-Config build
FileSystem::append(dir, GetSofaBuildConfigurationString()) // Multi-Config build
};

for (const auto & path : paths)
Expand Down

0 comments on commit 25874a7

Please sign in to comment.