Skip to content

Commit 6b41152

Browse files
committed
Merge remote-tracking branch 'lgt2x/win-sdl2' into vcpkg-all-thethings
2 parents 1ed931f + 564a080 commit 6b41152

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+239
-11490
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ jobs:
2222
matrix:
2323
os:
2424
- runner: windows-latest
25-
preset: win32
26-
cc: cl
27-
cxx: cl
28-
name: Windows-x86
29-
- runner: windows-latest
30-
preset: win64
25+
preset: win
3126
cc: cl
3227
cxx: cl
3328
name: Windows-x64
@@ -80,7 +75,7 @@ jobs:
8075
- uses: ilammy/msvc-dev-cmd@v1
8176
if: ${{ matrix.os.runner == 'windows-latest' }}
8277
with:
83-
arch: ${{ matrix.os.preset }}
78+
arch: win64
8479

8580
- name: Configure CMake
8681
env:

CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ install(
9393
if(UNIX)
9494
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-Wno-multichar;${BITS};${EXTRA_CXX_FLAGS}>")
9595
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${BITS}>")
96-
97-
find_package(SDL2 REQUIRED)
98-
# Some versions of the SDL2 find_package set SDL2_INCLUDE_DIR and some set a plural SDL2_INCLUDE_DIRS. Check both.
99-
message("SDL2 Include Dir is ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}")
10096
endif()
10197

98+
find_package(SDL2 REQUIRED)
99+
# Some versions of the SDL2 find_package set SDL2_INCLUDE_DIR and some set a plural SDL2_INCLUDE_DIRS. Check both.
100+
message("SDL2 Include Dir is ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}")
101+
102+
102103
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
103104
message("Building for Linux")
104105
add_compile_definitions(__LINUX__ _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-linux.hog\")
@@ -178,13 +179,13 @@ add_subdirectory(czip)
178179
add_subdirectory(d3music)
179180
add_subdirectory(ddebug)
180181

181-
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
182+
if(BUILD_EDITOR AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
182183
add_subdirectory(dd_grwin32)
183184
add_subdirectory(win32)
184-
else()
185-
add_subdirectory(linux)
186185
endif()
187186

187+
add_subdirectory(linux)
188+
188189
add_subdirectory(ddio)
189190
add_subdirectory(dd_video)
190191
add_subdirectory(fix)

CMakePresets.json

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,7 @@
77
"binaryDir": "${sourceDir}/builds/${presetName}"
88
},
99
{
10-
"name": "win32",
11-
"inherits": "defaults",
12-
"generator": "Ninja Multi-Config",
13-
"condition": {
14-
"type": "equals",
15-
"lhs": "${hostSystemName}",
16-
"rhs": "Windows"
17-
},
18-
"architecture": {
19-
"strategy": "external",
20-
"value": "x86"
21-
},
22-
"cacheVariables": {
23-
"VCPKG_TARGET_TRIPLET": "x86-windows-static-md"
24-
},
25-
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
26-
},
27-
{
28-
"name": "win64",
10+
"name": "win",
2911
"inherits": "defaults",
3012
"generator": "Ninja Multi-Config",
3113
"condition": {
@@ -65,12 +47,8 @@
6547
],
6648
"buildPresets": [
6749
{
68-
"name": "win32",
69-
"configurePreset": "win32"
70-
},
71-
{
72-
"name": "win64",
73-
"configurePreset": "win64"
50+
"name": "win",
51+
"configurePreset": "win"
7452
},
7553
{
7654
"name": "mac",
@@ -90,16 +68,10 @@
9068
}
9169
},
9270
{
93-
"name": "win32",
94-
"inherits": "defaults",
95-
"description": "Testing under Windows x86",
96-
"configurePreset": "win32"
97-
},
98-
{
99-
"name": "win64",
71+
"name": "win",
10072
"inherits": "defaults",
10173
"description": "Testing under Windows x64",
102-
"configurePreset": "win64"
74+
"configurePreset": "win"
10375
},
10476
{
10577
"name": "mac",

Descent3/CMakeLists.txt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -268,35 +268,30 @@ set(CPPS
268268
voice.cpp
269269
weapon.cpp
270270
WeaponFire.cpp
271-
weather.cpp)
271+
weather.cpp
272+
loki_utils.c
273+
sdlmain.cpp)
272274

273275
if(WIN32)
274-
set(PLATFORM_LIBS dd_grwin32 win32 wsock32.lib winmm.lib
275-
${DSOUND_LIBRARY} ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} ${DDRAW_LIBRARY})
276-
set(PLATFORM_CPPS winmain.cpp)
276+
set(PLATFORM_LIBS wsock32.lib winmm.lib)
277277
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
278278
endif()
279279

280280
if(UNIX AND NOT APPLE)
281-
set(PLATFORM_LIBS linux SDL2::SDL2 m ${CMAKE_DL_LIBS})
282-
set(PLATFORM_CPPS loki_utils.c lnxmain.cpp)
281+
set(PLATFORM_LIBS m ${CMAKE_DL_LIBS})
283282
endif()
284283

285284
if(APPLE)
286-
set(PLATFORM_LIBS linux SDL2::SDL2)
287-
set(PLATFORM_CPPS loki_utils.c lnxmain.cpp)
285+
set(PLATFORM_LIBS)
288286
set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon")
289287
endif()
290288

291289
file(GLOB_RECURSE INCS "../lib/*.h")
292290

293-
add_executable(Descent3
294-
WIN32
295-
${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS}
296-
)
297-
target_link_libraries(Descent3
291+
add_executable(Descent3 WIN32 ${HEADERS} ${CPPS} ${INCS})
292+
target_link_libraries(Descent3 PRIVATE
298293
2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio libmve libacm
299-
fix grtext manage mem misc model module movie stream_audio
294+
fix grtext manage mem misc model module movie stream_audio linux SDL2::SDL2
300295
music networking physics renderer rtperformance sndlib ui unzip vecmat md5
301296
${PLATFORM_LIBS})
302297
target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib)

Descent3/SDLMain.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)