annotate src/portaudio/CMakeLists.txt @ 46:efe5b9f38b13

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