CMakeLists.txt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. ###################
  24. # PLCopen Nodeset #
  25. ###################
  26. # PLCopen requires the full ns0 as basis
  27. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  28. # Generate types and namespace for DI
  29. ua_generate_nodeset_and_datatypes(
  30. NAME "di"
  31. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  32. FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  33. NAMESPACE_IDX 2
  34. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  35. INTERNAL
  36. )
  37. # generate PLCopen namespace which is using DI
  38. ua_generate_nodeset_and_datatypes(
  39. NAME "plc"
  40. # PLCopen does not define custom types. Only generate the nodeset
  41. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml"
  42. # PLCopen depends on the di nodeset, which must be generated before
  43. DEPENDS "di"
  44. INTERNAL
  45. )
  46. add_example(server_nodeset_plcopen server_nodeset_plcopen.c
  47. ${PROJECT_BINARY_DIR}/src_generated/ua_types_di_generated.c
  48. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_di.c
  49. ${PROJECT_BINARY_DIR}/src_generated/ua_namespace_plc.c)
  50. add_dependencies(server_nodeset_plcopen open62541-generator-ns-plc)
  51. target_include_directories(server_nodeset_plcopen PRIVATE ${PROJECT_SOURCE_DIR}/src) # needs an internal header
  52. endif()