| 1 |
cmake_minimum_required(VERSION 3.27) |
| 2 |
|
| 3 |
# if this is OS X, use an old SDK for backward compatibility |
| 4 |
# set(CMAKE_OSX_SYSROOT |
| 5 |
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk |
| 6 |
# CACHE STRING "SDK for OSX") |
| 7 |
|
| 8 |
set(MACOSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "minimum OS X target version") |
| 9 |
|
| 10 |
project(nyquist) |
| 11 |
|
| 12 |
########### |
| 13 |
# OPTIONS # |
| 14 |
########### |
| 15 |
|
| 16 |
option(USE_SOURCE_LIBS "Enabling this will disable searching for system installed libraries and instead use source-compiled versions" ON) |
| 17 |
|
| 18 |
if(WIN32) |
| 19 |
add_definitions("-D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS") |
| 20 |
endif(WIN32) |
| 21 |
|
| 22 |
################ |
| 23 |
# DEPENDENCIES # |
| 24 |
################ |
| 25 |
|
| 26 |
if(USE_SOURCE_LIBS) |
| 27 |
|
| 28 |
# sndfile |
| 29 |
set(ogg_SRCS |
| 30 |
libogg/src/bitwise.c |
| 31 |
libogg/src/framing.c) |
| 32 |
|
| 33 |
add_library(ogg_static STATIC ${ogg_SRCS}) |
| 34 |
if(WIN32) |
| 35 |
set_target_properties(ogg_static PROPERTIES COMPILE_FLAGS |
| 36 |
"-DWIN32 -D_WINDOWS /wd4068") |
| 37 |
endif(WIN32) |
| 38 |
|
| 39 |
set_property(TARGET ogg_static |
| 40 |
PROPERTY INCLUDE_DIRECTORIES |
| 41 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include) |
| 42 |
|
| 43 |
set(vorbis_SRCS |
| 44 |
libvorbis/lib/mdct.c |
| 45 |
libvorbis/lib/smallft.c |
| 46 |
libvorbis/lib/block.c |
| 47 |
libvorbis/lib/envelope.c |
| 48 |
libvorbis/lib/window.c |
| 49 |
libvorbis/lib/lsp.c |
| 50 |
libvorbis/lib/lpc.c |
| 51 |
libvorbis/lib/analysis.c |
| 52 |
libvorbis/lib/synthesis.c |
| 53 |
libvorbis/lib/psy.c |
| 54 |
libvorbis/lib/info.c |
| 55 |
libvorbis/lib/floor1.c |
| 56 |
libvorbis/lib/floor0.c |
| 57 |
libvorbis/lib/res0.c |
| 58 |
libvorbis/lib/mapping0.c |
| 59 |
libvorbis/lib/registry.c |
| 60 |
libvorbis/lib/codebook.c |
| 61 |
libvorbis/lib/sharedbook.c |
| 62 |
libvorbis/lib/lookup.c |
| 63 |
libvorbis/lib/bitrate.c |
| 64 |
) |
| 65 |
|
| 66 |
add_library(vorbis_static STATIC ${vorbis_SRCS}) |
| 67 |
target_include_directories(vorbis_static PRIVATE |
| 68 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/include |
| 69 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include) |
| 70 |
|
| 71 |
set(vorbisenc_SRCS |
| 72 |
libvorbis/lib/vorbisenc.c) |
| 73 |
add_library(vorbisenc_static STATIC ${vorbisenc_SRCS}) |
| 74 |
target_include_directories(vorbisenc_static PRIVATE |
| 75 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/include |
| 76 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include |
| 77 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/lib) |
| 78 |
|
| 79 |
set(vorbisfile_SRCS |
| 80 |
libvorbis/lib/vorbisfile.c) |
| 81 |
add_library(vorbisfile_static STATIC ${vorbisfile_SRCS}) |
| 82 |
target_include_directories(vorbisfile_static PRIVATE |
| 83 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/include |
| 84 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include |
| 85 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/lib) |
| 86 |
|
| 87 |
set(flac_SRCS |
| 88 |
FLAC/src/libFLAC/bitmath.c |
| 89 |
FLAC/src/libFLAC/bitreader.c |
| 90 |
FLAC/src/libFLAC/bitwriter.c |
| 91 |
FLAC/src/libFLAC/cpu.c |
| 92 |
FLAC/src/libFLAC/crc.c |
| 93 |
FLAC/src/libFLAC/fixed.c |
| 94 |
FLAC/src/libFLAC/float.c |
| 95 |
FLAC/src/libFLAC/format.c |
| 96 |
# FLAC/src/libFLAC/ia32/bitreader_asm.nasm |
| 97 |
FLAC/src/libFLAC/ia32/cpu_asm.nasm |
| 98 |
FLAC/src/libFLAC/ia32/fixed_asm.nasm |
| 99 |
FLAC/src/libFLAC/ia32/lpc_asm.nasm |
| 100 |
# FLAC/src/libFLAC/ia32/stream_encoder_asm.nasm |
| 101 |
FLAC/src/libFLAC/lpc.c |
| 102 |
FLAC/src/libFLAC/md5.c |
| 103 |
FLAC/src/libFLAC/memory.c |
| 104 |
FLAC/src/libFLAC/metadata_iterators.c |
| 105 |
FLAC/src/libFLAC/metadata_object.c |
| 106 |
FLAC/src/libFLAC/ogg_decoder_aspect.c |
| 107 |
FLAC/src/libFLAC/ogg_encoder_aspect.c |
| 108 |
FLAC/src/libFLAC/ogg_helper.c |
| 109 |
FLAC/src/libFLAC/ogg_mapping.c |
| 110 |
FLAC/src/libFLAC/stream_decoder.c |
| 111 |
FLAC/src/libFLAC/stream_encoder_framing.c |
| 112 |
FLAC/src/libFLAC/stream_encoder.c |
| 113 |
FLAC/src/libFLAC/window.c) |
| 114 |
|
| 115 |
add_library(flac_static STATIC ${flac_SRCS}) |
| 116 |
# There's a problem with quotes in XCode, so we need a special case |
| 117 |
if(APPLE) |
| 118 |
set_target_properties(flac_static PROPERTIES COMPILE_FLAGS |
| 119 |
"-DVERSION=\\\"1.3.1\\\" -DHAVE_LROUND") |
| 120 |
else(APPLE) |
| 121 |
if(WIN32) |
| 122 |
set_target_properties(flac_static PROPERTIES COMPILE_FLAGS |
| 123 |
"-DVERSION=\\\"1.3.1\\\" -DFLAC__NO_DLL -DFLAC__HAS_OGG -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DWIN32 -DFLAC__OVERFLOW_DETECT -D_LIB") |
| 124 |
else(WIN32) |
| 125 |
# also, Linux needs to get SIZE_MAX from stdint.h |
| 126 |
set_target_properties(flac_static PROPERTIES COMPILE_FLAGS |
| 127 |
"-DVERSION=\\\"1.3.1\\\" -DHAVE_LROUND -DHAVE_STDINT_H") |
| 128 |
endif(WIN32) |
| 129 |
endif(APPLE) |
| 130 |
target_include_directories(flac_static PRIVATE |
| 131 |
${CMAKE_CURRENT_SOURCE_DIR}/FLAC/src/libFLAC/include/ |
| 132 |
${CMAKE_CURRENT_SOURCE_DIR}/FLAC/include/ |
| 133 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include |
| 134 |
${CMAKE_CURRENT_SOURCE_DIR}/FLAC/src/libFLAC/ia32) |
| 135 |
|
| 136 |
set(sndfile_SRCS |
| 137 |
nylsf/ima_oki_adpcm.c |
| 138 |
nylsf/interleave.c |
| 139 |
nylsf/id3.c |
| 140 |
nylsf/audio_detect.c |
| 141 |
nylsf/chanmap.c |
| 142 |
nylsf/sndfile.c |
| 143 |
nylsf/common.c |
| 144 |
nylsf/file_io.c |
| 145 |
nylsf/aiff.c |
| 146 |
nylsf/alaw.c |
| 147 |
nylsf/au.c |
| 148 |
nylsf/avr.c |
| 149 |
nylsf/broadcast.c |
| 150 |
nylsf/caf.c |
| 151 |
nylsf/dither.c |
| 152 |
nylsf/double64.c |
| 153 |
nylsf/dwd.c |
| 154 |
nylsf/flac.c |
| 155 |
nylsf/float32.c |
| 156 |
nylsf/htk.c |
| 157 |
nylsf/mat4.c |
| 158 |
nylsf/mat5.c |
| 159 |
nylsf/nist.c |
| 160 |
nylsf/ogg.c |
| 161 |
nylsf/paf.c |
| 162 |
nylsf/pcm.c |
| 163 |
nylsf/pvf.c |
| 164 |
nylsf/raw.c |
| 165 |
nylsf/rx2.c |
| 166 |
nylsf/sd2.c |
| 167 |
nylsf/sds.c |
| 168 |
nylsf/ircam.c |
| 169 |
nylsf/dwvw.c |
| 170 |
nylsf/vox_adpcm.c |
| 171 |
nylsf/w64.c |
| 172 |
nylsf/wav_w64.c |
| 173 |
nylsf/wav.c |
| 174 |
nylsf/wve.c |
| 175 |
nylsf/xi.c |
| 176 |
nylsf/command.c |
| 177 |
nylsf/strings.c |
| 178 |
nylsf/svx.c |
| 179 |
nylsf/ima_adpcm.c |
| 180 |
nylsf/txw.c |
| 181 |
nylsf/ulaw.c |
| 182 |
nylsf/voc.c |
| 183 |
nylsf/ms_adpcm.c |
| 184 |
nylsf/g72x.c |
| 185 |
nylsf/gsm610.c |
| 186 |
nylsf/G72x/g72x.c |
| 187 |
nylsf/GSM610/gsm_create.c |
| 188 |
nylsf/GSM610/gsm_decode.c |
| 189 |
nylsf/GSM610/gsm_destroy.c |
| 190 |
nylsf/GSM610/gsm_encode.c |
| 191 |
nylsf/GSM610/code.c |
| 192 |
nylsf/GSM610/decode.c |
| 193 |
nylsf/GSM610/gsm_option.c |
| 194 |
nylsf/G72x/g721.c |
| 195 |
nylsf/G72x/g723_16.c |
| 196 |
nylsf/G72x/g723_24.c |
| 197 |
nylsf/G72x/g723_40.c |
| 198 |
nylsf/GSM610/long_term.c |
| 199 |
nylsf/GSM610/lpc.c |
| 200 |
nylsf/GSM610/preprocess.c |
| 201 |
nylsf/GSM610/rpe.c |
| 202 |
nylsf/GSM610/short_term.c |
| 203 |
nylsf/GSM610/table.c |
| 204 |
nylsf/GSM610/add.c |
| 205 |
nylsf/mpc2k.c |
| 206 |
nylsf/chunk.c |
| 207 |
nylsf/G72x/g721.c |
| 208 |
nylsf/G72x/g723_16.c |
| 209 |
nylsf/G72x/g723_24.c |
| 210 |
nylsf/G72x/g723_40.c |
| 211 |
nylsf/G72x/g72x.c |
| 212 |
# nylsf/G72x/g72x_test.c |
| 213 |
nylsf/GSM610/add.c |
| 214 |
nylsf/GSM610/code.c |
| 215 |
nylsf/GSM610/decode.c |
| 216 |
nylsf/GSM610/gsm_create.c |
| 217 |
nylsf/GSM610/gsm_decode.c |
| 218 |
nylsf/GSM610/gsm_destroy.c |
| 219 |
nylsf/GSM610/gsm_encode.c |
| 220 |
nylsf/GSM610/gsm_option.c |
| 221 |
nylsf/GSM610/long_term.c |
| 222 |
nylsf/GSM610/lpc.c |
| 223 |
nylsf/GSM610/preprocess.c |
| 224 |
nylsf/GSM610/rpe.c |
| 225 |
nylsf/GSM610/short_term.c |
| 226 |
nylsf/GSM610/table.c |
| 227 |
nylsf/macbinary3.c |
| 228 |
nylsf/macos.c |
| 229 |
nylsf/ogg_pcm.c |
| 230 |
nylsf/ogg_speex.c |
| 231 |
nylsf/ogg_vorbis.c |
| 232 |
nylsf/rf64.c |
| 233 |
) |
| 234 |
|
| 235 |
add_library(sndfile_static STATIC ${sndfile_SRCS}) |
| 236 |
|
| 237 |
if(WIN32) |
| 238 |
set_target_properties(sndfile_static PROPERTIES COMPILE_FLAGS |
| 239 |
"-DOS_IS_WIN32=1") |
| 240 |
set(EXTRA_SNDFILE_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/sys/win/msvc) |
| 241 |
else(WIN32) |
| 242 |
set(EXTRA_SNDFILE_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/sys/unix) |
| 243 |
endif(WIN32) |
| 244 |
|
| 245 |
|
| 246 |
target_include_directories(sndfile_static PRIVATE |
| 247 |
${CMAKE_CURRENT_SOURCE_DIR}/nylsf |
| 248 |
${CMAKE_CURRENT_SOURCE_DIR}/FLAC/include |
| 249 |
${CMAKE_CURRENT_SOURCE_DIR}/libogg/include |
| 250 |
${CMAKE_CURRENT_SOURCE_DIR}/libvorbis/include |
| 251 |
${CMAKE_CURRENT_SOURCE_DIR}/cmt |
| 252 |
${EXTRA_SNDFILE_INCLUDE}) |
| 253 |
|
| 254 |
# portaudio |
| 255 |
set(portaudio_SRCS |
| 256 |
portaudio/src/common/pa_ringbuffer.c |
| 257 |
portaudio/src/common/pa_ringbuffer.h |
| 258 |
portaudio/src/hostapi/skeleton/pa_hostapi_skeleton.c |
| 259 |
portaudio/include/portaudio.h |
| 260 |
portaudio/src/common/pa_allocation.h |
| 261 |
portaudio/src/common/pa_converters.c |
| 262 |
portaudio/src/common/pa_converters.h |
| 263 |
portaudio/src/common/pa_cpuload.c |
| 264 |
portaudio/src/common/pa_cpuload.h |
| 265 |
portaudio/src/common/pa_debugprint.c |
| 266 |
portaudio/src/common/pa_debugprint.h |
| 267 |
portaudio/src/common/pa_dither.c |
| 268 |
portaudio/src/common/pa_dither.h |
| 269 |
portaudio/src/common/pa_endianness.h |
| 270 |
portaudio/src/common/pa_front.c |
| 271 |
portaudio/src/common/pa_hostapi.h |
| 272 |
portaudio/src/common/pa_process.c |
| 273 |
portaudio/src/common/pa_process.h |
| 274 |
portaudio/src/common/pa_stream.c |
| 275 |
portaudio/src/common/pa_stream.h |
| 276 |
portaudio/src/common/pa_trace.c |
| 277 |
portaudio/src/common/pa_trace.h |
| 278 |
portaudio/src/common/pa_types.h |
| 279 |
portaudio/src/common/pa_util.h |
| 280 |
portaudio/src/common/pa_allocation.c |
| 281 |
portaudio/include/pa_jack.h |
| 282 |
# portaudio/src/common/pa_skeleton.c |
| 283 |
) |
| 284 |
if(UNIX) |
| 285 |
set(portaudio_SRCS ${portaudio_SRCS} |
| 286 |
portaudio/src/os/unix/pa_unix_util.c |
| 287 |
portaudio/src/os/unix/pa_unix_util.h |
| 288 |
portaudio/src/os/unix/pa_unix_hostapis.c |
| 289 |
portaudio/src/os/unix/pa_unix_util.c) |
| 290 |
if(APPLE) |
| 291 |
set(portaudio_mac_SRCS |
| 292 |
# correct hostapis seesm to be in pa_unix_hostapis.c |
| 293 |
# portaudio/src/os/mac_osx/pa_mac_hostapis.c |
| 294 |
portaudio/include/pa_mac_core.h |
| 295 |
portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c |
| 296 |
portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.h |
| 297 |
portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c |
| 298 |
portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h |
| 299 |
portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h |
| 300 |
portaudio/src/hostapi/coreaudio/pa_mac_core.c) |
| 301 |
set(portaudio_SRCS ${portaudio_SRCS} ${portaudio_mac_SRCS}) |
| 302 |
else(APPLE) |
| 303 |
# Linux |
| 304 |
set(portaudio_linux_SRCS |
| 305 |
portaudio/src/hostapi/alsa/pa_linux_alsa.c |
| 306 |
portaudio/src/hostapi/oss/pa_unix_oss.c) |
| 307 |
set(portaudio_SRCS ${portaudio_SRCS} ${portaudio_linux_SRCS}) |
| 308 |
endif(APPLE) |
| 309 |
else(UNIX) |
| 310 |
#WIN32 |
| 311 |
set(portaudio_SRCS ${portaudio_SRCS} |
| 312 |
portaudio/src/os/win/pa_win_hostapis.c |
| 313 |
portaudio/src/os/win/pa_win_util.c |
| 314 |
portaudio/src/os/win/pa_win_coinitialize.c |
| 315 |
portaudio/src/os/win/pa_win_coinitialize.h |
| 316 |
portaudio/src/os/win/pa_win_waveformat.c |
| 317 |
portaudio/src/os/win/pa_x86_plain_converters.c |
| 318 |
portaudio/src/os/win/pa_x86_plain_converters.h |
| 319 |
portaudio/src/hostapi/wasapi/pa_win_wasapi.c |
| 320 |
portaudio/src/hostapi/wmme/pa_win_wmme.c) |
| 321 |
|
| 322 |
# release will use static runtime library |
| 323 |
foreach(flag_var CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE) |
| 324 |
if(${flag_var} MATCHES "/MD") |
| 325 |
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
| 326 |
endif(${flag_var} MATCHES "/MD") |
| 327 |
endforeach(flag_var) |
| 328 |
message(STATUS |
| 329 |
"Note: overriding CMAKE_*_FLAGS_* to use Visual C static multithread library") |
| 330 |
set(VERBOSE_WARNINGS 0 CACHE BOOL "Do not use _CRT_SECURE_NO_WARNINGS to disable suggestions to use 'secure' versions of strcpy, etc.") |
| 331 |
if(NOT VERBOSE_WARNINGS) |
| 332 |
list(APPEND COMMON_DEFINITIONS "_CRT_SECURE_NO_WARNINGS") |
| 333 |
endif(NOT VERBOSE_WARNINGS) |
| 334 |
endif(UNIX) |
| 335 |
|
| 336 |
add_library(portaudio_static STATIC ${portaudio_SRCS}) |
| 337 |
target_include_directories(portaudio_static PRIVATE |
| 338 |
PROPERTY INCLUDE_DIRECTORIES |
| 339 |
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/include |
| 340 |
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/src/common) |
| 341 |
|
| 342 |
if(UNIX) |
| 343 |
target_include_directories(portaudio_static PRIVATE |
| 344 |
PROPERTY INCLUDE_DIRECTORIES |
| 345 |
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/src/os/unix) |
| 346 |
if(APPLE) |
| 347 |
else(APPLE) |
| 348 |
# Linux |
| 349 |
set(USE_ALSA 1 CACHE BOOL "Use ALSA audio rather than OSS") |
| 350 |
|
| 351 |
if(USE_ALSA) |
| 352 |
set(ALSA_FLAGS "-DPA_USE_ALSA=1") |
| 353 |
else(USE_ALSA) |
| 354 |
set(ALSA_FLAGS "") |
| 355 |
endif(USE_ALSA) |
| 356 |
set_target_properties(portaudio_static PROPERTIES COMPILE_FLAGS |
| 357 |
"-DPA_USE_OSS=1 -DHAVE_LINUX_SOUNDCARD_H ${ALSA_FLAGS}") |
| 358 |
endif(APPLE) |
| 359 |
else(UNIX) |
| 360 |
# Windows |
| 361 |
set_target_properties(portaudio_static PROPERTIES COMPILE_FLAGS |
| 362 |
"-DPA_USE_WMME=1 -DPA_USE_WASAPI=1") |
| 363 |
target_include_directories(portaudio_static PRIVATE |
| 364 |
PROPERTY INCLUDE_DIRECTORIES |
| 365 |
${CMAKE_CURRENT_SOURCE_DIR}/portaudio/src/os/win) |
| 366 |
endif(UNIX) |
| 367 |
|
| 368 |
## portaudio |
| 369 |
set(PORTAUDIO_INCLUDE_PATH ../portaudio/include) |
| 370 |
set(PORTAUDIO_LIBRARY portaudio_static) |
| 371 |
include_directories(${PORTAUDIO_INCLUDE_PATH}) |
| 372 |
## |
| 373 |
|
| 374 |
|
| 375 |
# liblo |
| 376 |
|
| 377 |
set(liblo_SRCS |
| 378 |
liblo/src/send.c |
| 379 |
liblo/src/server.c |
| 380 |
liblo/src/address.c |
| 381 |
liblo/src/blob.c |
| 382 |
liblo/src/bundle.c |
| 383 |
liblo/src/message.c |
| 384 |
liblo/src/method.c |
| 385 |
liblo/src/pattern_match.c |
| 386 |
liblo/src/timetag.c |
| 387 |
) |
| 388 |
|
| 389 |
add_library(lo_static STATIC ${liblo_SRCS}) |
| 390 |
if(UNIX) # including OS X... |
| 391 |
set(LIBLO_EXTRA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/liblo/osx) |
| 392 |
set_target_properties(lo_static PROPERTIES COMPILE_FLAGS -DHAVE_CONFIG_H) |
| 393 |
else(UNIX) |
| 394 |
set_target_properties(lo_static PROPERTIES COMPILE_FLAGS |
| 395 |
"-DPACKAGE_NAME=\\\"liblo\\\" -DHAVE_SELECT -DPRINTF_LL=\\\"ll\\\"") |
| 396 |
endif(UNIX) |
| 397 |
|
| 398 |
target_include_directories(lo_static PRIVATE |
| 399 |
${CMAKE_CURRENT_SOURCE_DIR}/liblo |
| 400 |
${CMAKE_CURRENT_SOURCE_DIR}/liblo/src |
| 401 |
${LIBLO_EXTRA_INCLUDES}) |
| 402 |
|
| 403 |
else(USE_SOURCE_LIBS) |
| 404 |
|
| 405 |
# sndfile |
| 406 |
find_library(LIBSNDFILE_LIBRARY sndfile) |
| 407 |
|
| 408 |
if(NOT LIBSNDFILE_LIBRARY) |
| 409 |
message(FATAL_ERROR "Nyquist requires the sndfile library") |
| 410 |
endif() |
| 411 |
|
| 412 |
find_path(SNDFILE_H_PATH sndfile.h) |
| 413 |
if(SNDFILE_H_PATH) |
| 414 |
include_directories(${SNDFILE_H_PATH}) |
| 415 |
else() |
| 416 |
message(FATAL_ERROR "Could not find sndfile.h") |
| 417 |
endif() |
| 418 |
|
| 419 |
if(NOT PORTAUDIO_LIBRARY) |
| 420 |
message(FATAL_ERROR "Nyquist requires the portaudio library") |
| 421 |
endif() |
| 422 |
|
| 423 |
# liblo |
| 424 |
|
| 425 |
find_library(LIBLO_LIBRARY lo) |
| 426 |
|
| 427 |
if(NOT LIBLO_LIBRARY) |
| 428 |
message(FATAL_ERROR "Nyquist requires the liblo library") |
| 429 |
endif() |
| 430 |
|
| 431 |
endif(USE_SOURCE_LIBS) |
| 432 |
|
| 433 |
####################### |
| 434 |
# BUILD CONFIGURATION # |
| 435 |
####################### |
| 436 |
|
| 437 |
# NYQUIST EXECUTABLE |
| 438 |
|
| 439 |
set(xlisp_SRCS |
| 440 |
xlisp/extern.c |
| 441 |
xlisp/xldmem.c |
| 442 |
xlisp/xlbfun.c |
| 443 |
xlisp/xlcont.c |
| 444 |
xlisp/xldbug.c |
| 445 |
xlisp/xleval.c |
| 446 |
xlisp/xlfio.c |
| 447 |
xlisp/xlftab.c |
| 448 |
xlisp/xlglob.c |
| 449 |
xlisp/xlimage.c |
| 450 |
xlisp/xlinit.c |
| 451 |
xlisp/xlio.c |
| 452 |
xlisp/xlisp.c |
| 453 |
xlisp/xljump.c |
| 454 |
xlisp/xllist.c |
| 455 |
xlisp/xlmath.c |
| 456 |
xlisp/xlobj.c |
| 457 |
xlisp/xlpp.c |
| 458 |
xlisp/xlprin.c |
| 459 |
xlisp/xlread.c |
| 460 |
xlisp/xlstr.c |
| 461 |
xlisp/xlsubr.c |
| 462 |
xlisp/xlsym.c |
| 463 |
xlisp/xlsys.c |
| 464 |
xlisp/path.c |
| 465 |
xlisp/security.c |
| 466 |
) |
| 467 |
|
| 468 |
set(tran_SRCS |
| 469 |
tran/abs.c |
| 470 |
tran/allpoles.c |
| 471 |
tran/alpass.c |
| 472 |
tran/alpasscv.c |
| 473 |
tran/alpassvc.c |
| 474 |
tran/alpassvv.c |
| 475 |
tran/amosc.c |
| 476 |
tran/areson.c |
| 477 |
tran/aresoncv.c |
| 478 |
tran/aresonvc.c |
| 479 |
tran/aresonvv.c |
| 480 |
tran/atone.c |
| 481 |
tran/atonev.c |
| 482 |
tran/biquadfilt.c |
| 483 |
tran/buzz.c |
| 484 |
tran/chase.c |
| 485 |
tran/clip.c |
| 486 |
tran/congen.c |
| 487 |
tran/const.c |
| 488 |
tran/coterm.c |
| 489 |
tran/delaycc.c |
| 490 |
tran/delaycv.c |
| 491 |
tran/eqbandvvv.c |
| 492 |
tran/exp.c |
| 493 |
tran/fmfb.c |
| 494 |
tran/fmfbv.c |
| 495 |
tran/fmosc.c |
| 496 |
tran/follow.c |
| 497 |
tran/fromarraystream.c |
| 498 |
tran/fromobject.c |
| 499 |
tran/gate.c |
| 500 |
tran/ifft.c |
| 501 |
tran/instrbanded.c |
| 502 |
tran/instrbow.c |
| 503 |
tran/instrbowedfreq.c |
| 504 |
tran/instrclar.c |
| 505 |
tran/instrclarall.c |
| 506 |
tran/instrclarfreq.c |
| 507 |
tran/instrflute.c |
| 508 |
tran/instrfluteall.c |
| 509 |
tran/instrflutefreq.c |
| 510 |
tran/instrmandolin.c |
| 511 |
tran/instrmodalbar.c |
| 512 |
tran/instrsax.c |
| 513 |
tran/instrsaxall.c |
| 514 |
tran/instrsaxfreq.c |
| 515 |
tran/instrsitar.c |
| 516 |
tran/integrate.c |
| 517 |
tran/log.c |
| 518 |
tran/lpreson.c |
| 519 |
tran/maxv.c |
| 520 |
tran/offset.c |
| 521 |
tran/oneshot.c |
| 522 |
tran/osc.c |
| 523 |
tran/partial.c |
| 524 |
tran/pluck.c |
| 525 |
tran/prod.c |
| 526 |
tran/pwl.c |
| 527 |
tran/quantize.c |
| 528 |
tran/recip.c |
| 529 |
tran/reson.c |
| 530 |
tran/resoncv.c |
| 531 |
tran/resonvc.c |
| 532 |
tran/resonvv.c |
| 533 |
tran/sampler.c |
| 534 |
tran/scale.c |
| 535 |
tran/shape.c |
| 536 |
tran/sine.c |
| 537 |
tran/siosc.c |
| 538 |
tran/slope.c |
| 539 |
tran/sqrt.c |
| 540 |
tran/tapf.c |
| 541 |
tran/tapv.c |
| 542 |
tran/tone.c |
| 543 |
tran/tonev.c |
| 544 |
tran/upsample.c |
| 545 |
tran/white.c |
| 546 |
tran/stkpitshift.c |
| 547 |
tran/stkrev.c |
| 548 |
tran/stkchorus.c) |
| 549 |
|
| 550 |
set(seq_SRCS |
| 551 |
# out of alphabetical order because seqext.h needed |
| 552 |
# before we generate interface for seq.c: |
| 553 |
nyqsrc/seqext.c |
| 554 |
cmt/seq.c |
| 555 |
nyqsrc/seqinterf.c |
| 556 |
cmt/seqmread.c |
| 557 |
cmt/seqmwrite.c |
| 558 |
cmt/seqread.c |
| 559 |
cmt/seqwrite.c ) |
| 560 |
|
| 561 |
|
| 562 |
set(cmt_SRCS |
| 563 |
cmt/cext.c |
| 564 |
cmt/cleanup.c |
| 565 |
cmt/cmdline.c |
| 566 |
cmt/cmtcmd.c |
| 567 |
cmt/moxc.c |
| 568 |
cmt/mem.c |
| 569 |
cmt/midifile.c |
| 570 |
cmt/midifns.c |
| 571 |
cmt/record.c |
| 572 |
cmt/tempomap.c |
| 573 |
cmt/timebase.c |
| 574 |
cmt/userio.c) |
| 575 |
|
| 576 |
set(nyqstk_SRCS |
| 577 |
nyqstk/instr.cpp |
| 578 |
nyqstk/src/Clarinet.cpp |
| 579 |
nyqstk/src/Delay.cpp |
| 580 |
nyqstk/src/DelayL.cpp |
| 581 |
nyqstk/src/Envelope.cpp |
| 582 |
nyqstk/src/Filter.cpp |
| 583 |
nyqstk/src/Instrmnt.cpp |
| 584 |
nyqstk/src/Noise.cpp |
| 585 |
nyqstk/src/OneZero.cpp |
| 586 |
nyqstk/src/Saxofony.cpp |
| 587 |
nyqstk/src/Stk.cpp |
| 588 |
nyqstk/src/WaveLoop.cpp |
| 589 |
nyqstk/src/WvIn.cpp |
| 590 |
nyqstk/stkinit.cpp |
| 591 |
nyqstk/src/DelayA.cpp |
| 592 |
nyqstk/src/Effect.cpp |
| 593 |
nyqstk/src/FileRead.cpp |
| 594 |
nyqstk/src/FileWvIn.cpp |
| 595 |
nyqstk/src/Flute.cpp |
| 596 |
nyqstk/src/Function.cpp |
| 597 |
nyqstk/src/Generator.cpp |
| 598 |
nyqstk/src/JCRev.cpp |
| 599 |
nyqstk/src/JetTable.cpp |
| 600 |
nyqstk/src/Mandolin.cpp |
| 601 |
nyqstk/src/Modal.cpp |
| 602 |
nyqstk/src/ModalBar.cpp |
| 603 |
nyqstk/src/NRev.cpp |
| 604 |
nyqstk/src/OnePole.cpp |
| 605 |
nyqstk/src/PitShift.cpp |
| 606 |
nyqstk/src/PluckTwo.cpp |
| 607 |
nyqstk/src/PoleZero.cpp |
| 608 |
nyqstk/src/PRCRev.cpp |
| 609 |
nyqstk/src/ReedTable.cpp |
| 610 |
nyqstk/src/SineWave.cpp |
| 611 |
nyqstk/src/Sitar.cpp |
| 612 |
nyqstk/src/ADSR.cpp |
| 613 |
nyqstk/src/BandedWG.cpp |
| 614 |
nyqstk/src/BiQuad.cpp |
| 615 |
nyqstk/src/Bowed.cpp |
| 616 |
nyqstk/src/BowTable.cpp |
| 617 |
nyqstk/src/Chorus.cpp |
| 618 |
nyqstk/stkint.cpp) |
| 619 |
|
| 620 |
set(nyqsrc_SRCS |
| 621 |
# put sound.c first (out of alphabetical order) because of dependencies |
| 622 |
nyqsrc/sound.c |
| 623 |
nyqsrc/add.c |
| 624 |
nyqsrc/avg.c |
| 625 |
nyqsrc/compose.c |
| 626 |
nyqsrc/convolve.c |
| 627 |
nyqsrc/downsample.c |
| 628 |
nyqsrc/fft.c |
| 629 |
nyqsrc/inverse.c |
| 630 |
nyqsrc/lpanal.c |
| 631 |
nyqsrc/multiseq.c |
| 632 |
nyqsrc/nyq-osc-server.c |
| 633 |
nyqsrc/phasevocoder.c |
| 634 |
nyqsrc/resamp.c |
| 635 |
nyqsrc/resampv.c |
| 636 |
nyqsrc/samples.c |
| 637 |
nyqsrc/sliderdata.c |
| 638 |
nyqsrc/sndmax.c |
| 639 |
nyqsrc/sndread.c |
| 640 |
nyqsrc/sndseq.c |
| 641 |
nyqsrc/sndsliders.c |
| 642 |
nyqsrc/stoponzero.c |
| 643 |
nyqsrc/trigger.c |
| 644 |
nyqsrc/yin.c |
| 645 |
) |
| 646 |
|
| 647 |
set(nyquist_SRCS |
| 648 |
nyqsrc/debug.c |
| 649 |
nyqsrc/falloc.c |
| 650 |
nyqsrc/local.c |
| 651 |
nyqsrc/handlers.c |
| 652 |
nyqsrc/multiread.c |
| 653 |
nyqsrc/pvshell.c |
| 654 |
nyqsrc/stats.c |
| 655 |
nyqsrc/ffilterkit.c |
| 656 |
nyqsrc/seqfnint.c |
| 657 |
nyqsrc/sndfnint.c |
| 658 |
nyqsrc/sndwritepa.c |
| 659 |
nyqsrc/f0.cpp |
| 660 |
ffts/src/fftlib.c |
| 661 |
ffts/src/fftext.c |
| 662 |
ffts/src/matlib.c |
| 663 |
cmupv/src/cmupv.c |
| 664 |
cmupv/src/internal.c |
| 665 |
snd/ieeecvt.c) |
| 666 |
|
| 667 |
|
| 668 |
list(APPEND nyquist_SRCS |
| 669 |
${xlisp_SRCS} ${tran_SRCS} ${cmt_SRCS} ${seq_SRCS} |
| 670 |
${nyqsrc_SRCS} ${nyqstk_SRCS}) |
| 671 |
|
| 672 |
if(UNIX) |
| 673 |
list(APPEND nyquist_SRCS |
| 674 |
sys/unix/osstuff.c |
| 675 |
sys/unix/term.c) |
| 676 |
else(UNIX) |
| 677 |
list(APPEND nyquist_SRCS |
| 678 |
sys/win/msvc/winstuff.c |
| 679 |
sys/win/msvc/winfun.c) |
| 680 |
endif(UNIX) |
| 681 |
|
| 682 |
# Add headers using GLOB |
| 683 |
|
| 684 |
file(GLOB xlisp_headers "${CMAKE_CURRENT_SOURCE_DIR}/xlisp/*.h") |
| 685 |
file(GLOB tran_headers "${CMAKE_CURRENT_SOURCE_DIR}/tran/*.h") |
| 686 |
file(GLOB cmt_headers "${CMAKE_CURRENT_SOURCE_DIR}/cmt/*.h") |
| 687 |
file(GLOB nyqstk_headers "${CMAKE_CURRENT_SOURCE_DIR}/nyqstk/*.h") |
| 688 |
file(GLOB nyqstk_include_headers "${CMAKE_CURRENT_SOURCE_DIR}/nyqstk/include/*.h") |
| 689 |
file(GLOB nyquist_headers "${CMAKE_CURRENT_SOURCE_DIR}/nyqsrc/*.h") |
| 690 |
set(nyquist_headers ${nyquist_headers} |
| 691 |
${CMAKE_CURRENT_SOURCE_DIR}/ffts/src/fftext.h |
| 692 |
${CMAKE_CURRENT_SOURCE_DIR}/ffts/src/fftlib.h |
| 693 |
${CMAKE_CURRENT_SOURCE_DIR}/cmupv/src/cmupv.h |
| 694 |
${CMAKE_CURRENT_SOURCE_DIR}/cmupv/src/internal.h) |
| 695 |
#file(GLOB liblo_headers "${CMAKE_CURRENT_SOURCE_DIR}/liblo/*.h") |
| 696 |
#file(GLOB sndfile_headers "${CMAKE_CURRENT_SOURCE_DIR}/nylsf/sndfile.h") |
| 697 |
|
| 698 |
|
| 699 |
list(APPEND nyquist_SRCS |
| 700 |
${xlisp_headers} ${tran_headers} ${cmt_headers} |
| 701 |
${nyqstk_headers} ${nyqstk_include_headers} |
| 702 |
${nyquist_headers}) |
| 703 |
|
| 704 |
## |
| 705 |
link_directories(../portaudio/lib/.libs) |
| 706 |
## |
| 707 |
|
| 708 |
# Create executables |
| 709 |
add_executable(ny ${nyquist_SRCS}) |
| 710 |
|
| 711 |
#include directories |
| 712 |
target_include_directories(ny PRIVATE |
| 713 |
ffts/src snd cmt xlisp tran nyqsrc nyqstk nyqstk/include |
| 714 |
cmupv/src portaudio/include) |
| 715 |
|
| 716 |
if(UNIX) |
| 717 |
target_include_directories(ny PRIVATE sys/unix) |
| 718 |
else(UNIX) |
| 719 |
target_include_directories(ny PRIVATE sys/win/msvc) |
| 720 |
endif(UNIX) |
| 721 |
|
| 722 |
if(USE_SOURCE_LIBS) |
| 723 |
## target_include_directories(ny PRIVATE nylsf liblo portaudio/include) |
| 724 |
target_include_directories(ny PRIVATE nylsf liblo) |
| 725 |
## |
| 726 |
target_link_libraries(ny ogg_static) |
| 727 |
target_link_libraries(ny vorbis_static) |
| 728 |
target_link_libraries(ny vorbisenc_static) |
| 729 |
target_link_libraries(ny vorbisfile_static) |
| 730 |
target_link_libraries(ny flac_static) |
| 731 |
target_link_libraries(ny sndfile_static) |
| 732 |
## target_link_libraries(ny portaudio_static) |
| 733 |
target_link_libraries(ny ${PORTAUDIO_LIBRARY}) |
| 734 |
## |
| 735 |
target_link_libraries(ny lo_static) |
| 736 |
else() |
| 737 |
target_link_libraries(ny ${LIBSNDFILE_LIBRARY}) |
| 738 |
target_link_libraries(ny ${PORTAUDIO_LIBRARY}) |
| 739 |
target_link_libraries(ny ${LIBLO_LIBRARY}) |
| 740 |
endif() |
| 741 |
|
| 742 |
# NYQUIST IDE |
| 743 |
|
| 744 |
if (APPLE) |
| 745 |
add_custom_target(NyquistIDE ALL |
| 746 |
rm -f jnyqide/jnyqide.jar |
| 747 |
COMMAND jnyqide/make-osx-app.sh |
| 748 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 749 |
COMMENT "Building jnyqide.jar") |
| 750 |
add_dependencies(NyquistIDE ny) |
| 751 |
else(APPLE) |
| 752 |
if(UNIX) # Linux |
| 753 |
if(USE_ALSA) |
| 754 |
set(SYSTEM_LSP sys/unix/alsa/system.lsp) |
| 755 |
else(USE_ALSA) |
| 756 |
set(SYSTEM_LSP sys/unix/nonalsa/system.lsp) |
| 757 |
endif(USE_ALSA) |
| 758 |
add_custom_target(jNyqIDE ALL |
| 759 |
mv jnyqide/SpecialMacHandler.java jnyqide/SpecialMacHandler.hidden |
| 760 |
COMMAND javac jnyqide/*.java |
| 761 |
COMMAND |
| 762 |
mv jnyqide/SpecialMacHandler.hidden jnyqide/SpecialMacHandler.java |
| 763 |
COMMAND rm -f jnyqide/jNyqIDE.jar |
| 764 |
COMMAND |
| 765 |
jar -cfm jnyqide/jNyqIDE.jar jnyqide/manifest.txt jnyqide/*.class |
| 766 |
COMMAND rm -f jnyqide/ny |
| 767 |
COMMAND ln -s ../ny jnyqide/ny |
| 768 |
COMMAND cp ${SYSTEM_LSP} runtime |
| 769 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 770 |
COMMENT "Building jnyqide/jNyqIDE.jar") |
| 771 |
add_dependencies(jNyqIDE ny) |
| 772 |
else(UNIX) # WIN32 |
| 773 |
add_custom_target(jNyqIDE ALL |
| 774 |
comp-ide.bat |
| 775 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 776 |
COMMENT "Building jnyqide/jNyqIDE.jar") |
| 777 |
add_dependencies(jNyqIDE ny) |
| 778 |
endif(UNIX) |
| 779 |
endif(APPLE) |
| 780 |
|
| 781 |
# endif() |
| 782 |
|
| 783 |
add_definitions("-DOSC") |
| 784 |
add_definitions("-DSTK_NYQUIST") |
| 785 |
|
| 786 |
set(EXTRA_NYQUIST_LIBS ) |
| 787 |
if(UNIX) |
| 788 |
if(APPLE) |
| 789 |
include_directories(${CMAKE_OSX_SYSROOT}/Developer/Headers/FlatCarbon |
| 790 |
src/sys/mac) |
| 791 |
set(FRAMEWORK_PATH ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks |
| 792 |
CACHE INTERNAL " " FORCE) |
| 793 |
set(COREAUDIO_LIB "${FRAMEWORK_PATH}/CoreAudio.framework") |
| 794 |
set(COREFOUNDATION_LIB "${FRAMEWORK_PATH}/CoreFoundation.framework") |
| 795 |
set(CORESERVICES_LIB "${FRAMEWORK_PATH}/CoreServices.framework") |
| 796 |
set(AUDIOTOOLBOX_LIB "${FRAMEWORK_PATH}/AudioToolbox.framework") |
| 797 |
set(AUDIOUNIT_LIB "${FRAMEWORK_PATH}/AudioUnit.framework") |
| 798 |
set(EXTRA_PA_LIBS ${COREAUDIO_LIB} ${COREFOUNDATION_LIB} |
| 799 |
${CORESERVICES_LIB} |
| 800 |
${AUDIOTOOLBOX_LIB} ${AUDIOUNIT_LIB}) |
| 801 |
|
| 802 |
# APPLE NyquistIde.app |
| 803 |
# add_custom_command(TARGET NyquistIDE |
| 804 |
# POST_BUILD |
| 805 |
# COMMAND ant bundle-nyquist |
| 806 |
# COMMAND sh ./finish-osx-app.sh |
| 807 |
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/jnyqide) |
| 808 |
|
| 809 |
add_definitions("-DPA_USE_COREAUDIO") |
| 810 |
add_definitions("-DCMTSTUFF") |
| 811 |
add_definitions("-Dmacintosh") |
| 812 |
else(APPLE) |
| 813 |
# Linux |
| 814 |
set(EXTRA_PA_LIBS asound pthread m) |
| 815 |
endif(APPLE) |
| 816 |
# useing ../liblo/liblo_s.a. The builder must explicitly make a |
| 817 |
# static liblo library with --enable-static and copy the result, |
| 818 |
# ../liblo/src/.libs/liblo.a, to ../liblo/liblo_s.a. Otherwise, |
| 819 |
# at least XCode might try to link with /usr/local/lib/liblo.dylib |
| 820 |
# By renaming, we gain confidence as to what is actually being linked. |
| 821 |
#set(LO lo_s) |
| 822 |
#set(LO_PATH ../liblo) |
| 823 |
#set(PORTMIDI_DBG portmidi_s) |
| 824 |
#set(PORTMIDI_OPT portmidi_s) |
| 825 |
else(UNIX) |
| 826 |
# the liblo project builds liblo.lib, not lo.lib |
| 827 |
# Iphlpapi is for GetAdaptersAddresses() in address.c |
| 828 |
set(EXTRA_PA_LIBS winmm.lib) |
| 829 |
set(EXTRA_NYQUIST_LIBS ws2_32.lib Iphlpapi.lib) |
| 830 |
endif(UNIX) |
| 831 |
|
| 832 |
target_link_libraries(ny ${EXTRA_NYQUIST_LIBS} ${EXTRA_PA_LIBS}) |
| 833 |
|
| 834 |
# Create args for intgen |
| 835 |
set(sndfnint_args "") |
| 836 |
foreach(arg ${nyqsrc_SRCS} ${tran_SRCS}) |
| 837 |
string(REPLACE ".c" ".h" arg_h ${arg}) |
| 838 |
set(sndfnint_args ${sndfnint_args} ${arg_h}) |
| 839 |
endforeach(arg ${nyqsrc_SRCS}) |
| 840 |
# some extra .h files, order is important due to dependencies: |
| 841 |
set(sndfnint_args nylsf/sndfile.h ${sndfnint_args} |
| 842 |
nyqsrc/sndfmt.h nyqsrc/sndwrite.h) |
| 843 |
# message(status "sndfnint_args: ${sndfnint_args}") |
| 844 |
|
| 845 |
# Create args for intgen |
| 846 |
set(seqfnint_args "") |
| 847 |
foreach(arg ${seq_SRCS}) |
| 848 |
string(REPLACE ".c" ".h" arg_h ${arg}) |
| 849 |
set(seqfnint_args ${seqfnint_args} ${arg_h}) |
| 850 |
endforeach(arg ${nyqsrc_SRCS}) |
| 851 |
# seqdecls.h has no corresponding .c files, so add |
| 852 |
# them here: |
| 853 |
set(seqfnint_args cmt/seqdecls.h ${seqfnint_args}) |
| 854 |
# message(status "seqfnint_args: ${seqfnint_args}") |
| 855 |
|
| 856 |
add_executable(intgen misc/intgen2.c misc/cmdline.c |
| 857 |
misc/cmdline.h cmt/swlogic.h) |
| 858 |
target_include_directories(intgen PRIVATE sys/unix misc cmt) |
| 859 |
|
| 860 |
add_custom_target(XLISP_C_Interfaces |
| 861 |
COMMAND intgen nyqsrc/sndfnint ${sndfnint_args} |
| 862 |
COMMAND intgen nyqsrc/seqfnint ${seqfnint_args} |
| 863 |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 864 |
SOURCES ${sndfnint_args} ${seqfnint_args}) |
| 865 |
|
| 866 |
add_executable(syncwritetest portaudio_test/syncwrite.c) |
| 867 |
target_include_directories(syncwritetest PRIVATE portaudio/include) |
| 868 |
target_link_libraries(syncwritetest ${PORTAUDIO_LIBRARY}) |
| 869 |
target_link_libraries(syncwritetest ${EXTRA_PA_LIBS}) |