CMakeLists.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. ####################
  2. # Nodeset Examples #
  3. ####################
  4. ###################
  5. # Custom XML #
  6. ###################
  7. # generate namespace from XML file
  8. ua_generate_nodeset_and_datatypes(
  9. NAME "example"
  10. FILE_NS "${PROJECT_SOURCE_DIR}/examples/nodeset/server_nodeset.xml"
  11. DEPENDS "${PROJECT_SOURCE_DIR}/tools/schema/Opc.Ua.NodeSet2.Minimal.xml"
  12. )
  13. # The .csv file can be created from within UaModeler or manually
  14. ua_generate_nodeid_header(
  15. NAME "example_nodeids"
  16. ID_PREFIX "EXAMPLE_NS"
  17. TARGET_SUFFIX "ids_example"
  18. FILE_CSV "${PROJECT_SOURCE_DIR}/examples/nodeset/server_nodeset.csv"
  19. )
  20. add_example(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_example.c ${PROJECT_BINARY_DIR}/src_generated/example_nodeids.h)
  21. if(UA_COMPILE_AS_CXX)
  22. set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/ua_namespace_example.c PROPERTIES LANGUAGE CXX)
  23. endif()
  24. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  25. ua_generate_nodeset_and_datatypes(
  26. NAME "testnodeset"
  27. FILE_CSV "${PROJECT_SOURCE_DIR}/examples/nodeset/testnodeset.csv"
  28. FILE_BSD "${PROJECT_SOURCE_DIR}/examples/nodeset/testtypes.bsd"
  29. NAMESPACE_IDX 2
  30. FILE_NS "${PROJECT_SOURCE_DIR}/examples/nodeset/testnodeset.xml"
  31. INTERNAL
  32. )
  33. add_example(server_testnodeset server_testnodeset.c
  34. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_testnodeset.c
  35. ${PROJECT_BINARY_DIR}/src_generated/ua_types_testnodeset_generated.c)
  36. add_dependencies(server_testnodeset open62541-generator-ns-testnodeset)
  37. endif()
  38. ###################
  39. # PLCopen Nodeset #
  40. ###################
  41. # PLCopen requires the full ns0 as basis
  42. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  43. # Generate types and namespace for DI
  44. ua_generate_nodeset_and_datatypes(
  45. NAME "di"
  46. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  47. FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  48. NAMESPACE_IDX 2
  49. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  50. INTERNAL
  51. )
  52. # generate PLCopen namespace which is using DI
  53. ua_generate_nodeset_and_datatypes(
  54. NAME "plc"
  55. # PLCopen does not define custom types. Only generate the nodeset
  56. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml"
  57. # PLCopen depends on the di nodeset, which must be generated before
  58. DEPENDS "di"
  59. INTERNAL
  60. )
  61. add_example(server_nodeset_plcopen server_nodeset_plcopen.c
  62. ${PROJECT_BINARY_DIR}/src_generated/ua_types_di_generated.c
  63. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_di.c
  64. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_plc.c)
  65. add_dependencies(server_nodeset_plcopen open62541-generator-ns-plc)
  66. endif()
  67. # POWERLINK requires the full ns0 as basis
  68. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  69. # Generate types and namespace for DI
  70. #ua_generate_nodeset_and_datatypes(
  71. # NAME "di"
  72. # FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  73. # FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  74. # NAMESPACE_IDX 2
  75. # FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  76. # INTERNAL
  77. #)
  78. # generate powerlink namespace which is using DI
  79. ua_generate_nodeset_and_datatypes(
  80. NAME "powerlink"
  81. # POWERLINK does not define custom types. Only generate the nodeset
  82. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/POWERLINK/Opc.Ua.POWERLINK.NodeIds.csv"
  83. FILE_BSD "${PROJECT_SOURCE_DIR}/examples/nodeset/Opc.Ua.POWERLINK.NodeSet2.bsd"
  84. NAMESPACE_IDX 3
  85. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/POWERLINK/Opc.Ua.POWERLINK.NodeSet2.xml"
  86. # POWERLINK depends on the di nodeset, which must be generated before
  87. DEPENDS "di"
  88. INTERNAL
  89. )
  90. add_example(server_nodeset_powerlink server_nodeset_powerlink.c
  91. ${PROJECT_BINARY_DIR}/src_generated/ua_types_di_generated.c
  92. ${PROJECT_BINARY_DIR}/src_generated/ua_types_powerlink_generated.c
  93. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_di.c
  94. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_powerlink.c)
  95. add_dependencies(server_nodeset_plcopen open62541-generator-ns-powerlink)
  96. endif()