Browse Source

commit Rainer's work and make some minor modifications to the top-level cmakelists to make visual studio happy

mr/4858113/396c189c01382f2fddc20c1e534100ce7282aca4
Nicholas Appleton 2 years ago
parent
commit
ea11061b20

+ 111
- 32
CMakeLists.txt View File

@@ -11,14 +11,17 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
11 11
 # been imported by some other CMakeLists.txt), we don't want to trump over
12 12
 # the top of that project's global settings.
13 13
 IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
14
+  PROJECT(portaudio)
15
+
16
+  # CMAKE_CONFIGURATION_TYPES only exists for multi-config generators (like
17
+  # Visual Studio or Xcode). For these projects, we won't define
18
+  # CMAKE_BUILD_TYPE as it does not make sense.
14 19
   IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
15 20
     MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE type to 'Debug' as none was specified.")
16 21
     SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
17 22
     SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
18 23
   ENDIF()
19 24
 
20
-  PROJECT(portaudio)
21
-
22 25
   SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
23 26
 
24 27
   IF(WIN32 AND MSVC)
@@ -172,7 +175,12 @@ IF(WIN32)
172 175
     OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
173 176
   ENDIF()
174 177
   IF(PA_USE_DS)
175
-    OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
178
+    IF(MINGW)
179
+      MESSAGE(STATUS "DirectSound support will be built with DSound provided by MinGW.")
180
+      OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" OFF)
181
+    ELSE(MINGW)
182
+      OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
183
+    ENDIF(MINGW)
176 184
     MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
177 185
     IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
178 186
       SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
@@ -186,10 +194,8 @@ IF(WIN32)
186 194
     SET(PA_SOURCES ${PA_SOURCES} ${PA_DS_SOURCES})
187 195
 
188 196
     # If we use DirectSound, we need this for the library to be found (if not in VS project settings)
189
-    IF(DXSDK_FOUND)
190
-      SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${DXSDK_DSOUND_LIBRARY})
191
-    ENDIF()
192
-  ENDIF()
197
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${DXSDK_DSOUND_LIBRARY})
198
+  ENDIF(PA_USE_DS)
193 199
 
194 200
   OPTION(PA_USE_WMME "Enable support for MME" ON)
195 201
   IF(PA_USE_WMME)
@@ -200,22 +206,16 @@ IF(WIN32)
200 206
     SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid)
201 207
   ENDIF()
202 208
 
203
-  IF(MSVC)
204
-    OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
205
-  ELSE()
206
-    # I was unable to get WASAPI to compile outside of Visual Studio. If
207
-    # anyone can figure out how to make this work with MinGW, please fix me.
208
-    SET(PA_USE_WASAPI OFF)
209
-  ENDIF()
209
+  # MinGW versions below 4.93, especially non MinGW-w64 distributions may
210
+  # break in the wasapi build. If an older MinGW version is required, WASAPI-
211
+  # support needs to be disabled.
212
+  OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
210 213
   IF(PA_USE_WASAPI)
211 214
     SET(PA_WASAPI_SOURCES src/hostapi/wasapi/pa_win_wasapi.c)
212 215
     SOURCE_GROUP("hostapi\\wasapi" FILES ${PA_WASAPI_SOURCES})
213 216
     SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wasapi.h)
214 217
     SET(PA_SOURCES ${PA_SOURCES} ${PA_WASAPI_SOURCES})
215 218
     SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid)
216
-    IF(NOT MSVC)
217
-      SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/hostapi/wasapi/mingw-include)
218
-    ENDIF()
219 219
   ELSE()
220 220
     SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
221 221
   ENDIF()
@@ -345,17 +345,44 @@ ELSE()
345 345
   SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_LITTLE_ENDIAN)
346 346
 ENDIF()
347 347
 
348
-ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES})
349
-SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
350
-TARGET_INCLUDE_DIRECTORIES(portaudio PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
351
-TARGET_INCLUDE_DIRECTORIES(portaudio PUBLIC include)
352
-TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES})
348
+OPTION(PA_BUILD_STATIC "Build static library" ON)
349
+OPTION(PA_BUILD_SHARED "Build shared/dynamic library" ON)
353 350
 
