@echo off rem Primary build script. Usage rem build.bat [x64] [SN] rem rem The first argument is x64 for 64-bit dlls. (Defaults to x86) rem Supply SN as the second argument to strong-name the assemblies. rem rem To build for the x64 you need to build from the "Visual Studio x64 Cross Tools Command Prompt" rem set DotNetFWVersion=2.0 if "%~1"=="x64" ( set X64=true shift ) else ( set X64=false ) if "%~1"=="SN" ( set CompilingSN=true ) else ( set CompilingSN=false ) if "%X64%"=="true" ( if "%CompilingSN%"=="true" ( set OutputPath=%CD%\..\bin\nt.x64.sn ) else ( set OutputPath=%CD%\..\bin\nt.x64 ) ) if "%X64%"=="false" ( if "%CompilingSN%"=="true" ( set OutputPath=%CD%\..\bin\nt.x86.sn ) else ( set OutputPath=%CD%\..\bin\nt.x86 ) ) if not exist "%OutputPath%" mkdir "%OutputPath%" set SrcPath=%CD%\..\src set BasePath=%CD%\.. call :Compile_P4DN_Assembly call :Compile_P4API_Assembly if exist "%OutputPath%\P4.Net.snk" del "%OutputPath%\P4.Net.snk" goto :eof :usage echo build.bat [x64] [SN] echo. echo The first argument is x64 for 64-bit dlls. (Defaults to x86) echo Supply SN as the second argument to strong-name the assemblies. echo. echo To build for the x64 you need to build from the "Visual Studio x64 Cross Tools Command Prompt" ehco. goto :eof :Compile_P4DN_Assembly rem set the source files set sources= "%SrcPath%\p4dn\AssemblyInfo.cpp" set sources= %sources% "%SrcPath%\p4dn\ClientApi_m.cpp" set sources= %sources% "%SrcPath%\p4dn\ClientUserDelegate.cpp" set sources= %sources% "%SrcPath%\p4dn\ClientUser_m.cpp" set sources= %sources% "%SrcPath%\p4dn\Error_m.cpp" set sources= %sources% "%SrcPath%\p4dn\NoEcho_m.cpp" set sources= %sources% "%SrcPath%\p4dn\Options_m.cpp" set sources= %sources% "%SrcPath%\p4dn\P4String.cpp" set sources= %sources% "%SrcPath%\p4dn\Spec_m.cpp" set sources= %sources% "%SrcPath%\p4dn\Stdafx.cpp" set sources= %sources% "%SrcPath%\p4dn\MergeData_m.cpp" set sources= %sources% "%SrcPath%\p4dn\P4MapMaker.cpp" if '%CompilingSN%'=='true' ( set sources= %sources% ""%SrcPath%\p4dn\SNAssemblyInfo.cpp" copy /y "%BasePath%\build\P4.Net.snk" "%OutputPath%\P4.Net.snk" >nul ) rem point to the P4API header files set FLAGS=/Od /I "%BasePath%\ext\p4api_vs2005_dyn\include\p4" rem VS compiler switches set FLAGS=%FLAGS% /D "WIN32" /D "OS_NT" /D "_WINDLL" /D "_MBCS" rem P4API compiler switches set FLAGS=%FLAGS% /D "CASE_INSENSITIVE" set FLAGS=%FLAGS% /FD /EHa set FLAGS=%FLAGS% /MD set FLAGS=%FLAGS% /W0 /nologo /c /Zi /TP set FLAGS=%FLAGS% /clr rem now compile cl %FLAGS% %sources% rem set the output assembly set FLAGS=/OUT:"%OutputPath%\p4dn.dll" set FLAGS=%FLAGS% /NOLOGO /DLL set FLAGS=%FLAGS% /NODEFAULTLIB:"LIBCMT.lib" /NODEFAULTLIB:"LIBCMTD.lib" set FLAGS=%FLAGS% /FIXED:No set FLAGS=%FLAGS% Ws2_32.lib set FLAGS=%FLAGS% msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib set FLAGS=%FLAGS% advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rem Build against the 2003 version of P4API, otherwise a dependency on VS2005 SP1 VC runtime is rem introduced... and that is not widely deployed on windows machines rem Unfortunately, not an option of x64, Perforce only supplies lib with SP1 dependencies if "%X64%"=="true" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2005_dyn_x64\lib\libclient.lib" if "%X64%"=="true" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2005_dyn_x64\lib\librpc.lib" if "%X64%"=="true" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2005_dyn_x64\lib\libsupp.lib" if "%X64%"=="true" set FLAGS=%FLAGS% /MACHINE:X64 if "%X64%"=="false" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2003_dyn\lib\libclient.lib" if "%X64%"=="false" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2003_dyn\lib\librpc.lib" if "%X64%"=="false" set FLAGS=%FLAGS% "%BasePath%\ext\p4api_vs2003_dyn\lib\libsupp.lib" if "%X64%"=="false" set FLAGS=%FLAGS% /MACHINE:X86 set FLAGS=%FLAGS% /MANIFEST /MANIFESTFILE:"%OutputPath%\p4dn.dll.intermediate.manifest" rem and now we link... link %FLAGS% "*.obj" rem embed the manifest file mt /nologo /outputresource:"%OutputPath%\p4dn.dll;#2" /manifest "%OutputPath%\p4dn.dll.intermediate.manifest" rem del /q "%OutputPath%\p4dn.dll.intermediate.manifest" if '%CompilingSN%'=='true' ( sn -q -R "%OutputPath%\p4dn.dll" "%BasePath%\build\P4.Net.snk" ) rem now clean-up del /q "*.obj" del /q "*.pdb" del /q "*.idb" goto :eof :Compile_P4API_Assembly set FLAGS=/target:library set FLAGS=%FLAGS% /reference:"%OutputPath%\p4dn.dll" set FLAGS=%FLAGS% /w:0 /o set FLAGS=%FLAGS% "/out:%OutputPath%\p4api.dll" set FLAGS=%FLAGS% /nologo "/doc:%OutputPath%\p4api.xml" set SOURCES="%SrcPath%\P4API\*.cs" "%SrcPath%\P4API\Exceptions\*.cs" "%SrcPath%\P4API\Record\*.cs" if '%CompilingSN%'=='true' ( set SOURCES= %SOURCES% "%SrcPath%\P4API\StrongName\SNAssemblyInfo.cs" ) echo Compiling p4api.dll... csc %FLAGS% %SOURCES% goto :eof
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19706 | MikeEheler |
Populate //guest/shawn_hladky/P4.Net/... //guest/MikeEheler/P4.Net/.... |
||
//guest/shawn_hladky/P4.Net/main/build/build.bat | |||||
#2 | 7204 | Shawn Hladky | P4.Net: Added Map functionality | ||
#1 | 6472 | Shawn Hladky | P4.Net: Build script updates to support x64 |