CMakeLists.txt 2.35 KB
Newer Older
moto's avatar
moto committed
1
################################################################################
2
# libtorchaudio
moto's avatar
moto committed
3
4
################################################################################
set(
moto's avatar
moto committed
5
  sources
6
  lfilter.cpp
7
  overdrive.cpp
Caroline Chen's avatar
Caroline Chen committed
8
  utils.cpp
moto's avatar
moto committed
9
10
  )

11
set(
moto's avatar
moto committed
12
  additional_libs
13
14
15
  )

set(
moto's avatar
moto committed
16
  compile_definitions)
17
18
19
20

#------------------------------------------------------------------------------#
# START OF CUSTOMIZATION LOGICS
#------------------------------------------------------------------------------#
21
if(BUILD_RNNT)
22
23
  list(
    APPEND
moto's avatar
moto committed
24
    sources
25
26
27
28
29
30
    rnnt/cpu/compute_alphas.cpp
    rnnt/cpu/compute_betas.cpp
    rnnt/cpu/compute.cpp
    rnnt/compute_alphas.cpp
    rnnt/compute_betas.cpp
    rnnt/compute.cpp
31
    rnnt/autograd.cpp
32
    )
Caroline Chen's avatar
Caroline Chen committed
33
  if (USE_CUDA)
34
35
    list(
      APPEND
moto's avatar
moto committed
36
      sources
Caroline Chen's avatar
Caroline Chen committed
37
38
39
      rnnt/gpu/compute_alphas.cu
      rnnt/gpu/compute_betas.cu
      rnnt/gpu/compute.cu
40
      )
Caroline Chen's avatar
Caroline Chen committed
41
  endif()
moto's avatar
moto committed
42
43
endif()

44
if(BUILD_RIR)
45
  list(APPEND sources rir/rir.cpp rir/ray_tracing.cpp)
46
47
48
  list(APPEND compile_definitions INCLUDE_RIR)
endif()

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
if(BUILD_ALIGN)
  list(
    APPEND
    sources
    forced_align/compute.cpp
    forced_align/cpu/compute.cpp
  )
  list(APPEND compile_definitions INCLUDE_ALIGN)
  if (USE_CUDA)
    list(
      APPEND
      sources
      forced_align/gpu/compute.cu
    )
  endif()
endif()

66
if(USE_CUDA)
67
68
69
70
71
  list(
    APPEND
    sources
    iir_cuda.cu
  )
72
73
  list(
    APPEND
moto's avatar
moto committed
74
75
    additional_libs
    cuda_deps
76
77
78
79
80
81
    )
endif()

if(OpenMP_CXX_FOUND)
  list(
    APPEND
moto's avatar
moto committed
82
    additional_libs
83
84
85
86
87
88
89
    OpenMP::OpenMP_CXX
    )
endif()

#------------------------------------------------------------------------------#
# END OF CUSTOMIZATION LOGICS
#------------------------------------------------------------------------------#
90

moto's avatar
moto committed
91
torchaudio_library(
92
  libtorchaudio
moto's avatar
moto committed
93
94
95
96
  "${sources}"
  ""
  "torch;${additional_libs}"
  "${compile_definitions}"
97
  )
moto's avatar
moto committed
98

99
100
101
if (APPLE)
  set(TORCHAUDIO_LIBRARY libtorchaudio CACHE INTERNAL "")
else()
moto's avatar
moto committed
102
103
104
105
  set(TORCHAUDIO_LIBRARY -Wl,--no-as-needed libtorchaudio -Wl,--as-needed CACHE INTERNAL "")
endif()

################################################################################
106
# Python extensions
moto's avatar
moto committed
107
108
################################################################################
if (BUILD_TORCHAUDIO_PYTHON_EXTENSION)
109
  set(
110
111
112
113
114
115
116
117
118
    extension_sources
    pybind/pybind.cpp
    )
  torchaudio_extension(
    _torchaudio
    "${extension_sources}"
    ""
    "libtorchaudio"
    ""
119
    )
moto's avatar
moto committed
120
endif()