annotate src/portaudio_20140130/CMakeLists.txt @ 81:7029a4916348

Merge build update
author Chris Cannam
date Thu, 31 Oct 2019 13:36:58 +0000
parents 7ddb4fc30dac
children
rev   line source
Chris@39 1 # $Id: $
Chris@39 2 #
Chris@39 3 # For a "How-To" please refer to the Portaudio documentation at:
Chris@39 4 # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/CMake
Chris@39 5 #
Chris@39 6 PROJECT( portaudio )
Chris@39 7
Chris@39 8 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
Chris@39 9
Chris@39 10 OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
Chris@39 11 IF(CMAKE_CL_64)
Chris@39 12 SET(TARGET_POSTFIX x64)
Chris@39 13 IF(PA_CONFIG_LIB_OUTPUT_PATH)
Chris@39 14 SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64)
Chris@39 15 ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
Chris@39 16 ELSE(CMAKE_CL_64)
Chris@39 17 SET(TARGET_POSTFIX x86)
Chris@39 18 IF(PA_CONFIG_LIB_OUTPUT_PATH)
Chris@39 19 SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
Chris@39 20 ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
Chris@39 21 ENDIF(CMAKE_CL_64)
Chris@39 22
Chris@39 23 OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF)
Chris@39 24 IF(PA_ENABLE_DEBUG_OUTPUT)
Chris@39 25 ADD_DEFINITIONS(-DPA_ENABLE_DEBUG_OUTPUT)
Chris@39 26 ENDIF(PA_ENABLE_DEBUG_OUTPUT)
Chris@39 27
Chris@39 28 IF(WIN32 AND MSVC)
Chris@39 29 OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
Chris@39 30 IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
Chris@39 31 FOREACH(flag_var
Chris@39 32 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
Chris@39 33 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
Chris@39 34 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
Chris@39 35 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
Chris@39 36 IF(${flag_var} MATCHES "/MD")
Chris@39 37 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
Chris@39 38 ENDIF(${flag_var} MATCHES "/MD")
Chris@39 39 ENDFOREACH(flag_var)
Chris@39 40 ENDIF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
Chris@39 41
Chris@39 42 ENDIF(WIN32 AND MSVC)
Chris@39 43
Chris@39 44 IF(WIN32)
Chris@39 45 OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON)
Chris@39 46
Chris@39 47 SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support)
Chris@39 48 # Try to find DirectX SDK
Chris@39 49 FIND_PACKAGE(DXSDK)
Chris@39 50 # Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see
Chris@39 51 # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC)
Chris@39 52 FIND_PACKAGE(ASIOSDK)
Chris@39 53
Chris@39 54 IF(ASIOSDK_FOUND)
Chris@39 55 OPTION(PA_USE_ASIO "Enable support for ASIO" ON)
Chris@39 56 ELSE(ASIOSDK_FOUND)
Chris@39 57 OPTION(PA_USE_ASIO "Enable support for ASIO" OFF)
Chris@39 58 ENDIF(ASIOSDK_FOUND)
Chris@39 59 IF(DXSDK_FOUND)
Chris@39 60 OPTION(PA_USE_DS "Enable support for DirectSound" ON)
Chris@39 61 ELSE(DXSDK_FOUND)
Chris@39 62 OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
Chris@39 63 ENDIF(DXSDK_FOUND)
Chris@39 64 OPTION(PA_USE_WMME "Enable support for MME" ON)
Chris@39 65 OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
Chris@39 66 OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON)
Chris@39 67 OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON)
Chris@39 68 MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO)
Chris@39 69 IF(PA_USE_DS)
Chris@39 70 OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
Chris@39 71 MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
Chris@39 72 ENDIF(PA_USE_DS)
Chris@39 73 ENDIF(WIN32)
Chris@39 74
Chris@39 75 # Set variables for DEF file expansion
Chris@39 76 IF(NOT PA_USE_ASIO)
Chris@39 77 SET(DEF_EXCLUDE_ASIO_SYMBOLS ";")
Chris@39 78 ENDIF(NOT PA_USE_ASIO)
Chris@39 79
Chris@39 80 IF(NOT PA_USE_WASAPI)
Chris@39 81 SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
Chris@39 82 ENDIF(NOT PA_USE_WASAPI)
Chris@39 83
Chris@39 84 IF(PA_USE_WDMKS_DEVICE_INFO)
Chris@39 85 ADD_DEFINITIONS(-DPAWIN_USE_WDMKS_DEVICE_INFO)
Chris@39 86 ENDIF(PA_USE_WDMKS_DEVICE_INFO)
Chris@39 87
Chris@39 88 IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
Chris@39 89 ADD_DEFINITIONS(-DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
Chris@39 90 ENDIF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
Chris@39 91
Chris@39 92 #######################################
Chris@39 93 IF(WIN32)
Chris@39 94 INCLUDE_DIRECTORIES(src/os/win)
Chris@39 95 ENDIF(WIN32)
Chris@39 96
Chris@39 97 IF(PA_USE_ASIO)
Chris@39 98 INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/common)
Chris@39 99 INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host)
Chris@39 100 INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host/pc)
Chris@39 101
Chris@39 102 SET(PA_ASIO_INCLUDES
Chris@39 103 include/pa_asio.h
Chris@39 104 )
Chris@39 105
Chris@39 106 SET(PA_ASIO_SOURCES
Chris@39 107 src/hostapi/asio/pa_asio.cpp
Chris@39 108 )
Chris@39 109
Chris@39 110 SET(PA_ASIOSDK_SOURCES
Chris@39 111 ${ASIOSDK_ROOT_DIR}/common/asio.cpp
Chris@39 112 ${ASIOSDK_ROOT_DIR}/host/pc/asiolist.cpp
Chris@39 113 ${ASIOSDK_ROOT_DIR}/host/asiodrivers.cpp
Chris@39 114 )
Chris@39 115
Chris@39 116 SOURCE_GROUP("hostapi\\ASIO" FILES
Chris@39 117 ${PA_ASIO_SOURCES}
Chris@39 118 )
Chris@39 119
Chris@39 120 SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES
Chris@39 121 ${PA_ASIOSDK_SOURCES}
Chris@39 122 )
Chris@39 123 ENDIF(PA_USE_ASIO)
Chris@39 124
Chris@39 125 IF(PA_USE_DS)
Chris@39 126 INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
Chris@39 127 INCLUDE_DIRECTORIES(src/os/win)
Chris@39 128
Chris@39 129 SET(PA_DS_INCLUDES
Chris@39 130 include/pa_win_ds.h
Chris@39 131 src/hostapi/dsound/pa_win_ds_dynlink.h
Chris@39 132 )
Chris@39 133
Chris@39 134 SET(PA_DS_SOURCES
Chris@39 135 src/hostapi/dsound/pa_win_ds.c
Chris@39 136 src/hostapi/dsound/pa_win_ds_dynlink.c
Chris@39 137 )
Chris@39 138
Chris@39 139 SOURCE_GROUP("hostapi\\dsound" FILES
Chris@39 140 ${PA_DS_INCLUDES}
Chris@39 141 ${PA_DS_SOURCES}
Chris@39 142 )
Chris@39 143 ENDIF(PA_USE_DS)
Chris@39 144
Chris@39 145 IF(PA_USE_WMME)
Chris@39 146
Chris@39 147 SET(PA_WMME_INCLUDES
Chris@39 148 include/pa_win_wmme.h
Chris@39 149 )
Chris@39 150
Chris@39 151 SET(PA_WMME_SOURCES
Chris@39 152 src/hostapi/wmme/pa_win_wmme.c
Chris@39 153 )
Chris@39 154
Chris@39 155 SOURCE_GROUP("hostapi\\wmme" FILES
Chris@39 156 ${PA_WMME_SOURCES}
Chris@39 157 )
Chris@39 158 ENDIF(PA_USE_WMME)
Chris@39 159
Chris@39 160 IF(PA_USE_WASAPI)
Chris@39 161
Chris@39 162 SET(PA_WASAPI_INCLUDES
Chris@39 163 include/pa_win_wasapi.h
Chris@39 164 )
Chris@39 165
Chris@39 166 SET(PA_WASAPI_SOURCES
Chris@39 167 src/hostapi/wasapi/pa_win_wasapi.c
Chris@39 168 )
Chris@39 169
Chris@39 170 SOURCE_GROUP("hostapi\\wasapi" FILES
Chris@39 171 ${PA_WASAPI_SOURCES}
Chris@39 172 )
Chris@39 173 ENDIF(PA_USE_WASAPI)
Chris@39 174
Chris@39 175 IF(PA_USE_WDMKS)
Chris@39 176
Chris@39 177 SET(PA_WDMKS_INCLUDES
Chris@39 178 include/pa_win_wdmks.h
Chris@39 179 )
Chris@39 180
Chris@39 181 SET(PA_WDMKS_SOURCES
Chris@39 182 src/hostapi/wdmks/pa_win_wdmks.c
Chris@39 183 )
Chris@39 184
Chris@39 185 SOURCE_GROUP("hostapi\\wdmks" FILES
Chris@39 186 ${PA_WDMKS_SOURCES}
Chris@39 187 )
Chris@39 188 ENDIF(PA_USE_WDMKS)
Chris@39 189
Chris@39 190 SET(PA_SKELETON_SOURCES
Chris@39 191 src/hostapi/skeleton/pa_hostapi_skeleton.c
Chris@39 192 )
Chris@39 193
Chris@39 194 SOURCE_GROUP("hostapi\\skeleton"
Chris@39 195 ${PA_SKELETON_SOURCES})
Chris@39 196
Chris@39 197 #######################################
Chris@39 198 IF(WIN32)
Chris@39 199 SET(PA_INCLUDES
Chris@39 200 include/portaudio.h
Chris@39 201 ${PA_ASIO_INCLUDES}
Chris@39 202 ${PA_DS_INCLUDES}
Chris@39 203 ${PA_WMME_INCLUDES}
Chris@39 204 ${PA_WASAPI_INCLUDES}
Chris@39 205 ${PA_WDMKS_INCLUDES}
Chris@39 206 )
Chris@39 207 ENDIF(WIN32)
Chris@39 208
Chris@39 209 SOURCE_GROUP("include" FILES
Chris@39 210 ${PA_INCLUDES}
Chris@39 211 )
Chris@39 212
Chris@39 213 SET(PA_COMMON_INCLUDES
Chris@39 214 src/common/pa_allocation.h
Chris@39 215 src/common/pa_converters.h
Chris@39 216 src/common/pa_cpuload.h
Chris@39 217 src/common/pa_debugprint.h
Chris@39 218 src/common/pa_dither.h
Chris@39 219 src/common/pa_endianness.h
Chris@39 220 src/common/pa_hostapi.h
Chris@39 221 src/common/pa_memorybarrier.h
Chris@39 222 src/common/pa_process.h
Chris@39 223 src/common/pa_ringbuffer.h
Chris@39 224 src/common/pa_stream.h
Chris@39 225 src/common/pa_trace.h
Chris@39 226 src/common/pa_types.h
Chris@39 227 src/common/pa_util.h
Chris@39 228 )
Chris@39 229
Chris@39 230 SET(PA_COMMON_SOURCES
Chris@39 231 src/common/pa_allocation.c
Chris@39 232 src/common/pa_converters.c
Chris@39 233 src/common/pa_cpuload.c
Chris@39 234 src/common/pa_debugprint.c
Chris@39 235 src/common/pa_dither.c
Chris@39 236 src/common/pa_front.c
Chris@39 237 src/common/pa_process.c
Chris@39 238 src/common/pa_ringbuffer.c
Chris@39 239 src/common/pa_stream.c
Chris@39 240 src/common/pa_trace.c
Chris@39 241 )
Chris@39 242
Chris@39 243 SOURCE_GROUP("common" FILES
Chris@39 244 ${PA_COMMON_INCLUDES}
Chris@39 245 ${PA_COMMON_SOURCES}
Chris@39 246 )
Chris@39 247
Chris@39 248 SOURCE_GROUP("cmake_generated" FILES
Chris@39 249 ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
Chris@39 250 ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
Chris@39 251 )
Chris@39 252
Chris@39 253 IF(WIN32)
Chris@39 254 SET(PA_PLATFORM_SOURCES
Chris@39 255 src/os/win/pa_win_hostapis.c
Chris@39 256 src/os/win/pa_win_util.c
Chris@39 257 src/os/win/pa_win_waveformat.c
Chris@39 258 src/os/win/pa_win_wdmks_utils.c
Chris@39 259 src/os/win/pa_win_coinitialize.c
Chris@39 260 src/os/win/pa_x86_plain_converters.c
Chris@39 261 )
Chris@39 262
Chris@39 263 SOURCE_GROUP("os\\win" FILES
Chris@39 264 ${PA_PLATFORM_SOURCES}
Chris@39 265 )
Chris@39 266 ENDIF(WIN32)
Chris@39 267
Chris@39 268 INCLUDE_DIRECTORIES( include )
Chris@39 269 INCLUDE_DIRECTORIES( src/common )
Chris@39 270
Chris@39 271 IF(WIN32 AND MSVC)
Chris@39 272 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
Chris@39 273 ENDIF(WIN32 AND MSVC)
Chris@39 274
Chris@39 275 ADD_DEFINITIONS(-DPORTAUDIO_CMAKE_GENERATED)
Chris@39 276 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
Chris@39 277
Chris@39 278 SET(SOURCES_LESS_ASIO_SDK
Chris@39 279 ${PA_COMMON_SOURCES}
Chris@39 280 ${PA_ASIO_SOURCES}
Chris@39 281 ${PA_DS_SOURCES}
Chris@39 282 ${PA_WMME_SOURCES}
Chris@39 283 ${PA_WASAPI_SOURCES}
Chris@39 284 ${PA_WDMKS_SOURCES}
Chris@39 285 ${PA_SKELETON_SOURCES}
Chris@39 286 ${PA_PLATFORM_SOURCES}
Chris@39 287 )
Chris@39 288
Chris@39 289 IF(PA_UNICODE_BUILD)
Chris@39 290 SET_SOURCE_FILES_PROPERTIES(
Chris@39 291 ${SOURCES_LESS_ASIO_SDK}
Chris@39 292 PROPERTIES
Chris@39 293 COMPILE_DEFINITIONS "UNICODE;_UNICODE"
Chris@39 294 )
Chris@39 295 ENDIF(PA_UNICODE_BUILD)
Chris@39 296
Chris@39 297 ADD_LIBRARY(portaudio SHARED
Chris@39 298 ${PA_INCLUDES}
Chris@39 299 ${PA_COMMON_INCLUDES}
Chris@39 300 ${SOURCES_LESS_ASIO_SDK}
Chris@39 301 ${PA_ASIOSDK_SOURCES}
Chris@39 302 ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
Chris@39 303 ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
Chris@39 304 )
Chris@39 305
Chris@39 306 ADD_LIBRARY(portaudio_static STATIC
Chris@39 307 ${PA_INCLUDES}
Chris@39 308 ${PA_COMMON_INCLUDES}
Chris@39 309 ${SOURCES_LESS_ASIO_SDK}
Chris@39 310 ${PA_ASIOSDK_SOURCES}
Chris@39 311 ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
Chris@39 312 )
Chris@39 313
Chris@39 314 # Configure the exports file according to settings
Chris@39 315 SET(GENERATED_MESSAGE "CMake generated file, do NOT edit! Use CMake-GUI to change configuration instead.")
Chris@39 316 CONFIGURE_FILE( cmake_support/template_portaudio.def ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def @ONLY )
Chris@39 317 # Configure header for options (PA_USE_xxx)
Chris@39 318 CONFIGURE_FILE( cmake_support/options_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h @ONLY )
Chris@39 319
Chris@39 320 IF(WIN32)
Chris@39 321 # If we use DirectSound, we need this for the library to be found (if not in VS project settings)
Chris@39 322 IF(PA_USE_DS AND DXSDK_FOUND)
Chris@39 323 TARGET_LINK_LIBRARIES(portaudio ${DXSDK_DSOUND_LIBRARY})
Chris@39 324 ENDIF(PA_USE_DS AND DXSDK_FOUND)
Chris@39 325
Chris@39 326 # If we use WDM/KS we need setupapi.lib
Chris@39 327 IF(PA_USE_WDMKS)
Chris@39 328 TARGET_LINK_LIBRARIES(portaudio setupapi)
Chris@39 329 ENDIF(PA_USE_WDMKS)
Chris@39 330
Chris@39 331 SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX})
Chris@39 332 SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX})
Chris@39 333 ENDIF(WIN32)
Chris@39 334
Chris@39 335 OPTION(PA_BUILD_TESTS "Include test projects" OFF)
Chris@39 336 OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF)
Chris@39 337
Chris@39 338 # Prepared for inclusion of test files
Chris@39 339 IF(PA_BUILD_TESTS)
Chris@39 340 SUBDIRS(test)
Chris@39 341 ENDIF(PA_BUILD_TESTS)
Chris@39 342
Chris@39 343 # Prepared for inclusion of test files
Chris@39 344 IF(PA_BUILD_EXAMPLES)
Chris@39 345 SUBDIRS(examples)
Chris@39 346 ENDIF(PA_BUILD_EXAMPLES)
Chris@39 347
Chris@39 348 #################################
Chris@39 349