CMakeLists.txt 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. include_directories(${PROJECT_SOURCE_DIR}/include)
  2. include_directories(${PROJECT_SOURCE_DIR}/deps)
  3. include_directories(${PROJECT_SOURCE_DIR}/src)
  4. include_directories(${PROJECT_BINARY_DIR}/src_generated)
  5. find_package(Check REQUIRED)
  6. find_package(Threads REQUIRED)
  7. set(LIBS ${CHECK_LIBRARIES} ${open62541_LIBRARIES})
  8. if(NOT WIN32)
  9. list(APPEND LIBS pthread m)
  10. if (NOT APPLE)
  11. list(APPEND LIBS rt subunit)
  12. endif()
  13. else()
  14. list(APPEND LIBS ws2_32)
  15. endif()
  16. if(UA_ENABLE_MULTITHREADING)
  17. list(APPEND LIBS urcu-cds urcu urcu-common)
  18. endif()
  19. add_definitions(-Wno-sign-conversion)
  20. # the unit test are built directly on the open62541 object files. so they can
  21. # access symbols that are hidden/not exported to the shared library
  22. add_executable(check_builtin check_builtin.c $<TARGET_OBJECTS:open62541-object>)
  23. target_link_libraries(check_builtin ${LIBS})
  24. add_test(builtin ${CMAKE_CURRENT_BINARY_DIR}/check_builtin)
  25. add_executable(check_memory check_memory.c $<TARGET_OBJECTS:open62541-object>)
  26. target_link_libraries(check_memory ${LIBS})
  27. add_test(memory ${CMAKE_CURRENT_BINARY_DIR}/check_memory)
  28. # add_executable(check_stack check_stack.c)
  29. # target_link_libraries(check_stack ${LIBS})
  30. # add_test(stack ${CMAKE_CURRENT_BINARY_DIR}/check_stack)
  31. add_executable(check_services_view check_services_view.c $<TARGET_OBJECTS:open62541-object>)
  32. target_link_libraries(check_services_view ${LIBS})
  33. add_test(services_view ${CMAKE_CURRENT_BINARY_DIR}/check_services_view)
  34. add_executable(check_services_attributes check_services_attributes.c $<TARGET_OBJECTS:open62541-object>)
  35. target_link_libraries(check_services_attributes ${LIBS})
  36. add_test(services_attributes ${CMAKE_CURRENT_BINARY_DIR}/check_services_attributes)
  37. add_executable(check_services_nodemanagement check_services_nodemanagement.c $<TARGET_OBJECTS:open62541-object>)
  38. target_link_libraries(check_services_nodemanagement ${LIBS})
  39. add_test(services_nodemanagement ${CMAKE_CURRENT_BINARY_DIR}/check_services_nodemanagement)
  40. add_executable(check_nodestore check_nodestore.c $<TARGET_OBJECTS:open62541-object>)
  41. target_link_libraries(check_nodestore ${LIBS})
  42. add_test(nodestore ${CMAKE_CURRENT_BINARY_DIR}/check_nodestore)
  43. add_executable(check_session check_session.c $<TARGET_OBJECTS:open62541-object>)
  44. target_link_libraries(check_session ${LIBS})
  45. add_test(session ${CMAKE_CURRENT_BINARY_DIR}/check_session)
  46. # add_executable(check_startup check_startup.c)
  47. # target_link_libraries(check_startup ${LIBS})
  48. # add_test(startup ${CMAKE_CURRENT_BINARY_DIR}/check_startup)
  49. # test with canned interactions from files
  50. add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin
  51. ${CMAKE_CURRENT_BINARY_DIR}/client_CreateActivateSession.bin
  52. PRE_BUILD
  53. COMMAND python ${PROJECT_SOURCE_DIR}/tools/hex2bin.py
  54. ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex
  55. ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_CreateActivateSession.hex
  56. DEPENDS ${PROJECT_SOURCE_DIR}/tools/hex2bin.py
  57. ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex
  58. ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_CreateActivateSession.hex)
  59. add_custom_target(client_HELOPN.bin DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin")
  60. add_custom_target(client_CreateActivateSession.bin DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/client_CreateActivateSession.bin")
  61. add_executable(check_server_binary_messages check_server_binary_messages.c testing_networklayers.c $<TARGET_OBJECTS:open62541-object>)
  62. target_include_directories(check_server_binary_messages PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
  63. target_link_libraries(check_server_binary_messages ${LIBS})
  64. add_dependencies(check_server_binary_messages client_HELOPN.bin)
  65. add_test(check_server_binary_messages_helopn ${CMAKE_CURRENT_BINARY_DIR}/check_server_binary_messages
  66. ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin)
  67. add_test(check_server_binary_messages_activate_session ${CMAKE_CURRENT_BINARY_DIR}/check_server_binary_messages
  68. ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin
  69. ${CMAKE_CURRENT_BINARY_DIR}/client_CreateActivateSession.bin)