# HG changeset patch # User Sebastien Jodogne # Date 1549653149 -3600 # Node ID 534759b0cf148d8c1ef0d37b5fe460c6e4ef7122 # Parent 39b2f29ddf3ce40b8cc6cbb943026e55ebc4364c use of macros to report performance warnings diff -r 39b2f29ddf3c -r 534759b0cf14 Framework/Plugins/OrthancCppDatabasePlugin.h --- a/Framework/Plugins/OrthancCppDatabasePlugin.h Fri Feb 08 19:55:01 2019 +0100 +++ b/Framework/Plugins/OrthancCppDatabasePlugin.h Fri Feb 08 20:12:29 2019 +0100 @@ -1847,10 +1847,13 @@ sprintf(info, "Performance warning: The database index plugin was compiled " "against an old version of the Orthanc SDK (%d.%d.%d): " - "Consider upgrading to version 1.5.4 of the Orthanc SDK", + "Consider upgrading to version %d.%d.%d of the Orthanc SDK", ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, - ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); + ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER, + ORTHANC_OPTIMAL_VERSION_MAJOR, + ORTHANC_OPTIMAL_VERSION_MINOR, + ORTHANC_OPTIMAL_VERSION_REVISION); OrthancPluginLogWarning(context, info); } diff -r 39b2f29ddf3c -r 534759b0cf14 Framework/Plugins/PluginInitialization.cpp --- a/Framework/Plugins/PluginInitialization.cpp Fri Feb 08 19:55:01 2019 +0100 +++ b/Framework/Plugins/PluginInitialization.cpp Fri Feb 08 20:12:29 2019 +0100 @@ -65,9 +65,16 @@ return false; } - if (OrthancPluginCheckVersionAdvanced(context, 1, 5, 4) == 1) + if (OrthancPluginCheckVersionAdvanced(context, 1, 4, 0) == 1) { ImplicitTransaction::SetErrorOnDoubleExecution(true); + } + + if (OrthancPluginCheckVersionAdvanced(context, + ORTHANC_OPTIMAL_VERSION_MAJOR, + ORTHANC_OPTIMAL_VERSION_MINOR, + ORTHANC_OPTIMAL_VERSION_REVISION) == 1) + { isOptimal = true; } @@ -110,9 +117,12 @@ int minor = boost::lexical_cast(tokens[1]); int revision = boost::lexical_cast(tokens[2]); - isOptimal = (major > 1 || - (major == 1 && minor > 5) || - (major == 1 && minor == 5 && revision >= 4)); + isOptimal = (major > ORTHANC_OPTIMAL_VERSION_MAJOR || + (major == ORTHANC_OPTIMAL_VERSION_MAJOR && + minor > ORTHANC_OPTIMAL_VERSION_MINOR) || + (major == ORTHANC_OPTIMAL_VERSION_MAJOR && + minor == ORTHANC_OPTIMAL_VERSION_MINOR && + revision >= ORTHANC_OPTIMAL_VERSION_REVISION)); } } @@ -121,8 +131,11 @@ { LOG(WARNING) << "Performance warning in " << dbms << " index: Your version of Orthanc (" - << context->orthancVersion << ") should be upgraded to 1.5.4 " - << "to benefit from best performance"; + << context->orthancVersion << ") should be upgraded to " + << ORTHANC_OPTIMAL_VERSION_MAJOR << "." + << ORTHANC_OPTIMAL_VERSION_MINOR << "." + << ORTHANC_OPTIMAL_VERSION_REVISION + << " to benefit from best performance"; } diff -r 39b2f29ddf3c -r 534759b0cf14 MySQL/CMakeLists.txt --- a/MySQL/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/MySQL/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,11 +3,15 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() - set(ORTHANC_FRAMEWORK_VERSION "1.5.4") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif() diff -r 39b2f29ddf3c -r 534759b0cf14 PostgreSQL/CMakeLists.txt --- a/PostgreSQL/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/PostgreSQL/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,11 +3,15 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() - set(ORTHANC_FRAMEWORK_VERSION "1.5.4") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif() diff -r 39b2f29ddf3c -r 534759b0cf14 Resources/CMake/DatabasesPluginConfiguration.cmake --- a/Resources/CMake/DatabasesPluginConfiguration.cmake Fri Feb 08 19:55:01 2019 +0100 +++ b/Resources/CMake/DatabasesPluginConfiguration.cmake Fri Feb 08 20:12:29 2019 +0100 @@ -44,9 +44,25 @@ endif() +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_MAJOR) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_MAJOR is not defined") +endif() + +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_MINOR) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_MINOR is not defined") +endif() + +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_REVISION) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_REVISION is not defined") +endif() + + add_definitions( -DHAS_ORTHANC_EXCEPTION=1 -DORTHANC_ENABLE_PLUGINS=1 + -DORTHANC_OPTIMAL_VERSION_MAJOR=${ORTHANC_OPTIMAL_VERSION_MAJOR} + -DORTHANC_OPTIMAL_VERSION_MINOR=${ORTHANC_OPTIMAL_VERSION_MINOR} + -DORTHANC_OPTIMAL_VERSION_REVISION=${ORTHANC_OPTIMAL_VERSION_REVISION} ) diff -r 39b2f29ddf3c -r 534759b0cf14 SQLite/CMakeLists.txt --- a/SQLite/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/SQLite/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,12 +3,16 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() set(ORTHANC_FRAMEWORK_VERSION "1.4.0") - set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") endif() include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake)