Преглед на файлове

Merge branch '74-ctk-enable-categories' Closes #74.

* 74-ctk-enable-categories:
  Support disabling CTK_BUILD_EXAMPLES based on user changes.
  Added utility macro which allows to completely specify the option name.
  Use STATUS messages for enabling hints.
  Don't mark QT_QMAKE_EXECUTABLE as advanced.
  Add CTK_ENABLE_Python_Wrapping top-level option
  Add ctk_option_logical_expression_to_message function
  ctkMacroOptionUtils - Improve the enabling message
  New CTK_ENABLE_* build system feature.
  Removed Messaging library.
Sascha Zelzer преди 13 години
родител
ревизия
7cac6550c2

+ 4 - 16
CMake/ctkBlockCheckDependencies.cmake

@@ -13,9 +13,9 @@
 # Collect CTK library target dependencies
 #
 
-ctkMacroCollectAllTargetLibraries("${CTK_LIBS_SUBDIRS}" "Libs" ALL_TARGET_LIBRARIES)
-ctkMacroCollectAllTargetLibraries("${CTK_PLUGINS_SUBDIRS}" "Plugins" ALL_TARGET_LIBRARIES)
-ctkMacroCollectAllTargetLibraries("${CTK_APPLICATIONS_SUBDIRS}" "Applications" ALL_TARGET_LIBRARIES)
+ctkMacroCollectAllTargetLibraries("${CTK_LIBS}" "Libs" ALL_TARGET_LIBRARIES)
+ctkMacroCollectAllTargetLibraries("${CTK_PLUGINS}" "Plugins" ALL_TARGET_LIBRARIES)
+ctkMacroCollectAllTargetLibraries("${CTK_APPS}" "Applications" ALL_TARGET_LIBRARIES)
 #message(STATUS ALL_TARGET_LIBRARIES:${ALL_TARGET_LIBRARIES})
 
 #-----------------------------------------------------------------------------
@@ -25,19 +25,7 @@ ctkMacroCollectAllTargetLibraries("${CTK_APPLICATIONS_SUBDIRS}" "Applications" A
 # of the macro ctkMacroCollectAllTargetLibraries, let's get the list of all Non-CTK dependencies.
 # NON_CTK_DEPENDENCIES is expected by the macro ctkMacroShouldAddExternalProject
 ctkMacroGetAllNonProjectTargetLibraries("${ALL_TARGET_LIBRARIES}" NON_CTK_DEPENDENCIES)
-#message(STATUS NON_CTK_DEPENDENCIES:${NON_CTK_DEPENDENCIES})
-
-#-----------------------------------------------------------------------------
-# Include external projects
-#
-#-----------------------------------------------------------------------------
-# Git protocole option
-#
-option(CTK_USE_GIT_PROTOCOL "If behind a firewall turn this OFF to use http instead." ON)
-set(git_protocol "git")
-if(NOT CTK_USE_GIT_PROTOCOL)
-  set(git_protocol "http")
-endif()
+#message(NON_CTK_DEPENDENCIES:${NON_CTK_DEPENDENCIES})
 
 #-----------------------------------------------------------------------------
 # Enable and setup External project global properties

+ 66 - 0
CMake/ctkMacroOptionUtils.cmake

@@ -0,0 +1,66 @@
+
+function(ctk_option_logical_expression_to_message varname logical_expr)
+  set(enabling_msg)
+  foreach(arg ${logical_expr})
+    if(NOT "${${arg}}" STREQUAL "")
+      set(value_as_int 0)
+      if(${${arg}})
+        set(value_as_int 1)
+      endif()
+      set(enabling_msg "${enabling_msg} ${arg}:${value_as_int}")
+    else()
+      set(enabling_msg "${enabling_msg} ${arg}")
+    endif()
+  endforeach()
+  set(${varname} ${enabling_msg} PARENT_SCOPE)
+endfunction()
+
+macro(ctk_option option_prefix name doc default)
+  option(${option_prefix}_${name} ${doc} ${default})
+  mark_as_advanced(${option_prefix}_${name})
+  list(APPEND ${option_prefix}S ${name})
+  set(_logical_expr ${ARGN})
+  if(_logical_expr AND NOT ${option_prefix}_${name})
+    if(${ARGN})
+      # Force the option to ON. This is okay since the
+      # logical expression should contain a CTK_ENABLE_*
+      # option value, which requires the current option to be ON.
+      get_property(_doc_string CACHE ${option_prefix}_${name} PROPERTY HELPSTRING)
+      set(${option_prefix}_${name} ON CACHE BOOL ${_doc_string} FORCE)
+      # Generate user-friendly message
+      set(enabling_msg)
+      ctk_option_logical_expression_to_message(enabling_msg "${ARGN}")
+      message(STATUS "Enabling [${option_prefix}_${name}] because of [${enabling_msg}] evaluates to True")
+    endif()
+  endif()
+endmacro()
+
+macro(ctk_lib_option name doc default)
+  ctk_option(CTK_LIB ${name} ${doc} ${default} ${ARGN})
+endmacro()
+
+macro(ctk_plugin_option name doc default)
+  ctk_option(CTK_PLUGIN ${name} ${doc} ${default} ${ARGN})
+endmacro()
+
+macro(ctk_app_option name doc default)
+  ctk_option(CTK_APP ${name} ${doc} ${default} ${ARGN})
+endmacro()
+
+macro(ctk_enable_option_raw name doc default)
+  option(${name} "${doc}" ${default})
+  if(DEFINED ${name}_internal)
+    if(${${name}} AND ${${name}_internal})
+      if(NOT (${ARGN}))
+        get_property(_doc_string CACHE ${name} PROPERTY HELPSTRING)
+        set(${name} OFF CACHE BOOL ${_doc_string} FORCE)
+        message("Full support for [${name}] disabled")
+      endif()
+    endif()
+  endif()
+  set(${name}_internal ${${name}} CACHE INTERNAL "" FORCE)
+endmacro()
+
+macro(ctk_enable_option name doc default)
+  ctk_enable_option_raw(CTK_ENABLE_${name} ${doc} ${default} ${ARGN})
+endmacro()

+ 0 - 3
CMake/ctkMacroSetupQt.cmake

@@ -24,9 +24,6 @@ macro(ctkMacroSetupQt)
   set(minimum_required_qt_version "4.6")
 
   find_package(Qt4)
-
-  # This option won't show up in the main CMake configure panel
-  mark_as_advanced(QT_QMAKE_EXECUTABLE)
   
   if(QT4_FOUND)
 

+ 7 - 7
CMake/ctkMacroTargetLibraries.cmake

@@ -222,17 +222,17 @@ macro(ctkMacroGetAllNonProjectTargetLibraries all_target_libraries varname)
     list(REMOVE_ITEM _tmp_list ${all_project_libraries})
   endif()
   set(${varname} ${_tmp_list})
-  #message(STATUS varname:${varname}:${${varname}})
+  #message(varname:${varname}:${${varname}})
 endmacro()
 
 #! \ingroup CMakeUtilities
 macro(ctkMacroShouldAddExternalProject libraries_variable_name resultvar)
-  if(NOT DEFINED NON_CTK_DEPENDENCIES)
-    message(FATAL_ERROR "Variable NON_CTK_DEPENDENCIES is undefined !")
-  endif() 
-  list(FIND NON_CTK_DEPENDENCIES ${libraries_variable_name} index)
   set(${resultvar} FALSE)
-  if(${index} GREATER -1)
-    set(${resultvar} TRUE)
+  if(DEFINED NON_CTK_DEPENDENCIES)
+    list(FIND NON_CTK_DEPENDENCIES ${libraries_variable_name} index)
+  
+    if(${index} GREATER -1)
+      set(${resultvar} TRUE)
+    endif()
   endif()
 endmacro()

+ 259 - 133
CMakeLists.txt

@@ -74,6 +74,7 @@ endif()
 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
   message(STATUS "Setting build type to 'Debug' as none was specified.")
   set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
+  mark_as_advanced(CMAKE_BUILD_TYPE)
   # Set the possible values of build type for cmake-gui
   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
     "MinSizeRel" "RelWithDebInfo")
