standalone.cmake 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. if("${CMAKE_BUILD_TYPE}" STREQUAL "")
  2. set(CMAKE_BUILD_TYPE "Release")
  3. endif()
  4. if (NOT TARGET ade )
  5. find_package(ade 0.1.0 REQUIRED)
  6. endif()
  7. if (WITH_GAPI_ONEVPL)
  8. find_package(VPL)
  9. if(VPL_FOUND)
  10. set(HAVE_GAPI_ONEVPL TRUE)
  11. endif()
  12. endif()
  13. set(FLUID_TARGET fluid)
  14. set(FLUID_ROOT "${CMAKE_CURRENT_LIST_DIR}/../")
  15. file(GLOB FLUID_includes "${FLUID_ROOT}/include/opencv2/*.hpp"
  16. "${FLUID_ROOT}/include/opencv2/gapi/g*.hpp"
  17. "${FLUID_ROOT}/include/opencv2/gapi/util/*.hpp"
  18. "${FLUID_ROOT}/include/opencv2/gapi/own/*.hpp"
  19. "${FLUID_ROOT}/include/opencv2/gapi/fluid/*.hpp")
  20. file(GLOB FLUID_sources "${FLUID_ROOT}/src/api/g*.cpp"
  21. "${FLUID_ROOT}/src/api/rmat.cpp"
  22. "${FLUID_ROOT}/src/api/media.cpp"
  23. "${FLUID_ROOT}/src/compiler/*.cpp"
  24. "${FLUID_ROOT}/src/compiler/passes/*.cpp"
  25. "${FLUID_ROOT}/src/executor/*.cpp"
  26. "${FLUID_ROOT}/src/backends/fluid/*.cpp"
  27. "${FLUID_ROOT}/src/backends/streaming/*.cpp"
  28. "${FLUID_ROOT}/src/backends/common/*.cpp")
  29. add_library(${FLUID_TARGET} STATIC ${FLUID_includes} ${FLUID_sources})
  30. target_include_directories(${FLUID_TARGET}
  31. PUBLIC $<BUILD_INTERFACE:${FLUID_ROOT}/include>
  32. PRIVATE ${FLUID_ROOT}/src)
  33. target_compile_definitions(${FLUID_TARGET} PUBLIC GAPI_STANDALONE
  34. # This preprocessor definition resolves symbol clash when
  35. # standalone fluid meets gapi ocv module in one application
  36. PUBLIC cv=fluidcv)
  37. set_target_properties(${FLUID_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE True)
  38. set_property(TARGET ${FLUID_TARGET} PROPERTY CXX_STANDARD 11)
  39. if(MSVC)
  40. target_compile_options(${FLUID_TARGET} PUBLIC "/wd4251")
  41. target_compile_options(${FLUID_TARGET} PUBLIC "/wd4275")
  42. target_compile_definitions(${FLUID_TARGET} PRIVATE _CRT_SECURE_NO_DEPRECATE)
  43. # Disable obsollete warning C4503 popping up on MSVC <<2017
  44. # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4503?view=vs-2019
  45. set_target_properties(${FLUID_TARGET} PROPERTIES COMPILE_FLAGS "/wd4503")
  46. endif()
  47. target_link_libraries(${FLUID_TARGET} PRIVATE ade)
  48. if(WIN32)
  49. # Required for htonl/ntohl on Windows
  50. target_link_libraries(${FLUID_TARGET} PRIVATE wsock32 ws2_32)
  51. endif()