Replies: 1 comment
-
Thanks for this guide. This makes things a bit clearer, especially the seemingly random strings in the fake package config. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Adding new libs is not trivial. This discussion should help you on your journey to add new libs.
Compile for UWP using MSVC
The first step is to get the actual lib compiled for UWP using the MSVC toolchain, either via direct Windows call, or through our MSYS2 linux emulation layer. This is the most difficult part: Find out how the lib's build system works. Check if and how it is possible to change the compiler. Change it and hope it works. Check if there is a UWP configuration, create one if it is not there. Make sure if builds on all target platforms. There is no general advice here. You need to dig in and find a way. It's not a bad idea to ask the lib developers. If you are lucky, they use github or similar systems, where you could open an issue. Some use mailing lists, which make it much harder (at least for me) to get in touch. Explain them that you need to build with MSVC because the lib needs to be linked with MSVC based project.
Most libs come from a linux environment and use gcc as compiler. There is a vast number of different build systems on linux. I know a few by now, but there are a whole lot more. Some make it easy to switch compilers, for some it is very difficult.
Sometimes you can find forks that have been changed to use MSVC, but often they are outdated. The ShiftMediaProject has a lot of libs for FFmpeg, but not all of them. I forked a bunch of them and added ARM/ARM64 targets. But for many others, I had to manually find out how to build them with MSVC so they properly link with our FFmpeg build.
A few tips:
Often, linux scripts will use
CC
(the GCC compiler) for compiler calls. You might need to replace it with MSVC cl.exe like thisCC=cl
. Either this can be done as some parameter, or you need to put this right before the build or configure call with only a space separator, e.g.CC=cl ./configure
.You might have to manually create an UWP build configuration. These are the parameters required (you might have to change
/
to-
.Compiler arguments (c_args): /MD /DWINAPI_FAMILY=WINAPI_FAMILY_APP
Linker arguments (c_link_args): /APPCONTAINER /WINMD WindowsApp.lib
How the FFmpeg configure script works
When you enable a new lib in ffmpeg, the confgure script will check that the lib is actually found with the expected name, that the include files are found in the right location, and that compilation will work. This is usually done with calls like this in the configure script.
So what happens here?
Integrate with our FFmpeg build script
If you have succeeded to (manually) build the lib and link it with ffmpeg, the most difficult parts are done. Now you need to automate the steps and integrate them in the build script. Make sure that build works for all platforms. There might be problems with assembler code for specific platforms, some errors only show up late when linking ffmpeg.
Beta Was this translation helpful? Give feedback.
All reactions