Skip to content

Commit 4e9c510

Browse files
committed
Move STB implementation to separate file to avoid PCH issues
1 parent 8733c83 commit 4e9c510

File tree

6 files changed

+53
-5
lines changed

6 files changed

+53
-5
lines changed

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScreenshot.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "GameClient/GameText.h"
2828
#include "WW3D2/dx8wrapper.h"
2929
#include "WW3D2/surface.h"
30-
31-
#define STB_IMAGE_WRITE_IMPLEMENTATION
3230
#include <stb_image_write.h>
3331

3432
struct ScreenshotThreadData
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
** Command & Conquer Generals(tm)
3+
** Copyright 2025 Electronic Arts Inc.
4+
**
5+
** This program is free software: you can redistribute it and/or modify
6+
** it under the terms of the GNU General Public License as published by
7+
** the Free Software Foundation, either version 3 of the License, or
8+
** (at your option) any later version.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#define STB_IMAGE_WRITE_IMPLEMENTATION
20+
#include <stb_image_write.h>
21+

GeneralsMD/Code/GameEngineDevice/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ target_link_libraries(z_gameenginedevice PRIVATE
218218
stb
219219
)
220220

221+
target_sources(z_gameenginedevice PRIVATE
222+
Source/W3DDevice/GameClient/stb_image_write_impl.cpp
223+
)
224+
225+
set_source_files_properties(
226+
Source/W3DDevice/GameClient/stb_image_write_impl.cpp
227+
PROPERTIES
228+
SKIP_PRECOMPILE_HEADERS ON
229+
)
230+
221231
target_link_libraries(z_gameenginedevice PUBLIC
222232
corei_gameenginedevice_public
223233
z_gameengine

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3012,7 +3012,7 @@ void W3DDisplay::takeScreenShotCompressed(void)
30123012
}
30133013

30143014
void W3DDisplay::takeScreenShotPNG(void)
3015-
{
3015+
{
30163016
W3D_TakeCompressedScreenshot(SCREENSHOT_PNG);
30173017
}
30183018

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScreenshot.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "GameClient/GameText.h"
2828
#include "WW3D2/dx8wrapper.h"
2929
#include "WW3D2/surface.h"
30-
31-
#define STB_IMAGE_WRITE_IMPLEMENTATION
3230
#include <stb_image_write.h>
3331

3432
struct ScreenshotThreadData
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
** Command & Conquer Generals(tm)
3+
** Copyright 2025 Electronic Arts Inc.
4+
**
5+
** This program is free software: you can redistribute it and/or modify
6+
** it under the terms of the GNU General Public License as published by
7+
** the Free Software Foundation, either version 3 of the License, or
8+
** (at your option) any later version.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#define STB_IMAGE_WRITE_IMPLEMENTATION
20+
#include <stb_image_write.h>
21+

0 commit comments

Comments
 (0)