News:

--

Main Menu

Building avidemux with visual studio 2015 (WIP)

Started by mean, November 29, 2016, 07:26:11 AM

Previous topic - Next topic

mean

This is very work in progress !

What you'll need :

* Visual studio  2015, community edition is enough
* Msys64 installed : Additionnal package tar,bzip2, patch, make
* Cmake installed

* Qt5.7 installed (msvc2015 version)
* yasm in your path, named "yasm.exe", rename it if needed. I personnaly copied it to the visual studio folder i.e. c:\Program Files x86)\Microsoft visual studio\VC\bin\amd64\yasm.exe

Make sure you have cmake, Qt in your path


You'll need a mingw skeleton folder containing the libs, includes and exe will need later on
My setup is to have it as d:/mingw

Mingw skeleton just contains
- pkgconfig
- zlib
-sqlite3
- winpthread

with the following layout
  bin
     libwinpthread-1.dll  pkg-config.exe  sqlite3.dll  zlib.dll  zlibd.dll
  include
     pthread.h  pthread_compat.h  pthread_time.h  pthread_unistd.h  sched.h  schedule.h  semaphore.h  sqlite3.h  sqlite3ext.h  zconf.h  zlib.h
  lib
     libsqlite3.lib  libwinpthread.la  libwinpthread.lib  libzlib.lib  libzlibd.lib  old  pkconfig  sqlite3.lib  zlib.dll  zlibd.dll 

/!\ The lib must match your architecture , amd64 here
/!\ cmake is picky, the lib must starts with "lib" i.e. zlib will not work, libzlib will work


mean

#1
Setup :

We'll use a msys bash shell for all operations (you can use visual c++ 2015 later if you want)

1- Start a command shell (windows)
2- Go to c:\Program files (x86)\Visual studio 14.0\VC

vcvarsall.bat amd64

then from the *same shell* run usr/bin/bash.exe

You have now a bash shell setup for Visual c++ 64 bits setup

Add the visual studio path  :
export PATH="/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64":$PATH

Check everything is working :
"which cl" => should answer c:\Program files (x86)\Microsoft Visual studio 14.0/VC/bin/amd64/cl.exe
"which link" =>  should answer c:\Program files (x86)\Microsoft Visual studio 14.0/VC/bin/amd64/link.exe

If it answers /usr/bin/link.exe rename it (i.e. /usr/bin/link /usr/bin/link___) and retry

"which patch" =>  should answer /usr/bin/patch
"which tar" =>  should answer /usr/bin/tar
"which bunzip2" =>  should answer /usr/bin/bunzip2











mean

#2
Step 1: building ffmpeg

The full build is broken at the moment
We'll do it in two steps , i.e. generate ffmpeg once, then reuse the generated stuff
It's a good idea anyway, building ffmpeg is very very slow
So go to where your build tree will be, for example d:/build/buildFFmpeg



cmake  -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="z:/runVs" -DVS_ROOT="d:/mingw" -DVERBOSE=True  /z/vs/avidemux_core

CMAKE_INSTALL_PREFIX => Where your binaries will end up. In my case it's z:/runVS
VS_ROOT => mingw skeleton, d:/mingw for me

avidemux sources are located in z:\vs

mean

#3
then build

cmake --build . --target INSTALL             

It will fail, but we'll finish the build manually

cd ffmpeg/build
make -j 4
make install

Copy the resulting libs and source header somewhere else
like d:/import

so that it has the following structure

d:/import
    include
         config.h  libavcodec  libavformat  libavutil  libpostproc  libswscale 

   lib
        avcodec.exp  avcodec-57.def  avdevice.exp  avdevice-57.def  avformat.exp  avformat-57.def  avutil.exp  avutil-55.def  nonumber      postproc.lib     postproc-54.dll  swscale.lib    swscale-4.dll                                                                   
       avcodec.lib  avcodec-57.dll  avdevice.lib  avdevice-57.dll  avformat.lib  avformat-57.dll  avutil.lib  avutil-55.dll  postproc.exp  postproc-54.def  swscale.exp      swscale-4.def   

Make sure you copy the headers from inside avidemux, not vanilla ffmpeg


The we can clean it up and rebuild using the pre built ffmpeg setup
It will be much faster





mean

#4
Build Core, reusing the ffmpeg binaries
-------------------------------------------------
Go to your build tree, for example d:\build\buildCore

cmake  -G "Visual Studio 14 2015 Win64" -DVS_IMPORT=True -DIMPORT_FOLDER="d:\import" -DCMAKE_INSTALL_PREFIX="z:/runVs" -DVS_ROOT="d:/mingw" -DVERBOSE=True  /z/vs/avidemux_core                                                                                                                   
cmake --build . --target INSTALL           

It will compile and install core
You can also open the sln file with visual studio, dont forget to build the INSTALL target so that it is deployed
You can also use the cmake-gui to generate the sln, but it's a pain to do it again and again with the GUI




mean

#5
build avidemux/Qt5
-----------------------
Once done we can switch to qt5

Go to where your build tree will be e.g. d:\build\buildQt



cmake  -DVERBOSE=True -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="z:/runVs" -DVS_ROOT="d:/mingw" -DVERBOSE=True -DENABLE_QT5=True  /z/vs/avidemux/qt4                                                                                                   
cmake --build . --target INSTALL


You might need to copy a few dlls to CMAKE_INSTALL_PREFIX, such a sqlite3.dll, zlib.dll, winpthread-1.dll and the ffmpeg dll

You can start avidemux.exe

At the moment it crashes at startup for some weird microsoft way of doing things error

mean

Very minimalistic build should be ok and run now