Commit 9dbe3a7d authored by jcfr's avatar jcfr

BUG: Centralize revision/version information into version header file. Fixes 1204

* Remove SlicerVersion.txt that provide redundant information and
remove associated "discoverRepository" function.

* Note that slicer revision associated with extension manager can be overwritten
at runtime from within python using:

   slicer.app.extensionManagerModel().slicerRevision = "12345"

* See http://www.na-mic.org/Bug/view.php?id=1204

git-svn-id: http://svn.slicer.org/Slicer4/trunk@19948 3bd1e089-480b-0410-8dfb-8563597acbee
parent 66473039
......@@ -158,8 +158,6 @@ void qSlicerCoreApplicationPrivate::init()
this->ITKFactoriesDir = this->discoverITKFactoriesDirectory();
this->setEnvironmentVariable("ITK_AUTOLOAD_PATH", this->ITKFactoriesDir);
this->discoverRepository();
this->setPythonEnvironmentVariables();
this->setTclEnvironmentVariables();
......@@ -429,30 +427,6 @@ QString qSlicerCoreApplicationPrivate::discoverITKFactoriesDirectory()
return itkFactoriesDir.absolutePath();
}
//-----------------------------------------------------------------------------
void qSlicerCoreApplicationPrivate::discoverRepository()
{
QDir slicerShareDir(this->SlicerHome);
slicerShareDir.cd(Slicer_SHARE_DIR);
QFileInfo slicerVersion(slicerShareDir, "SlicerVersion.txt");
QFile slicerVersionFile(slicerVersion.absoluteFilePath());
if (!slicerVersionFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
qWarning() << "Can't find SlicerVersion.txt at address:"
<< slicerVersionFile.fileName();
return;
}
QTextStream slicerVersionStream(&slicerVersionFile);
QString build, buildDate, repositoryUrl, repositoryRevision;
slicerVersionStream >> build >> this->Platform;
slicerVersionStream >> buildDate >> buildDate;
slicerVersionStream >> repositoryUrl >> this->RepositoryUrl;
slicerVersionStream >> repositoryRevision >> this->RepositoryRevision;
this->RepositoryBranch = QFileInfo(this->RepositoryUrl).fileName();
}
//-----------------------------------------------------------------------------
void qSlicerCoreApplicationPrivate::setPythonEnvironmentVariables()
{
......@@ -1189,22 +1163,19 @@ QString qSlicerCoreApplication::acknowledgment()const
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::repositoryUrl()const
{
Q_D(const qSlicerCoreApplication);
return d->RepositoryUrl;
return Slicer_WC_URL;
}
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::repositoryBranch()const
{
Q_D(const qSlicerCoreApplication);
return d->RepositoryBranch;
return QFileInfo(this->repositoryUrl()).fileName();
}
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::repositoryRevision()const
{
Q_D(const qSlicerCoreApplication);
return d->RepositoryRevision;
return Slicer_WC_REVISION;
}
//-----------------------------------------------------------------------------
......@@ -1222,22 +1193,19 @@ int qSlicerCoreApplication::minorVersion() const
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::platform()const
{
Q_D(const qSlicerCoreApplication);
return d->Platform;
return QString("%1-%2").arg(Slicer_PLATFORM).arg(Slicer_ARCHITECTURE);
}
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::arch()const
{
Q_D(const qSlicerCoreApplication);
return d->Platform.split("-").at(1);
return Slicer_ARCHITECTURE;
}
//-----------------------------------------------------------------------------
QString qSlicerCoreApplication::os()const
{
Q_D(const qSlicerCoreApplication);
return d->Platform.split("-").at(0);
return Slicer_PLATFORM;
}
//-----------------------------------------------------------------------------
......
......@@ -81,10 +81,6 @@ public:
/// Set 'ITKFactoriesDir' variable using 'ITK_AUTOLOAD_PATH' environment variable
QString discoverITKFactoriesDirectory();
/// Set variable 'Repository{Url, Revision, Url}' and Platform extracting information
/// from SlicerVersion.txt
void discoverRepository();
/// Set PYTHONHOME and PYTHONPATH environment variables is not already set.
void setPythonEnvironmentVariables();
......@@ -123,13 +119,6 @@ public:
/// Release, RelWithDebInfo, MinSizeRel or any other custom build type.
QString IntDir;
/// Variable set extracting information from SlicerVersion.txt
/// \sa discoverRepository
QString RepositoryUrl;
QString RepositoryBranch;
QString RepositoryRevision;
QString Platform;
QSettings* Settings;
/// ModuleManager - It should exist only one instance of the factory
......
build @Slicer_PLATFORM@-@Slicer_ARCHITECTURE@
buildDate @Slicer_BUILDDATE@
svnurl @Slicer_WC_URL@
svnrevision @Slicer_WC_REVISION@
......@@ -714,29 +714,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} ${Slicer_REQUIRED_CXX_FLAGS} ${ITK_
#-----------------------------------------------------------------------------
set(QMRML_EXPORT_HEADER_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/Libs/MRML/Widgets/CMake/qMRMLExport.h.in")
#-----------------------------------------------------------------------------
# Generate SlicerVersion.txt
#-----------------------------------------------------------------------------
SlicerMacroExtractRepositoryInfo(VAR_PREFIX Slicer)
set(slicer_version_file ${Slicer_HOME}/${Slicer_SHARE_DIR}/SlicerVersion.txt)
# Note that Slicer_BUILD is set above
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/SlicerVersion.txt.in
${slicer_version_file}
)
install(FILES
${slicer_version_file}
DESTINATION ${Slicer_INSTALL_SHARE_DIR}
COMPONENT Development
)
# --------------------------------------------------------------------------
# Configure and install headers
# --------------------------------------------------------------------------
SlicerMacroExtractRepositoryInfo(VAR_PREFIX Slicer) # Used to configure vtkSlicerVersionConfigure.h.in
set(files
vtkSlicerConfigure.h
vtkSlicerVersionConfigure.h
......@@ -747,6 +730,17 @@ foreach(f ${files})
${CMAKE_CURRENT_BINARY_DIR}/${f}
)
endforeach()
if(NOT Slicer_INSTALL_NO_DEVELOPMENT)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerConfigure.h"
"${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerVersionConfigure.h"
DESTINATION ${Slicer_INSTALL_INCLUDE_DIR} COMPONENT Development
)
endif()
#-----------------------------------------------------------------------------
# Configure testing scripts
#-----------------------------------------------------------------------------
set(files
Utilities/Scripts/runValgrind.sh
Utilities/Scripts/runValgrindForOneModule.sh
......@@ -762,14 +756,6 @@ foreach(f ${files})
)
endforeach()
if(NOT Slicer_INSTALL_NO_DEVELOPMENT)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerConfigure.h"
"${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerVersionConfigure.h"
DESTINATION ${Slicer_INSTALL_INCLUDE_DIR} COMPONENT Development
)
endif()
#-----------------------------------------------------------------------------
# Includes
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment