故事发生了,VLC SDK
pod的Windows
头文件(包括)有问题MSYS2
。
一般来说,当从 *nix 迁移插件时,头文件vlc_threads.h
会显示:
static inline int vlc_poll(struct pollfd *fds, unsigned nfds, int timeout)
{
int val;
vlc_testcancel();
val = poll(fds, nfds, timeout);
if (val < 0)
vlc_testcancel();
return val;
}
# define poll(u,n,t) vlc_poll(u, n, t)
没有一个编译器想吃掉它。说到poll
一开始没有定义,以及libtorrent-rasterbar
使用 的,由于定义了宏而boost
无法访问该函数。poll
我决定走这条路:下载SDK
,解压(我们只在组装库时需要它),然后如果程序集在下面WIN32
,则转到带有标题的文件夹,读取文件,从那里剪切宏,更换:
if (WIN32)
include (FetchContent)
cmake_policy (SET CMP0135 NEW)
FetchContent_Declare (
vlc_windows
URL "https://github.com/evo-i/vlc-bittorrent-sdk-windows/raw/vlc-3.0.32-win64/vlc-3.0.21-win64.7z")
FetchContent_MakeAvailable(vlc_windows)
add_library (libvlccore SHARED IMPORTED)
set_target_properties (libvlccore
PROPERTIES
IMPORTED_IMPLIB "${vlc_windows_SOURCE_DIR}/sdk/lib/libvlccore.lib"
INTERFACE_INCLUDE_DIRECTORIES "${vlc_windows_SOURCE_DIR}/sdk/include/vlc/plugins")
add_library (Vendor::VlcPlugin ALIAS libvlccore)
if (NOT DEFINED VLC_THREADS_FIXED)
file (READ
"${vlc_windows_SOURCE_DIR}/sdk/include/vlc/plugins/vlc_threads.h"
VLC_THREADS_BUG)
string (REPLACE "val = poll(fds, nfds, timeout)"
"val = vlc_poll(fds, nfds, timeout)"
VLC_THREADS_NO_THREADS_BUG
${VLC_THREADS_BUG})
string (REPLACE "# define poll(u,n,t) vlc_poll(u, n, t)" ""
VLC_THREADS_NO_MORE_BUGS
${VLC_THREADS_NO_THREADS_BUG})
file (WRITE
"${vlc_windows_SOURCE_DIR}/sdk/include/vlc/plugins/vlc_threads.h"
${VLC_THREADS_NO_MORE_BUGS})
unset (VLC_THREADS_NO_MORE_BUGS)
set (VLC_THREADS_FIXED 1 CACHE BOOL "" FORCE)
endif (NOT DEFINED VLC_THREADS_FIXED)
else (WIN32)
...
因此,当写入文件时,一切都很好,但没有一个分号;
!什么都吃了CMake
!认为这是一个列表...
有什么办法让他不要这样做吗?当阅读或写作时......嗯,你确实需要这样做。