order_packages.cmake.em.stamp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # generated from catkin/cmake/em/order_packages.cmake.em
  2. @{
  3. import os
  4. try:
  5. from catkin_pkg.cmake import get_metapackage_cmake_template_path
  6. except ImportError as e:
  7. raise RuntimeError('ImportError: "from catkin_pkg.cmake import get_metapackage_cmake_template_path" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e)
  8. try:
  9. from catkin_pkg.topological_order import topological_order
  10. except ImportError as e:
  11. raise RuntimeError('ImportError: "from catkin_pkg.topological_order import topological_order" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e)
  12. try:
  13. from catkin_pkg.package import InvalidPackage
  14. except ImportError as e:
  15. raise RuntimeError('ImportError: "from catkin_pkg.package import InvalidPackage" failed: %s\nMake sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.' % e)
  16. # vars defined in order_packages.context.py.in
  17. try:
  18. ordered_packages = topological_order(os.path.normpath(source_root_dir), whitelisted=whitelisted_packages, blacklisted=blacklisted_packages, underlay_workspaces=underlay_workspaces)
  19. except InvalidPackage as e:
  20. print('message(FATAL_ERROR "%s")' % ('%s' % e).replace('"', '\\"'))
  21. ordered_packages = []
  22. fatal_error = False
  23. }@
  24. set(CATKIN_ORDERED_PACKAGES "")
  25. set(CATKIN_ORDERED_PACKAGE_PATHS "")
  26. set(CATKIN_ORDERED_PACKAGES_IS_META "")
  27. set(CATKIN_ORDERED_PACKAGES_BUILD_TYPE "")
  28. @[for path, package in ordered_packages]@
  29. @[if path is None]@
  30. message(FATAL_ERROR "Circular dependency in subset of packages:\n@package")
  31. @{
  32. fatal_error = True
  33. }@
  34. @[elif package.name != 'catkin']@
  35. list(APPEND CATKIN_ORDERED_PACKAGES "@(package.name)")
  36. list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "@(path.replace('\\','/'))")
  37. list(APPEND CATKIN_ORDERED_PACKAGES_IS_META "@(str('metapackage' in [e.tagname for e in package.exports]))")
  38. @{
  39. package.evaluate_conditions(os.environ)
  40. try:
  41. build_type = package.get_build_type()
  42. except InvalidPackage:
  43. build_type = None
  44. }@
  45. @[if build_type is None]@
  46. message(FATAL_ERROR "Only one <build_type> element is permitted for package '@(package.name)'.")
  47. @{
  48. fatal_error = True
  49. }@
  50. @[else]@
  51. list(APPEND CATKIN_ORDERED_PACKAGES_BUILD_TYPE "@(package.get_build_type())")
  52. @[end if]@
  53. @{
  54. deprecated = [e for e in package.exports if e.tagname == 'deprecated']
  55. }@
  56. @[if deprecated]@
  57. message("WARNING: Package '@(package.name)' is deprecated@(' (%s)' % deprecated[0].content if deprecated[0].content else '')")
  58. @[end if]@
  59. @[end if]@
  60. @[end for]@
  61. @[if not fatal_error]@
  62. @{
  63. message_generators = [package.name for (_, package) in ordered_packages if 'message_generator' in [e.tagname for e in package.exports]]
  64. }@
  65. set(CATKIN_MESSAGE_GENERATORS @(' '.join(message_generators)))
  66. @[end if]@
  67. set(CATKIN_METAPACKAGE_CMAKE_TEMPLATE "@(get_metapackage_cmake_template_path().replace('\\','/'))")