-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·58 lines (53 loc) · 2.64 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
find_package(OpenCV COMPONENTS core objdetect )
if(NOT OpenCV_FOUND )
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-ubuntu-latest-wasm_false-android_none.tar")
if(WIN32)
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-windows-latest-wasm_false-android_none.tar")
endif(WIN32)
if (APPLE)
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-macos-latest-wasm_false-android_none.tar")
endif(APPLE)
if(EMSCRIPTEN)
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-ubuntu-latest-wasm_true-android_none.tar")
endif(EMSCRIPTEN)
if(ANDROID)
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-ubuntu-latest-wasm_false-android_${ANDROID_ABI}.tar")
endif(ANDROID)
FetchContent_Declare(
OpenCV
DOWNLOAD_EXTRACT_TIMESTAMP true
URL ${builturl}
)
FetchContent_GetProperties(OpenCV)
if(NOT OpenCV_POPULATED)
message(STATUS "OpenCV prebuilt will be downloaded from ${builturl} if not found on the system")
FetchContent_Populate(OpenCV)
message(STATUS "OpenCV is installed in ${opencv_SOURCE_DIR}")
set(OpenCV_DIR ${opencv_SOURCE_DIR}/lib/cmake/opencv4)
if(WIN32)
set(OpenCV_DIR ${opencv_SOURCE_DIR})
endif(WIN32)
if(ANDROID)
set(OpenCV_DIR ${opencv_SOURCE_DIR}/sdk/native/jni)
endif(ANDROID)
find_package(OpenCV COMPONENTS core objdetect)
endif()
endif()
if(OpenCV_FOUND)
add_library(QrDec qrcodedec.cpp)
target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${OpenCV_INCLUDE_DIRS}>)
target_link_libraries(QrDec PUBLIC ${OpenCV_LIBS})
target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/qrCode>")
install(TARGETS QrDec
EXPORT qrCodeTargets
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT Qr
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qrCode
COMPONENT Qr
)
else()
message(STATUS "OpenCV was not found")
endif(OpenCV_FOUND)