在 VS2010 中从 Sourceforge 编译最新代码的技巧是在 1 处修改 ny.props 文件,并在 portaudio-v19 和 portmixer 的 Pre-Build 和 Post-Build 步骤中扩展变量。在当前的解决方案中,我似乎无法让 VS2010 中的环境变量如下所示。扩展它们似乎可以解决这个问题。但是,像 SDK 目录环境变量这样的预先声明的变量可以正常工作。
此外,对 ny.props 文件中引号的单一修复会在以后修复所有级联。这似乎是让它正确编译的最小修复。
修复如下:
ny.props 原文:
<?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>
ny.props 修复:
<?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>
portaudio-v19 Pre-Build 原版:
echo on
set CFG="$(ProjectDir)/$(Configuration)/config.h"
echo // Automatically generated file >%CFG%
IF NOT "%DXSDK_DIR%" == "" echo #define PA_USE_DS 1 >>%CFG%
IF NOT "%ASIOSDK_DIR%" == "" echo #define PA_USE_ASIO 1 >>%CFG%
IF NOT "%JACKSDK_DIR%" == "" echo #define PA_USE_JACK 1 >>%CFG%
IF NOT "%JACKSDK_DIR%" == "" echo #define PA_DYNAMIC_JACK 1 >>%CFG%
rem echo #define PA_USE_WDMKS 1 >>%CFG%
echo #define PA_USE_WASAPI 1 >>%CFG%
echo #define PA_USE_WMME 1 >>%CFG%
portaudio-v19 预构建修复:
echo // Automatically generated file >"$(ProjectDir)/$(Configuration)/config.h"
IF NOT "%DXSDK_DIR%" == "" echo #define PA_USE_DS 1 >>"$(ProjectDir)/$(Configuration)/config.h"
IF NOT "%ASIOSDK_DIR%" == "" echo #define PA_USE_ASIO 1 >>"$(ProjectDir)/$(Configuration)/config.h"
IF NOT "%JACKSDK_DIR%" == "" echo #define PA_USE_JACK 1 >>"$(ProjectDir)/$(Configuration)/config.h"
IF NOT "%JACKSDK_DIR%" == "" echo #define PA_DYNAMIC_JACK 1 >>"$(ProjectDir)/$(Configuration)/config.h"
rem echo #define PA_USE_WDMKS 1 >>"$(ProjectDir)/$(Configuration)/config.h"
echo #define PA_USE_WASAPI 1 >>"$(ProjectDir)/$(Configuration)/config.h"
echo #define PA_USE_WMME 1 >>"$(ProjectDir)/$(Configuration)/config.h"
portaudio-v19 后期构建原版:
echo on
set BASE="../../../lib-src/portaudio-v19"
set CFG=$(ProjectDir)$(Configuration)\config.h
set INTDIR=$(Configuration)
set CFLAGS=/O2 /GL /I "%BASE%/include" /I "%BASE%/src/common" /I "%BASE%/src/os/win" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"%INTDIR%/" /Fd"%INTDIR%" /W3 /nologo /c /wd4996 /FI "%CFG%" /errorReport:prompt
set LIBS=
find "PA_USE_DS 1" "%CFG%"
IF ERRORLEVEL 1 goto NoDS
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/x86\dxguid.lib"
:NoDS
find "PA_USE_WASAPI 1" "%CFG%"
IF ERRORLEVEL 1 goto NoWASAPI
cl %CFLAGS% "%BASE%/src/hostapi/wasapi/pa_win_wasapi.c"
:NoWASAPI
find "PA_USE_WDMKS 1" "%CFG%"
IF ERRORLEVEL 1 goto NoWDMKS
cl %CFLAGS% "%BASE%/src/hostapi/wdmks/pa_win_wdmks.c"
:NoWDMKS
find "PA_USE_ASIO 1" "%CFG%"
IF ERRORLEVEL 1 goto NoASIO
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%BASE%/src/hostapi/asio/pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%BASE%/src/hostapi/asio/iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/common/asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/pc/asiolist.cpp"
:NoASIO
find "PA_USE_JACK 1" "%CFG%" >NUL
IF ERRORLEVEL 1 goto NoJACK
cl %CFLAGS% /I "%JACKSDK_DIR%/includes" "%BASE%/src/hostapi/jack/pa_jack.c"
cl %CFLAGS% /I "%JACKSDK_DIR%/includes" "%BASE%/src/hostapi/jack/pa_jack_dynload.c"
:NoJACK
lib /OUT:"$(TargetPath)" "%INTDIR%/*.obj" %LIBS%
portaudio-v19 构建后修复:
find "PA_USE_DS 1" "$(ProjectDir)$(Configuration)/config.h"
IF ERRORLEVEL 1 goto NoDS
cl /O2 /GL /I "../../../lib-src/portaudio-v19/include" /I "../../../lib-src/portaudio-v19/src/common" /I "../../../lib-src/portaudio-v19/src/os/win" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)/" /Fd"$(IntDir)/" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)$(Configuration)/config.h" /errorReport:prompt /I "%DXSDK_DIR%/include" "../../../lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c"
cl /O2 /GL /I "../../../lib-src/portaudio-v19/include" /I "../../../lib-src/portaudio-v19/src/common" /I "../../../lib-src/portaudio-v19/src/os/win" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)/" /Fd"$(IntDir)/" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)$(Configuration)/config.h" /errorReport:prompt /I "%DXSDK_DIR%/include" "../../../lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds_dynlink.c"
:NoDS
find "PA_USE_WASAPI 1" "$(ProjectDir)$(Configuration)/config.h"
IF ERRORLEVEL 1 goto NoWASAPI
cl /O2 /GL /I "../../../lib-src/portaudio-v19/include" /I "../../../lib-src/portaudio-v19/src/common" /I "../../../lib-src/portaudio-v19/src/os/win" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)/" /Fd"$(IntDir)/" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)$(Configuration)/config.h" /errorReport:prompt "../../../lib-src/portaudio-v19/src/hostapi/wasapi/pa_win_wasapi.c"
:NoWASAPI
find "PA_USE_WDMKS 1" "$(ProjectDir)$(Configuration)/config.h"
IF ERRORLEVEL 1 goto NoWDMKS
cl %CFLAGS% "%BASE%/src/hostapi/wdmks/pa_win_wdmks.c"
:NoWDMKS
find "PA_USE_ASIO 1" "$(ProjectDir)$(Configuration)/config.h"
IF ERRORLEVEL 1 goto NoASIO
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%BASE%/src/hostapi/asio/pa_asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%BASE%/src/hostapi/asio/iasiothiscallresolver.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/common/asio.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/asiodrivers.cpp"
cl %CFLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/pc/asiolist.cpp"
:NoASIO
find "PA_USE_JACK 1" "$(ProjectDir)$(Configuration)/config.h"
IF ERRORLEVEL 1 goto NoJACK
cl %CFLAGS% /I "%JACKSDK_DIR%/includes" "%BASE%/src/hostapi/jack/pa_jack.c"
cl %CFLAGS% /I "%JACKSDK_DIR%/includes" "%BASE%/src/hostapi/jack/pa_jack_dynload.c"
:NoJACK
lib /OUT:"$(TargetPath)" "$(IntDir)/*.obj" "%DXSDK_DIR%/lib/x86/dxguid.lib"
portmixer Post-Build original:
set BASE="../../../lib-src/portmixer"
set CFLAGS=/O2 /GL /I "%BASE%/../portaudio-v19/include" /I "%BASE%/include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)" /Fd"$(IntDir)" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)/$(Configuration)/config.h" /errorReport:prompt
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"
:NoDX
lib /OUT:"$(TargetPath)" "$(IntDir)*.obj" %LIBS%
portmixer Post-Build fix:
if "%DXSDK_DIR%"=="" goto NoDX
cl /O2 /GL /I "../../../lib-src/portmixer/../portaudio-v19/include" /I "../../../lib-src/portmixer/include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)/" /Fd"$(IntDir)/" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)/$(Configuration)/config.h" /errorReport:prompt /I "%DXSDK_DIR%/include" "../../../lib-src/portmixer/src/px_win_ds.c"
:NoDX
lib /OUT:"$(TargetPath)" "$(IntDir)/*.obj" "%DXSDK_DIR%/lib/x86/dxguid.lib"
portmixer Post-Build 原版:
set BASE="../../../lib-src/portmixer"
set CFLAGS=/O2 /GL /I "%BASE%/../portaudio-v19/include" /I "%BASE%/include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)" /Fd"$(IntDir)" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)/$(Configuration)/config.h" /errorReport:prompt
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"
:NoDX
lib /OUT:"$(TargetPath)" "$(IntDir)*.obj" %LIBS%
portmixer 构建后修复:
if "%DXSDK_DIR%"=="" goto NoDX
cl /O2 /GL /I "../../../lib-src/portmixer/../portaudio-v19/include" /I "../../../lib-src/portmixer/include" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fo"$(IntDir)/" /Fd"$(IntDir)/" /W3 /nologo /c /wd4996 /FI "$(ProjectDir)/$(Configuration)/config.h" /errorReport:prompt /I "%DXSDK_DIR%/include" "../../../lib-src/portmixer/src/px_win_ds.c"
:NoDX
lib /OUT:"$(TargetPath)" "$(IntDir)/*.obj" "%DXSDK_DIR%/lib/x86/dxguid.lib"