PythonQtGenerator.cmake 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. set(location_args )
  50. if(${proj}_URL)
  51. set(location_args URL ${${proj}_URL})
  52. elseif(${proj}_GIT_REPOSITORY)
  53. set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY}
  54. GIT_TAG ${revision_tag})
  55. else()
  56. set(location_args GIT_REPOSITORY "${git_protocol}://github.com/commontk/PythonQt.git"
  57. GIT_TAG ${revision_tag})
  58. endif()
  59. #message(STATUS "ExternalProject/PythonQtGenerator: PythonQt is NOT an ExternalProject")
  60. ExternalProject_Add(${proj}
  61. SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
  62. BINARY_DIR ${proj}-build
  63. PREFIX ${proj}${ep_suffix}
  64. ${location_args}
  65. CMAKE_GENERATOR ${gen}
  66. UPDATE_COMMAND ""
  67. INSTALL_COMMAND ""
  68. CMAKE_CACHE_ARGS
  69. ${ep_common_cache_args}
  70. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  71. )
  72. endif()
  73. set(PYTHONQTGENERATOR_EXECUTABLE ${CMAKE_BINARY_DIR}/PythonQtGenerator-build/PythonQtGenerator)
  74. # Since PythonQtGenerator is an executable, there is no need to add its corresponding
  75. # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
  76. endif()
  77. list(APPEND CTK_SUPERBUILD_EP_VARS PYTHONQTGENERATOR_EXECUTABLE:FILEPATH)
  78. endif()
  79. endif()