354
-ADD_LIBRARY(portaudio_static STATIC ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES})
355
-SET_PROPERTY(TARGET portaudio_static APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
356
-TARGET_INCLUDE_DIRECTORIES(portaudio_static PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
357
-TARGET_INCLUDE_DIRECTORIES(portaudio_static PUBLIC include)
358
-TARGET_LINK_LIBRARIES(portaudio_static ${PA_LIBRARY_DEPENDENCIES})
351
+IF(MSVC)
352
+  OPTION(PA_LIBNAME_ADD_SUFFIX "Add suffix _static to static library name" ON)
353
+ELSE()
354
+  OPTION(PA_LIBNAME_ADD_SUFFIX "Add suffix _static to static library name" OFF)
355
+ENDIF()
356
+
357
+# MSVC: if PA_LIBNAME_ADD_SUFFIX is not used, and both static and shared libraries are
358
+# built, one, of import- and static libraries, will overwrite the other. In
359
+# embedded builds this is not an issue as they will only build the configuration
360
+# used in the host application.
361
+MARK_AS_ADVANCED(PA_LIBNAME_ADD_SUFFIX)
362
+IF(MSVC AND PA_BUILD_STATIC AND PA_BUILD_SHARED AND NOT PA_LIBNAME_ADD_SUFFIX)
363
+  MESSAGE(WARNING "Building both shared and static libraries, and avoiding the suffix _static will lead to a name conflict")
364
+  SET(PA_LIBNAME_ADD_SUFFIX ON CACHE BOOL "Forcing use of suffix _static to avoid name conflict between static and import library" FORCE)
365
+  MESSAGE(WARNING "PA_LIBNAME_ADD_SUFFIX was set to ON")
366
+ENDIF()
367
+
368
+IF(PA_BUILD_SHARED)
369
+  ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES})
370
+  SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
371
+  TARGET_INCLUDE_DIRECTORIES(portaudio PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
372
+  TARGET_INCLUDE_DIRECTORIES(portaudio PUBLIC include)
373
+  TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES})
374
+ENDIF()
375
+
376
+IF(PA_BUILD_STATIC)
377
+  ADD_LIBRARY(portaudio_static STATIC ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES})
378
+  SET_PROPERTY(TARGET portaudio_static APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
379
+  TARGET_INCLUDE_DIRECTORIES(portaudio_static PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
380
+  TARGET_INCLUDE_DIRECTORIES(portaudio_static PUBLIC include)
381
+  TARGET_LINK_LIBRARIES(portaudio_static ${PA_LIBRARY_DEPENDENCIES})
382
+  IF(NOT PA_LIBNAME_ADD_SUFFIX)
383
+    SET_PROPERTY(TARGET portaudio_static PROPERTY OUTPUT_NAME portaudio)
384
+  ENDIF()
385
+ENDIF()
359 386
 
360 387
 IF(WIN32 AND MSVC)
361 388
   OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
@@ -370,8 +397,20 @@ IF(WIN32 AND MSVC)
370 397
       SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
371 398
     ENDIF()
372 399
   ENDIF()
373
-  SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX} FOLDER "Portaudio")
374
-  SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX} FOLDER "Portaudio")
400
+  IF(PA_BUILD_SHARD)
401
+    IF(PA_LIBNAME_ADD_SUFFIX)
402
+      SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX})
403
+    ELSE()
404
+      SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio)
405
+    ENDIF()
406
+  ENDIF()
407
+  IF(PA_BUILD_STATIC)
408
+    IF(PA_LIBNAME_ADD_SUFFIX)
409
+      SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX})
410
+    ELSE()
411
+      SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio)
412
+    ENDIF()
413
+  ENDIF()
375 414
 ELSE()
376 415
   IF(APPLE AND CMAKE_VERSION VERSION_GREATER 3.4.2)
377 416
     OPTION(PA_OUTPUT_OSX_FRAMEWORK "Generate an OS X framework instead of the simple library" OFF)
@@ -386,11 +425,52 @@ ELSE()
386 425
     ENDIF()
387 426
   ENDIF()
388 427
 
389
-  IF(NOT PA_OUTPUT_OSX_FRAMEWORK)
428
+  # At least on Windows in embedded builds, portaudio's install target should likely
429
+  # not be executed, as the library would usually already be installed as part of, and
430
+  # by means of the host application.
431
+  # The option below offers the option to avoid executing the portaudio install target
432
+  # for cases in which the host-application executes install, but no independent install
433
+  # of portaudio is wished.
434
+  OPTION(PA_DISABLE_INSTALL "Disable targets install and uninstall (for embedded builds)" OFF)
435
+
436
+  IF(NOT PA_OUTPUT_OSX_FRAMEWORK AND NOT PA_DISABLE_INSTALL)
390 437
     CONFIGURE_FILE(cmake_support/portaudio-2.0.pc.in ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc @ONLY)
