First try to mix old style and new style meshgems

This commit is contained in:
Anthony Geay 2022-02-10 14:25:46 +01:00
parent 385b688f73
commit e1682190e9

View File

@ -60,6 +60,8 @@ namespace boofs = boost::filesystem;
#undef SMESH_CAUGHT
#define SMESH_CAUGHT error =
constexpr char MESHGEMS_OLD_STYLE[] = "MESHGEMS_OLD_STYLE";
namespace
{
@ -372,7 +374,7 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
*/
//================================================================================
bool SignCAD( void* meshgems_cad, std::string& error )
bool SignCAD_After( void* meshgems_cad, std::string& error )
{
LibraryFile libraryFile;
if ( !loadLibrary( error, libraryFile ))
@ -402,6 +404,15 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
return ok;
}
bool SignCAD( void* meshgems_cad, std::string& error )
{
const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
return SignCAD_After(meshgems_cad, error);
else
return true;
}
//================================================================================
/*!
* \brief Sign a mesh
@ -411,7 +422,7 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
*/
//================================================================================
bool SignMesh( void* meshgems_mesh, std::string& error )
bool SignMesh_After( void* meshgems_mesh, std::string& error )
{
LibraryFile libraryFile;
if ( !loadLibrary( error, libraryFile ))
@ -441,6 +452,15 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
return ok;
}
bool SignMesh( void* meshgems_mesh, std::string& error )
{
const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
return SignMesh_After(meshgems_mesh, error);
else
return true;
}
//================================================================================
/*!
* \brief Return a license key to pass as argument to a MG mesher executable
@ -451,12 +471,12 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
*/
//================================================================================
std::string GetKey(const std::string& gmfFile,
int nbVertex,
int nbEdge,
int nbFace,
int nbVol,
std::string& error)
std::string GetKey_After(const std::string& gmfFile,
int nbVertex,
int nbEdge,
int nbFace,
int nbVol,
std::string& error)
{
std::string key;
LibraryFile libraryFile;
@ -480,6 +500,20 @@ namespace SMESHUtils_MGLicenseKeyGen // API implementation
return key;
}
std::string GetKey(const std::string& gmfFile,
int nbVertex,
int nbEdge,
int nbFace,
int nbVol,
std::string& error)
{
const char *meshGemsOldStyleEnvVar( getenv( MESHGEMS_OLD_STYLE ) );
if ( !meshGemsOldStyleEnvVar || strlen(meshGemsOldStyleEnvVar) == 0 )
return GetKey_After(gmfFile,nbVertex,nbEdge,nbFace,nbVol,error);
else
return std::string("0");
}
//================================================================================
/*!
* \brief Return false if libMeshGemsKeyGenerator.so is not functional