CMakeLists.txt 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated/tests")
  2. include_directories("${PROJECT_BINARY_DIR}/src_generated/tests")
  3. ###############################################
  4. # Test Companion Specs that need the full NS0 #
  5. ###############################################
  6. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  7. # Generate types for DI namespace
  8. ua_generate_datatypes(
  9. NAME "ua_types_di"
  10. TARGET_SUFFIX "tests-types-di"
  11. NAMESPACE_IDX 2
  12. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  13. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  14. FILES_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  15. )
  16. # Generate types for ADI namespace
  17. ua_generate_datatypes(
  18. NAME "ua_types_adi"
  19. TARGET_SUFFIX "tests-types-adi"
  20. NAMESPACE_IDX 3
  21. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  22. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/OpcUaAdiModel.csv"
  23. FILES_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.Types.bsd"
  24. )
  25. # generate DI namespace
  26. ua_generate_nodeset(
  27. NAME "tests-di"
  28. FILE "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  29. TYPES_ARRAY "UA_TYPES_DI"
  30. INTERNAL
  31. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  32. DEPENDS_TYPES "UA_TYPES"
  33. DEPENDS_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml"
  34. DEPENDS_TARGET "open62541-generator-tests-types-di"
  35. )
  36. # generate PLCopen namespace which is using DI
  37. ua_generate_nodeset(
  38. NAME "tests-adi"
  39. FILE "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.NodeSet2.xml"
  40. TYPES_ARRAY "UA_TYPES_ADI"
  41. INTERNAL
  42. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  43. DEPENDS_TYPES
  44. "UA_TYPES" "UA_TYPES_DI"
  45. DEPENDS_NS
  46. "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml"
  47. "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  48. DEPENDS_TARGET "open62541-generator-ns-tests-di" "open62541-generator-tests-types-adi"
  49. )
  50. # generate PLCopen namespace which is using DI
  51. ua_generate_nodeset(
  52. NAME "tests-plc"
  53. FILE "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml"
  54. INTERNAL
  55. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  56. DEPENDS_TYPES
  57. "UA_TYPES" "UA_TYPES_DI"
  58. DEPENDS_NS
  59. "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml"
  60. "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  61. DEPENDS_TARGET "open62541-generator-ns-tests-di"
  62. )
  63. add_executable(check_nodeset_compiler_adi check_nodeset_compiler_adi.c
  64. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_di_generated.c
  65. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_tests_di.c
  66. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_adi_generated.c
  67. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_tests_adi.c
  68. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  69. add_dependencies(check_nodeset_compiler_adi open62541-generator-ns-tests-adi)
  70. target_link_libraries(check_nodeset_compiler_adi ${LIBS})
  71. add_test_valgrind(nodeset_compiler_adi ${TESTS_BINARY_DIR}/check_nodeset_compiler_adi)
  72. add_executable(check_nodeset_compiler_plc check_nodeset_compiler_plc.c
  73. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_di_generated.c
  74. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_tests_di.c
  75. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_tests_plc.c
  76. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  77. add_dependencies(check_nodeset_compiler_plc open62541-generator-ns-tests-plc)
  78. target_link_libraries(check_nodeset_compiler_plc ${LIBS})
  79. add_test_valgrind(nodeset_compiler_plc ${TESTS_BINARY_DIR}/check_nodeset_compiler_plc)
  80. endif()
  81. #generate testnodeset
  82. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  83. ua_generate_datatypes(
  84. NAME "ua_types_testnodeset"
  85. TARGET_SUFFIX "tests-types-testnodeset"
  86. NAMESPACE_IDX 2
  87. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  88. FILE_CSV "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testnodeset.csv"
  89. FILES_BSD "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testtypes.bsd"
  90. )
  91. ua_generate_nodeset(
  92. NAME "tests-testnodeset"
  93. FILE "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testnodeset.xml"
  94. TYPES_ARRAY "UA_TYPES_TESTNODESET"
  95. INTERNAL
  96. OUTPUT_DIR "${PROJECT_BINARY_DIR}/src_generated/tests"
  97. DEPENDS_TYPES "UA_TYPES"
  98. DEPENDS_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml"
  99. DEPENDS_TARGET "open62541-generator-tests-types-testnodeset"
  100. )
  101. add_executable(check_nodeset_compiler_testnodeset check_nodeset_compiler_testnodeset.c
  102. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_tests_testnodeset.c
  103. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_testnodeset_generated.c
  104. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  105. add_dependencies(check_nodeset_compiler_testnodeset open62541-generator-ns-tests-testnodeset)
  106. target_link_libraries(check_nodeset_compiler_testnodeset ${LIBS})
  107. add_test_valgrind(nodeset_compiler_testnodeset ${TESTS_BINARY_DIR}/check_nodeset_compiler_testnodeset)
  108. endif()