Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Recommended Posts

In this guide, I'll walk you through the process of compiling with GCC 4.8 or even GCC 4.9, similar to what's used in the vanilla version, and how to implement C++11 to enhance performance and support modern programming practices.

Step 1: Update Your Makefile

Initially, you need to modify your Makefile. Ensure that you edit the SVN_VERSION line to avoid any errors. For example:

This is the hidden content, please

Step 2: Specify Your Compiler

First, ensure you have the appropriate compiler installed. If you haven't done this yet, navigate to the directory using:

This is the hidden content, please

Then execute:

This is the hidden content, please

In the Makefile, look for the line that says:

This is the hidden content, please

You can change this to:

This is the hidden content, please

Or, if you are utilizing GCC 4.8, simply modify it to:

This is the hidden content, please

Step 3: Recompile Dependencies

Before proceeding with your game compilation, ensure that all necessary libraries are also recompiled with GCC 4.8 or 4.9. Change the compiler in the Makefile and recompile the sources from the following directories:

  • libgame/src
  • libpoly
  • libserverkey
  • libsql
  • libthecore/src

Also, recompile the cryptopp library located in the Extern/cryptopp directory with the newer GCC version.

Step 4: Compile Your Game

You can now compile your game and the database source code with the updated GCC version. You should notice a reduction in file size, as the contemporary compilers generate faster and more efficient game files.

If you want to ensure that the library files used during your compilation process are correctly recognized, you can specify the following compiler flag:

This is the hidden content, please

Feel free to adjust the path to suit your setup! By using this command, you instruct the linker to prioritize this directory when looking for the necessary libraries, falling back to other directories only if the specified ones don't contain the files.

Step 5: Implement C++11

Utilizing C++11 is crucial when introducing new statements into your code. The updated source code for loading the database without relying on text files requires at least the dbcache to be upgraded. This change will also result in smaller file sizes, providing added benefits.

To enable C++11, add the following CFLAGS to your compiler settings:

This is the hidden content, please

This directive tells the compiler to utilize C++11 features. Be aware that not all compilers support C++11, but the newer versions of GCC handle it without any issues.

Step 6: Fix Compilation Errors

After compiling your source code, you may encounter new errors. Open every .cpp and .h file in your text editor (Notepad++ is recommended) and perform the following replacements (using the find-and-replace feature):

  • Change typeof to __typeof
  • Change auto_ptr to unique_ptr

Make sure to check the common directory as well!

Once you’ve made these changes, you can recompile the source, and the process is complete!

Optional: Selective Compilation

You do not need to compile every part of your source code with C++11. For instance, you can choose to compile only the dbcache module with it.

Step 7: Fine-Tuning Optimization Flags

For enhanced optimization, you may experiment with various tuning flags. The -O2 flag is often beneficial, but you might find better results using alternatives like -O3 or -Ofast. However, proceed with caution and consider using -fstrict-aliasing to prevent the compiler from optimizing instructions that could lead to crashes. Always pay attention to the warnings that the compiler generates; they are essential for maintaining the stability of your application.

Conclusion

I hope this guide proves to be helpful for your compilation endeavors. As with previous tutorials, please let me know your thoughts and feel free to ask if you have any questions!

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...