Success compiling Audacity with VS2010
Posted: Tue Nov 15, 2011 5:23 am
In your Audacity directory, convert win/audacity.sln by opening it in MS VS2010 (this needs to be an up-to-date version--use Windows Update service and make sure you are set to "update other products from Microsoft"). DO NOT attempt to build it yet!
After the conversion, in the /win/ folder you will find the newly-created-during-conversion file:
ny.props
Open this file with a text editor and replace it with the following:
A close comparison will show the removal of some unwanted quotation marks.
Now you need to turn off DSound; there must be an easier way using #defines and pre-processor symbols, but I'm no compiler guru <grin>...
Choose the Solution you wish to build (Unicode Release, Unicode Debug, Release or Debug); open (if not already) the Solution Explorer window in MS VS2010 and right-click the Audacity Project. From the context menu choose Properties.
add to Audacity project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portaudio-v19 project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portmixer project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
portaudio-v19 remove 1 line; property page: Build Events > Pre-Build Events -- Command Line:
portmixer remove 1 line; property page: Build Events > Pre-Build Events -- Command Line:
portaudio-v19 remove 2 lines; property page: Build Events > POST-Build Events -- Command Line:
-------BECOMES---
portmixer remove 1 line; property page: Build Events > POST-Build Events -- Command Line:
-------BECOMES---
The above procedure will need to be followed for every Solution you wish to build--a real hassle! So, if you ever SVN Checkout a complete HEAD you will need to go through all that all over again unless you save everything and only replace the changed files.
There are a few lines of code to comment out:
lib-srcportaudio-v19srcoswinpa_win_hostapis.c lines 75-77:
lib-srcportmixersrcpx_mixer.c lines 54-57:
and in the same file, lines 135-139:
That's it, the wxWidgets libraries will not need to be re-built! Now build, run and enjoy the spiffy new IDE of MS VS2010.
After the conversion, in the /win/ folder you will find the newly-created-during-conversion file:
ny.props
Open this file with a text editor and replace it with the following:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup
Condition="'$(copyBeforeTargets)' == '' and '$(copyAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
<copyBeforeTargets>Midl</copyBeforeTargets>
<copyAfterTargets>CustomBuild</copyAfterTargets>
</PropertyGroup>
<PropertyGroup>
<copyDependsOn
Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(copyDependsOn)</copyDependsOn>
</PropertyGroup>
<ItemDefinitionGroup>
<copy>
<OutputName>$(OutDir)$(ProjectFileName)%(Filename)%(Extension)</OutputName>
<CommandLineTemplate>copy /Y [inputs] %(OutputName)</CommandLineTemplate>
<Outputs>%(OutputName)</Outputs>
<ExecutionDescription>Copying %(Filename)</ExecutionDescription>
</copy>
</ItemDefinitionGroup>
</Project>
Now you need to turn off DSound; there must be an easier way using #defines and pre-processor symbols, but I'm no compiler guru <grin>...
Choose the Solution you wish to build (Unicode Release, Unicode Debug, Release or Debug); open (if not already) the Solution Explorer window in MS VS2010 and right-click the Audacity Project. From the context menu choose Properties.
add to Audacity project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portaudio-v19 project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portmixer project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
portaudio-v19 remove 1 line; property page: Build Events > Pre-Build Events -- Command Line:
Code: Select all
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>"$(ProjectDir)/$(Configuration)/config.h"Code: Select all
IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>"$(ProjectDir)/$(Configuration)/config.h"Code: Select all
if "%DXSDK_DIR%"=="" goto NoDX
cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/hostapi/dsound/pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/hostapi/dsound/pa_win_ds_dynlink.c"
set LIBS="%DXSDK_DIR%/lib/x86dxguid.lib"
:NoDXCode: Select all
if "%DXSDK_DIR%"=="" goto NoDX
set LIBS="%DXSDK_DIR%/lib/x86dxguid.lib"
:NoDXCode: Select all
if "%DXSDK_DIR%"=="" goto NoDX
cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/px_win_ds.c"
set LIBS="%DXSDK_DIR%/lib/x86/dxguid.lib"
:NoDXCode: Select all
if "%DXSDK_DIR%"=="" goto NoDX
set LIBS="%DXSDK_DIR%/lib/x86/dxguid.lib"
:NoDXThere are a few lines of code to comment out:
lib-srcportaudio-v19srcoswinpa_win_hostapis.c lines 75-77:
Code: Select all
//#ifndef PA_NO_DS
// PaWinDs_Initialize,
//#endifCode: Select all
//#if defined(PX_USE_WIN_DSOUND)
//int OpenMixer_Win_DirectSound(px_mixer *Px, int index);
//#endifCode: Select all
//#if defined(PX_USE_WIN_DSOUND)
// case paDirectSound:
// good = OpenMixer_Win_DirectSound(Px, i);
// break;
//#endif