Browse Source

Treat DirectSound just like any other standard Windows SDK library.

Currently the CMake build system goes through complicated logic to
find the DirectX SDK. This is completely unnecessary, because modern
versions of the Windows SDK include dsound.h and dsound.lib in the
standard paths, so it can be treated just like the other Windows OS
libraries and we can safely assume it is available.

This commit simplifies the logic and will allow the vcpkg portaudio
port to align with portaudio stream, by getting rid of this patch:
  95f9ce56f3/ports/portaudio/find_dsound.patch

I have verified that PortAudio CMake still builds with this commit
with the following toolchains:
 - Windows Visual Studio 2017 native CMake support
 - mingw-w64 on Windows (msys2)
 - mingw-w64 cross-compiling from Debian Unstable
mr/7040151/95e86c307b9cd20180f3c1f52853c3424ce62ae5
Etienne Dechamps 7 months ago
parent
commit
0baa1e2e31
2 changed files with 2 additions and 99 deletions
  1. 2
    11
      CMakeLists.txt
  2. 0
    88
      cmake_support/FindDXSDK.cmake

+ 2
- 11
CMakeLists.txt View File

@@ -169,13 +169,7 @@ IF(WIN32)
169 169
     SET(DEF_EXCLUDE_ASIO_SYMBOLS ";")
170 170
   ENDIF()
171 171
 
172
-  # Try to find DirectX SDK
173
-  FIND_PACKAGE(DXSDK)
174
-  IF(DXSDK_FOUND)
175
-    OPTION(PA_USE_DS "Enable support for DirectSound" ON)
176
-  ELSE()
177
-    OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
178
-  ENDIF()
172
+  OPTION(PA_USE_DS "Enable support for DirectSound" ON)
179 173
   IF(PA_USE_DS)
180 174
     IF(MINGW)
181 175
       MESSAGE(STATUS "DirectSound support will be built with DSound provided by MinGW.")
@@ -187,16 +181,13 @@ IF(WIN32)
187 181
     IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
188 182
       SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
189 183
     ENDIF()
190
-    SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${DXSDK_INCLUDE_DIR})
191 184
     SET(PA_DS_INCLUDES src/hostapi/dsound/pa_win_ds_dynlink.h)
192 185
     SET(PA_DS_SOURCES src/hostapi/dsound/pa_win_ds.c src/hostapi/dsound/pa_win_ds_dynlink.c)
193 186
     SOURCE_GROUP("hostapi\\dsound" FILES ${PA_DS_INCLUDES} ${PA_DS_SOURCES})
194 187
     SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_ds.h)
195 188
     SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_DS_INCLUDES})
196 189
     SET(PA_SOURCES ${PA_SOURCES} ${PA_DS_SOURCES})
197
-
198
-    # If we use DirectSound, we need this for the library to be found (if not in VS project settings)
199
-    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${DXSDK_DSOUND_LIBRARY})
190
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} dsound)
200 191
   ENDIF(PA_USE_DS)
201 192
 
202 193
   OPTION(PA_USE_WMME "Enable support for MME" ON)

+ 0
- 88
cmake_support/FindDXSDK.cmake View File

@@ -1,88 +0,0 @@
1
-# $Id: $
2
-#
3
-# - For MSVC builds try to find the MS DirectX SDK, for MinGW just the
4
-# MinGW dsound library
5
-#
6
-# Once done this will define
7
-#
8
-#  DXSDK_FOUND - system has DirectX SDK
9
-#  DXSDK_ROOT_DIR - path to the DirectX SDK base directory
10
-#  DXSDK_INCLUDE_DIR - the DirectX SDK include directory
11
-#  DXSDK_LIBRARY_DIR - DirectX SDK libraries path
12
-#
13
-#  DXSDK_DSOUND_LIBRARY - Path to dsound.lib
14
-#
15
-# MinGW builds have to use dsound provided by MinGW, so we need to avoid finding
16
-# the actual MS-DX-SDK in case it is installed on a build system. With MinGW,
17
-# "DXSDK" boils down to just another library and headers in default locations.
18
-# There might be old MinGW distributions without dsound though, so it is good to
19
-# verify its availability.
20
-
21
-
22
-if(WIN32)
23
-else(WIN32)
24
-  message(FATAL_ERROR "FindDXSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
25
-endif(WIN32)
26
-
27
-if(MSVC)
28
-
29
-  find_path(DXSDK_ROOT_DIR
30
-    include/dxsdkver.h
31
-    HINTS
32
-      $ENV{DXSDK_DIR}
33
-  )
34
-
35
-  find_path(DXSDK_INCLUDE_DIR
36
-    dxsdkver.h
37
-    PATHS
38
-      ${DXSDK_ROOT_DIR}/include
39
-  )
40
-
41
-  IF(CMAKE_CL_64)
42
-    find_path(DXSDK_LIBRARY_DIR
43
-    dsound.lib
44
-    PATHS
45
-      ${DXSDK_ROOT_DIR}/lib/x64
46
-  )
47
-  ELSE(CMAKE_CL_64)
48
-    find_path(DXSDK_LIBRARY_DIR
49
-    dsound.lib
50
-    PATHS
51
-      ${DXSDK_ROOT_DIR}/lib/x86
52
-  )
53
-  ENDIF(CMAKE_CL_64)
54
-
55
-  find_library(DXSDK_DSOUND_LIBRARY
56
-    dsound.lib
57
-    PATHS
58
-      ${DXSDK_LIBRARY_DIR}
59
-  )
60
-
61
-  # handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
62
-  # all listed variables are TRUE
63
-  INCLUDE(FindPackageHandleStandardArgs)
64
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR)
65
-
66
-ELSEIF(MINGW)
67
-
68
-  GET_FILENAME_COMPONENT(MINGW_BIN_DIR ${CMAKE_C_COMPILER} DIRECTORY)
69
-  GET_FILENAME_COMPONENT(MINGW_SYSROOT ${MINGW_BIN_DIR} DIRECTORY)
70
-  # The glob expression below should only return a single folder:
71
-  FILE(GLOB MINGW_TOOLCHAIN_FOLDER ${MINGW_SYSROOT}/*mingw32)
72
-  
73
-  find_library(DXSDK_DSOUND_LIBRARY
74
-    libdsound.a dsound
75
-    HINTS
76
-      "${MINGW_TOOLCHAIN_FOLDER}/lib"
77
-      "${MINGW_SYSROOT}/lib"
78
-  )
79
-
80
-  INCLUDE(FindPackageHandleStandardArgs)
81
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_DSOUND_LIBRARY)
82
-
83
-ENDIF(MSVC)
84
-
85
-MARK_AS_ADVANCED(
86
-    DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR
87
-    DXSDK_LIBRARY_DIR DXSDK_DSOUND_LIBRARY
88
-)

Loading…
Cancel
Save