ctkMacroGeneratePluginManifest.cmake 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #
  2. # Depends on:
  3. # CTK/CMake/ctkMacroParseArguments.cmake
  4. #
  5. MACRO(ctkMacroGeneratePluginManifest QRC_SRCS)
  6. CtkMacroParseArguments(MY
  7. "ACTIVATIONPOLICY;CATEGORY;CONTACT_ADDRESS;COPYRIGHT;DESCRIPTION;DOC_URL;ICON;LICENSE;NAME;REQUIRE_PLUGIN;SYMBOLIC_NAME;VENDOR;VERSION"
  8. ""
  9. ${ARGN}
  10. )
  11. # Sanity checks
  12. IF(NOT DEFINED MY_SYMBOLIC_NAME)
  13. MESSAGE(SEND_ERROR "SYMBOLIC_NAME is mandatory")
  14. ENDIF()
  15. SET(_manifest_content "Plugin-SymbolicName: ${MY_SYMBOLIC_NAME}")
  16. IF(DEFINED MY_ACTIVATIONPOLICY)
  17. STRING(TOLOWER "${MY_ACTIVATIONPOLICY}" _activation_policy)
  18. IF(_activation_policy STREQUAL "eager")
  19. SET(_manifest_content "${_manifest_content}\nPlugin-ActivationPolicy: eager")
  20. ELSE()
  21. MESSAGE(SEND_ERROR "ACTIVATIONPOLICY is set to '${MY_ACTIVATIONPOLICY}', which is not supported")
  22. ENDIF()
  23. ENDIF()
  24. IF(DEFINED MY_CATEGORY)
  25. SET(_manifest_content "${_manifest_content}\nPlugin-Category: ${MY_CATEGORY}")
  26. ENDIF()
  27. IF(DEFINED MY_CONTACT_ADDRESS)
  28. SET(_manifest_content "${_manifest_content}\nPlugin-ContactAddress: ${MY_CONTACT_ADDRESS}")
  29. ENDIF()
  30. IF(DEFINED MY_COPYRIGHT)
  31. SET(_manifest_content "${_manifest_content}\nPlugin-Copyright: ${MY_COPYRIGHT}")
  32. ENDIF()
  33. IF(DEFINED MY_DESCRIPTION)
  34. SET(_manifest_content "${_manifest_content}\nPlugin-Description: ${MY_DESCRIPTION}")
  35. ENDIF()
  36. IF(DEFINED MY_DOC_URL)
  37. SET(_manifest_content "${_manifest_content}\nPlugin-DocURL: ${MY_DOC_URL}")
  38. ENDIF()
  39. IF(DEFINED MY_ICON)
  40. SET(_manifest_content "${_manifest_content}\nPlugin-Icon: ${MY_ICON}")
  41. ENDIF()
  42. IF(DEFINED MY_LICENSE)
  43. SET(_manifest_content "${_manifest_content}\nPlugin-License: ${MY_LICENSE}")
  44. ENDIF()
  45. IF(DEFINED MY_NAME)
  46. SET(_manifest_content "${_manifest_content}\nPlugin-Name: ${MY_NAME}")
  47. ENDIF()
  48. IF(DEFINED MY_REQUIRE_PLUGIN)
  49. SET(_manifest_content "${_manifest_content}\nRequire-Plugin: ${MY_REQUIRE_PLUGIN}")
  50. ENDIF()
  51. IF(DEFINED MY_VENDOR)
  52. SET(_manifest_content "${_manifest_content}\nPlugin-Vendor: ${MY_VENDOR}")
  53. ENDIF()
  54. IF(DEFINED MY_VERSION)
  55. SET(_manifest_content "${_manifest_content}\nPlugin-Version: ${MY_VERSION}")
  56. ENDIF()
  57. SET(_manifest_filename "MANIFEST.MF")
  58. SET(_manifest_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_manifest_filename}")
  59. SET(_manifest_qrc_filepath "${CMAKE_CURRENT_BINARY_DIR}/${MY_SYMBOLIC_NAME}_manifest.qrc")
  60. SET(_manifest_qrc_content
  61. "<!DOCTYPE RCC><RCC version=\"1.0\">
  62. <qresource prefix=\"/${MY_SYMBOLIC_NAME}/META-INF\">
  63. <file>${_manifest_filename}</file>
  64. </qresource>
  65. </RCC>
  66. ")
  67. FILE(WRITE "${_manifest_filepath}" "${_manifest_content}")
  68. FILE(WRITE "${_manifest_qrc_filepath}" "${_manifest_qrc_content}")
  69. QT4_ADD_RESOURCES(${QRC_SRCS} ${_manifest_qrc_filepath})
  70. ENDMACRO()