1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 10:12:32 +01:00

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

View File

@ -27,6 +27,7 @@ CONFIGURE_ARGS="
-DUSE_SYSTEM_FFMPEG=ON -DUSE_SYSTEM_FFMPEG=ON
-DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_CURL=ON
-DUSE_SYSTEM_LIBPNG=ON -DUSE_SYSTEM_LIBPNG=ON
-DUSE_SYSTEM_OPENCV=ON
" "
# shellcheck disable=SC2086 # shellcheck disable=SC2086

View File

@ -25,6 +25,7 @@ cmake .. \
-DUSE_SDL=ON \ -DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=ON \ -DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_FFMPEG=OFF \ -DUSE_SYSTEM_FFMPEG=OFF \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_DISCORD_RPC=ON \ -DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \ -DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \ -DLLVM_DIR=/opt/llvm/lib/cmake/llvm \

View File

@ -44,6 +44,7 @@ cmake .. \
-DUSE_SDL=ON \ -DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=ON \ -DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_FFMPEG=OFF \ -DUSE_SYSTEM_FFMPEG=OFF \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_DISCORD_RPC=ON \ -DUSE_DISCORD_RPC=ON \
-DOpenGL_GL_PREFERENCE=LEGACY \ -DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \ -DLLVM_DIR=/opt/llvm/lib/cmake/llvm \

View File

@ -131,6 +131,7 @@ export MACOSX_DEPLOYMENT_TARGET=13.0
-DUSE_SYSTEM_MVK=ON \ -DUSE_SYSTEM_MVK=ON \
-DUSE_SYSTEM_FAUDIO=OFF \ -DUSE_SYSTEM_FAUDIO=OFF \
-DUSE_SYSTEM_SDL=ON \ -DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_OPENCV=ON \
$CMAKE_EXTRA_OPTS \ $CMAKE_EXTRA_OPTS \
-DLLVM_TARGET_ARCH=arm64 \ -DLLVM_TARGET_ARCH=arm64 \
-DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_ARCHITECTURES=arm64 \

View File

@ -98,6 +98,7 @@ export MACOSX_DEPLOYMENT_TARGET=13.0
-DUSE_SYSTEM_MVK=ON \ -DUSE_SYSTEM_MVK=ON \
-DUSE_SYSTEM_FAUDIO=OFF \ -DUSE_SYSTEM_FAUDIO=OFF \
-DUSE_SYSTEM_SDL=ON \ -DUSE_SYSTEM_SDL=ON \
-DUSE_SYSTEM_OPENCV=ON \
$CMAKE_EXTRA_OPTS \ $CMAKE_EXTRA_OPTS \
-DLLVM_TARGET_ARCH=X86_64 \ -DLLVM_TARGET_ARCH=X86_64 \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \

View File

@ -344,7 +344,7 @@ add_subdirectory(miniupnp EXCLUDE_FROM_ALL)
add_subdirectory(rtmidi EXCLUDE_FROM_ALL) add_subdirectory(rtmidi EXCLUDE_FROM_ALL)
# OPENCV # OPENCV
# TODO: add library and -DHAVE_OPENCV add_subdirectory(opencv EXCLUDE_FROM_ALL)
# add nice ALIAS targets for ease of use # add nice ALIAS targets for ease of use
if(USE_SYSTEM_LIBUSB) if(USE_SYSTEM_LIBUSB)
@ -376,3 +376,4 @@ add_library(3rdparty::soundtouch ALIAS soundtouch)
add_library(3rdparty::sdl2 ALIAS ${SDL2_TARGET}) add_library(3rdparty::sdl2 ALIAS ${SDL2_TARGET})
add_library(3rdparty::miniupnpc ALIAS libminiupnpc-static) add_library(3rdparty::miniupnpc ALIAS libminiupnpc-static)
add_library(3rdparty::rtmidi ALIAS rtmidi) add_library(3rdparty::rtmidi ALIAS rtmidi)
add_library(3rdparty::opencv ALIAS ${OPENCV_TARGET})

21
3rdparty/opencv/CMakeLists.txt vendored Normal file
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()

View File

