Quellcode durchsuchen

Merge topic 'fix-ctkSimplePythonShell-linkage-and-test-errors'

* fix-ctkSimplePythonShell-linkage-and-test-errors:
  Include python test depending on Qt bindings only when possible
  Limit the decorators built-in ctkSimplePythonShell to Core and Widgets
Jean-Christophe Fillion-Robin vor 14 Jahren
Ursprung
Commit
7d84d23e68

+ 13 - 2
Applications/ctkSimplePythonShell/CMakeLists.txt

@@ -74,8 +74,19 @@ IF(CTK_WRAP_PYTHONQT_LIGHT OR CTK_WRAP_PYTHONQT_FULL)
   # and set variables holding list of pythonqt initialization method
   SET(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION)
   SET(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL)
-
-  FOREACH(lib_name ${CTK_WRAPPED_LIBRARIES_PYTHONQT})
+  
+  # To avoid the complex process of resolving the dependencies associated with each 
+  # external project required by each decorator. For now, let's just include the decorator 
+  # associated with CTKCore and CTKWidgets.
+  SET(MY_CTK_WRAPPED_LIBRARIES_PYTHONQT)
+  IF(CTK_LIB_Core)
+    LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKCore)
+  ENDIF()
+  IF(CTK_LIB_Widgets)
+    LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKWidgets)
+  ENDIF()
+  
+  FOREACH(lib_name ${MY_CTK_WRAPPED_LIBRARIES_PYTHONQT})
 
     LIST(APPEND KIT_target_libraries ${lib_name}PythonQt)
 

+ 8 - 2
Applications/ctkSimplePythonShell/Testing/Python/CMakeLists.txt

@@ -2,16 +2,22 @@
 SET(KIT_TESTS ${CPP_TEST_PATH}/ctkSimplePythonShell)
 
 SET(SCRIPTS
-  derivedQWidgetTest.py
   wrappedQInvokableTest.py
   wrappedQPropertyTest.py
   wrappedSlotTest.py
   )
 
-IF(CTK_LIB_Widgets)
+# Since QTimer is part of QtCore and is used in both 'ctkWidgetsTest.py' and 'derivedQWidgetTest.py', 
+# these two tests should be included only if CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE is ON
+
+IF(CTK_LIB_Widgets AND CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE)
   LIST(APPEND SCRIPTS ctkWidgetsTest.py)
 ENDIF()
 
+IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE AND CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI)
+  LIST(APPEND SCRIPTS derivedQWidgetTest.py)
+ENDIF()
+
 IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
   LIST(APPEND SCRIPTS
     vtkPythonSmoke.py