commontk / CTK

A set of common support code for medical imaging, surgical navigation, and related purposes.
https://commontk.org
Apache License 2.0
866 stars 492 forks source link

Make CTKConfig.cmake and UseCTK.cmake relocatable #403

Closed jcfr closed 11 years ago

jcfr commented 11 years ago

References:

Related issues: #65 #158

jcfr commented 11 years ago

@saschazelzer @nolden Will let you know when I have working draft topic. I expect to push something later this afternoon (EST)

jcfr commented 11 years ago

@saschazelzer @nolden Making progress. Heading to bed ... :sleeping:

Here is the current structure simply specifying CMAKE_INSTALL_PREFIX without customizing any of the CTK_INSTALL_*_DIR variables:

./bin
./bin/ctkDICOMDemoSCU
./bin/ctkPluginGenerator
[...]
./bin/ctkDICOMIndexer
./bin/Python
./bin/Python/ctkSimplePythonShell.pyc
./bin/Python/ctkSimplePythonShell.py
./bin/Python/ctk
./bin/Python/ctk/__init__.py
./bin/Python/ctk/__init__.pyc
./bin/Python/qt
./bin/Python/qt/__init__.py
./bin/Python/qt/__init__.pyc
./bin/ctkDICOMObjectViewer
./bin/ctkDICOMRetrieve
./include
./include/ctk-0.1
./include/ctk-0.1/ctkTrackedPlugin_p.h
./include/ctk-0.1/ctkRangeSlider.h
./include/ctk-0.1/ctkCmdLineModuleRunException.h
./include/ctk-0.1/ctkAbstractObjectFactory.h
./include/ctk-0.1/ctkWorkflowStackedWidget.h
./include/ctk-0.1/ctkPluginManifest_p.h
./include/ctk-0.1/ctkMatrixWidgetEventPlayer.h
[...]
./include/ctk-0.1/ctkBooleanMapper.h
./include/ctk-0.1/ctkPathLineEditEventPlayer.h
./include/ctk-0.1/ctkTransferFunctionGradientItem.h
./include/ctk-0.1/org.commontk.eventbus
./include/ctk-0.1/org.commontk.eventbus/ctkTopicRegistry.h
./include/ctk-0.1/org.commontk.eventbus/ctkNetworkConnectorQtSoap.h
[...]
./include/ctk-0.1/org.commontk.eventbus/ctkEventDispatcher.h
./include/ctk-0.1/org.commontk.eventbus/ctkEventDispatcherLocal.h
./include/ctk-0.1/org.commontk.eventbus/ctkEventDefinitions.h
./include/ctk-0.1/org.commontk.eventbus/ctkEventBusManager.h
./include/ctk-0.1/ctkServiceTrackerCustomizer.h
./include/ctk-0.1/ctkDICOMItem.h
./include/ctk-0.1/ctkActionsWidget.h
./include/ctk-0.1/ctkCmdLineModuleConcurrentHelpers.h
./include/ctk-0.1/ctkDICOMDatabase.h
[...]
./include/ctk-0.1/ctkPushButton.h
./include/ctk-0.1/ctkPlugin_p.h
./include/ctk-0.1/ctkCoordinatesWidget_p.h
./include/ctk-0.1/ctkCmdLineModuleFunctionPointerTask_p.h
./include/ctk-0.1/ctkFontButtonEventPlayer.h
./include/ctk-0.1/ctkDICOMAbstractThumbnailGenerator.h
./include/ctk-0.1/ctkPluginTracker.tpp
./include/ctk-0.1/org.commontk.plugingenerator.core
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorCppTemplate.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorTargetLibraries.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorCMakeLists.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorAbstractTemplate.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorHeaderTemplate.h
./include/ctk-0.1/org.commontk.plugingenerator.core/org_commontk_plugingenerator_core_Export.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorCodeModel.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorAbstractExtension.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin_p.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorConstants.h
./include/ctk-0.1/org.commontk.plugingenerator.core/ctkPluginGeneratorCppPluginActivator.h
./include/ctk-0.1/ctkSettingsDialog.h
./include/ctk-0.1/ctkScreenshotDialog_p.h
[...]
./include/ctk-0.1/ctkPopupWidget_p.h
./include/ctk-0.1/ctkFittedTextBrowser.h
./include/ctk-0.1/ctkWorkflowWidgetStep_p.h
./include/ctk-0.1/ctkSettings.h
./include/ctk-0.1/ctkRangeSliderEventPlayer.h
./include/ctk-0.1/ctkSettingsPanel.h
./include/ctk-0.1/ctkDICOMModel.h
./include/ctk-0.1/ctkServiceRegistration_p.h
./include/ctk-0.1/ctkConsole.h
./include/ctk-0.1/ctkPluginFramework_global.h
./include/ctk-0.1/ctkTestApplication.h
./include/ctk-0.1/ctkMenuComboBox_p.h
./include/ctk-0.1/ctkWorkflow_p.h
[...]
./include/ctk-0.1/ctkServiceTracker.tpp
./include/ctk-0.1/ctkPathListButtonsWidget_p.h
./lib
./lib/ctk-0.1
./lib/ctk-0.1/CTKDICOMCorePythonQt.so
./lib/ctk-0.1/libCTKScriptingPythonCore.so.0.1.0
./lib/ctk-0.1/libCTKDummyPlugin.so
./lib/ctk-0.1/libCTKScriptingPythonWidgets.so.0.1.0
./lib/ctk-0.1/CTKCorePythonQt.so
./lib/ctk-0.1/libCTKDICOMWidgets.so.0.1
./lib/ctk-0.1/libCTKCommandLineModulesBackendFunctionPointer.so.0.1.0
./lib/ctk-0.1/CTKCommandLineModulesBackendLocalProcessPythonQt.so
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtGui.so
./lib/ctk-0.1/libCTKWidgets.so.0.1.0
./lib/ctk-0.1/libCTKPluginFramework.so.0.1
./lib/ctk-0.1/libCTKPluginFramework.so.0.1.0
./lib/ctk-0.1/CMake
./lib/ctk-0.1/CMake/ctkFunctionCompileSnippets.cmake
./lib/ctk-0.1/CMake/ctkMacroBuildPlugin.cmake
./lib/ctk-0.1/CMake/ctkFunctionGetLibraryDirs.cmake
./lib/ctk-0.1/CMake/ctkFunctionGeneratePluginManifest.cmake
./lib/ctk-0.1/CMake/ctkMacroValidateBuildOptions.cmake
./lib/ctk-0.1/CMake/ctkMacroSetPaths.cmake
./lib/ctk-0.1/CMake/ctkMacroParseArguments.cmake
./lib/ctk-0.1/CMake/ctkExport.h.in
./lib/ctk-0.1/CMake/ctkFunctionCheckoutRepo.cmake
./lib/ctk-0.1/CMake/ctkMacroBuildLibWrapper.cmake
./lib/ctk-0.1/CMake/ctkMacroAddCtkLibraryOptions.cmake
./lib/ctk-0.1/CMake/ctkMacroListFilter.cmake
./lib/ctk-0.1/CMake/ctkFunctionExtractOptionNameAndValue.cmake
./lib/ctk-0.1/CMake/CTKPluginUseFile.cmake
./lib/ctk-0.1/CMake/ctkFunctionGetGccVersion.cmake
./lib/ctk-0.1/CMake/ctkMacroBuildApp.cmake
./lib/ctk-0.1/CMake/ctkMacroWrapPythonQt.cmake
./lib/ctk-0.1/CMake/ctkMacroBuildLib.cmake
./lib/ctk-0.1/CMake/CTKConfigVersion.cmake
./lib/ctk-0.1/CMake/ctkFunctionGetIncludeDirs.cmake
./lib/ctk-0.1/CMake/ctkMacroBuildQtPlugin.cmake
./lib/ctk-0.1/CMake/ctkFunctionCheckCompilerFlags.cmake
./lib/ctk-0.1/CMake/ctkFunctionAddPluginRepo.cmake
./lib/ctk-0.1/CMake/ctkMacroOptionUtils.cmake
./lib/ctk-0.1/CMake/ctkFunctionGetCompilerVisibilityFlags.cmake
./lib/ctk-0.1/CMake/ctkMacroTargetLibraries.cmake
./lib/ctk-0.1/CMake/ctkMacroGenerateMocs.cmake
./lib/ctk-0.1/CMake/ctkMacroSetupQt.cmake
./lib/ctk-0.1/CMake/ctkFunctionGenerateDGraphInput.cmake
./lib/ctk-0.1/CMake/CTKExports.cmake
./lib/ctk-0.1/CMake/ctkMacroCompilePythonScript.cmake
./lib/ctk-0.1/CMake/ctkMacroGeneratePluginResourceFile.cmake
./lib/ctk-0.1/CMake/CTKConfig.cmake
./lib/ctk-0.1/CMake/ctkFunctionGenerateProjectXml.cmake
./lib/ctk-0.1/CMake/CTKExports-debug.cmake
./lib/ctk-0.1/libCTKDICOMWidgets.so.0.1.0
./lib/ctk-0.1/libCTKScriptingPythonWidgets.so.0.1
./lib/ctk-0.1/libCTKCommandLineModulesCore.so.0.1
./lib/ctk-0.1/plugins
./lib/ctk-0.1/plugins/liborg_commontk_plugingenerator_core.so
./lib/ctk-0.1/plugins/liborg_commontk_plugingenerator_ui.so
./lib/ctk-0.1/plugins/liborg_commontk_eventbus.so
./lib/ctk-0.1/CTKDICOMWidgetsPythonQt.so
./lib/ctk-0.1/libCTKCommandLineModulesBackendLocalProcess.so.0.1
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtGui.so.0.1
./lib/ctk-0.1/designer
./lib/ctk-0.1/designer/libCTKDICOMWidgetsPlugins.so
./lib/ctk-0.1/designer/libCTKScriptingPythonWidgetsPlugins.so
./lib/ctk-0.1/designer/libCTKWidgetsPlugins.so
./lib/ctk-0.1/libCTKDICOMCore.so.0.1
./lib/ctk-0.1/libCTKCore.so.0.1
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtWebKit.so.0.1
./lib/ctk-0.1/libCTKCore.so
./lib/ctk-0.1/libCTKCore.so.0.1.0
./lib/ctk-0.1/libCTKDICOMCore.so
./lib/ctk-0.1/libCTKCommandLineModulesBackendLocalProcess.so
./lib/ctk-0.1/CTKCommandLineModulesBackendFunctionPointerPythonQt.so
./lib/ctk-0.1/libCTKCommandLineModulesCore.so
./lib/ctk-0.1/libCTKCommandLineModulesCore.so.0.1.0
./lib/ctk-0.1/libCTKPluginFramework.so
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtWebKit.so.0.1.0
./lib/ctk-0.1/libCTKWidgets.so
./lib/ctk-0.1/CTKPluginFrameworkPythonQt.so
./lib/ctk-0.1/libCTKScriptingPythonWidgets.so
./lib/ctk-0.1/libCTKDummyPlugin.so.0.1
./lib/ctk-0.1/CTKCommandLineModulesFrontendQtGuiPythonQt.so
./lib/ctk-0.1/libCTKScriptingPythonCore.so.0.1
./lib/ctk-0.1/CTKWidgetsPythonQt.so
./lib/ctk-0.1/libCTKDICOMCore.so.0.1.0
./lib/ctk-0.1/libCTKWidgets.so.0.1
./lib/ctk-0.1/CTKScriptingPythonWidgetsPythonQt.so
./lib/ctk-0.1/libCTKCommandLineModulesBackendLocalProcess.so.0.1.0
./lib/ctk-0.1/libCTKDICOMWidgets.so
./lib/ctk-0.1/libCTKCommandLineModulesBackendFunctionPointer.so
./lib/ctk-0.1/CTKCommandLineModulesFrontendQtWebKitPythonQt.so
./lib/ctk-0.1/libCTKScriptingPythonCore.so
./lib/ctk-0.1/libCTKDummyPlugin.so.0.1.0
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtWebKit.so
./lib/ctk-0.1/CTKCommandLineModulesCorePythonQt.so
./lib/ctk-0.1/libCTKCommandLineModulesBackendFunctionPointer.so.0.1
./lib/ctk-0.1/libCTKCommandLineModulesFrontendQtGui.so.0.1.0
pieper commented 11 years ago