391 438
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc DESTINATION lib/pkgconfig)
392 439
     INSTALL(FILES ${PA_PUBLIC_INCLUDES} DESTINATION include)
393
-    INSTALL(TARGETS portaudio DESTINATION lib)
440
+    INSTALL(FILES README.txt DESTINATION share/doc/portaudio)
441
+    INSTALL(FILES LICENSE.txt DESTINATION share/doc/portaudio)
442
+    IF(MINGW)
443
+      # For MinGW the destination for dll vs dll.a and .a needs to be specified separartely, also
444
+      # there are two targets (shared and static)
445
+      IF(PA_BUILD_SHARED)
446
+        INSTALL(TARGETS portaudio RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
447
+      ENDIF()
448
+      IF(PA_BUILD_STATIC)
449
+        INSTALL(TARGETS portaudio_static ARCHIVE DESTINATION lib)
450
+      ENDIF()
451
+      # Installing to the default application-location on Windows creates an error (a privileges and/or path
452
+      # syntax problem). The install_prefix will only be force-overridden if not defined by user input.
453
+      # The MinGW sysroot used here is generated in the file FindDSXSDK.cmake in the folder cmake_support:
454
+      IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
455
+          SET(CMAKE_INSTALL_PREFIX ${MINGW_SYSROOT} CACHE PATH "Cmake install path/prefix" FORCE)
456
+      ENDIF()
457
+    ELSE()
458
+      IF(PA_BUILD_SHARED)
459
+        INSTALL(TARGETS portaudio DESTINATION lib)
460
+      ENDIF()
461
+      IF(PA_BUILD_STATIC)
462
+        INSTALL(TARGETS portaudio_static DESTINATION lib)
463
+      ENDIF()
464
+    ENDIF()
465
+    MESSAGE(STATUS "Installation prefix is ${CMAKE_INSTALL_PREFIX}")
466
+    # uninstall target
467
+    CONFIGURE_FILE(
468
+        "${CMAKE_CURRENT_SOURCE_DIR}/cmake_support/cmake_uninstall.cmake.in"
469
+        "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
470
+        IMMEDIATE @ONLY)
471
+
472
+    ADD_CUSTOM_TARGET(uninstall
473
+        COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
394 474
   ENDIF()
395 475
 ENDIF()
396 476
 
@@ -405,4 +485,3 @@ OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF)
405 485
 IF(PA_BUILD_EXAMPLES)
406 486
   SUBDIRS(examples)
407 487
 ENDIF()
408
-

+ 63
- 34
cmake_support/FindDXSDK.cmake View File

@@ -1,6 +1,8 @@
1 1
 # $Id: $
2 2
 #
3
-# - Try to find the DirectX SDK
3
+# - For MSVC builds try to find the MS DirectX SDK, for MinGW just the
4
+# MinGW dsound library
5
+#
4 6
 # Once done this will define
5 7
 #
6 8
 #  DXSDK_FOUND - system has DirectX SDK
@@ -10,48 +12,75 @@
10 12
 #
11 13
 #  DXSDK_DSOUND_LIBRARY - Path to dsound.lib
12 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
+
13 21
 
14 22
 if(WIN32)
15 23
 else(WIN32)
16 24
   message(FATAL_ERROR "FindDXSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
17 25
 endif(WIN32)
18 26
 
19
-find_path(DXSDK_ROOT_DIR
20
-  include/dxsdkver.h
21
-  HINTS
22
-    $ENV{DXSDK_DIR}
23
-)
27
+if(MSVC)
24 28
 
25
-find_path(DXSDK_INCLUDE_DIR
26
-  dxsdkver.h
27
-  PATHS
28
-    ${DXSDK_ROOT_DIR}/include 
29
-)  
30
-
31
-IF(CMAKE_CL_64)
32
-find_path(DXSDK_LIBRARY_DIR
33
-  dsound.lib
34
-  PATHS
35
-  ${DXSDK_ROOT_DIR}/lib/x64
36
-)
37
-ELSE(CMAKE_CL_64)
38
-find_path(DXSDK_LIBRARY_DIR
39
-  dsound.lib
40
-  PATHS
41
-  ${DXSDK_ROOT_DIR}/lib/x86
42
-)
43
-ENDIF(CMAKE_CL_64)
29
+  find_path(DXSDK_ROOT_DIR
30
+    include/dxsdkver.h
31
+    HINTS
32
+      $ENV{DXSDK_DIR}
33
+  )
44 34
 
45
-find_library(DXSDK_DSOUND_LIBRARY 
46
-  dsound.lib
47
-  PATHS
48
-  ${DXSDK_LIBRARY_DIR}
49
-)
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)
50 82
 
51
-# handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if 
52
-# all listed variables are TRUE
53
-INCLUDE(FindPackageHandleStandardArgs)
54
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR)
83
+ENDIF(MSVC)
55 84
 
