Add opencv to cmake

This commit is contained in:
Megamouse
2024-11-16 11:03:42 +01:00
parent 6eaaadec71
commit 2d14742a05
11 changed files with 50 additions and 6 deletions
+2 -1
View File
@@ -344,7 +344,7 @@ add_subdirectory(miniupnp EXCLUDE_FROM_ALL)
add_subdirectory(rtmidi EXCLUDE_FROM_ALL)
# OPENCV
# TODO: add library and -DHAVE_OPENCV
add_subdirectory(opencv EXCLUDE_FROM_ALL)
# add nice ALIAS targets for ease of use
if(USE_SYSTEM_LIBUSB)
@@ -376,3 +376,4 @@ add_library(3rdparty::soundtouch ALIAS soundtouch)
add_library(3rdparty::sdl2 ALIAS ${SDL2_TARGET})
add_library(3rdparty::miniupnpc ALIAS libminiupnpc-static)
add_library(3rdparty::rtmidi ALIAS rtmidi)
add_library(3rdparty::opencv ALIAS ${OPENCV_TARGET})
+21
View File
@@ -0,0 +1,21 @@
# OpenCV
set(OPENCV_TARGET 3rdparty_dummy_lib PARENT_SCOPE)
if (USE_SYSTEM_OPENCV)
message(STATUS "RPCS3: using system OpenCV")
find_package(OpenCV)
if(OPENCV_FOUND)
message(STATUS "RPCS3: found system OpenCV")
include_directories(${OpenCV_INCLUDE_DIRS})
add_library(3rdparty_opencv INTERFACE)
target_link_libraries(3rdparty_opencv INTERFACE ${OpenCV_LIBS})
target_compile_definitions(3rdparty_opencv INTERFACE -DHAVE_OPENCV)
set(OPENCV_TARGET 3rdparty_opencv PARENT_SCOPE)
else()
message(WARNING "RPCS3: OpenCV not found. Building without OpenCV support")
endif()
else()
message(WARNING "RPCS3: Building without OpenCV support")
endif()