Filter SDK/Compile AviSynth

From Avisynth wiki
Revision as of 14:16, 22 December 2016 by Admin (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

All AviSynth versions up to 2.61 have code base that is explicitly for Visual C++ 6 with the Processor Pack add on. Since 2.61 newer compilers are supported. Solutions and project files are present for Microsoft Visual C/C++ 6 (1998), 8 (2005) and 9 (2008). For Microsoft Visual C/C++ 10 (2010) and more recent MS compilers you should open the Microsoft Visual C/C++ 9 (2008) solution and let it do the conversion for you. You will get a bunch of MSB8012 warnings, but the converted solution and project files should be fine.

  • Prior AviSynth 2.55, the DirectShowSource filter was not a separate plugin. This means that you needed to install DirectX SDK (where the baseclasses were included) to compile AviSynth itself.
  • From 2.55 up to 2.60 you only need to install DirectX SDK in order to compile the DirectShowSource plugin.
  • Since 2.61 the baseclasses are included in the source tree, so you won't need to install Windows SDK (note these classes are only included in standalone Windows SDK versions, not in the ones included in Express editions nor in DirectX SDK).

To sum up, for compiling AviSynth and DirectShowSource, it's sufficient to use the Express edition. However for Visual C++ 6 the Processor Pack add on is still needed.

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).

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++ 8.0 (2005) Express and Professional Edition

Installing MS VC++ 2005 Express and Professional Edition

  • Install MS VC++ 2005 Express Edition.

http://www.microsoft.com/express/2005/ It is web-based install, but you need to register (which you can do freely).

I prefer manual installation with full CD image download. It may be used on computer without Internet access. http://go.microsoft.com/fwlink/?linkid=57034 (Note: link updated Dec/10)

Run it at least once before installing the SDK

  • Install Microsoft Platform SDK

Last version is at http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB

Previous versions works fine too (and older February 2003).

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm

It seems, you need install Core component only with Web install, but you may prefer full or ISO download for offline computer.

Setting up MS VC++ 2005 Express and Professional Edition environment

  • Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.

Add the paths to the appropriate subsection (change 'Microsoft Platform SDK for Windows Server 2003 R2' in following strings by your real path of installed version of Microsoft SDK):

Add to Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin

Add to Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include

Add to Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

See http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

  • Update the corewin_express.vsprops file.

To make the Win32 template work in Visual C++ Express you need to edit the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and change the string that reads:

AdditionalDependencies="kernel32.lib" to

AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"

This step is usually not needed for most AviSynth plugins (kernel.lib is enough), but sometimes you may need in some other library, in particular User.Lib for debug.

  • Enable Win32 Windows Application type in the Win32 Application Wizard.

To enable that type, you need to edit the file AppSettings.htm file located in the folder “%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\".

In a text editor comment out lines 441 - 444 by putting a // in front of them as shown here:

// WIN_APP.disabled = true;

// WIN_APP_LABEL.disabled = true;

// DLL_APP.disabled = true;

// DLL_APP_LABEL.disabled = true;

Save and close the file and open Visual C++ Express.

This step is optional if you have project file for plugin (new or old C++ version) and do not create new plugin from scratch.

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, you should compile the baseclasses first and link the plugin with the resulting library strmbase.lib (debug version: strmbasd.lib). Note that since 2.61 the baseclasses are included in the source. So you don't need to install DirectX SDK or Windows SDK separately.
  • If for some reason you want to install Windows SDK 7.0, 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 [*].

---

[*] 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.

Setting up MS VC++ 2008 Express and Professional Edition environment

Prior to AviSynth 2.61 you need the standalone Windows SDK versions to have the BaseClasses. In addition you need to the following include and lib paths:

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"

Since AviSynth 2.61 this is not necessary anymore, since BaseClasses is included with AviSynth 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, you should compile the baseclasses first and link the plugin with the resulting library strmbase.lib (debug version: strmbasd.lib). Note that since 2.61 the baseclasses are included in the source. So you don't need to install DirectX SDK or Windows SDK separately.
  • If for some reason you want to install Windows SDK 7.1, 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 targeting 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]

---

  • When targeting 64-bit plugins, you need to install the Windows SDK 7.1 too and make it current.

Setting up MS VC++ 2010 Express and Professional Edition environment

Prior to AviSynth 2.61 you need the standalone Windows SDK versions to have the BaseClasses. In addition you need to the following include and lib paths:

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.1\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.1\Samples\multimedia\directshow\baseclasses\Release"
SET LIB=%LIB%;"C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Lib\x86"

Since AviSynth 2.61 this is not necessary anymore, since BaseClasses is included with AviSynth 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

Personal tools