@@ -178,6 +179,7 @@ set(CTK_CMAKE_UTILITIES_DIR ${CTK_SOURCE_DIR}/Utilities/CMake)
 include(CMake/ctkMacroParseArguments.cmake)
 include(CMake/ctkMacroSetPaths.cmake)
 include(CMake/ctkMacroListFilter.cmake)
+include(CMake/ctkMacroOptionUtils.cmake)
 include(CMake/ctkMacroBuildLib.cmake)
 include(CMake/ctkMacroBuildLibWrapper.cmake)
 include(CMake/ctkMacroBuildPlugin.cmake)
@@ -199,17 +201,10 @@ include(CMake/ctkFunctionGetLibraryDirs.cmake)
 include(CMake/ctkFunctionGetGccVersion.cmake)
 
 #-----------------------------------------------------------------------------
-# Qt Designer Plugins
-
-option(BUILD_QTDESIGNER_PLUGINS "Build Qt Designer plugins" ON)
-if(BUILD_QTDESIGNER_PLUGINS)
-  include(CMake/ctkMacroBuildQtDesignerPlugin.cmake)
-endif()
-
-#-----------------------------------------------------------------------------
 # Testing
 #
-option(BUILD_TESTING "Test the project" ON)
+option(BUILD_TESTING "Test the project" OFF)
+mark_as_advanced(BUILD_TESTING)
 if(BUILD_TESTING)
   enable_testing()
   include(CTest)
@@ -249,6 +244,7 @@ endif()
 # Coverage
 #
 option(WITH_COVERAGE "Enable/Disable coverage" OFF)
+mark_as_advanced(WITH_COVERAGE)
 
 #-----------------------------------------------------------------------------
 # Documentation
@@ -344,73 +340,67 @@ if(QT4_FOUND)
 endif()
 
 #-----------------------------------------------------------------------------
