Difference between revisions of "Build the client with MSVC 2003"

From OpenUru
Jump to: navigation, search
m (Updated link to PhysX (the previous one is... dead))
(Build steps: zlib + libpng installation instructions)
 
(2 intermediate revisions by 2 users not shown)
Line 122: Line 122:
 
         .....</pre>
 
         .....</pre>
 
</li>
 
</li>
<li>Compile and install OpenSSL.  It is best to compile it yourself, because we need to make sure it is dynamically linked (this is important for licensing purposes).<BR>  '''Note:''' This will cause the Uru client to require the OpenSSL DLLs to be present in the client directory or in the system path.<BR><BR>  Copy the installed stuff to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenSSL"  (created by "make install" - you do not want your development tree here).<BR><BR>
+
<li>Compile and install OpenSSL (see [[Build OpenSSL with MS Visual C++]])As this is security software, it is best (in my opinion) to compile it yourself from source.  You can choose either static or dynamic linking.<BR>  '''Note:''' If you link it dynamically, it will cause the Uru client to require the OpenSSL DLLs to be present in the client directory or in the system path.<BR><BR>  Copy the installed stuff to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenSSL"  (created by "make install" - you do not want your development tree here).<BR><BR>
 
Directory structure in the CWE tree will look like this:
 
Directory structure in the CWE tree will look like this:
 
<pre>
 
<pre>
Line 134: Line 134:
 
</li>
 
</li>
 
<li>Open up "Visual Studio .NET 2003 Command Prompt" and change to the "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\jpeg-8c-rgba directory." Copy makefile.vc to makefile.nmake, and jconfig.vc to jconfig.h and then run ''nmake nodebug=1 -f makefile.nmake''.  This will build the library in non-debug mode.  If you use a debug library, the linker will complain when we link the client executable.</li>
 
<li>Open up "Visual Studio .NET 2003 Command Prompt" and change to the "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\jpeg-8c-rgba directory." Copy makefile.vc to makefile.nmake, and jconfig.vc to jconfig.h and then run ''nmake nodebug=1 -f makefile.nmake''.  This will build the library in non-debug mode.  If you use a debug library, the linker will complain when we link the client executable.</li>
 +
<li>Install zlib and libpng<br />
 +