Jc you are a machine!

nolden commented 11 years ago

Hi Jc,

great progress!!! I can't test it right now but I will be happy to do that soon. One thing: in MITK, Ubuntu 12.04 LTS is a Tier 1 platform which also means we would prefer to keep the required CMake version in CTK and MITK compatible with the version provided by the system, which is 2.8.7. Could we copy the CMakePackageConfigHelpers file to CTK? Or are there other improvements between 2.8.8 and 2.8.7 we would depend on?

jcfr commented 11 years ago

@nolden Good point. I tuned the last commit to provide the CMake module CMakePackageConfigHelpers is not already provided by the version used to configure CTK. With that mechanism in place, it doesn't make sens to bump the CMake version.

jcfr commented 11 years ago

Getting closer ... just few variables are still no "relocated":

# The CTK include file directories.
SET(CTK_INCLUDE_DIRS ";/home/jchris/Projects/CTK/Libs/Core;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Core;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Core/Resources/UI;/home/jchris/Projects/CTK-Debug/CTK-build;/home/jchris/Projects/CTK/Libs/Core/Testing/Cpp;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Core/Testing/Cpp;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Core/Testing/Cpp/Resources/UI;/home/jchris/Projects/CTK/Libs/PluginFramework;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/PluginFramework;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/PluginFramework/Resources/UI;/home/jchris/Projects/CTK-Debug;/home/jchris/Projects/CTK/Libs/Widgets;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Widgets;/home/jchris/Projects/CTK-Debug/CTK-build/Libs/Widgets/Resources/UI;[...]")

