Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc30f6b

Browse files
authored
CMake build options improvements (#593)
1 parent641429b commitdc30f6b

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

‎CMakeLists.txt‎

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,28 @@ if(XBOX_CONSOLE_TARGET STREQUAL "durango")
6060
set(BUILD_GAMEINPUTOFF)
6161
set(BUILD_WGIOFF)
6262
set(BUILD_XINPUTOFF)
63-
set(BUILD_XBOXONE_SHADERSON)
6463
set(BUILD_XAUDIO_WIN10OFF)
6564
set(BUILD_XAUDIO_WIN8ON)
65+
set(BUILD_XAUDIO_REDISTOFF)
66+
set(BUILD_XBOXONE_SHADERSON)
6667
set(BUILD_TOOLSOFF)
6768
elseif(WINDOWS_STORE)
6869
set(BUILD_GAMEINPUTOFF)
6970
set(BUILD_WGION)
71+
set(BUILD_XINPUTOFF)
72+
set(BUILD_XAUDIO_WIN10ON)
73+
set(BUILD_XAUDIO_WIN8OFF)
74+
set(BUILD_XAUDIO_REDISTOFF)
7075
set(BUILD_TOOLSOFF)
76+
elseif(MINGW)
77+
set(BUILD_WGIOFF)
78+
set(BUILD_XAUDIO_WIN10OFF)
79+
set(BUILD_XAUDIO_WIN8OFF)
80+
if (NOT BUILD_GAMEINPUT)
81+
set(BUILD_XINPUTON)
82+
endif()
83+
elseif(WIN32AND (NOT BUILD_GAMEINPUT)AND (NOT BUILD_WGI))
84+
set(BUILD_XINPUTON)
7185
endif()
7286

7387
include(GNUInstallDirs)
@@ -145,29 +159,14 @@ set(SHADER_SOURCES
145159
Src/Shaders/SpriteEffect.fx
146160
Src/Shaders/ToneMap.fx)
147161

148-
# Xbox-specific extensions
149-
if(DEFINED XBOX_CONSOLE_TARGET)
150-
set(LIBRARY_HEADERS${LIBRARY_HEADERS}
151-
Inc/XboxDDSTextureLoader.h)
152-
153-
set(LIBRARY_SOURCES${LIBRARY_SOURCES}
154-
Src/XboxDDSTextureLoader.cpp)
155-
endif()
156-
157162
# These source files are identical in both DX11 and DX12 version.
158163
set(LIBRARY_HEADERS${LIBRARY_HEADERS}
159-
Inc/GamePad.h
160-
Inc/Keyboard.h
161-
Inc/Mouse.h
162164
Inc/SimpleMath.h
163165
Inc/SimpleMath.inl)
164166

165167
set(LIBRARY_SOURCES${LIBRARY_SOURCES}
166168
Src/BinaryReader.cpp
167-
Src/GamePad.cpp
168169
Src/Geometry.cpp
169-
Src/Keyboard.cpp
170-
Src/Mouse.cpp
171170
Src/SimpleMath.cpp)
172171

173172
set(LIBRARY_SOURCES${LIBRARY_SOURCES}
@@ -193,14 +192,28 @@ set(SHADER_SOURCES ${SHADER_SOURCES}
193192
Src/Shaders/Structures.fxh
194193
Src/Shaders/Utilities.fxh)
195194

196-
if(MINGW)
197-
set(BUILD_XAUDIO_WIN10OFF)
198-
set(BUILD_XAUDIO_WIN8OFF)
195+
# Xbox-specific extensions
196+
if(DEFINED XBOX_CONSOLE_TARGET)
197+
set(LIBRARY_HEADERS${LIBRARY_HEADERS}
198+
Inc/XboxDDSTextureLoader.h)
199+
200+
set(LIBRARY_SOURCES${LIBRARY_SOURCES}
201+
Src/XboxDDSTextureLoader.cpp)
202+
endif()
203+
204+
if(BUILD_XINPUTOR BUILD_WGIOR BUILD_GAMEINPUT)
205+
set(LIBRARY_HEADERS${LIBRARY_HEADERS}
206+
Inc/GamePad.h
207+
Inc/Keyboard.h
208+
Inc/Mouse.h)
209+
210+
set(LIBRARY_SOURCES${LIBRARY_SOURCES}
211+
Src/GamePad.cpp
212+
Src/Keyboard.cpp
213+
Src/Mouse.cpp)
199214
endif()
200215

201-
if(WINDOWS_STORE
202-
OR BUILD_XAUDIO_WIN10OR BUILD_XAUDIO_WIN8
203-
OR BUILD_XAUDIO_REDIST)
216+
if(BUILD_XAUDIO_WIN10OR BUILD_XAUDIO_WIN8OR BUILD_XAUDIO_REDIST)
204217
set(LIBRARY_HEADERS${LIBRARY_HEADERS}
205218
Inc/Audio.h)
206219

@@ -274,7 +287,7 @@ if(WIN32 AND BUILD_SHARED_LIBS)
274287
target_link_libraries(${PROJECT_NAME}PRIVATE kernelx.lib combase.lib d3d12_x.lib xi.lib)
275288
endif()
276289

277-
if(MINGW)
290+
if(MINGWAND BUILD_XINPUT)
278291
target_link_libraries(${PROJECT_NAME}PRIVATE xinput1_4.lib)
279292
endif()
280293
else()
@@ -297,9 +310,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
297310

298311
target_compile_features(${PROJECT_NAME}PUBLIC cxx_std_11)
299312

300-
if(WINDOWS_STORE
301-
OR BUILD_XAUDIO_WIN10OR BUILD_XAUDIO_WIN8
302-
OR BUILD_XAUDIO_REDIST)
313+
if(BUILD_XAUDIO_WIN10OR BUILD_XAUDIO_WIN8OR BUILD_XAUDIO_REDIST)
303314
target_include_directories(${PROJECT_NAME}PRIVATE Audio)
304315
endif()
305316

@@ -315,8 +326,7 @@ if(directxmath_FOUND)
315326
target_link_libraries(${PROJECT_NAME}PRIVATE Microsoft::DirectXMath)
316327
endif()
317328

318-
if(BUILD_XAUDIO_REDIST
319-
AND (NOT BUILD_XAUDIO_WIN10)AND (NOT BUILD_XAUDIO_WIN8)AND (NOT WINDOWS_STORE))
329+
if(BUILD_XAUDIO_REDISTAND (NOT BUILD_XAUDIO_WIN10)AND (NOT BUILD_XAUDIO_WIN8))
320330
message(STATUS"Using XAudio2Redist for DirectX Tool Kit for Audio.")
321331
find_package(xaudio2redist CONFIG REQUIRED)
322332
target_link_libraries(${PROJECT_NAME}PUBLIC Microsoft::XAudio2Redist)

‎CMakePresets.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@
122122
"cacheVariables": {
123123
"BUILD_XAUDIO_WIN10":false,
124124
"BUILD_XAUDIO_WIN8":false,
125-
"BUILD_XAUDIO_REDIST":true,
126-
"BUILD_XINPUT":true
125+
"BUILD_XAUDIO_REDIST":true
127126
},
128127
"hidden":true
129128
},
@@ -324,6 +323,9 @@
324323
{"name":"x86-Debug-MinGW" ,"description":"MinG-W32 (Debug)","inherits": ["base","x86","Debug","GNUC","VCPKG","XAudio2Redist","MinGW32" ] },
325324
{"name":"x86-Release-MinGW","description":"MinG-W32 (Release)","inherits": ["base","x86","Release","GNUC","VCPKG","XAudio2Redist","MinGW32" ] },
326325

326+
{"name":"x64-Debug-MinGW-GI" ,"description":"MinG-W64 (Debug) using GameInput","inherits": ["base","x64","Debug","GNUC","VCPKG","XAudio2Redist","MinGW64" ],"cacheVariables": {"BUILD_GAMEINPUT":"true" } },
327+
{"name":"x64-Release-MinGW-GI","description":"MinG-W64 (Release) using GameInput","inherits": ["base","x64","Release","GNUC","VCPKG","XAudio2Redist","MinGW64" ],"cacheVariables": {"BUILD_GAMEINPUT":"true" } },
328+
327329
{"name":"x64-Debug-ICC" ,"description":"Intel Classic Compiler (Debug) for Windows 8","inherits": ["base","x64","Debug","Intel" ] },
328330
{"name":"x64-Release-ICC" ,"description":"Intel Classic Compiler (Release) for Windows 8","inherits": ["base","x64","Release","Intel" ] },
329331

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp