CMakeLists.txt 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. include_directories("${PROJECT_BINARY_DIR}/src_generated/tests")
  2. ###############################################
  3. # Test Companion Specs that need the full NS0 #
  4. ###############################################
  5. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  6. set(GENERATE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src_generated/tests")
  7. # Generate types and namespace for DI
  8. ua_generate_nodeset_and_datatypes(
  9. NAME "tests-di"
  10. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv"
  11. FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd"
  12. NAMESPACE_IDX 2
  13. OUTPUT_DIR "${GENERATE_OUTPUT_DIR}"
  14. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
  15. INTERNAL
  16. )
  17. # Generate types and namespace for ADI
  18. ua_generate_nodeset_and_datatypes(
  19. NAME "tests-adi"
  20. FILE_CSV "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/OpcUaAdiModel.csv"
  21. FILE_BSD "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.Types.bsd"
  22. NAMESPACE_IDX 3
  23. OUTPUT_DIR "${GENERATE_OUTPUT_DIR}"
  24. FILE_NS "${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.NodeSet2.xml"
  25. DEPENDS "tests-di"
  26. INTERNAL
  27. )
  28. add_executable(check_nodeset_compiler_adi check_nodeset_compiler_adi.c
  29. ${UA_NODESET_TESTS_DI_SOURCES}
  30. ${UA_NODESET_TESTS_ADI_SOURCES}
  31. ${UA_TYPES_TESTS_DI_SOURCES}
  32. ${UA_TYPES_TESTS_ADI_SOURCES}
  33. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  34. add_dependencies(check_nodeset_compiler_adi open62541-generator-ns-tests-adi)
  35. target_link_libraries(check_nodeset_compiler_adi ${LIBS})
  36. add_test_valgrind(nodeset_compiler_adi ${TESTS_BINARY_DIR}/check_nodeset_compiler_adi)
  37. # generate PLCopen namespace which is using DI
  38. ua_generate_nodeset_and_datatypes(
  39. NAME "tests-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. OUTPUT_DIR "${GENERATE_OUTPUT_DIR}"
  44. DEPENDS "tests-di"
  45. INTERNAL
  46. )
  47. add_executable(check_nodeset_compiler_plc check_nodeset_compiler_plc.c
  48. ${UA_NODESET_TESTS_DI_SOURCES}
  49. ${UA_NODESET_TESTS_PLC_SOURCES}
  50. ${UA_TYPES_TESTS_DI_SOURCES}
  51. ${UA_TYPES_TESTS_PLC_SOURCES}
  52. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  53. add_dependencies(check_nodeset_compiler_plc open62541-generator-ns-tests-plc)
  54. target_link_libraries(check_nodeset_compiler_plc ${LIBS})
  55. add_test_valgrind(nodeset_compiler_plc ${TESTS_BINARY_DIR}/check_nodeset_compiler_plc)
  56. endif()
  57. #generate testnodeset
  58. if(UA_NAMESPACE_ZERO STREQUAL "FULL")
  59. # Generate types and namespace for ADI
  60. ua_generate_nodeset_and_datatypes(
  61. NAME "tests-testnodeset"
  62. FILE_CSV "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testnodeset.csv"
  63. FILE_BSD "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testtypes.bsd"
  64. NAMESPACE_IDX 2
  65. OUTPUT_DIR "${GENERATE_OUTPUT_DIR}"
  66. FILE_NS "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testnodeset.xml"
  67. )
  68. add_executable(check_nodeset_compiler_testnodeset check_nodeset_compiler_testnodeset.c
  69. ${UA_NODESET_TESTS_TESTNODESET_SOURCES}
  70. ${UA_TYPES_TESTS_TESTNODESET_SOURCES}
  71. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  72. add_dependencies(check_nodeset_compiler_testnodeset open62541-generator-ns-tests-testnodeset)
  73. target_link_libraries(check_nodeset_compiler_testnodeset ${LIBS})
  74. add_test_valgrind(nodeset_compiler_testnodeset ${TESTS_BINARY_DIR}/check_nodeset_compiler_testnodeset)
  75. endif()