-# CTK Libraries - Use ON or OFF to indicate if the library should be built by default
-#
-set(CTK_LIBS
-  Core:ON
-  PluginFramework:ON
-  Widgets:OFF
-  DICOM/Core:OFF
-  DICOM/Widgets:OFF
-  ImageProcessing/ITK/Core:OFF
-  #Messaging/Core:OFF  # MessagingCore library need some love :) - Let's disable it for now :(
-  #ModuleDescription:OFF # ModuleDescription library need some love :) - Let's disable it for now :(
-  Scripting/Python/Core:OFF
-  Scripting/Python/Widgets:OFF
-  Visualization/VTK/Core:OFF
-  Visualization/VTK/Widgets:OFF
-  #Visualization/XIP:OFF # XIP library need some love :) - Let's disable it for now :(
-  )
+# To make options show up in both CTK-SuperBuild and CTK regular build, let's add them
+# before the SuperBuild script is included
+#
 
 #-----------------------------------------------------------------------------
-# CTK Plugins - Use ON or OFF to indicate if the plugin should be built by default
-#
-set(CTK_PLUGINS
-  # Optional plug-ins implementings interfaces in PluginFramework/service/
-  org.commontk.eventbus:OFF
-  org.commontk.configadmin:OFF
-  org.commontk.eventadmin:OFF
-  org.commontk.log:OFF
-  org.commontk.log4qt:OFF
-  org.commontk.metatype:OFF
-
-  # Plug-ins related to DICOM WG23 (Application Hosting)
-  org.commontk.dah.core:OFF
-  org.commontk.dah.app:OFF
-  org.commontk.dah.host:OFF
-  org.commontk.dah.exampleapp:OFF
-  org.commontk.dah.examplehost:OFF
+# High-Level CTK options
 
-  # Misc
-  org.commontk.plugingenerator.core:OFF
-  org.commontk.plugingenerator.ui:OFF
-  org.commontk.slicermodule:OFF
-  )
+# The ctk_enable_option macro expects a logical expression after the first
+# three arguments. This expression should only contain build option names
+# which belong to leafs in the required dependency tree.
 
-#-----------------------------------------------------------------------------
-# CTK Applications - Use ON or OFF to indicate if the application should be built by default
-#
-set(CTK_APPLICATIONS
-  ctkCLIPluginExplorer:OFF
-  ctkDICOM:OFF
-  ctkDICOMIndexer:OFF
-  ctkDICOMDemoSCU:OFF
-  ctkDICOMQuery:OFF
-  ctkDICOMRetrieve:OFF
-  ctkDICOMQueryRetrieve:OFF
-  ctkExampleHost:OFF
-  ctkExampleHostedApp:OFF
-  ctkEventBusDemo:OFF
-  ctkPluginBrowser:OFF
-  ctkPluginGenerator:OFF
-  ctkDICOMObjectViewer:OFF
-  ctkSimplePythonShell:OFF
-  )
+# The CTK infrastructure for high-level DICOM support. This includes
+# DICOM indexing, networking, and GUI widgets.
+ctk_enable_option(DICOM "Enable default DICOM support" OFF
+                  CTK_LIB_DICOM/Widgets)
+
+# The CTK infrastructure for building a DICOM Part 19 compliant application
+# host and/or hosted application. This will not enable any example plugins
+# or executables (enable CTK_ENABLE_EXAMPLES for that).
+ctk_enable_option(DICOMApplicationHosting "Enable DICOM Part 19 Application Hosting support" OFF
+                  CTK_PLUGIN_org.commontk.dah.host AND CTK_PLUGIN_org.commontk.dah.app)
+
+# The CTK Qt Widgets. This will enable the Qt Widget library only.
+# It might trigger the enabling of other widget libraries in combination
+# with other enabled options.
+ctk_enable_option(Widgets "Enable Qt Widget libraries" OFF
+                  CTK_LIB_Widgets)
+
+# The CTK Plugin Framework, a dynamic component system based on OSGi.
+# This will enable only the framework itself.                  
+ctk_enable_option(PluginFramework "Enable Plugin Framework" OFF
+                  CTK_LIB_PluginFramework)
 
 #-----------------------------------------------------------------------------
-# To make options show up in both CTK-SuperBuild and CTK regular build, let's add them
-# before the SuperBuild script is included
-#
+# Other options
+
+# The CTK Python Wrapping
+ctk_enable_option(Python_Wrapping "Wrap CTK classes using Qt meta-object system into Python language" OFF
+                  CTK_LIB_Scripting/Python/Core)
+
+# Build examples
+# Create the logical expression containing the minium set of required options
+# for the CTK_BUILD_EXAMPLES option to be ON
+set(_build_examples_logical_expr)
+foreach(_app ${CTK_ENABLED_APPS})
+  list(APPEND _build_examples_logical_expr CTK_APP_${_app} AND)
+endforeach()
+if(_build_examples_logical_expr)
+  list(REMOVE_AT _build_examples_logical_expr -1)
+endif()
+
+ctk_enable_option_raw(CTK_BUILD_EXAMPLES "Build examples for CTK components" OFF
+                  ${_build_examples_logical_expr})
+
+# Git protocol option
+option(CTK_USE_GIT_PROTOCOL "If behind a firewall turn this OFF to use http instead." ON)
+mark_as_advanced(CTK_USE_GIT_PROTOCOL)
+set(git_protocol "git")
+if(NOT CTK_USE_GIT_PROTOCOL)
+  set(git_protocol "http")
+endif()
 
 # Let's mark as advanced some default properties
 mark_as_advanced(CMAKE_INSTALL_PREFIX)
