CMakeLists.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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})
  8. if(NOT WIN32)
  9. list(APPEND LIBS pthread)
  10. if (NOT APPLE)
  11. list(APPEND LIBS rt)
  12. endif()
  13. else()
  14. list(APPEND LIBS ws2_32)
  15. endif()
  16. if(ENABLE_MULTITHREADING)
  17. list(APPEND LIBS urcu-cds urcu urcu-common)
  18. endif(ENABLE_MULTITHREADING)
  19. # the unit test are built directly on the open62541 object files. so they can
  20. # access symbols that are hidden/not exported to the shared library
  21. add_executable(check_builtin check_builtin.c $<TARGET_OBJECTS:open62541-object>)
  22. target_link_libraries(check_builtin ${LIBS})
  23. add_test(builtin ${CMAKE_CURRENT_BINARY_DIR}/check_builtin)
  24. add_executable(check_memory check_memory.c $<TARGET_OBJECTS:open62541-object>)
  25. target_link_libraries(check_memory ${LIBS})
  26. add_test(memory ${CMAKE_CURRENT_BINARY_DIR}/check_memory)
  27. # add_executable(check_stack check_stack.c)
  28. # target_link_libraries(check_stack ${LIBS})
  29. # add_test(stack ${CMAKE_CURRENT_BINARY_DIR}/check_stack)
  30. # add_executable(check_base64 check_base64.c)
  31. # target_link_libraries(check_base64 ${LIBS})
  32. # add_test(base64 ${CMAKE_CURRENT_BINARY_DIR}/check_base64)
  33. add_executable(check_services_view check_services_view.c $<TARGET_OBJECTS:open62541-object>)
  34. target_link_libraries(check_services_view ${LIBS})
  35. add_test(services_view ${CMAKE_CURRENT_BINARY_DIR}/check_services_view)
  36. add_executable(check_services_attributes check_services_attributes.c $<TARGET_OBJECTS:open62541-object>)
  37. target_link_libraries(check_services_attributes ${LIBS})
  38. add_test(services_attributes ${CMAKE_CURRENT_BINARY_DIR}/check_services_attributes)
  39. add_executable(check_nodestore check_nodestore.c $<TARGET_OBJECTS:open62541-object>)
  40. target_link_libraries(check_nodestore ${LIBS})
  41. add_test(nodestore ${CMAKE_CURRENT_BINARY_DIR}/check_nodestore)
  42. add_executable(check_session check_session.c $<TARGET_OBJECTS:open62541-object>)
  43. target_link_libraries(check_session ${LIBS})
  44. add_test(session ${CMAKE_CURRENT_BINARY_DIR}/check_session)
  45. # add_executable(check_startup check_startup.c)
  46. # target_link_libraries(check_startup ${LIBS})
  47. # add_test(startup ${CMAKE_CURRENT_BINARY_DIR}/check_startup)
  48. # test with canned interactions from files
  49. #add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin
  50. # PRE_BUILD
  51. # COMMAND python ${PROJECT_SOURCE_DIR}/tools/hex2bin.py ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex
  52. # ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_CreateActivateSession.hex
  53. # DEPENDS ${PROJECT_SOURCE_DIR}/tools/hex2bin.py
  54. # ${CMAKE_CURRENT_SOURCE_DIR}/dumps/client_HELOPN.hex)
  55. #set(check_fileinput_source check_server_interaction_fileinput.c testing_networklayers.c $<TARGET_OBJECTS:open62541-object>)
  56. #if(NOT ENABLE_AMALGAMATION)
  57. # list(APPEND check_fileinput_source ${PROJECT_SOURCE_DIR}/examples/logger_stdout.c)
  58. #endif()
  59. #add_executable(check_server_interaction_fileinput ${check_fileinput_source})
  60. #target_include_directories(check_server_interaction_fileinput PRIVATE ${PROJECT_SOURCE_DIR}/examples)
  61. #target_include_directories(check_server_interaction_fileinput PRIVATE ${PROJECT_BINARY_DIR})
  62. #target_link_libraries(check_server_interaction_fileinput ${LIBS})
  63. #add_test(server_interaction_fileinput ${CMAKE_CURRENT_BINARY_DIR}/check_server_interaction_fileinput ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin)
  64. #add_custom_target(server_interaction_fileinput ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/client_HELOPN.bin)