Skip to content

Commit

Permalink
[Qt-Ffmpeg: 更新mpv播放器库的引用为qmpv]:对Qt-Ffmpeg项目的CMakeLists.txt和pro文件进行了修改…
Browse files Browse the repository at this point in the history
…,将mpv播放器库的引用从`custommpv`更新为`qmpv`。

- 在`examples/mpvplayer/CMakeLists.txt`中,将`target_compile_definitions`中的`custommpv`更改为`qmpv`,并在`target_link_libraries`中作出了相应的更改。
- 对`examples/mpvplayer/mpvplayer.pro`文件进行了修改,将`LIBS`中的`custommpv`更改为`qmpv`。
- 在`src/mpv/CMakeLists.txt`文件中,将`add_custom_library(custommpv ...)`更改为`add_custom_library(qmpv ...)`,并相应更新了`target_link_libraries`中的库名称。
- 对`src/mpv/mpv.pro`文件进行了更新,将`TARGET`的值从`custommpv`更改为`qmpv`。
  • Loading branch information
RealChuan committed Jun 6, 2024
1 parent 1891851 commit ef1ae20
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
7 changes: 3 additions & 4 deletions examples/mpvplayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ qt_add_executable(MpvPlayer MANUAL_FINALIZATION ${PROJECT_SOURCES})
target_compile_definitions(MpvPlayer PRIVATE "MPV_ON")
target_link_libraries(
MpvPlayer
PRIVATE custommpv
PRIVATE qmpv
thirdparty
dump
utils
Expand All @@ -41,10 +41,9 @@ if(CMAKE_HOST_WIN32)
file(COPY C:\\3rd\\x64\\mpv\\libmpv-2.dll
DESTINATION ${EXECUTABLE_OUTPUT_PATH}/)
elseif(CMAKE_HOST_APPLE)
target_link_directories(MpvPlayer PRIVATE /usr/lib)
target_link_directories(MpvPlayer PRIVATE /usr/local/lib)
target_link_directories(MpvPlayer PRIVATE "/usr/local/lib")
target_link_libraries(MpvPlayer PRIVATE mpv)
elseif(CMAKE_HOST_UNIX)
elseif(CMAKE_HOST_LINUX)
target_link_libraries(MpvPlayer PRIVATE mpv)
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/mpvplayer/mpvplayer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TARGET = MpvPlayer
DEFINES += MPV_ON

LIBS += \
-l$$replaceLibName(custommpv) \
-l$$replaceLibName(qmpv) \
-l$$replaceLibName(thirdparty) \
-l$$replaceLibName(dump) \
-l$$replaceLibName(utils)
Expand Down
19 changes: 9 additions & 10 deletions src/mpv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ set(PROJECT_SOURCES
previewwidget.hpp
qthelper.hpp)

add_custom_library(custommpv ${PROJECT_SOURCES} ${SOURCES})
target_link_libraries(custommpv PRIVATE Qt6::Widgets Qt6::OpenGLWidgets)
add_custom_library(qmpv ${PROJECT_SOURCES} ${SOURCES})
target_link_libraries(qmpv PRIVATE Qt6::Widgets Qt6::OpenGLWidgets)

if(CMAKE_HOST_WIN32)
target_include_directories(custommpv PRIVATE "C:\\3rd\\x64\\mpv\\include")
target_link_libraries(custommpv PRIVATE C:\\3rd\\x64\\mpv\\libmpv.dll.a)
target_include_directories(qmpv PRIVATE "C:\\3rd\\x64\\mpv\\include")
target_link_libraries(qmpv PRIVATE C:\\3rd\\x64\\mpv\\libmpv.dll.a)
elseif(CMAKE_HOST_APPLE)
target_include_directories(custommpv PRIVATE "/usr/local/include")
target_link_directories(custommpv PRIVATE /usr/lib)
target_link_directories(custommpv PRIVATE /usr/local/lib)
target_link_libraries(custommpv PRIVATE mpv)
target_include_directories(qmpv PRIVATE "/usr/local/include")
target_link_directories(qmpv PRIVATE "/usr/local/lib")
target_link_libraries(qmpv PRIVATE mpv)
elseif(CMAKE_HOST_LINUX)
target_link_libraries(custommpv PRIVATE mpv)
target_link_libraries(qmpv PRIVATE mpv)
endif()

if(CMAKE_HOST_WIN32)
target_compile_definitions(custommpv PRIVATE "MPV_LIBRARY")
target_compile_definitions(qmpv PRIVATE "MPV_LIBRARY")
endif()
2 changes: 1 addition & 1 deletion src/mpv/mpv.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(mpv.pri)
QT += core gui network widgets openglwidgets

DEFINES += MPV_LIBRARY
TARGET = $$replaceLibName(custommpv)
TARGET = $$replaceLibName(qmpv)

SOURCES += \
mediainfo.cc \
Expand Down
2 changes: 1 addition & 1 deletion src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(PROJECT_SOURCES
utils.h
utilstr.h)

add_custom_library(utils ${PROJECT_SOURCES} ${SOURCES})
add_custom_library(utils ${PROJECT_SOURCES})
target_link_libraries(utils PRIVATE Qt6::Widgets Qt6::Core5Compat)

if(CMAKE_HOST_WIN32)
Expand Down

0 comments on commit ef1ae20

Please sign in to comment.