Skip to content

Commit

Permalink
remove deprecated cmake statement
Browse files Browse the repository at this point in the history
  • Loading branch information
fredroy committed Dec 27, 2024
1 parent d49613d commit c1abfc6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
5 changes: 0 additions & 5 deletions Sofa/framework/Helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
if((CMAKE_SYSTEM_NAME STREQUAL Windows) AND SOFA_USE_DEPENDENCY_PACK)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "$<INSTALL_INTERFACE:include/extlibs/WinDepPack>")
endif()
# The default binary suffix for libraries/plugins is "_d" when using a debug build.
# since this is configuration specific it is a bit more convenient to put it as a debug compile definition for
# PluginManager.cpp, at the expense of being much less visible compare to having it in the generated
# SofaFramework/config.h
set_property(SOURCE ${SRC_ROOT}/system/PluginManager.cpp APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG "SOFA_LIBSUFFIX=_d" )

# DEPENDENCY LINKS AND INCLUDE DIRS
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Config )
Expand Down
44 changes: 39 additions & 5 deletions Sofa/framework/Helper/src/sofa/helper/system/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,37 @@ constexpr std::string_view GetSofaBuildConfigurationString()
return SOFA_BUILD_CONFIGURATION_STR;
}

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

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

return SofaBuildConfiguration::NonStandard;
}

namespace sofa::helper::system
{

Expand Down Expand Up @@ -157,11 +188,14 @@ void PluginManager::writeToIniFile(const std::string& path)
/// (depends on platform, version, debug/release build)
std::string PluginManager::getDefaultSuffix()
{
#ifdef SOFA_LIBSUFFIX
return sofa_tostring(SOFA_LIBSUFFIX);
#else
return std::string();
#endif
if constexpr(GetSofaBuildConfiguration() == SofaBuildConfiguration::Debug)
{
return "_d";
}
else
{
return "";
}
}

PluginManager::PluginLoadStatus PluginManager::loadPluginByPath(const std::string& pluginPath, std::ostream* errlog)
Expand Down

0 comments on commit c1abfc6

Please sign in to comment.