@ -29,6 +29,7 @@ option(USE_SYSTEM_SDL "Prefer system SDL instead of the builtin one" ON)
option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF) option(USE_SYSTEM_FFMPEG "Prefer system ffmpeg instead of the prebuild one" OFF)
option(USE_SYSTEM_OPENAL "Prefer system OpenAL instead of the prebuild one" ON) option(USE_SYSTEM_OPENAL "Prefer system OpenAL instead of the prebuild one" ON)
option(USE_SYSTEM_CURL "Prefer system Curl instead of the prebuild one" ON) option(USE_SYSTEM_CURL "Prefer system Curl instead of the prebuild one" ON)
option(USE_SYSTEM_OPENCV "Prefer system OpenCV instead of the builtin one" ON)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")

View File

@ -13,6 +13,7 @@
"USE_SYSTEM_CURL": "OFF", "USE_SYSTEM_CURL": "OFF",
"USE_SYSTEM_ZLIB": "OFF", "USE_SYSTEM_ZLIB": "OFF",
"USE_SYSTEM_LIBPNG": "OFF", "USE_SYSTEM_LIBPNG": "OFF",
"USE_SYSTEM_OPENCV": "ON",
"BUILD_LLVM": "OFF", "BUILD_LLVM": "OFF",
"STATIC_LINK_LLVM": "ON" "STATIC_LINK_LLVM": "ON"
} }
@ -29,6 +30,7 @@
"USE_SYSTEM_CURL": "OFF", "USE_SYSTEM_CURL": "OFF",
"USE_SYSTEM_ZLIB": "OFF", "USE_SYSTEM_ZLIB": "OFF",
"USE_SYSTEM_LIBPNG": "OFF", "USE_SYSTEM_LIBPNG": "OFF",
"USE_SYSTEM_OPENCV": "ON",
"LLVM_ENABLE_LIBCXX": "ON", "LLVM_ENABLE_LIBCXX": "ON",
"BUILD_LLVM": "OFF", "BUILD_LLVM": "OFF",
"STATIC_LINK_LLVM": "ON" "STATIC_LINK_LLVM": "ON"
@ -56,6 +58,7 @@
"USE_SYSTEM_CURL": "OFF", "USE_SYSTEM_CURL": "OFF",
"USE_SYSTEM_ZLIB": "OFF", "USE_SYSTEM_ZLIB": "OFF",
"USE_SYSTEM_OPENAL": "OFF", "USE_SYSTEM_OPENAL": "OFF",
"USE_SYSTEM_OPENCV": "OFF",
"BUILD_LLVM": "ON", "BUILD_LLVM": "ON",
"STATIC_LINK_LLVM": "ON" "STATIC_LINK_LLVM": "ON"
}, },

View File

@ -98,9 +98,19 @@ set_target_properties(rpcs3
AUTOMOC ON AUTOMOC ON
AUTOUIC ON) AUTOUIC ON)
target_link_libraries(rpcs3 PRIVATE rpcs3_emu rpcs3_ui) target_link_libraries(rpcs3
target_link_libraries(rpcs3 PRIVATE 3rdparty::discordRPC 3rdparty::qt6 3rdparty::hidapi 3rdparty::libusb 3rdparty::wolfssl 3rdparty::libcurl 3rdparty::zlib) PRIVATE
target_link_libraries(rpcs3 PRIVATE ${ADDITIONAL_LIBS}) rpcs3_emu
rpcs3_ui
3rdparty::discordRPC
3rdparty::qt6
3rdparty::hidapi
3rdparty::libusb
3rdparty::wolfssl
3rdparty::libcurl
3rdparty::zlib
3rdparty::opencv
${ADDITIONAL_LIBS})
# Unix display manager # Unix display manager
if(X11_FOUND) if(X11_FOUND)

View File

@ -145,11 +145,13 @@ target_compile_definitions(rpcs3_ui PRIVATE WIN32_LEAN_AND_MEAN)
target_link_libraries(rpcs3_ui target_link_libraries(rpcs3_ui
PUBLIC PUBLIC
3rdparty::qt6 3rdparty::yaml-cpp 3rdparty::qt6
3rdparty::yaml-cpp
PRIVATE PRIVATE
rpcs3_emu rpcs3_emu
3rdparty::zlib 3rdparty::pugixml 3rdparty::zlib
3rdparty::pugixml
3rdparty::discordRPC 3rdparty::discordRPC
3rdparty::hidapi 3rdparty::hidapi
3rdparty::libusb 3rdparty::libusb
@ -157,4 +159,5 @@ target_link_libraries(rpcs3_ui
3rdparty::7zip 3rdparty::7zip
3rdparty::wolfssl 3rdparty::wolfssl
3rdparty::libcurl 3rdparty::libcurl
3rdparty::opencv
3rdparty::rtmidi) 3rdparty::rtmidi)