Skip to content

Commit 25ae27a

Browse files
committed
Add code review
1 parent 93a8e06 commit 25ae27a

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectXMath.pc"
9292

9393
#--- Optional extension libraries
9494
if(BUILD_XDSP)
95+
message(STATUS "Including XDSP Digital Signal Processing (DSP)")
9596
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/XDSP)
9697
endif()
9798

9899
if(BUILD_SHMATH)
100+
message(STATUS "Including C++ Spherical Harmonics Math")
99101
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/SHMath)
100102
endif()
101103

SHMath/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if(WIN32 AND BUILD_DX11)
5959
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXSHD3D11.cpp)
6060
endif()
6161

62-
if(BUILD_DX12)
62+
if(WIN32 AND BUILD_DX12)
6363
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXSHD3D12.cpp)
6464
endif()
6565

@@ -71,6 +71,20 @@ target_include_directories(${PROJECT_NAME} PUBLIC
7171

7272
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11)
7373

74+
if(MINGW)
75+
find_package(directx-headers CONFIG REQUIRED)
76+
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::DirectX-Headers)
77+
target_compile_definitions(${PROJECT_NAME} PUBLIC USING_DIRECTX_HEADERS)
78+
else()
79+
find_package(directx-headers CONFIG QUIET)
80+
endif()
81+
82+
if(directx-headers_FOUND)
83+
message(STATUS "Using DirectX-Headers package")
84+
target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft::DirectX-Headers)
85+
target_compile_definitions(${PROJECT_NAME} PRIVATE USING_DIRECTX_HEADERS)
86+
endif()
87+
7488
#--- Package
7589
include(CMakePackageConfigHelpers)
7690

SHMath/DirectXSHD3D12.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
// C5039 pointer or reference to potentially throwing function passed to extern C function under - EHc
1717
#endif
1818

19+
#ifdef USING_DIRECTX_HEADERS
20+
#include <directx/d3d12.h>
21+
#else
1922
#include <d3d12.h>
23+
#endif
2024

2125
#include "DirectXSH.h"
2226

@@ -224,7 +228,7 @@ HRESULT DirectX::SHProjectCubeMap(
224228

225229
// index from [0,W-1], f(0) maps to -1 + 1/W, f(W-1) maps to 1 - 1/w
226230
// linear function x*S +B, 1st constraint means B is (-1+1/W), plug into
227-
// second and solve for S: S = 2*(1-1/W)/(W-1). The old code that did
231+
// second and solve for S: S = 2*(1-1/W)/(W-1). The old code that did
228232
// this was incorrect - but only for computing the differential solid
229233
// angle, where the final value was 1.0 instead of 1-1/w...
230234

0 commit comments

Comments
 (0)