# The CTK external project libraries.
SET(CTK_EXTERNAL_LIBRARIES "general;/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/lib/libQtOpenGL.so;general;/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/lib/libQtXmlPatterns.so;general;/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/lib/libQtGui.so;general;/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/lib/libQtTest.so;general;/home/jchris/Support/QtSDK-1.2.1/Desktop/Qt/4.8.1/gcc/lib/libQtXml.so;general;[...]")

[...]

SET(CTK_EXECUTABLE_DIRS "/home/jchris/Projects/CTK-Debug/CTK-build/bin")

# CTK external projects variables

set(CTK_CTKData_DIR "/home/jchris/Projects/CTK-Debug/CTKData")
set(CTK_PYTHONQT_INSTALL_DIR "/home/jchris/Projects/CTK-Debug/CMakeExternals/Install")
set(CTK_PYTHON_EXECUTABLE "/usr/bin/python")
set(CTK_PYTHON_INCLUDE_DIR "/usr/include/python2.7")
set(CTK_PYTHON_LIBRARY "/usr/lib/x86_64-linux-gnu/libpython2.7.so")
set(CTK_DCMTK_DIR "/home/jchris/Projects/CTK-Debug/CMakeExternals/Install")
set(CTK_QtSOAP_DIR "/home/jchris/Projects/CTK-Debug/QtSOAP-build")
set(CTK_qxmlrpc_DIR "/home/jchris/Projects/CTK-Debug/qxmlrpc-build")
jcfr commented 11 years ago