@@ -418,21 +408,178 @@ mark_as_advanced(DART_TESTING_TIMEOUT)
 
 # KWStyle
 option(CTK_USE_KWSTYLE     "Enable sourcecode-based style tests." OFF)
-#mark_as_advanced(CTK_USE_KWSTYLE)
+mark_as_advanced(CTK_USE_KWSTYLE)
 
-#---------------------------------------------------------------------------
-# Will contain a list of sub-directory without option ON or OFF
+# Qt Designer Plugins
+option(CTK_BUILD_QTDESIGNER_PLUGINS "Build Qt Designer plugins" ON)
+mark_as_advanced(CTK_BUILD_QTDESIGNER_PLUGINS)
+if(CTK_BUILD_QTDESIGNER_PLUGINS)
+  include(CMake/ctkMacroBuildQtDesignerPlugin.cmake)
+endif()
+
+#-----------------------------------------------------------------------------
+# CTK Libraries
+#
+
+ctk_lib_option(Core
+               "Build the Core library" ON)
+
+ctk_lib_option(PluginFramework
+               "Build the Plugin Framework" OFF
+               CTK_ENABLE_PluginFramework)
+
+ctk_lib_option(Widgets
+               "Build the Widgets library" OFF
+               CTK_ENABLE_Widgets OR (CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES))
+               
+ctk_lib_option(DICOM/Core
+               "Build the DICOM Core library" OFF
+               CTK_ENABLE_DICOM OR (CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES))
+               
+ctk_lib_option(DICOM/Widgets
+               "Build the DICOM Widgets library" OFF
+               CTK_ENABLE_DICOM AND CTK_ENABLE_Widgets OR (CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES))
+               
+ctk_lib_option(ImageProcessing/ITK/Core
+               "Build the ITK Core library" OFF)
+               
+ctk_lib_option(Scripting/Python/Core
+               "Build the Python Core library" OFF)
+               
+ctk_lib_option(Scripting/Python/Widgets
+               "Build the Python Widgets library" OFF
+               CTK_LIB_Widgets AND CTK_ENABLE_Python_Wrapping)
+               
+ctk_lib_option(Visualization/VTK/Core
+               "Build the VTK Core library" OFF)
+               
+ctk_lib_option(Visualization/VTK/Widgets
+               "Build the VTK Widgets library" OFF)
+               
+#ctk_lib_option(ModuleDescription
+#               "Build the Command Line Module Description library" OFF)
+
+#ctk_lib_option(Visualization/XIP
+#               "Build the XIP library" OFF)
+
+#-----------------------------------------------------------------------------
+# CTK Applications - Use ON or OFF to indicate if the application should be built by default
 #
