ctkMacroGeneratePluginManifest.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. STRING(REPLACE "." "_" _symbolic_name ${MY_SYMBOLIC_NAME})
  60. SET(_manifest_qrc_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_symbolic_name}_manifest.qrc")
  61. SET(_manifest_qrc_content
  62. "<!DOCTYPE RCC><RCC version=\"1.0\">
  63. <qresource prefix=\"/${MY_SYMBOLIC_NAME}/META-INF\">
  64. <file>${_manifest_filename}</file>
  65. </qresource>
  66. </RCC>
  67. ")
  68. FILE(WRITE "${_manifest_filepath}" "${_manifest_content}")
  69. FILE(WRITE "${_manifest_qrc_filepath}" "${_manifest_qrc_content}")
  70. QT4_ADD_RESOURCES(${QRC_SRCS} ${_manifest_qrc_filepath})
  71. ENDMACRO()