@domibel Let me know what you think. This should make things easier on your side.

nolden commented 11 years ago

@jcfr Great! Two findings/comments.

In

INSTALL_DIR/lib/ctk-0.1/CMake/CTKPluginUseFile.cmake

the include paths contain references to BUILD_DIR and SOURCE_DIR

The version number (0.1) in the paths should be removed for the Debian package. We could do this with a patch in the Debian package if we want to keep them for CTK. Or is there already an option?

jcfr commented 11 years ago
  1. Will look at BUILD_DIR and SOURCE_DIR in CTKPluginUseFile.cmake. I may create a separate issue for this and still integrate the topic.
  2. There are no need to patch, on Debian CTK could be configured passing custom value for the following internal options:
CTK_INSTALL_BIN_DIR
CTK_INSTALL_LIB_DIR
CTK_INSTALL_PLUGIN_DIR
CTK_INSTALL_PLUGIN_DIR
CTK_INSTALL_CMAKE_DIR
CTK_INSTALL_INCLUDE_DIR
CTK_INSTALL_PLUGIN_INCLUDE_DIR
CTK_INSTALL_QTPLUGIN_DIR
CTK_INSTALL_DOC_DIR

For more details, see https://github.com/jcfr/CTK/blob/1775da595835639cb6220d056590544dd621b55b/CMakeLists.txt#L113-136

nolden commented 11 years ago
  1. Thanks
  2. Just found the options, should have looked more closely ;)