56 85
 MARK_AS_ADVANCED(
57 86
     DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR

+ 21
- 0
cmake_support/cmake_uninstall.cmake.in View File

@@ -0,0 +1,21 @@
1
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2
+  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
3
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4
+
5
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6
+string(REGEX REPLACE "\n" ";" files "${files}")
7
+foreach(file ${files})
8
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9
+  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10
+    exec_program(
11
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12
+      OUTPUT_VARIABLE rm_out
13
+      RETURN_VALUE rm_retval
14
+      )
15
+    if(NOT "${rm_retval}" STREQUAL 0)
16
+      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17
+    endif(NOT "${rm_retval}" STREQUAL 0)
18
+  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19
+    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20
+  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21
+endforeach(file)

+ 1
- 1
configure.in View File

@@ -349,7 +349,7 @@ case "${host_os}" in
349 349
             add_objects src/hostapi/wasapi/pa_win_wasapi.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o
350 350
             LIBS="${LIBS} -lwinmm -lm -lole32 -luuid"
351 351
             DLL_LIBS="${DLL_LIBS} -lwinmm -lole32"
352
-            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
352
+            CFLAGS="$CFLAGS -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
353 353
         fi
354 354
         ;;
355 355
 

+ 4
- 1
src/hostapi/dsound/pa_win_ds.c View File

@@ -904,6 +904,9 @@ static PaError AddOutputDeviceInfoFromDirectSound(
904 904
                             case DSSPEAKER_STEREO:           count = 2; break;
905 905
                             case DSSPEAKER_SURROUND:         count = 4; break;
906 906
                             case DSSPEAKER_5POINT1:          count = 6; break;
907
+#ifndef DSSPEAKER_7POINT1
908
+#define DSSPEAKER_7POINT1 0x00000007
909
+#endif
907 910
                             case DSSPEAKER_7POINT1:          count = 8; break;
908 911
 #ifndef DSSPEAKER_7POINT1_SURROUND
909 912
 #define DSSPEAKER_7POINT1_SURROUND 0x00000008
@@ -2136,7 +2139,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
2136 2139
         }
2137 2140
         else
2138 2141
         {
2139
-            CalculateBufferSettings( &stream->hostBufferSizeFrames, &pollingPeriodFrames,
2142
+            CalculateBufferSettings( (unsigned long*)&stream->hostBufferSizeFrames, &pollingPeriodFrames,
2140 2143
                     /* isFullDuplex = */ (inputParameters && outputParameters),
2141 2144
                     suggestedInputLatencyFrames,
2142 2145
                     suggestedOutputLatencyFrames, 

+ 10
- 5
src/hostapi/wasapi/pa_win_wasapi.c View File

@@ -60,16 +60,21 @@
60 60
 #endif
61 61
 
62 62
 // WASAPI
63
+// using adjustments for MinGW build from @mgeier/MXE
64
+// https://github.com/mxe/mxe/commit/f4bbc45682f021948bdaefd9fd476e2a04c4740f
63 65
 #include <mmreg.h>  // must be before other Wasapi headers
64
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
65
-	#include <Avrt.h>
66
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) || defined(__MINGW64_VERSION_MAJOR)
67
+	#include <avrt.h>
66 68
 	#define COBJMACROS
67
-	#include <Audioclient.h>
69
+	#include <audioclient.h>
68 70
 	#include <endpointvolume.h>
69 71
 	#define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
70
-	#include <mmdeviceapi.h>
72
+#ifndef _MSC_VER
73
+	#include <functiondiscoverykeys_devpkey.h>
74
+#endif
71 75
 	#include <functiondiscoverykeys.h>
72
-    #include <devicetopology.h>	// Used to get IKsJackDescription interface
76
+	#include <mmdeviceapi.h>
77
+	#include <devicetopology.h>	// Used to get IKsJackDescription interface
73 78
 	#undef INITGUID
74 79
 #endif
75 80
 #ifndef __MWERKS__

Loading…
Cancel
Save