|
| 1 | +# Build Configurations Overview |
| 2 | + |
| 3 | +This page describes the various build configurations used in the project, detailing the different types of builds, their |
| 4 | +purpose, and the associated compiler flags for each configuration. These configurations control how the code is compiled |
| 5 | +and optimized for different development and release scenarios. |
| 6 | + |
| 7 | +## Build Configurations |
| 8 | + |
| 9 | +There are four main build configurations in the project, each designed for different purposes: |
| 10 | + |
| 11 | +### 1. **Release (O2, _RELEASE)** |
| 12 | + |
| 13 | +- **Purpose:** The release configuration is used for building the final version of the game that will be distributed to |
| 14 | + end users. |
| 15 | +- **Features:** |
| 16 | + - Maximum optimization (`/O2`) for better performance. |
| 17 | + - No debugging information is included to ensure smaller binary size and improved performance. |
| 18 | + - Suitable for production builds. |
| 19 | + |
| 20 | +- **Compiler Flags:** |
| 21 | + - `/O2`: Optimization for speed. |
| 22 | + - `/D "_RELEASE"`: Defines the release configuration. |
| 23 | + - `/D "NDEBUG"`: Disables debugging code. |
| 24 | + |
| 25 | +- **Use Case:** This configuration is used when preparing the game for release to the end user. |
| 26 | + |
| 27 | +### 2. **Debug (Od, _DEBUG)** |
| 28 | + |
| 29 | +- **Purpose:** The debug configuration is used for development and debugging. It includes debugging symbols and disables |
| 30 | + optimizations to make it easier to step through code. |
| 31 | +- **Features:** |
| 32 | + - No optimization (`/Od`), making debugging easier but with slower execution. |
| 33 | + - Debugging symbols and additional information are included to help track issues. |
| 34 | + - The build is less efficient but provides full access to debugging features. |
| 35 | + |
| 36 | +- **Compiler Flags:** |
| 37 | + - `/Od`: Disables optimizations to facilitate debugging. |
| 38 | + - `/D "_DEBUG"`: Defines the debug configuration. |
| 39 | + - `/ZI`: Generates debugging information. |
| 40 | + - `/Gm`: Enables minimal rebuilds. |
| 41 | + |
| 42 | +- **Use Case:** Used during development for debugging and resolving issues in the code. |
| 43 | + |
| 44 | +### 3. **Internal (O2, _INTERNAL)** |
| 45 | + |
| 46 | +- **Purpose:** The internal configuration is used for internal development purposes, offering optimization and some |
| 47 | + debugging features to help developers while maintaining performance. |
| 48 | +- **Features:** |
| 49 | + - Combines optimization (`/O2`) for performance with limited debugging options. |
| 50 | + - Suitable for internal testing and development, where performance is important, but some debugging features are |
| 51 | + still needed. |
| 52 | + |
| 53 | +- **Compiler Flags:** |
| 54 | + - `/O2`: Optimization for speed. |
| 55 | + - `/D "_INTERNAL"`: Defines the internal build configuration. |
| 56 | + - `/D "NDEBUG"`: Disables debugging in the final build. |
| 57 | + - `/Zi`: Generates debugging information. |
| 58 | + |
| 59 | +- **Use Case:** Used for internal builds when developers need optimized performance but still want some debugging tools |
| 60 | + available. |
| 61 | + |
| 62 | +### 4. **Profile (O2, IG_DEBUG_STACKTRACE, _RELEASE, _PROFILE)** |
| 63 | + |
| 64 | +- **Purpose:** The profile configuration is used for performance profiling and optimization. It is designed to help |
| 65 | + developers analyze performance bottlenecks and gather performance data. |
| 66 | +- **Features:** |
| 67 | + - Includes optimization (`/O2`) and performance profiling flags. |
| 68 | + - Supports detailed stack tracing (`IG_DEBUG_STACKTRACE`) to gather performance metrics. |
| 69 | + - Designed for analyzing how the game performs under various conditions and measuring optimization effectiveness. |
| 70 | + |
| 71 | +- **Compiler Flags:** |
| 72 | + - `/O2`: Optimization for performance. |
| 73 | + - `/D "_PROFILE"`: Enables profiling configuration. |
| 74 | + - `/D "IG_DEBUG_STACKTRACE"`: Enables stack trace debugging for performance analysis. |
| 75 | + - `/D "NDEBUG"`: Disables debugging code in the final build. |
| 76 | + |
| 77 | +- **Use Case:** Used for profiling and performance analysis to optimize code and identify potential bottlenecks. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Key Compiler Flags |
| 82 | + |
| 83 | +Below is a list of the key compiler flags used across different configurations: |
| 84 | + |
| 85 | +### Optimization Flags |
| 86 | + |
| 87 | +- **`/O2`**: Optimizes the code for speed. This flag is typically used in release builds and performance profiling |
| 88 | + builds. |
| 89 | +- **`/Od`**: Disables optimizations, which is useful during debugging when you want to ensure that the debugger can |
| 90 | + easily track code execution. |
| 91 | + |
| 92 | +### Debugging Flags |
| 93 | + |
| 94 | +- **`/D "_DEBUG"`**: Defines the build as a debug version, enabling debugging-specific features in the code. |
| 95 | +- **`/D "_RELEASE"`**: Defines the build as a release version, disabling debugging features and optimizing for |
| 96 | + performance. |
| 97 | +- **`/D "_INTERNAL"`**: Marks the build as an internal version, which may include some debugging information while still |
| 98 | + being optimized for performance. |
| 99 | +- **`/D "NDEBUG"`**: Disables debugging code, typically used in release and internal builds. |
| 100 | + |
| 101 | +### Profiling Flags |
| 102 | + |
| 103 | +- **`/D "_PROFILE"`**: Enables performance profiling in the build. This flag is used to gather performance data during |
| 104 | + runtime. |
| 105 | +- **`/D "IG_DEBUG_STACKTRACE"`**: Enables stack trace generation, which helps in analyzing performance issues and |
| 106 | + crashes. |
| 107 | + |
| 108 | +### Additional Flags |
| 109 | + |
| 110 | +- **`/ZI`**: Generates debugging information and supports editing and continuing in Visual Studio. |
| 111 | +- **`/WX`**: Treats warnings as errors, which is often used to enforce strict coding standards. |
| 112 | +- **`/Gm`**: Enables minimal rebuild, allowing faster incremental builds. |
| 113 | +- **`/MD`**: Links with the dynamic version of the C runtime library, commonly used for Windows builds. |
| 114 | +- **`/Yu"PreRTS.h"`**: Tells the compiler to use precompiled headers, which can speed up compilation time. |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## When to Use Each Configuration |
| 119 | + |
| 120 | +- **Release:** Use this configuration when preparing the final version of the game for distribution. It ensures the game |
| 121 | + is optimized for performance with no debugging overhead. |
| 122 | +- **Debug:** Use this configuration during development when you need to debug issues. It disables optimizations and |
| 123 | + includes debugging information. |
| 124 | +- **Internal:** Use this configuration for internal builds where you need some debugging features but still require |
| 125 | + optimized performance. |
| 126 | +- **Profile:** Use this configuration when analyzing the performance of the game. It helps identify bottlenecks and |
| 127 | + areas that can be optimized further. |
0 commit comments