Announcement

Collapse
No announcement yet.

Compiling the SDK

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compiling the SDK

    Edit: I merged this thread with smacfan's, since they cover the same topic.

    I suspect there will be some issues with this, so might as well create a thread about it.

    If you have Visual Studio 2003 (Visual C++ 7) you should be able to load the SDK up directly. If not, you can use the following process to get codeblocks to allow you to modify and compile the SDK. All the software you need for this is freeware. DaveMcW pioneered this:

    Here is a free method of building the DLL. (Thanks to Ogre Wiki for many of the details.)

    I had trouble getting some of the debug options to compile, so I turned them off.


    1: Download the VC++ Toolkit 2003 and install it.

    2: Grab the 3 multithreaded library files and put them in C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib.
    msvcrt.lib and msvcrtd.lib (found in the .NET runtime)
    msvcprt.lib (Read Ogre Wiki to see where this comes from)

    3: Download the Platform SDK. You can also use internet explorer to install it automatically (recommended).

    4: Download the latest CodeBlocks "without compiler" and install it.

    5: The first time you install CodeBlocks, you will be shown a list of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default. Press OK.

    6: Go to Settings->Compiler in the CodeBlocks menu. Click the "Directories" tab and add the the following directories to the compiler tab (changing to account for where you installed the packages):

    Code:
    C:\Program Files\Microsoft Visual C++ Toolkit 2003\Include
    C:\Program Files\Microsoft Platform SDK\Include
    In the Directories/Linker tab add the following directories:

    Code:
    C:\Program Files\Microsoft Visual C++ Toolkit 2003\Lib
    C:\Program Files\Microsoft Platform SDK\Lib
    7: Open \CvGameCoreDLL\CvGameCoreDLL.vcproj in CodeBlocks.

    8: Go to Project->Build options->Final Release.

    On the "Compiler Flags" tab, uncheck "Produce debugging symbols [/Zi]".

    On the "Other options" tab, change EHsc to /EHsc

    On the "Linker" tab, add a new link library called user32

    Also on the Linker tab, delete the linker option "/pdb:Final Release\CvGameCoreDLL.pdb" and press OK.

    9: Change the "Build target" drop-down to Final Release.

    10: File->Save project. This creates a CodeBlocks project (.cbp) that you can open in the future.

    11: Build->Build. When the compiler finishes, you will have \..\Assets\CvGameCoreDLL.dll !
    Last edited by Locutus; April 15, 2006, 08:53.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

  • #2
    The SDK converts to Visual C++ 2005 (8.0) as long as you remember the ensure that no files are read-only. I haven't tried compiling it yet, so I can't say about possible stability issues, but I don't think there should be many (VC++ 2003 -> 2005 shouldn't have anywhere near as many problems as VC++ 6 -> 2003 is famous for).

    Also Visual Studio 2005 Express Edition is fully capable of handling the SDK. Plus it's free, which is rare for Microsoft.
    Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
    "Just because I'm paranoid doesn't mean there's no conspiracy"

    Comment


    • #3
      Originally posted by MMC
      The SDK converts to Visual C++ 2005 (8.0) as long as you remember the ensure that no files are read-only. I haven't tried compiling it yet, so I can't say about possible stability issues, but I don't think there should be many (VC++ 2003 -> 2005 shouldn't have anywhere near as many problems as VC++ 6 -> 2003 is famous for).
      Nope, 2005 doesn't compile. There's some problem with something in the Boost Python code IIRC (which is outside the SDK). This may well be fixed in the XP (no promises though), but for this SDK it's too late.
      Last edited by Locutus; April 13, 2006, 18:28.
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        Ok... Although I have been able to compile Source (ie Half Life 2) on VC++ 2005, and that's not supposed to work either. Maybe I have a weird version of VC++ that doesn't have all the bugs in it that M$ use to make you need the service packs.
        Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
        "Just because I'm paranoid doesn't mean there's no conspiracy"

        Comment


        • #5
          So microsoft incorporates bugs just to make sure that we download service packs that are free anyway?

          Comment


          • #6
            meh... just because the services packs are free, why should they change the operating policy that seems to have worked for them for 20 odd years? :P

            DOS never had 'service packs'. You had to buy the next version to fix problems or get new features.
            Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
            "Just because I'm paranoid doesn't mean there's no conspiracy"

            Comment


            • #7
              Compiling the SDK to match 1.61

              OK, per the post by PJayTycy in the 1.61 patch thread (about 2/3 of the way down on this page: http://www.apolyton.com/forums/showt...9&pagenumber=2) I have installed the MSVC 2003 stuff, Platform SDK, .NET SDK, .NET libs, plus CodeBlocks, made the compiler & linker dir and option changes, saved the project file and ran a build. Substituting my DLL for the 1.61 DLL, first thing I notice is that the intro graphics and movie are even choppier than they were with the 1.61 release version.

              So, what can we do in building the DLL to fix the choppiness of the movies? I noticed a linker switch in the Final Release target, "/debug", does this need to be deleted? I also notice that the newly built DLL is about 1 MB bigger than the released patch version. How did they do that?

              To prevent the same question from being asked again, yes I am building the "Final Release" target, and *not* a debug target. Checked and double-checked.

              TIA for any help you can provide.

              smacfan

              Comment


              • #8
                Sorry to answer my own post, but I tried a build without the Linker "/debug" switch, this reduced the "Final Release" DLL to 3756KB in size, vs 3620KB for the released 1.61 patch DLL. I would presume that the Linker switch was including debug libraries even though compiler debugging had been turned off.

                However, it is still not identical in size, which worries me a little.

                Can anyone tell what that "/pdb:..." switch in the original "vcproj" project file was intended to do? I deleted it per the instructions, but I hate to do things without knowing the reasons for doing it.

                WRT the size difference, could it be differences in the MS SDK or .NET SDK libs that cause the difference?

                Oh, and the rebuilt DLL runs the game just fine (so far, not really thoroughly tested yet on my games in progresss, but I'll get around to it, sooner or later... )

                smacfan

                Comment


                • #9
                  That must be the switch that (now) builds a program database file:

                  A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program.
                  http://msdn2.microsoft.com/en-us/library/yd4f8bd1(VS.80).aspx

                  Comment


                  • #10
                    Is it possible to compile with another compiler than Visual C++ ?
                    In all that we undertake it is necessary to give two thirds to the mind and the other third randomly. Increase the first fraction and you will become pusillanimous, increase the second and you will be reckless.
                    Napoleon

                    Comment


                    • #11
                      Originally posted by Mirakle
                      Is it possible to compile with another compiler than Visual C++ ?
                      Sure, but you'll have to make your own makefile.
                      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                      Comment


                      • #12
                        Originally posted by Locutus


                        Sure, but you'll have to make your own makefile.
                        The exported function names has to be decorated in the same way as MS compilers decorartes them. This makes it difficult, but not impossible to use other compilers. (You will most likely have to assign the export names for the functions yourself.)
                        Creator of the Civ3MultiTool

                        Comment


                        • #13
                          I never said it was easy
                          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                          Comment


                          • #14
                            Originally posted by Peter Triggs
                            That must be the switch that (now) builds a program database file:

                            http://msdn2.microsoft.com/en-us/library/yd4f8bd1(VS.80).aspx
                            Many thanks, that eases my worries.

                            Now, if I (we) can figure out how the Fireaxians created a DLL that's 136KB smaller than I (we) can create out here in the wild, I would have no worries at all.

                            Can we ask Soren or Thamer to chime in on this, please?

                            Pretty please? With a cherry on top?

                            smacfan

                            Comment


                            • #15
                              136 KB sounds almost exactly like the default debug info VC/VC+ adds if you don't turn that off. on binaries at least, no idea about libraries.

                              Comment

                              Working...
                              X