Skip to content

Instantly share code, notes, and snippets.

Created December 21, 2020 13:59
What would you like to do?
add OpenCV to a project using CMake
cmake_minimum_required(VERSION 3.6)
# opencv
set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/opencv-4.5.0/sdk/native/jni)
find_package(OpenCV REQUIRED core imgproc) # specify desired OpenCV modules here
# mylibname
add_library(mylibname SHARED nativeutils.cpp)
target_include_directories(mylibname PRIVATE
target_link_libraries(mylibname android log jnigraphics ${OpenCV_LIBS})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment