
if(ANDROID)
set(OpenCV_DIR "${ARTIFACTS_DIR}/opencv/android-arm64/4.5.5/sdk/native/jni" CACHE PATH "" FORCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
#set(OpenCV_DIR "${ARTIFACTS_DIR}/opencv/linux-x64/${my_ocv_ver}/lib/cmake/opencv4" CACHE PATH "" FORCE)
#set(OpenCV_DIR "${ARTIFACTS_DIR}/opencv/linux-x64/5.x-dev/lib/cmake/opencv5")

#set(OpenCV_DIR "/home/zz/artifacts/opencv/linux-x64/4.5.5/lib/cmake/opencv4")
set(OpenCV_DIR "/home/zz/artifacts/opencv/linux-x64/4.5.5-ipp/lib/cmake/opencv4") # for QA, cv::exp test fail
#set(OpenCV_DIR "/home/zz/artifacts/opencv/linux-x64/3.4.13/share/OpenCV") # for YuQiWei, seamlessClone
endif()
message(STATUS ">>> OpenCV_DIR: ${OpenCV_DIR}")
find_package(OpenCV REQUIRED)
# if(OpenCV_FOUND)
#     message(STATUS "OpenCV library: ${OpenCV_INSTALL_PATH}")
#     message(STATUS "    version: ${OpenCV_VERSION}")
#     message(STATUS "    libraries: ${OpenCV_LIBS}")
#     message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")
#     if(${OpenCV_VERSION_MAJOR} GREATER 3)
#         set(CMAKE_CXX_STANDARD 11)
#     endif()
# else()
#     message(FATAL_ERROR "Error! OpenCV not found!")
# endif()


#--- libpng
if(ANDROID)
    #set(png_DIR "${ARTIFACTS_DIR}/libpng/1.6.38-dev/linux-x64/lib/libpng")
    # set(png_lib "${ARTIFACTS_DIR}/libpng/1.6.38-dev/android-arm64/lib/libpng.a")
    # set(png_include_dir "${ARTIFACTS_DIR}/libpng/1.6.38-dev/android-arm64/include")
    set(libpng_install_dir "/home/zz/artifacts/libpng/1.6.38-dev/android-arm64")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
    # set(png_lib "${ARTIFACTS_DIR}/libpng/1.6.38-dev/linux-x64/lib/libpng16.a")
    # set(png_include_dir "${ARTIFACTS_DIR}/libpng/1.6.38-dev/linux-x64/include")
    set(libpng_install_dir "/home/zz/artifacts/libpng/1.6.38-dev/linux-x64")
endif()

include("${libpng_install_dir}/lib/libpng/libpng16.cmake")
set_target_properties(png
    PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${libpng_install_dir}/include/libpng16
)
set_target_properties(png_static
    PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${libpng_install_dir}/include/libpng16
)