PythonQtGenerator.cmake 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 ${CMAKE_BINARY_DIR}/PythonQt)
  29. #MESSAGE(STATUS "ExternalProject/PythonQtGenerator: PythonQt already added as ExternalProject")
  30. ExternalProject_Add(${proj}
  31. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  32. BINARY_DIR ${proj}-build
  33. PREFIX ${proj}${ep_suffix}
  34. DOWNLOAD_COMMAND ""
  35. CMAKE_GENERATOR ${gen}
  36. INSTALL_COMMAND ""
  37. SOURCE_DIR ${CMAKE_BINARY_DIR}/PythonQt/generator
  38. CMAKE_ARGS
  39. ${ep_common_args}
  40. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  41. DEPENDS
  42. "PythonQt" # To make sure the generator code is checked out, let's depent on PythonQt
  43. )
  44. ELSE()
  45. #MESSAGE(STATUS "ExternalProject/PythonQtGenerator: PythonQt is NOT an ExternalProject")
  46. ExternalProject_Add(${proj}
  47. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  48. BINARY_DIR ${proj}-build
  49. PREFIX ${proj}${ep_suffix}
  50. GIT_REPOSITORY "${git_protocol}://github.com/commontk/PythonQt.git"
  51. GIT_TAG "patched"
  52. CMAKE_GENERATOR ${gen}
  53. INSTALL_COMMAND ""
  54. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}/generator
  55. CMAKE_ARGS
  56. ${ep_common_args}
  57. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  58. )
  59. ENDIF()
  60. SET(PYTHONQTGENERATOR_EXECUTABLE ${CMAKE_BINARY_DIR}/PythonQtGenerator/PythonQtGenerator)
  61. # Since PythonQtGenerator is an executable, there is no need to add its corresponding
  62. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  63. ENDIF()
  64. LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DPYTHONQTGENERATOR_EXECUTABLE:FILEPATH=${PYTHONQTGENERATOR_EXECUTABLE})
  65. ENDIF()