Filter SDK/Compile AviSynth
Introduction
All AviSynth versions up to 2.60 have code base that is explicitly for Visual C++ 6 with the Processor Pack add on. If you want to compile the DirectShowSource plugin you will also need to install the DirextX stuff.
Note that prior AviSynth 2.55, the DirectShowSource filter was not a separate plugin. This means that you needed to install the DirectX stuff to also compile AviSynth itself.
Since 2.61 newer compilers are supported. Solutions and project files are present for Microsoft Visual C/C++ 8 (2005), 9 (2008) and 10 (2010). It's sufficient to get the Express edition and for compiling the DirectShowSource plugin you will need to install a Windows SDK where the baseclasses are included. More information can be found below.
Compiling AviSynth with Visual C++ 6.0 (1998)
Installing MS VC++ 1998
Install Microsoft Visual Studio (containing VC6). You need the Professional or Enterprise edition, since the Student (Standard) edition is not enough. The reason is that you need the Processor Pack (with MASM for certain optimization code), which you can't install with the Student Edition. Also, you must not install SP6, as it does not support the Processor Pack (and will remove it).
- Install Visual Studio 6.0 SP5. It's no longer available from microsoft.com, google for vs6sp5.exe.
- Install Visual C++ 6.0 Processor Pack.
- Install Platform SDK (February 2003). It's the last one which supports VC 6.0:
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.1.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.2.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.3.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.4.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.5.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.6.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.7.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.8.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.9.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.10.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.11.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.12.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.13.cab
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.bat
- http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/extract.exe
- Install DirectX 9 SDK. SDK 8.1 was used for old Avisynth. Note that DirectDraw support is dropped since DirectX SDK (June 2010) and the last SDK supporting VC 6.0 was DirectX SDK (Summer 2003), which is (what a coincidence!) no longer available from microsoft.com.
- Now you should compile BaseClasses (release, debug or both) from DX90SDK\Samples\C++\DirectShow\BaseClasses. In later versions BaseClasses where moved to DirectX SDK Extras package and finally to Platform SDK.
Setting up MS VC++ 1998 environment
- Before compiling Avisynth, check your Tools -> Options -> Directories. Something like this should work for Includes:
- ... DX90SDK\Samples\C++\DirectShow\BaseClasses
- ... DX90SDK\Include
- ... MICROSOFT SDK\INCLUDE
- ... Microsoft Visual Studio\VC98\INCLUDE
- ... Microsoft Visual Studio\VC98\MFC\INCLUDE
- ... Microsoft Visual Studio\VC98\ATL\INCLUDE
- and for Libraries:
- ... DX90SDK\SAMPLES\C++\DIRECTSHOW\BASECLASSES\RELEASE_UNICODE
- ... DX90SDK\SAMPLES\C++\DIRECTSHOW\BASECLASSES\DEBUG_UNICODE
- ... DX90SDK\Lib
- ... Microsoft SDK\Lib
- ... Microsoft Visual Studio\VC98\Lib
- ... Microsoft Visual Studio\VC98\Lib
- ... Microsoft Visual Studio\VC98\MFC\LIB
- After successful compilation you may want to use NSIS to make an installer. Just run avisynth\distrib\AviSynth_2.5.nsi.
Compiling Avisynth with MS VC 2003
Using MS VC 2003 compilers is possible but will require some changes.
1.) get source zip or fresh cvs checkout (project file, libs, everything)
2.) opened workspace in vs.net 2003, and selected "yes to all" on the convert projects popup
3.) set configuration to release
4.) had to do the usual thing for the custom build step command line on the asm file "convert_a.asm", which is take out the quotation marks
5.) the SoundTouch lib still has problems, replace it with own build. Get source code (v1.3.1) at http://www.surina.net/soundtouch and compile the library. You will have to set the Runtime Library under C/C++ codegeneration to Multi-threaded DLL when you compile the SoundTouch lib with VS .NET 2003 (you should use the same compiler you want to compile avisynth with).
6.) compile and it works, has the usual warnings but those are fine
Compiling Avisynth with MS VC 2005
Using both 2005 and 2005 Express compilers is possible but will require some changes. Please feel free to openly discuss any issues you find so other may benefit from your experiences.
Be aware the 2005 RT environment changes the way system exceptions are handled and processed. So your builds may not respond as expected to error conditions.
AviSynth 2.6 move to VC2005 Express: http://forum.doom9.org/showthread.php?t=112138
Instruction to set VC2005 Express environment
Compiling Avisynth with MS VC++ 9.0 (2008) Express and Professional Edition
Installing MS VC++ 2008 Express and Professional Edition
- Install MS VC++ 2008 Express SP1. Either get the web-based installer (download link; when running it will download the necessary components when installing) or the full iso (download link).
When downloading the iso, you will need to mount it as a separate drive using VirtualCloneDrive for example. More about the Express editions can be found here.
- Note that Windows SDK 6.0a will be included in this edition. In general, an 'a' version of the Windows SDK is always included in an Express edition. So for compiling AviSynth itself you won't need to download and install Windows SDK separately.
- When you want to compile the DirectShowSource plugin, the above steps are not sufficient since the baseclasses are not included in Windows SDK 6.0a. So you will need to install Windows SDK 7.0 first. Doing so is a bit challenging due to some bugs which need to be addressed:
- Before installing Windows SDK 7.0 (holds for newer versions too) you need to de-install every Redistributable Package otherwise the install will fail. You can reinstall them afterwards again.
- Install Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 (or the full iso, download link), also called Windows SDK 7.0.
- It's a good idea to look at the log-file if the installation is successful or not. The log file is located at: C:\%user%\AppData\Local\Temp\SDKSetup_7.0.6918.0.log or for XP users C:\%userprofile%\Local Settings\Temp\SDKSetup_7.0.6918.0.log. The value of %user% can be found by typing echo %user% in a dos prompt.
- The last step is to make your Windows SDK 7.0 current (thus configuring VC to use the installed SDK instead of its own SDK) and this can be done with the Windows SDK Configuration Tool.
However when the display format of your operating system is not English, you might get the error "Your system does not have Visual Studio 2005 or Visual Studio 2008 installed.".
If that's the case set the display format of your operating system to English (US): Go to Control Panel and navigate to your Regional and Language Options. On the Formats tab ensure English (United States) is selected.
At last use the gui or the command-line version of Windows SDK Configuration Tool to change to the version of the Windows SDK you wish to target. The command-line version is located at C:\Program Files\Microsoft SDKs\Windows\v7.0\Setup\WindowsSdkVer.exe. For example to target the Windows 7 SDK, go to the Windows SDK prompt by Clicking All Programs -> Select Microsoft Windows SDK v7.0 -> Select CMD shell. At the Windows SDK command prompt, type 'WindowsSdkVer.exe -version:v7.0' [without quotes] - Microsoft SDK comes with a command-line build environment (which is called SetEnv.Cmd). It's broken and needs to be fixed if you want to use it [*].
- Install the DirectX SDK (August 2009).
---
[*] SetEnv.Cmd is located in C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin and needs to be fixed:
- subfolder VC needs to be added in the variables VCRoot and VSRoot:
SET "VCRoot=%ProgramFiles%\Microsoft Visual Studio 9.0\VC" SET "VSRoot=%ProgramFiles%\Microsoft Visual Studio 9.0\VC\"
- Note that the '>nul 2>&1' part in SetEnv.Cmd will hide the output of the REG command. If you want to see that output (makes relevant error messages visible too), just remove that part.
- You need to add 'setlocal EnableDelayedExpansion' (without quotes) on the top of the file otherwise the variables to be expanded at execution time, resulting in a broken path variable (hence it can't find the reg command, and hence SetEnv.Cmd will crash). More information can be found here.
---
- When targeting 64-bit plugins, you need to install the Windows SDK 7.0 too and make it current. However the 64-bit support is broken (meaning you can't select x64 as target platform in the configuration manager) and needs to be fixed. More can be found here and here. A patch can be found here.
- A final note: Your registry should have these entries.
Setting up MS VC++ 2008 Express and Professional Edition environment
Go to Tools > Options > Projects and Solutions > VC++ Directories and add the following entries on top:
- Add DirectShow and DirectX to C++ command line INCLUDE path
SET INCLUDE=%INCLUDE%;"C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\Multimedia\DirectShow\BaseClasses" SET INCLUDE=%INCLUDE%;"C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Include"
- Add DirectShow and DirectX to link command line LIB path
SET LIB=%LIB%;"C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses\Release" SET LIB=%LIB%;"C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Lib\x86"
todo: don't need to do this, will be set in the project file of DSS itself.
Compiling Avisynth
xxx
Compiling Avisynth with MS VC++ 10.0 (2010) Express and Professional Edition
One might think that the issues were present in MS VC++ 9.0 (2008) Express and Windows SDK 7.0 are solved in later versions, but that's not the case in MS VC++ 10 (2010) Express and Windows SDK 7.1. In fact the installation is even more problematic. When you want to compile the DirectShowSource plugin, you need to install Windows SDK 7.1 too. As explained here you need to install the following components in this order:
- Visual Studio 2010
- Windows SDK 7.1
- Visual Studio 2010 SP1
- Visual C++ 2010 SP1 Compiler Update
Installing MS VC++ 2010 Express and Professional Edition
- Install MS VC++ 2010 Express. Either get the web-based installer (download link; when running it will download the necessary components when installing) or the full iso (download link).
When downloading the iso, you will need to mount it as a separate drive using VirtualCloneDrive for example. More about the Express editions can be found here.
- Note that Windows SDK 7.0a will be included in this edition. In general, an 'a' version of the Windows SDK is always included in an Express edition. So for compiling AviSynth itself you won't need to download and install Windows SDK separately.
- When you want to compile the DirectShowSource plugin, the above steps are not sufficient since the baseclasses are not included in Windows SDK 7.0a. So you will need to install Windows SDK 7.1 first. Doing so is a bit challenging due to some bugs which need to be addressed:
- Before installing Windows SDK 7.1 (holds for newer versions too) you need to de-install every Redistributable Package otherwise the install will fail. You can reinstall them afterwards again.
- Install Microsoft Windows SDK for Windows 7.1 and .NET Framework 4 SP1 (or the full iso, download link), also called Windows SDK 7.1.
- It's a good idea to look at the log-file if the installation is successful or not. The log file is located at: C:\%user%\AppData\Local\Temp\SDKSetup_7.0.6918.0.log or for XP C:\%userprofile%\Local Settings\Temp\SDKSetup_7.0.6918.0.log (apparently it has no 7.1 in its filename). The value of %user% can be found by typing echo %user% in a dos prompt.
- The last step is to make your Windows SDK 7.1 current (thus configuring VC to use the installed SDK instead of its own SDK) and this can be done with the Windows SDK Configuration Tool.
However when the display format of your operating system is not English, you might get the error "Your system does not have Visual Studio 2005 or Visual Studio 2008 installed.".
If that's the case set the display format of your operating system to English (US): Go to Control Panel and navigate to your Regional and Language Options. On the Formats tab ensure English (United States) is selected.
At last use the gui or the command-line version of Windows SDK Configuration Tool to change to the version of the Windows SDK you wish to target. The command-line version is located at C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe. For example to target the Windows 7.1 SDK, go to the Windows SDK prompt by Clicking All Programs -> Select Microsoft Windows SDK v7.1 -> Select CMD shell. At the Windows SDK command prompt, type 'WindowsSdkVer.exe -version:v7.1' [without quotes] - Microsoft SDK comes with a command-line build environment. It is called SetEnv.Cmd and should be called by
Setenv /Release /x86
when targetting the 32-bit release version. Note that it works properly.
- Install Visual Studio 2010 SP1 [1]
- Install Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1 [2]
- Install the DirectX SDK (August 2009).
---
- When targeting 64-bit plugins, you need to install the Windows SDK 7.1 too and make it current.
- A final note: Your registry should have these entries.
Setting up MS VC++ 2010 Express and Professional Edition environment
Go to Tools > Options > Projects and Solutions > VC++ Directories and add the following entries on top:
- Add DirectShow and DirectX to C++ command line INCLUDE path
SET INCLUDE=%INCLUDE%;"C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\Multimedia\DirectShow\BaseClasses" SET INCLUDE=%INCLUDE%;"C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Include"
- Add DirectShow and DirectX to link command line LIB path
SET LIB=%LIB%;"C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses\Release" SET LIB=%LIB%;"C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Lib\x86"
todo: don't need to do this, will be set in the project file of DSS itself.
Compiling Avisynth
xxx
Compiling Avisynth with ICC 11
See: http://forum.doom9.org/showthread.php?p=1388247#post1388247
Discussion topic about compiling AviSynth
Compiling Avisynth: http://forum.doom9.org/showthread.php?t=41913 yes to all