CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. )
  12. # The .csv file can be created from within UaModeler or manually
  13. ua_generate_nodeid_header(
  14. NAME "example_nodeids"
  15. ID_PREFIX "EXAMPLE_NS"
  16. TARGET_SUFFIX "ids_example"
  17. FILE_CSV "${PROJECT_SOURCE_DIR}/examples/nodeset/server_nodeset.csv"
  18. )
  19. add_example(server_nodeset server_nodeset.c ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_example.c ${PROJECT_BINARY_DIR}/src_generated/example_nodeids.h)
  20. if(UA_COMPILE_AS_CXX)
  21. set_source_files_properties(${PROJECT_BINARY_DIR}/src_generated/ua_namespace_example.c PROPERTIES LANGUAGE CXX)
  22. endif()
  23. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  24. ua_generate_nodeset_and_datatypes(
  25. NAME "testnodeset"
  26. FILE_CSV "${PROJECT_SOURCE_DIR}/examples/nodeset/testnodeset.csv"
  27. FILE_BSD "${PROJECT_SOURCE_DIR}/examples/nodeset/testtypes.bsd"
  28. NAMESPACE_IDX 2
  29. FILE_NS "${PROJECT_SOURCE_DIR}/examples/nodeset/testnodeset.xml"
  30. INTERNAL
  31. )
  32. add_example(server_testnodeset server_testnodeset.c
  33. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_testnodeset.c
  34. ${PROJECT_BINARY_DIR}/src_generated/ua_types_testnodeset_generated.c)
  35. add_dependencies(server_testnodeset open62541-generator-ns-testnodeset)
  36. endif()
  37. ###################
  38. # PLCopen Nodeset #
  39. ###################
  40. # PLCopen requires the full ns0 as basis
  41. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  42. # Generate types and namespace for DI
  43. ua_generate_nodeset_and_datatypes(
  44. NAME "di"
  45. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  46. FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  47. NAMESPACE_IDX 2
  48. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  49. INTERNAL
  50. )
  51. # generate PLCopen namespace which is using DI
  52. ua_generate_nodeset_and_datatypes(
  53. NAME "plc"
  54. # PLCopen does not define custom types. Only generate the nodeset
  55. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml"
  56. # PLCopen depends on the di nodeset, which must be generated before
  57. DEPENDS "di"
  58. INTERNAL
  59. )
  60. add_example(server_nodeset_plcopen server_nodeset_plcopen.c
  61. ${PROJECT_BINARY_DIR}/src_generated/ua_types_di_generated.c
  62. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_di.c
  63. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_plc.c)
  64. add_dependencies(server_nodeset_plcopen open62541-generator-ns-plc)
  65. endif()