cmake_minimum_required(VERSION 3.10)
project(ExampleCPP CXX)
set(CMAKE_CXX_STANDARD 17)

set(ExampleName CalibrationByTcpTouch)
add_executable(${ExampleName} ${ExampleName}.cpp)
if(WIN32)
  target_include_directories(${ExampleName} PRIVATE ${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/include)
  target_link_libraries(${ExampleName} PRIVATE ${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/lib/HandEyeSDK.lib)
  file(GLOB HandEyeSDK_DLLS "${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/bin/*.dll")
  add_custom_command(TARGET ${ExampleName}
                     POST_BUILD
                     COMMAND ${CMAKE_COMMAND} -E copy_if_different
                     ${HandEyeSDK_DLLS}
                     $<TARGET_FILE_DIR:${ExampleName}>)
else()
  set(RVCHandEyeDir "/opt/RVCHandEyeCalibration")
  target_include_directories(${ExampleName} PRIVATE "${RVCHandEyeDir}/include")
  target_link_libraries(${ExampleName} PRIVATE "${RVCHandEyeDir}/lib/libHandEyeSDK.so")
endif()

set(ExampleName DetectMarker)
add_executable(${ExampleName} ${ExampleName}.cpp)
if(WIN32)
  target_include_directories(${ExampleName} PRIVATE ${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/include)
  target_link_libraries(${ExampleName} PRIVATE ${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/lib/HandEyeSDK.lib)
  file(GLOB HandEyeSDK_DLLS "${CMAKE_SOURCE_DIR}/External/HandEyeSDK/Win64/bin/*.dll")
  add_custom_command(TARGET ${ExampleName}
                     POST_BUILD
                     COMMAND ${CMAKE_COMMAND} -E copy_if_different
                     ${HandEyeSDK_DLLS}
                     $<TARGET_FILE_DIR:${ExampleName}>)
else()
  set(RVCHandEyeDir "/opt/RVCHandEyeCalibration")
  target_include_directories(${ExampleName} PRIVATE "${RVCHandEyeDir}/include")
  target_link_libraries(${ExampleName} PRIVATE "${RVCHandEyeDir}/lib/libHandEyeSDK.so")
endif()
