CMakeLists.txt 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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()