PythonQtGenerator.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #
  2. # PythonQtGenerator
  3. #
  4. SET(PythonQtGenerator_DEPENDS)
  5. IF(CTK_WRAP_PYTHONQT_FULL)
  6. # Sanity checks
  7. IF(DEFINED PYTHONQTGENERATOR_EXECUTABLE AND NOT EXISTS ${PYTHONQTGENERATOR_EXECUTABLE})
  8. MESSAGE(FATAL_ERROR "PYTHONQTGENERATOR_EXECUTABLE variable is defined but corresponds to non-existing executable")
  9. ENDIF()
  10. IF(NOT DEFINED PYTHONQTGENERATOR_EXECUTABLE)
  11. #
  12. # PythonQtGenerator is the tool allowing to generate the PythonQt decorators using
  13. # typesystem xml files. If called without any option, it will generate the bindings for Qt.
  14. #
  15. # See http://www.pyside.org/docs/apiextractor/typesystem.html
  16. # See http://doc.trolltech.com/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-typesystem.html
  17. # See http://qt.gitorious.org/qt-labs/qtscriptgenerator
  18. #
  19. SET(proj PythonQtGenerator)
  20. # MESSAGE(STATUS "Adding project:${proj}")
  21. SET(PythonQtGenerator_DEPENDS ${proj})
  22. #
  23. # If directory PythonQt already exists, the corresponding project will
  24. # be cloned. Since PythonQt and PythonQtGenerator source code are hosted
  25. # on the same repository, we will assume that if the directory PythonQt
  26. # exists, the generator code will also be available.
  27. #
  28. IF(EXISTS ${ep_source_dir}/PythonQt)
  29. #MESSAGE(STATUS "ExternalProject/PythonQtGenerator: PythonQt already added as ExternalProject")
  30. ExternalProject_Add(${proj}
  31. DOWNLOAD_COMMAND ""
  32. CMAKE_GENERATOR ${gen}
  33. INSTALL_COMMAND ""
  34. SOURCE_DIR ${ep_source_dir}/PythonQt/generator
  35. CMAKE_ARGS
  36. ${ep_common_args}
  37. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  38. DEPENDS
  39. "PythonQt" # To make sure the generator code is checked out, let's depent on PythonQt
  40. )
  41. ELSE()
  42. #MESSAGE(STATUS "ExternalProject/PythonQtGenerator: PythonQt is NOT an ExternalProject")
  43. ExternalProject_Add(${proj}
  44. GIT_REPOSITORY "${git_protocol}://github.com/commontk/PythonQt.git"
  45. GIT_TAG "patched"
  46. CMAKE_GENERATOR ${gen}
  47. INSTALL_COMMAND ""
  48. SOURCE_DIR ${ep_source_dir}/${proj}/generator
  49. CMAKE_ARGS
  50. ${ep_common_args}
  51. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  52. )
  53. ENDIF()
  54. SET(PYTHONQTGENERATOR_EXECUTABLE ${ep_build_dir}/PythonQtGenerator/PythonQtGenerator)
  55. # Since PythonQtGenerator is an executable, there is no need to add its corresponding
  56. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  57. ENDIF()
  58. ENDIF()