Skip to content

Commit

Permalink
update documents about building. add a Chinese document
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Mar 29, 2013
1 parent 6e63108 commit af89e91
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 34 deletions.
78 changes: 78 additions & 0 deletions doc/BuildQtAV-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 1,78 @@
## 1. Setup the environment

QtAV 依赖 FFmpeg, PortAudio,以及一些可选的库如direct2d, xvideo
可以从这里下载windows下FFmpeg和PortAudio开发用的文件 [QtAV sourceforge page](https://sourceforge.net/projects/qtav/files/depends)
windows 下的 FFmpeg 也可以从这里下载 [Zeranoe](http://ffmpeg.zeranoe.com/builds)
Or you can build them your self [Compile FFmpeg and PortAudio](https://github.com/wang-bin/QtAV/wiki/Compile-FFmpeg-and-PortAudio)

首先你 *必须* 让编译器能找到 FFmpeg 的头文件和库文件., 否则在 qmake 时会出错。如果你已经把那些文件放到该放的位置了,可以忽略这步。

vc 编译器会在环境变量 __*INCLUDE*__ 制定的那些目录搜索头文件, __*LIB*__ 制定的目录搜索库文件,因此如果你使用命令行编译的话可以这样设置环境

set INCLUDE=ffmpeg_path\include;portaudio_path\include;%INCLUDE%
set LIB=ffmpeg_path\lib;portaudio_path\lib;%LIB%


GCC 会在环境变量 __*CPATH*__ 搜索头文件, __*LIBRARY_PATH*__ 里搜索库文件。因此你可以设置这些变量来包含 FFmpeg 和 PortAudio 相关的路径。
unix shell环境下的 gcc (也包括环境中有sh.exe的mingw环境):

export CPATH=ffmpeg_path/include:portaudio_path/include:$CPATH
export LIBRARY_PATH=ffmpeg_path/include:portaudio_path/lib:$LIBRARY_PATH

windows 无sh.exe的环境下的 gcc

set CPATH=ffmpeg_path\include;portaudio_path\include;%CPATH%
set LIBRARY_PATH=ffmpeg_path\lib;portaudio_path\lib;%LIBRARY_PATH%

如果使用 QtCreator 进行编译, 打开左边的 '工程' 页面,添加或追加相应的环境变量就行

## 2. qmake

对于大多数系统, 只要

qmake
make

强烈建议不要在源码目录编译,而是使用如下的方法

cd your_build_dir
qmake QtAV_source_dir/QtAV.pro
make

qmake 在第一次运行的时候会检测所依赖的库, 你要保证这些库能被找到。
然后 qmake 会在编译目录生成一个 cache 文件 _.qmake.cache_ . cache 文件包含了检测结果,比如 portaudio 是否支持。 如果你想重新检测, 则需要删除 _**.qmake.cache**_ 再运行 qmake

_WARNING_: If you are in windows mingw with sh.exe environment, you may need run qmake twice. I have not find out the reason!

## 3. Make

使用 make, jom, nmake 或者 QtCreator 进行编译.



## Windows 下的编译

你必须在qmake前配置好环境,如最开始所说的。

#### Visual Studio

我没有在 QtAV 里放任何 vs 的工程文件,因为这些工程很容易由 qmake 生成

打开命令行

qmake -r -tp vc QtAV.pro

然后 sln 和 vcxproj(vcproj) 文件会创建. 用 Visual Studio 打开 QtAV.sln 进行编译.

另外你也可以使用 Qt vs plugin 来导入qmake 工程(未测试)

#### QtCreator 里使用 MSVC

QtCreator 会检测 VC 编译器,编译过程和 gcc 的差不多,很简单。


#### VC 命令行下编译

我从 VS2012 Update1 中提取了 VC 编译器和 windows sdk. 可以从这里下载 http://qtbuild.googlecode.com/files/vs2012-x86.7z

这个编译环境很精简但是开发C 的功能很完整,至少能用它成功编译 Qt。
78 changes: 78 additions & 0 deletions doc/BuildQtAV.md
Original file line number Diff line number Diff line change
@@ -0,0 1,78 @@
## 1. Setup the environment

QtAV depends on FFmpeg, PortAudio and some other optional libraries such as direct2d and xvideo.
You can download FFmpeg and PortAudio development files for windows from [QtAV sourceforge page](https://sourceforge.net/projects/qtav/files/depends)
You can also download FFmpeg development files for windows from [Zeranoe](http://ffmpeg.zeranoe.com/builds)
Or you can build them your self [Compile FFmpeg and PortAudio](https://github.com/wang-bin/QtAV/wiki/Compile-FFmpeg-and-PortAudio)

You *MUST* let your compiler know where FFmpeg headers and libraries are. Otherwise you will get an error when running qmake. If they are already be where they should be, just skip this step.

vc compiler will search headers in __*INCLUDE*__ and search libraries in __*LIB*__, so you can set the environment like below if your compile in command line

set INCLUDE=ffmpeg_path\include;portaudio_path\include;%INCLUDE%
set LIB=ffmpeg_path\lib;portaudio_path\lib;%LIB%

GCC will search headers in environment var __*CPATH*__ and libraries in __*LIBRARY_PATH*__. So you can set those vars to include your FFmepg and PortAudio dir.

gcc in unix shell environment(including mingw with sh.exe):

export CPATH=ffmpeg_path/include:portaudio_path/include:$CPATH
export LIBRARY_PATH=ffmpeg_path/include:portaudio_path/lib:$LIBRARY_PATH

gcc in windows cmd environment without sh.exe

set CPATH=ffmpeg_path\include;portaudio_path\include;%CPATH%
set LIBRARY_PATH=ffmpeg_path\lib;portaudio_path\lib;%LIBRARY_PATH%

If you are building in QtCreator, goto QtCreator's 'Projects' page and add or append those environment.

## 2. Run qmake

For most platforms, just

qmake
make

It's strongly recommend not to build in source dir.

cd your_build_dir
qmake QtAV_source_dir/QtAV.pro
make

qmake will run check the required libraries at the first time, so you must make sure those libraries can be found by compiler.
Then qmake will create a cache file _.qmake.cache_ in your build dir. Cache file stores the check results, for example, whether portaudio is available. If you want to recheck, delete _**.qmake.cache**_ and run qmake again

_WARNING_: If you are in windows mingw with sh.exe environment, you may need run qmake twice. I have not find out the reason!

## 3. Make

use make, jom, nmake or QtCreator to build it.



## Build in Windows

You MUST setup the environment before qmake as mention at the beginning.

#### Build In Visual Studio

I don't put any vs project file in QtAV, because it's easy to create by qmake.

Open cmd

qmake -r -tp vc QtAV.pro

Then sln and vcxproj(vcproj) files will be created. Open QtAV.sln in your Visual Studio, Compile it.

Another solution is using Qt vs plugin. It will help you to load qmake projects(not tested).

#### Build In QtCreator With MSVC

QtCreator will detect VC compiler if it is installed. So it's easy to build in QtCreator


#### Build in Command Line VC

I have got VC compiler and win sdk from latest VS2012 Update1. You can download it from http://qtbuild.googlecode.com/files/vs2012-x86.7z

The environment is small but has the almost complete functionality for developing C . At least it can build Qt.
14 changes: 14 additions & 0 deletions doc/CompileFFmpegAndPortAudioWithMSVC.md
Original file line number Diff line number Diff line change
@@ -0,0 1,14 @@
## Build FFmpeg With MSVC

The difficulty is compiling FFmpeg with msvc. The method can be found on the internet. But there is an easier way. When compiling the latest version of FFmpeg with mingw gcc, the *.lib are also created and installed in /usr/local/bin, which can be linked by msvc.
For other libraries compiled with mingw gcc, we can link them in a similar way. I introduce how to use the portaudio library created by mingw gcc. If you compile portaudio with mingw gcc, portaudio.lib file will not be created. So we should create it manually. But the def file can be found in lib/.lib, it will not be installed by default. There is a powerful tool named _dlltool_, with which we can create a lib from a def file for vc, using the following command
`dlltool -m i386 -d libportaudio-2.dll.def -l portaudio.lib -D libportaudio-2.dll`
Then put portaudio.lib into /usr/local/lib and it will be found when linking.
The compiled libraries with msvc support can be found [here](https://sourceforge.net/projects/qtav/files/depends)


## Build PortAudio

## Build QtAV

https://github.com/wang-bin/QtAV/wiki/Build-QtAV
34 changes: 0 additions & 34 deletions doc/CompileWithMSVC.md

This file was deleted.

0 comments on commit af89e91

Please sign in to comment.