''Interim notice:'' This step applies as soon as [https://bitbucket.org/OpenUru_org/cwe-ou/pull-request/10/improved-cursors pull request #10] is applied. Before, older versions of zlib and libpng are included in the CWE source tree.<br />
 +
'''For Visual Studio 2003:'''
 +
<ol><li>Download ''zlib127.zip'' (or a newer version) from [http://www.zlib.net/ http://www.zlib.net/], extract the ''zlib-1.2.7'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib''.</li>
 +
<li>Download ''lpng1511.zip'' (or a newer version) from [http://libpng.org/pub/png/libpng.html http://libpng.org/pub/png/libpng.html], extract the ''lpng1511'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png''.</li>
 +
<li>Open ''png/projects/visualc71/libpng.sln'' in Visual Studio 2003.</li>
 +
<li>Right-click on the “libpng” project in the ''Solution Explorer'' and choose ''Properties''.</li>
 +
<li>Select configuration “LIB Debug” in the popup menu at the top.</li>
 +
<li>Select ''Configuration Properties'' > ''C/C++'' > ''Code Generation'' on the left.</li>
 +
<li>Change the ''Runtime Library'' line to “Multi-threaded Debug DLL (/MDd)”. (This step avoids a warning in the final Plasma build. As far as I understand, leaving it out is harmless, but better do it to be sure.)</li>
 +
<li>Choose the “LIB Release” configuration and set ''Runtime Library'' to “Multi-threaded DLL (/MD)”.</li>
 +
<li>Repeat steps 4 to 8 for the other two projects “pngtest” and “zlib”.</li>
 +
<li>Select “LIB Debug” from the ''Solution Configurations'' popup menu in the toolbar, then ''Build'' > ''Build Solution''.</li>
 +
<li>Select the “LIB Release” configuration and build the solution.</li>
 +
<li>Make a new folder ''png/lib'' and move ''png/projects/visualc71/Win32_LIB_Debug/libpngd.lib'' as well as ''png/projects/visualc71/Win32_LIB_Release/libpng.lib'' into it.</li>
 +
<li>Make a new folder ''zlib/lib'' and move ''png/projects/visualc71/Win32_LIB_Debug/ZLib/zlibd.lib'' as well as ''png/projects/visualc71/Win32_LIB_Release/ZLib/zlib.lib'' into it.</li></ol>
 +
'''For Visual Studio 2010:''' (if anyone ever makes a “Build with VS 2010” page, that could be moved there)
 +
<ol><li>Download ''zlib127.zip'' (or a newer version) from [http://www.zlib.net/ http://www.zlib.net/], extract the ''zlib-1.2.7'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib''.</li>
 +
<li>Download ''lpng1511.zip'' (or a newer version) from [http://libpng.org/pub/png/libpng.html http://libpng.org/pub/png/libpng.html], extract the ''lpng1511'' folder it contains and move/rename it to ''MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png''.</li>
 +
<li>Open ''png/projects/vstudio/zlib.props'' in a text editor (Notepad or Visual Studio will do) and change the ''<ZLibSrcDir>'' element (third line from the bottom) to read
 +
<code><ZLibSrcDir>..\..\..\..\zlib</ZLibSrcDir></code></li>
 +
<li>Open ''png/projects/vstudio/vstudio.sln'' in Visual Studio 2010.</li>
 +
<li>Right-click on the “zlib” project in the ''Solution Explorer'' and choose ''Properties''.</li>
 +
<li>Select configuration “Debug Library” in the popup menu at the top.</li>
 +
<li>Select ''Configuration Properties'' > ''C/C++'' > ''Preprocessor'' on the left.</li>
 +
<li>Insert <code>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;</code>
 +
into the ''Preprocessor Definitions'' line (so that it reads <code>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</code> afterwards).</li>
 +
<li>Select ''Configuration Properties'' > ''C/C++'' > ''Code Generation'' on the left.</li>
 +
<li>Change the ''Runtime Library'' line to “Multi-threaded Debug DLL (/MDd)”. (This step avoids a warning in the final Plasma build. As far as I understand, leaving it out is harmless, but better do it to be sure.)</li>
 +
<li>Choose the “Release Library” configuration and repeat step 8 (so that the line reads <code>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE</code> afterwards).</li>
 +
<li>Set ''Runtime Library'' to “Multi-threaded DLL (/MD)” like in step 10.</li>
 +
<li>Close the ''zlib Property Pages'' dialog.</li>
 +
<li>Repeat the ''Runtime Library'' setting (steps 10 and 12) on projects ''libpng'', ''pngtest'', ''pngvalid''.</li>
 +
<li>Right-click on the “zlib” project and choose ''Add'' > ''Existing Item…''.</li>
 +
<li>Navigate to ''StaticSDKs/XPlatform/zlib'', select all ''*.c'' files there (sort the list by file type to make this easier), and click ''Add''. This should add files ''gzclose.c'', ''gzlib.c'', ''gzread.c'', ''gzwrite.c'' to the project, the rest should have been there already.</li>
 +
<li>Select “Debug Library” from the ''Solution Configurations'' popup menu in the toolbar, then ''Build'' > ''Build Solution''.</li>
 +
<li>Select the “Release Library” configuration and build the solution.</li>
 +
<li>Make new folders ''png/lib'' and ''zlib/lib'' and move and rename the following files into them:
 +
<ul><li>png/projects/vstudio/Debug Library/libpng15.lib → png/lib/libpngd.lib</li>
 +
<li>png/projects/vstudio/Debug Library/zlib.lib → zlib/lib/zlibd.lib</li>
 +
<li>png/projects/vstudio/Release Library/libpng15.lib → png/lib/libpng.lib</li>
 +
<li>png/projects/vstudio/Release Library/zlib.lib → zlib/lib/zlib.lib</li></ul></li></ol>
 +
</li>
 
<li>Once you have completed all the setup steps, open a "Visual Studio .NET 2003 Command Prompt" again, and change directory to the root of the CWE source.  Run "build-allclient-solution.bat" and wait.  If all is well, you will have a plClient.exe and UruLauncher.exe, along with the matching PhysX DLLs, in "CWE\MOULOpenSourceClientPlugin\Plasma20\test".  Rename plClient.exe to UruExplorer.exe, and copy the executables and DLLs to your "Uru Live" directory.  You do not need to copy in the *.pdb. *.map, or sp.dll files for a live external build.  Those are only used by the internal builds.</li>
 
<li>Once you have completed all the setup steps, open a "Visual Studio .NET 2003 Command Prompt" again, and change directory to the root of the CWE source.  Run "build-allclient-solution.bat" and wait.  If all is well, you will have a plClient.exe and UruLauncher.exe, along with the matching PhysX DLLs, in "CWE\MOULOpenSourceClientPlugin\Plasma20\test".  Rename plClient.exe to UruExplorer.exe, and copy the executables and DLLs to your "Uru Live" directory.  You do not need to copy in the *.pdb. *.map, or sp.dll files for a live external build.  Those are only used by the internal builds.</li>
 
</ol>
 
</ol>

Latest revision as of 13:00, 12 July 2012

Introduction

This document provides steps to build the CWE client with minimal changes from the initial Cyan source release. It is assumed that you have the initial Cyan source commit, the four commits made by a'moaca (add jpeg-8c library, remove EAX, replace IJL with IJG, and remove Bink), and the one made by cjkelly1 (modify the MsDevProjects and add batch files) in your source tree. Be aware that subsequent commits by other developers may invalidate these instructions.

Items needed to compile

Instructions to obtain the Microsoft Platform SDK February 2003 edition

The old MS Platform SDK is no longer available as a single package from Microsoft. You will have to either order it for $10 from MS, or download the parts and build the install yourself. To build it yourself, download the files from the below links into the same directory.

PSDK-FULL.1.cab
PSDK-FULL.2.cab
PSDK-FULL.3.cab
PSDK-FULL.4.cab
PSDK-FULL.5.cab
PSDK-FULL.6.cab
PSDK-FULL.7.cab
PSDK-FULL.8.cab
PSDK-FULL.9.cab
PSDK-FULL.10.cab
PSDK-FULL.11.cab
PSDK-FULL.12.cab
PSDK-FULL.13.cab
PSDK-FULL.bat
Extract.exe

Run the batch file that is in the directory, and it will build the install. After doing this, you can either install the SDK directly, or burn it onto a CD so you will have it for later and install from there (I recommend burning to a CD, as this multi-part thing is a hassle).


Note on versions: I am using this older stuff because it is closest to what Cyan builds with. These instructions have only been tested with these specific versions. If you use other versions of the SDKs and such, you will have to adjust for the changes. If you do use different versions, it would be greatly appreciated if you would add a section to this document explaining what you had to do to use the newer versions, so everyone can benefit from your work.

Build steps

  1. Obtain CWE sources from the repository.
  2. Install MS Platform SDK. You only need the "Core SDK" and the "Internet Development SDK". You do not need to use the setup.exe in the root of the SDK installer directory - this is merely a splash page and requires IE. Instead, go to the "setup" directory and run "CoreSDK-x86.msi" and then run "IESDK-x86.msi". Note that the "-ia64" installers are for Itanium 64 bit machines, and will not run in x64. Note: Do not copy the .msi files somewhere else and run them. They need to be run in the same directory as all the *.cab files.
  3. Copy the include and lib directories from the SDK to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\PlatformSDK". Note:The directory where the SDK resides will be the one specified in the "Select An Installation Location" dialog when you ran the .msi files. This location will vary by platform.

    Directory structure in the CWE tree will look like this:
    StaticSDKs
      Win32
        PlatformSDK
          include
          lib
  4. Build libogg and libvorbis using MSVC 2003.
    1. Create a directory and then create two subdirectories under it called "ogg" and "vorbis".
    2. Unpack the sources into their respective directories. Make sure it does not do ogg\ogg-1.2.0, or some such thing. Vorbis depends on ogg, and it looks for the ogg stuff in ..\ogg.
    3. Fire up MSVC 2003.
    4. Do File -> Open -> Project, and select the ogg\win32\VS6\ogg_static.vcproj file. It will prompt to convert and open the project - click "Yes".
    5. On the drop down box on the top of the window, change it from "debug" to "release".
    6. Right-click on the "ogg_static" project and select build. Accept the "save file as" defaults in the box that pops up and just click "save".
    7. ogg build is done. Under win32\VS6\Static_Release, there will be a ogg_static.lib file.
    8. File -> Close Solution
    9. Do File -> Open -> Project and select the vorbis\win32\vorbis_static.dsp file. It will prompt to convert and open the project - click "Yes".
    10. On the drop down box on the top of the window, change it from "debug" to "release".
    11. Right-click on the "vorbis_static" project and select build. Accept the "save file as" defaults in the box that pops up and just click "save".
    12. vorbis build is done - under win32\Vorbis_Static_Release, there will be a vorbis_static.lib file.
    13. File -> Close Solution
    14. Start at step (i), and repeat the steps, choosing "vorbisfile_static.dsp" instead. You will have under vorbis\win32\VorbisFile_Static_Release a vorbisfile.static.lib file when done.

    Note: Warnings in the build process are ogg/vorbis problems, and fixing an old release of ogg/vorbis is outside the scope of this document. Also, we are using the VC6 projects instead of the MSVC 2003 ones so that the file names and such will match what Cyan has in their projects. You can build the MSVC 2003 projects if you wish, but you will have to either change the output file names to match the VC6 ones, or change Cyan's projects to use the names the MSVC 2003 projects use. Building the VC6 ones required the less changing of the projects.

  5. Copy the contents of your ogg directory and then vorbis directory into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\oggvorbis". It is okay to let it overwrite. Once that is done, copy the lib files you created above into "CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\oggvorbis\lib"

    Directory structure in the CWE tree will look like this:
      StaticSDKs
        win32
          oggvorbis
            doc
            examples
            include
            lib
            ....
  6. Install the OpenAL SDK and copy it to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenAL 1.1 with EFX SDK"

    Directory structure in the CWE tree will look like this:
      StaticSDKs
        win32
          OpenAL 1.1 with EFX SDK
            docs
            include
            libs
            ....
  7. Install the DirectX 9.0c SDK and copy it to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\DX9.0c"

    Directory structure in the CWE tree will look like this:
      StaticSDKs
        Win32
          DX9.0c
            Developer Runtime
            Documentation
            include
            Lib
            .....
  8. Install "PhysX 2.6.4 SDK Core" (or, if you have or can obtain it, 2.6.0) and copy it to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\PhysX". You must use a 2.6.x version, because the mesh cooking format was changed in 2.7.x. You will copy subdirectories from "C:\Program Files\AGEIA Technologies\AGEIA PhysX SDK\v2.6.4\SDKs" and C:\Program Files (x86)\AGEIA Technologies\AGEIA PhysX SDK\v2.6.4\Bin"

    Directory structure in the CWE tree will look like this:
      StaticSDKs
        Win32
          PhysX
            Bin
            Cooking
            Docs
            Foundation
            Framework
            lib
            .....
  9. Compile and install OpenSSL (see Build OpenSSL with MS Visual C++). As this is security software, it is best (in my opinion) to compile it yourself from source. You can choose either static or dynamic linking.
    Note: If you link it dynamically, it will cause the Uru client to require the OpenSSL DLLs to be present in the client directory or in the system path.

    Copy the installed stuff to "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\Win32\OpenSSL" (created by "make install" - you do not want your development tree here).

    Directory structure in the CWE tree will look like this:
      StaticSDKs
         Win32
           OpenSSL
             bin
             include
               openssl
             lib
  10. Open up "Visual Studio .NET 2003 Command Prompt" and change to the "\CWE\MOULOpenSourceClientPlugin\StaticSDKs\XPlatform\jpeg-8c-rgba directory." Copy makefile.vc to makefile.nmake, and jconfig.vc to jconfig.h and then run nmake nodebug=1 -f makefile.nmake. This will build the library in non-debug mode. If you use a debug library, the linker will complain when we link the client executable.
  11. Install zlib and libpng
    Interim notice: This step applies as soon as pull request #10 is applied. Before, older versions of zlib and libpng are included in the CWE source tree.
    For Visual Studio 2003:
    1. Download zlib127.zip (or a newer version) from http://www.zlib.net/, extract the zlib-1.2.7 folder it contains and move/rename it to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib.
    2. Download lpng1511.zip (or a newer version) from http://libpng.org/pub/png/libpng.html, extract the lpng1511 folder it contains and move/rename it to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png.
    3. Open png/projects/visualc71/libpng.sln in Visual Studio 2003.
    4. Right-click on the “libpng” project in the Solution Explorer and choose Properties.
    5. Select configuration “LIB Debug” in the popup menu at the top.
    6. Select Configuration Properties > C/C++ > Code Generation on the left.
    7. Change the Runtime Library line to “Multi-threaded Debug DLL (/MDd)”. (This step avoids a warning in the final Plasma build. As far as I understand, leaving it out is harmless, but better do it to be sure.)
    8. Choose the “LIB Release” configuration and set Runtime Library to “Multi-threaded DLL (/MD)”.
    9. Repeat steps 4 to 8 for the other two projects “pngtest” and “zlib”.
    10. Select “LIB Debug” from the Solution Configurations popup menu in the toolbar, then Build > Build Solution.
    11. Select the “LIB Release” configuration and build the solution.
    12. Make a new folder png/lib and move png/projects/visualc71/Win32_LIB_Debug/libpngd.lib as well as png/projects/visualc71/Win32_LIB_Release/libpng.lib into it.
    13. Make a new folder zlib/lib and move png/projects/visualc71/Win32_LIB_Debug/ZLib/zlibd.lib as well as png/projects/visualc71/Win32_LIB_Release/ZLib/zlib.lib into it.

    For Visual Studio 2010: (if anyone ever makes a “Build with VS 2010” page, that could be moved there)

    1. Download zlib127.zip (or a newer version) from http://www.zlib.net/, extract the zlib-1.2.7 folder it contains and move/rename it to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/zlib.
    2. Download lpng1511.zip (or a newer version) from http://libpng.org/pub/png/libpng.html, extract the lpng1511 folder it contains and move/rename it to MOULOpenSourceClientPlugin/StaticSDKs/XPlatform/png.
    3. Open png/projects/vstudio/zlib.props in a text editor (Notepad or Visual Studio will do) and change the <ZLibSrcDir> element (third line from the bottom) to read <ZLibSrcDir>..\..\..\..\zlib</ZLibSrcDir>
    4. Open png/projects/vstudio/vstudio.sln in Visual Studio 2010.
    5. Right-click on the “zlib” project in the Solution Explorer and choose Properties.
    6. Select configuration “Debug Library” in the popup menu at the top.
    7. Select Configuration Properties > C/C++ > Preprocessor on the left.
    8. Insert _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; into the Preprocessor Definitions line (so that it reads WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) afterwards).
    9. Select Configuration Properties > C/C++ > Code Generation on the left.
    10. Change the Runtime Library line to “Multi-threaded Debug DLL (/MDd)”. (This step avoids a warning in the final Plasma build. As far as I understand, leaving it out is harmless, but better do it to be sure.)
    11. Choose the “Release Library” configuration and repeat step 8 (so that the line reads _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE afterwards).
    12. Set Runtime Library to “Multi-threaded DLL (/MD)” like in step 10.
    13. Close the zlib Property Pages dialog.
    14. Repeat the Runtime Library setting (steps 10 and 12) on projects libpng, pngtest, pngvalid.
    15. Right-click on the “zlib” project and choose Add > Existing Item….
    16. Navigate to StaticSDKs/XPlatform/zlib, select all *.c files there (sort the list by file type to make this easier), and click Add. This should add files gzclose.c, gzlib.c, gzread.c, gzwrite.c to the project, the rest should have been there already.
    17. Select “Debug Library” from the Solution Configurations popup menu in the toolbar, then Build > Build Solution.
    18. Select the “Release Library” configuration and build the solution.
    19. Make new folders png/lib and zlib/lib and move and rename the following files into them:
      • png/projects/vstudio/Debug Library/libpng15.lib → png/lib/libpngd.lib
      • png/projects/vstudio/Debug Library/zlib.lib → zlib/lib/zlibd.lib
      • png/projects/vstudio/Release Library/libpng15.lib → png/lib/libpng.lib
      • png/projects/vstudio/Release Library/zlib.lib → zlib/lib/zlib.lib
  12. Once you have completed all the setup steps, open a "Visual Studio .NET 2003 Command Prompt" again, and change directory to the root of the CWE source. Run "build-allclient-solution.bat" and wait. If all is well, you will have a plClient.exe and UruLauncher.exe, along with the matching PhysX DLLs, in "CWE\MOULOpenSourceClientPlugin\Plasma20\test". Rename plClient.exe to UruExplorer.exe, and copy the executables and DLLs to your "Uru Live" directory. You do not need to copy in the *.pdb. *.map, or sp.dll files for a live external build. Those are only used by the internal builds.



Additional notes

  • This is built as a PLASMA_EXTERNAL_RELEASE, BUILD_TYPE_LIVE build.
  • Only the "Win32|Release" target will build with the changes I loaded to the repository. I did not modify any other build types, so if you wish to build those, you will have to fix them up first.
  • Crypto keys are located in "CWE\MOULOpenSourceClientPlugin\Plasma20\Sources\Plasma\NucleusLib\pnNetBase". Edit the *.hpp files with a text editor to replace the Cyan keys with your own server's keys. A future action item is to move the keys to an external INI and add a dialog which will allow the user to select the keys for the server they are connecting to.

Important: Make sure to run "clean-allclient-solution.bat" and rebuild when you change crypto keys, to make sure they are updated.

  • Server hostnames are located in the following files:

The status URL:
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plClient/winmain.cpp" "CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/Apps/plUruLauncher/Main.cpp"

The auth/gatekeeper address
"CWE\MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbSrvs.cpp"


IMPORTANT: You *must* make sure your client is using the same versions of the PhysX DLLs that you built with. They are not compatible from version to version.