-set(CTK_LIBS_SUBDIRS )
-set(CTK_PLUGINS_SUBDIRS )
-set(CTK_APPLICATIONS_SUBDIRS )
+ 
+#ctk_app_option(ctkCLIPluginExplorer "Build the CLI Plugin Explorer" OFF)
+
+ctk_app_option(ctkDICOM
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMIndexer
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMDemoSCU
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMQuery
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMRetrieve
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMQueryRetrieve
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkExampleHost
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkExampleHostedApp
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkEventBusDemo
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkPluginBrowser
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkPluginGenerator
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkDICOMObjectViewer
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
+               
+ctk_app_option(ctkSimplePythonShell
+               "Build the DICOM example application" OFF
+               CTK_ENABLE_Python_Wrapping AND CTK_BUILD_EXAMPLES)
+
+# Save the set of enabled apps in a cache file
+set(_enabled_apps)
+foreach(_app ${CTK_APPS})
+  if(CTK_APP_${_app})
+    list(APPEND _enabled_apps ${_app})
+  endif()
+endforeach()
+set(CTK_ENABLED_APPS ${_enabled_apps} CACHE INTERNAL "" FORCE)
+
+#-----------------------------------------------------------------------------
+# CTK Plugins - none of them is build by default
+#
+
+# Plugins in the list below are not build by default
+set(plugin_list
+  # Optional plug-ins implementings interfaces in PluginFramework/service/
+  org.commontk.configadmin
+  org.commontk.eventadmin
+  org.commontk.log
+  org.commontk.log4qt
+  org.commontk.metatype
+
+  # Misc
+  org.commontk.slicermodule
+  )
+
+foreach(_plugin ${plugin_list})  
+  ctk_plugin_option(${_plugin} "Build the ${_plugin} plugin." OFF)
+endforeach()
+
+# Plug-ins related to the PluginGenerator application
+ctk_plugin_option(org.commontk.plugingenerator.core "Build the org.commontk.plugingenerator.core plugin." OFF)
+ctk_plugin_option(org.commontk.plugingenerator.ui
+                  "Build the org.commontk.plugingenerator.ui plugin." OFF
+                  CTK_APP_ctkPluginGenerator)
+
+# Plug-ins related to DICOM WG23 (Application Hosting)
+ctk_plugin_option(org.commontk.dah.core "Build the org.commontk.dah.core plugin." OFF)
+ctk_plugin_option(org.commontk.dah.app "Build the org.commontk.dah.app plugin." OFF)
+ctk_plugin_option(org.commontk.dah.host "Build the org.commontk.dah.host plugin." OFF)
+                  
+ctk_plugin_option(org.commontk.dah.exampleapp
+                  "Build the org.commontk.dah.exampleapp plugin." OFF
+                  CTK_APP_ctkExampleHostedApp)
+                  
+ctk_plugin_option(org.commontk.dah.examplehost
+                  "Build the org.commontk.dah.examplehost plugin." OFF
+                  CTK_APP_ctkExampleHost)
+
+# Plug-ins related to the EventBus demo application
+ctk_plugin_option(org.commontk.eventbus
+                  "Build the org.commontk.eventbus plugin." OFF
+                  CTK_APP_ctkEventBusDemo)
 
 #-----------------------------------------------------------------------------
-# Build options associated with CTK libraries
+# Generate target_directories list - List of directory corresponding to the different
+# libraries, plugins and applications associated with the corresponding option name.
 #
 # The following FOREACH loops are used to:
-#   1) Add build options associated with either libraries, plugins and applications
-#   2) Update either CTK_LIBS_SUBDIRS, CTK_PLUGINS_SUBDIRS or CTK_APPS_SUBDIRS variables
+#   1) Update either CTK_LIBS_SUBDIRS, CTK_PLUGINS_SUBDIRS or CTK_APPS_SUBDIRS variables
 #
 # For CTK libraries, if the file Libs/<DIR>/<LIBNAME>/ctk_library_options.cmake exists,
 # in addition to 'CTK_LIB_<DIR>/<LIBNAME>' option, the following ones
@@ -447,52 +594,23 @@ set(CTK_APPLICATIONS_SUBDIRS )
 #       OPT2:ON
 #       )
 
-# Build options associated with CTK libraries
-set(ctk_lib_options_list) # This list will be updated in ctkFunctionExtractOptionNameAndValue
-foreach(lib ${CTK_LIBS})
-  ctkFunctionExtractOptionNameAndValue(${lib} lib_name lib_value)
-  option(CTK_LIB_${lib_name} "Enable ${lib_name} Library." ${lib_value})
-  if(CTK_LIB_${lib_name})
-    ctkMacroAddCtkLibraryOptions(${lib_name})
-  endif()
-  list(APPEND CTK_LIBS_SUBDIRS "${lib_name}")
-endforeach()
-
-# Build options associated with CTK plugins
-foreach(plugin ${CTK_PLUGINS})
-  ctkFunctionExtractOptionNameAndValue(${plugin} plugin_name plugin_value)
-  option(CTK_PLUGIN_${plugin_name} "Build ${plugin_name} Plugin." ${plugin_value})
-  list(APPEND CTK_PLUGINS_SUBDIRS "${plugin_name}")
-endforeach()
-
-# Build options associated with CTK applications
-foreach(app ${CTK_APPLICATIONS})
-  ctkFunctionExtractOptionNameAndValue(${app} app_name app_value)
-  option(CTK_APP_${app_name} "Build ${app_name} Application." ${app_value})
-  list(APPEND CTK_APPLICATIONS_SUBDIRS "${app_name}")
-endforeach()
-
-#-----------------------------------------------------------------------------
-# Generate target_directories list - List of directory corresponding to the different
-# libraries, plugins and applications associated with the corresponding option name.
-#
-
 # Create list of directories corresponding to the enabled targets
 set(target_directories)
 
-foreach(lib ${CTK_LIBS_SUBDIRS})
-  set(option_name CTK_LIB_${lib})
-  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Libs/${lib}^^${option_name}")
+set(ctk_lib_options_list) # This list will be updated in ctkMacroAddCtkLibraryOptions
+foreach(lib ${CTK_LIBS})
+  if(CTK_LIB_${lib})
+    ctkMacroAddCtkLibraryOptions(${lib})
+  endif()
+  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Libs/${lib}^^CTK_LIB_${lib}")
 endforeach()
 
-foreach(plugin ${CTK_PLUGINS_SUBDIRS})
-  set(option_name CTK_PLUGIN_${plugin})
-  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${plugin}^^${option_name}")
+foreach(plugin ${CTK_PLUGINS})
+  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${plugin}^^CTK_PLUGIN_${plugin}")
 endforeach()
 
-foreach(app ${CTK_APPLICATIONS_SUBDIRS})
-  set(option_name CTK_APP_${app})
-  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${app}^^${option_name}")
+foreach(app ${CTK_APPS})
+  list(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${app}^^CTK_APP_${app}")
 endforeach()
 
 #message(STATUS target_directories:${target_directories})
@@ -526,26 +644,34 @@ ctkFunctionGenerateDGraphInput(${CTK_BINARY_DIR} "${target_directories}" WITH_EX
 ctkMacroValidateBuildOptions("${CTK_BINARY_DIR}" "${DGraph_EXECUTABLE}" "${target_directories}")
 
 #-----------------------------------------------------------------------------
-# CTK Python wrapping - Propose the option only if CTK_LIB_Scriping/Python/Core is ON
+# CTK Python wrapping
+# Enable CTK_LIB_Scripting/Python/Core if either CTK_ENABLE_Python_Wrapping OR CTK_WRAP_PYTHONQT_FULL
+#
+set(CTK_WRAP_PYTHONQT_LIGHT ${CTK_ENABLE_Python_Wrapping})
+option(CTK_WRAP_PYTHONQT_FULL "Experimental - Wrap CTK classes using Qt meta-object system into Python language" OFF)
+mark_as_advanced(CTK_WRAP_PYTHONQT_FULL)
+if(CTK_WRAP_PYTHONQT_FULL AND CTK_WRAP_PYTHONQT_LIGHT)
+  message(FATAL_ERROR "CTK_ENABLE_Python_Wrapping AND CTK_WRAP_PYTHONQT_FULL options are mutually exclusive. Please enable only one !")
+endif()
+
+set(logical_expr CTK_WRAP_PYTHONQT_LIGHT OR CTK_WRAP_PYTHONQT_FULL)
+if((${logical_expr}) AND NOT CTK_LIB_Scripting/Python/Core)
+  set(CTK_LIB_Scripting/Python/Core ON CACHE BOOL "Build the Python Core library" FORCE)
+  set(enabling_msg)
+  ctk_option_logical_expression_to_message(enabling_msg "${logical_expr}")
+  message("Enabling [CTK_LIB_Scripting/Python/Core] because of [${enabling_msg}] evaluates to True")
+endif()
+
+# Check if dependencies are satisfied
 if(CTK_LIB_Scripting/Python/Core)
   find_package(PythonInterp)
   if(NOT PYTHONINTERP_FOUND)
-    message(SEND_ERROR "PYTHON_EXECUTABLE variable should be set to build CTK_LIB_Scripting/Python")
+    message(FATAL_ERROR "PYTHON_EXECUTABLE variable should be set to build CTK_LIB_Scripting/Python")
   endif()
   find_package(PythonLibs)
   if(NOT PYTHONLIBS_FOUND)
     message(FATAL_ERROR "PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS should be set to build CTK_LIB_Scripting/Python")
   endif()
-  option(CTK_WRAP_PYTHONQT_FULL "Experimental - Wrap CTK classes using Qt meta-object system into Python language" OFF)
-  mark_as_advanced(CTK_WRAP_PYTHONQT_FULL)
-  option(CTK_WRAP_PYTHONQT_LIGHT "Wrap CTK classes using Qt meta-object system into Python language" OFF)
-  if(CTK_WRAP_PYTHONQT_FULL AND CTK_WRAP_PYTHONQT_LIGHT)
-    message(SEND_ERROR "CTK_WRAP_PYTHONQT_{LIGHT,FULL} options are mutually exclusive. Please enable only one !")
-  endif()
-else()
-  # Note that an unset boolean variable is considered to be False
-  unset(CTK_WRAP_PYTHONQT_FULL CACHE)
-  unset(CTK_WRAP_PYTHONQT_LIGHT CACHE)
 endif()
 
 #-----------------------------------------------------------------------------
@@ -705,7 +831,7 @@ endif()
 #-----------------------------------------------------------------------------
 # Add CTK library subdirectories
 #
-foreach(lib ${CTK_LIBS_SUBDIRS})
+foreach(lib ${CTK_LIBS})
   IF (CTK_LIB_${lib})
     add_subdirectory(Libs/${lib})
   endif()
@@ -714,7 +840,7 @@ endforeach()
 #-----------------------------------------------------------------------------
 # Add CTK plugin subdirectories
 #
-foreach(plugin ${CTK_PLUGINS_SUBDIRS})
+foreach(plugin ${CTK_PLUGINS})
   if(CTK_PLUGIN_${plugin})
     add_subdirectory(Plugins/${plugin})
   endif()
@@ -723,7 +849,7 @@ endforeach()
 #-----------------------------------------------------------------------------
 # Add CTK application subdirectories
 #
-foreach(app ${CTK_APPLICATIONS_SUBDIRS})
+foreach(app ${CTK_APPS})
   IF (CTK_APP_${app})
     add_subdirectory(Applications/${app})
   endif()

+ 1 - 1
Libs/DICOM/Core/CMakeLists.txt

@@ -92,7 +92,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
+#if(CTK_BUILD_QTDESIGNER_PLUGINS)
 #  add_subdirectory(Plugins)
 #endif()
 

+ 1 - 1
Libs/DICOM/Widgets/CMakeLists.txt

@@ -88,7 +88,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-if(BUILD_QTDESIGNER_PLUGINS)
+if(CTK_BUILD_QTDESIGNER_PLUGINS)
   add_subdirectory(Plugins)
 endif()
 

+ 1 - 1
Libs/ImageProcessing/ITK/Core/CMakeLists.txt

@@ -54,7 +54,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
+#if(CTK_BUILD_QTDESIGNER_PLUGINS)
 #  add_subdirectory(Plugins)
 #endif()
 

+ 0 - 67
Libs/Messaging/Core/CMakeLists.txt

@@ -1,67 +0,0 @@
-project(CTKMessagingCore)
-
-#
-# See CTK/CMake/ctkMacroBuildLib.cmake for details
-#
-
-set(KIT_export_directive "CTK_MESSAGING_CORE_EXPORT")
-
-
-# Source files
-set(KIT_SRCS
-  ctkMessagingServer.h
-  ctkMessagingServer.cpp
-  ctkMessagingClient.h
-  ctkMessagingClient.cpp
-  )
-
-# Headers that should run through moc
-set(KIT_MOC_SRCS
-  )
-
-# UI files
-set(KIT_UI_FORMS
-  )
-
-# Resources
-set(KIT_resources
-  )
-
-# Set VTK_LIBRARIES variable
-#set(ZMQ_LIBRARIES
-#  vtkCommon
-#  vtkFiltering
-#  )
-
-# Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
-# The following macro will read the target libraries from the file 'target_libraries.cmake'
-ctkFunctionGetTargetLibraries(KIT_target_libraries)
-
-ctkMacroBuildLib(
-  NAME ${PROJECT_NAME}
-  EXPORT_DIRECTIVE ${KIT_export_directive}
-  SRCS ${KIT_SRCS}
-  MOC_SRCS ${KIT_MOC_SRCS}
-  UI_FORMS ${KIT_UI_FORMS}
-  TARGET_LIBRARIES ${KIT_target_libraries}
-  RESOURCES ${KIT_resources}
-  LIBRARY_TYPE ${CTK_LIBRARY_MODE}
-  )
-
-if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
-  ctkMacroBuildLibWrapper(
-    TARGET ${PROJECT_NAME}
-    SRCS ${KIT_SRCS}
-    WRAPPER_LIBRARY_TYPE ${CTK_LIBRARY_MODE}
-    )
-endif()
-
-# Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
-#  add_subdirectory(Plugins)
-#endif()
-
-# Testing
-if(BUILD_TESTING)
-  add_subdirectory(Testing)
-endif()

+ 0 - 20
Libs/Messaging/Core/Testing/CMakeLists.txt

@@ -1,20 +0,0 @@
-set(KIT ${PROJECT_NAME})
-
-create_test_sourcelist(Tests ${KIT}CppTests.cpp
-  ctkMessagingServerTest1.cpp
-  #EXTRA_INCLUDE TestingMacros.h
-  )
-
-SET (TestsToRun ${Tests})
-REMOVE (TestsToRun ${KIT}CppTests.cpp)
-
-set(LIBRARY_NAME ${PROJECT_NAME})
-
-add_executable(${KIT}CppTests ${Tests})
-target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES})
-
-#
-# Add Tests
-#
-
-SIMPLE_TEST( ctkMessagingServerTest1 )

+ 0 - 37
Libs/Messaging/Core/Testing/ctkMessagingServerTest1.cpp

@@ -1,37 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
-
-  Copyright (c) Kitware Inc.
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0.txt
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=========================================================================*/
-
-// CTK includes
-#include "ctkMessagingServer.h"
-#include "ctkModelTester.h"
-
-// STD includes
-#include <cstdlib>
-#include <iostream>
-
-//-----------------------------------------------------------------------------
-int ctkMessagingServerTest1(int argc, char * argv [] )
-{
-  
-  ctkMessagingServer * server = new ctkMessagingServer;
-
-  return EXIT_SUCCESS;
-}
-

+ 0 - 39
Libs/Messaging/Core/ctkMessagingClient.cpp

@@ -1,39 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
-
-  Copyright (c) Kitware Inc.
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0.txt
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=========================================================================*/
-
-// ZMQ includes
-
-// ctkMessagingCore includes
-#include "ctkMessagingClient.h"
-
-// STD includes
-#include <iostream>
-
-
-//------------------------------------------------------------------------------
-ctkMessagingClient::ctkMessagingClient()/*:d_ptr(new ctkMessagingClientPrivate)*/
-{
-}
-
-//----------------------------------------------------------------------------
-ctkMessagingClient::~ctkMessagingClient()
-{
-}
-

+ 0 - 46
Libs/Messaging/Core/ctkMessagingClient.h

@@ -1,46 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
-
-  Copyright (c) Kitware Inc.
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0.txt
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=========================================================================*/
-
-#ifndef __ctkMessagingClient_h
-#define __ctkMessagingClient_h
-
-// ZMQ includes 
-#include <zmq.hpp>
-#include "ctkMessagingCoreExport.h"
-
-//class ctkMessagingClientPrivate;
-
-class CTK_MESSAGING_CORE_EXPORT ctkMessagingClient
-{
-public:
-  //typedef QObject Superclass;
-  explicit ctkMessagingClient();
-  virtual ~ctkMessagingClient();
-  
-
-//protected:
-//  QScopedPointer<ctkMessagingClientPrivate> d_ptr;
-//private:
-//  Q_DECLARE_PRIVATE(ctkMessagingClient);
-//  Q_DISABLE_COPY(ctkMessagingClient);
-
-};
-
-#endif

+ 0 - 44
Libs/Messaging/Core/ctkMessagingServer.cpp

@@ -1,44 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
-
-  Copyright (c) Kitware Inc.
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0.txt
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=========================================================================*/
-
-// ZMQ includes
-
-// ctkMessagingCore includes
-#include "ctkMessagingServer.h"
-
-// STD includes
-#include <iostream>
-
-
-//------------------------------------------------------------------------------
-ctkMessagingServer::ctkMessagingServer()/*:d_ptr(new ctkMessagingServerPrivate)*/
-{
-  zmq::context_t ctx (1, 1);
-
-  // Create a PUB socket for port 5555 on the lo interface
-  zmq::socket_t s(ctx, ZMQ_PUB);
-  //s.bind ("tcp://lo0:5555");
-}
-
-//----------------------------------------------------------------------------
-ctkMessagingServer::~ctkMessagingServer()
-{
-}
-

+ 0 - 46
Libs/Messaging/Core/ctkMessagingServer.h

@@ -1,46 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
-
-  Copyright (c) Kitware Inc.
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0.txt
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=========================================================================*/
-
-#ifndef __ctkMessagingServer_h
-#define __ctkMessagingServer_h
-
-// ZMQ includes 
-#include <zmq.hpp>
-#include "ctkMessagingCoreExport.h"
-
-//class ctkMessagingServerPrivate;
-
-class CTK_MESSAGING_CORE_EXPORT ctkMessagingServer
-{
-public:
-  //typedef QObject Superclass;
-  explicit ctkMessagingServer();
-  virtual ~ctkMessagingServer();
-  
-
-//protected:
-//  QScopedPointer<ctkMessagingServerPrivate> d_ptr;
-//private:
-//  Q_DECLARE_PRIVATE(ctkMessagingServer);
-//  Q_DISABLE_COPY(ctkMessagingServer);
-
-};
-
-#endif

+ 0 - 11
Libs/Messaging/Core/target_libraries.cmake

@@ -1,11 +0,0 @@
-#
-# See CMake/ctkFunctionGetTargetLibraries.cmake
-# 
-# This file should list the libraries required to build the current CTK libraries
-#
-
-set(target_libraries
-  #OpenIGTLink_LIBRARIES
-  ZMQ_LIBRARIES
-  CTKCore
-  )

+ 1 - 1
Libs/Scripting/Python/Core/CMakeLists.txt

@@ -67,7 +67,7 @@ ctkMacroBuildLib(
   )
 
 # Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
+#if(CTK_BUILD_QTDESIGNER_PLUGINS)
 #  add_subdirectory(Plugins)
 #endif()
 

+ 1 - 1
Libs/Scripting/Python/Widgets/CMakeLists.txt

@@ -57,7 +57,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-if(BUILD_QTDESIGNER_PLUGINS)
+if(CTK_BUILD_QTDESIGNER_PLUGINS)
   add_subdirectory(Plugins)
 endif()
 

+ 1 - 1
Libs/Visualization/VTK/Core/CMakeLists.txt

@@ -93,7 +93,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
+#if(CTK_BUILD_QTDESIGNER_PLUGINS)
 #  add_subdirectory(Plugins)
 #endif()
 

+ 1 - 1
Libs/Visualization/VTK/Widgets/CMakeLists.txt

@@ -139,7 +139,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-if(BUILD_QTDESIGNER_PLUGINS)
+if(CTK_BUILD_QTDESIGNER_PLUGINS)
   add_subdirectory(Plugins)
 endif()
 

+ 1 - 1
Libs/Visualization/XIP/CMakeLists.txt

@@ -50,7 +50,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-#if(BUILD_QTDESIGNER_PLUGINS)
+#if(CTK_BUILD_QTDESIGNER_PLUGINS)
 #  add_subdirectory(Plugins)
 #endif()
 

+ 1 - 1
Libs/Widgets/CMakeLists.txt

@@ -290,7 +290,7 @@ if(CTK_WRAP_PYTHONQT_FULL OR CTK_WRAP_PYTHONQT_LIGHT)
 endif()
 
 # Plugins
-if(BUILD_QTDESIGNER_PLUGINS)
+if(CTK_BUILD_QTDESIGNER_PLUGINS)
   add_subdirectory(Plugins)
 endif()
 

+ 4 - 4
SuperBuild.cmake

@@ -52,17 +52,17 @@ find_package(Doxygen QUIET)
 # Generate cmake variable name corresponding to Libs, Plugins and Applications
 #
 set(ctk_libs_bool_vars)
-foreach(lib ${CTK_LIBS_SUBDIRS})
+foreach(lib ${CTK_LIBS})
   list(APPEND ctk_libs_bool_vars CTK_LIB_${lib})
 endforeach()
 
 set(ctk_plugins_bool_vars)
-foreach(plugin ${CTK_PLUGINS_SUBDIRS})
+foreach(plugin ${CTK_PLUGINS})
   list(APPEND ctk_plugins_bool_vars CTK_PLUGIN_${plugin})
 endforeach()
 
 set(ctk_applications_bool_vars)
-foreach(app ${CTK_APPLICATIONS_SUBDIRS})
+foreach(app ${CTK_APPS})
   list(APPEND ctk_applications_bool_vars CTK_APP_${app})
 endforeach()
 
@@ -72,7 +72,7 @@ endforeach()
 
 set(ctk_cmake_boolean_args
   BUILD_TESTING
-  BUILD_QTDESIGNER_PLUGINS
+  CTK_BUILD_QTDESIGNER_PLUGINS
   CTK_USE_KWSTYLE
   WITH_COVERAGE
   DOCUMENTATION_TARGET_IN_ALL