FFT: Prevent user from attempting hops smaller than SC's block size
[supercollider.git] / server / plugins / CMakeLists.txt
blob788ecc29beb0640a2b331f0554963e8edad21b69
2 if(NOT NO_LIBSNDFILE)
3         find_package(Sndfile)
4 else()
5         add_definitions("-DNO_LIBSNDFILE")
6 endif()
8 include_directories(${CMAKE_SOURCE_DIR}/include/common
9                     ${CMAKE_SOURCE_DIR}/include/plugin_interface)
11 if (NOVA_SIMD)
12         include_directories(${CMAKE_SOURCE_DIR}/external_libraries/nova-simd)
13         add_definitions("-DNOVA_SIMD")
14 endif()
16 # large file support
17 if (CMAKE_SIZEOF_VOID_P MATCHES "4")
18         execute_process(COMMAND getconf LFS_CFLAGS
19                 OUTPUT_VARIABLE LFS_CFLAGS
20                 ERROR_QUIET
21                 OUTPUT_STRIP_TRAILING_WHITESPACE)
22 elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
23         execute_process(COMMAND getconf LFS64_CFLAGS
24                 OUTPUT_VARIABLE LFS_CFLAGS
25                 ERROR_QUIET
26                 OUTPUT_STRIP_TRAILING_WHITESPACE)
27 endif()
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LFS_CFLAGS}")
31 set(plugin_sources
32         BinaryOpUGens.cpp
33         ChaosUGens.cpp
34         DelayUGens.cpp
35         DemandUGens.cpp
36         DynNoiseUGens.cpp
37         FilterUGens.cpp
38         GendynUGens.cpp
39         GrainUGens.cpp
40         IOUGens.cpp
41         LFUGens.cpp
42         MulAddUGens.cpp
43         NoiseUGens.cpp
44         OscUGens.cpp
45         PanUGens.cpp
46         PhysicalModelingUGens.cpp
47         ReverbUGens.cpp
48         TestUGens.cpp
49         TriggerUGens.cpp
50         UnaryOpUGens.cpp
51         UnpackFFTUGens.cpp
53         UIUGens.cpp
56 set(plugins "")
57 set(supernova_plugins "")
59 set(CMAKE_SHARED_MODULE_PREFIX "")
60 if(APPLE OR WIN32)
61         set(CMAKE_SHARED_MODULE_SUFFIX ".scx")
62 endif()
64 if (${CMAKE_COMPILER_IS_GNUCXX})
65         add_definitions(-fno-finite-math-only)
66         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
67         if(NOT WIN32)
68                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
69         endif()
70 endif()
72 foreach(plugin ${plugin_sources})
73         string(REPLACE .cpp "" plugin_name ${plugin} )
74                 add_library(${plugin_name} MODULE ${plugin})
75         list(APPEND plugins ${plugin_name})
76 endforeach(plugin)
78 set(uiugens UIUGens)
80 if (WIN32)
81     if(MSVC)
82         include_directories (../../platform/windows/compat_stuff) # for stdbool.h
83     endif()
84 endif()
86 add_library(FFT_UGens MODULE
87                         FFTInterfaceTable.cpp
88                         FFT_UGens.cpp
89                         PV_UGens.cpp
90                         PartitionedConvolution.cpp
91                         ${scplugin_common_sources}
92                         )
94 add_library(PV_ThirdParty MODULE
95                         Convolution.cpp
96                         FFT2InterfaceTable.cpp
97                         FeatureDetection.cpp
98                         PV_ThirdParty.cpp
99                         ${scplugin_common_sources}
100                         )
102 add_library(ML_UGens MODULE
103                         ML.cpp
104                         Loudness.cpp
105                         BeatTrack.cpp
106                         Onsets.cpp
107                         onsetsds.c
108                         KeyTrack.cpp
109                         MFCC.cpp
110                         BeatTrack2.cpp
111                         ML_SpecStats.cpp
112                         ${scplugin_common_sources}
113                         )
115 if(NOT NO_LIBSNDFILE)
116         set(diskio_sources DiskIO_UGens.cpp)
118         add_library(DiskIO_UGens MODULE ${diskio_sources})
120         if(SNDFILE_FOUND)
121                 include_directories(${SNDFILE_INCLUDE_DIR})
122                 target_link_libraries(DiskIO_UGens ${SNDFILE_LIBRARIES} ${MATH_LIBRARY} ${PTHREADS_LIBRARY})
124                 list(APPEND plugins DiskIO_UGens)
125         else()
126                 message(SEND_ERROR "Cannot find libsndfile")
127         endif(SNDFILE_FOUND)
128 endif()
130 set(fft_ugens FFT_UGens PV_ThirdParty ML_UGens)
131 list(APPEND plugins FFT_UGens PV_ThirdParty ML_UGens)
133 if (FFTW3F_FOUND)
134         include_directories (${FFTW3F_INCLUDE_DIR})
135 endif()
137 if (SUPERNOVA)
138         foreach(plugin ${plugin_sources})
139                 string(REPLACE .cpp "_supernova" plugin_name ${plugin} )
140                 add_library(${plugin_name} MODULE ${plugin})
141                 list(APPEND supernova_plugins ${plugin_name})
142                 set_property(TARGET ${plugin_name}
143                     APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
144         endforeach(plugin)
146         list(APPEND uiugens UIUGens_supernova)
148         add_library(FFT_UGens_supernova MODULE
149                                 FFTInterfaceTable.cpp
150                                 FFT_UGens.cpp
151                                 PV_UGens.cpp
152                                 PartitionedConvolution.cpp
153                                 ${scplugin_common_sources}
154                                 )
156         add_library(PV_ThirdParty_supernova MODULE
157                                 Convolution.cpp
158                                 FFT2InterfaceTable.cpp
159                                 FeatureDetection.cpp
160                                 PV_ThirdParty.cpp
161                                 ${scplugin_common_sources}
162                                 )
164         add_library(ML_UGens_supernova MODULE
165                                 ML.cpp
166                                 Loudness.cpp
167                                 BeatTrack.cpp
168                                 Onsets.cpp
169                                 onsetsds.c
170                                 KeyTrack.cpp
171                                 MFCC.cpp
172                                 BeatTrack2.cpp
173                                 ML_SpecStats.cpp
174                                 ${scplugin_common_sources}
175                                 )
177         set_property(TARGET FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova
178                                 APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
180         list(APPEND fft_ugens FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova)
181         list(APPEND supernova_plugins FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova)
183         if(NOT NO_LIBSNDFILE)
184                 add_library(DiskIO_UGens_supernova MODULE
185                                 DiskIO_UGens.cpp)
186                 set_property(TARGET DiskIO_UGens_supernova
187                                         APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
189                 if(SNDFILE_FOUND)
190                         include_directories(${SNDFILE_INCLUDE_DIR})
191                         target_link_libraries(DiskIO_UGens_supernova ${SNDFILE_LIBRARIES} ${MATH_LIBRARY} ${PTHREADS_LIBRARY})
192                         list(APPEND supernova_plugins DiskIO_UGens_supernova)
193                 else()
194                         message(SEND_ERROR "Cannot find libsndfile")
195                 endif(SNDFILE_FOUND)
196         endif()
197 endif(SUPERNOVA)
199 foreach(ugen ${fft_ugens})
200         target_link_libraries(${ugen} ${MATH_LIBRARY})
202         if (APPLE)
203                 target_link_libraries(${ugen} "-framework vecLib")
204         endif()
205 endforeach()
207 foreach (ugen ${uiugens})
208     target_link_libraries(${ugen} ${PTHREADS_LIBRARY})
209 endforeach()
211 foreach (plugin ${plugins})
212     if (WIN32)
213         target_link_libraries(${plugin} wsock32 ws2_32)
214     endif()
215 endforeach()
217 foreach (plugin ${supernova_plugins})
218     if (WIN32)
219         target_link_libraries(${plugin} ws2_32)
220     endif()
221 endforeach()
223 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
224         find_package(X11 REQUIRED)
226         if (NOT X11_Xt_FOUND)
227                 message(FATAL_ERROR "libxt not found")
228         endif()
230         include_directories(X11_Xt_INCLUDE_PATH)
232         foreach (ugen ${uiugens})
233                 target_link_libraries(${ugen} ${X11_X11_LIB})
234         endforeach()
235 elseif (APPLE)
236         foreach (ugen ${uiugens})
237                 target_link_libraries(${ugen} "-framework CoreServices -framework Carbon")
238         endforeach()
240         if(NOT NO_LIBSNDFILE)
241                 target_link_libraries(DiskIO_UGens "-framework CoreServices")
242         endif()
244         add_definitions("-DSC_DARWIN")
245 endif()
247 if (APPLE)
248         # determines the app name and app install location (scappbundlename, scappdir):
249         include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
251         install(TARGETS ${plugins}
252                         DESTINATION "${scappauxresourcesdir}/plugins"
253                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
255 elseif (WIN32)
256         install(TARGETS ${plugins}
257                         DESTINATION "SuperCollider/plugins"
258                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
259 else()
260         install(TARGETS ${plugins}
261                         DESTINATION "lib/SuperCollider/plugins"
262                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
264         if (SUPERNOVA)
265                 install(TARGETS ${supernova_plugins}
266                         DESTINATION "lib/supernova/plugins"
267                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
268         endif()
269 endif()