PythonQtGenerator.cmake 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #
  2. # PythonQtGenerator
  3. #
  4. if(CTK_WRAP_PYTHONQT_FULL)
  5. # Sanity checks
  6. if(DEFINED PYTHONQTGENERATOR_EXECUTABLE AND NOT EXISTS ${PYTHONQTGENERATOR_EXECUTABLE})
  7. message(FATAL_ERROR "PYTHONQTGENERATOR_EXECUTABLE variable is defined but corresponds to non-existing executable")
  8. endif()
  9. set(proj PythonQtGenerator)
  10. set(proj_DEPENDENCIES)
  11. list(APPEND CTK_DEPENDENCIES ${proj})
  12. if(CTK_SUPERBUILD)
  13. if(NOT DEFINED PYTHONQTGENERATOR_EXECUTABLE)
  14. #
  15. # PythonQtGenerator is the tool allowing to generate the PythonQt decorators using
  16. # typesystem xml files. If called without any option, it will generate the bindings for Qt.
  17. #
  18. # See http://www.pyside.org/docs/apiextractor/typesystem.html
  19. # See http://doc.trolltech.com/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-typesystem.html
  20. # See http://qt.gitorious.org/qt-labs/qtscriptgenerator
  21. #
  22. # message(STATUS "Adding project:${proj}")
  23. #
  24. # If directory PythonQt already exists, the corresponding project will
  25. # be cloned. Since PythonQt and PythonQtGenerator source code are hosted
  26. # on the same repository, we will assume that if the directory PythonQt
  27. # exists, the generator code will also be available.
  28. #
  29. if(EXISTS ${CMAKE_BINARY_DIR}/PythonQt)
  30. #message(STATUS "ExternalProject/PythonQtGenerator: PythonQt already added as ExternalProject")
  31. ExternalProject_Add(${proj}
  32. SOURCE_DIR ${CMAKE_BINARY_DIR}/PythonQt/generator
  33. BINARY_DIR ${proj}-build
  34. PREFIX ${proj}${ep_suffix}
  35. DOWNLOAD_COMMAND ""
  36. CMAKE_GENERATOR ${gen}
  37. INSTALL_COMMAND ""
  38. CMAKE_CACHE_ARGS
  39. ${ep_common_cache_args}
  40. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  41. DEPENDS
  42. "PythonQt" # To make sure the generator code is checked out, let's depend on PythonQt
  43. )
  44. else()
  45. set(revision_tag 3171a94e16ba9bfee137)
  46. if(${proj}_REVISION_TAG)
  47. set(revision_tag ${${proj}_REVISION_TAG})
  48. endif()
  49. #message(STATUS "ExternalProject/PythonQtGenerator: PythonQt is NOT an ExternalProject")
  50. ExternalProject_Add(${proj}
  51. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  52. BINARY_DIR ${proj}-build
  53. PREFIX ${proj}${ep_suffix}
  54. GIT_REPOSITORY "${git_protocol}://github.com/commontk/PythonQt.git"
  55. GIT_TAG 3171a94e16ba9bfee137
  56. CMAKE_GENERATOR ${gen}
  57. UPDATE_COMMAND ""
  58. INSTALL_COMMAND ""
  59. CMAKE_CACHE_ARGS
  60. ${ep_common_cache_args}
  61. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  62. )
  63. endif()
  64. set(PYTHONQTGENERATOR_EXECUTABLE ${CMAKE_BINARY_DIR}/PythonQtGenerator-build/PythonQtGenerator)
  65. # Since PythonQtGenerator is an executable, there is no need to add its corresponding
  66. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  67. endif()
  68. list(APPEND CTK_SUPERBUILD_EP_VARS PYTHONQTGENERATOR_EXECUTABLE:FILEPATH)
  69. endif()
  70. endif()