class library: SynthDef - replaceUGen fixes
[supercollider.git] / server / plugins / CMakeLists.txt
blobfd7ef94a08154e23910a05bb0f7bed5fff476722
2 if(NOT NO_LIBSNDFILE)
3         find_package(Sndfile)
4 endif()
6 include_directories(${CMAKE_SOURCE_DIR}/include/common
7                     ${CMAKE_SOURCE_DIR}/include/plugin_interface)
9 if (NOVA_SIMD)
10         include_directories(${CMAKE_SOURCE_DIR}/external_libraries/nova-simd)
11         add_definitions("-DNOVA_SIMD")
12 endif()
14 # large file support
15 if (CMAKE_SIZEOF_VOID_P MATCHES "4")
16         execute_process(COMMAND getconf LFS_CFLAGS
17                 OUTPUT_VARIABLE LFS_CFLAGS
18                 ERROR_QUIET
19                 OUTPUT_STRIP_TRAILING_WHITESPACE)
20 elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
21         execute_process(COMMAND getconf LFS64_CFLAGS
22                 OUTPUT_VARIABLE LFS_CFLAGS
23                 ERROR_QUIET
24                 OUTPUT_STRIP_TRAILING_WHITESPACE)
25 endif()
27 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LFS_CFLAGS}")
29 set(plugin_sources
30         BinaryOpUGens.cpp
31         ChaosUGens.cpp
32         DelayUGens.cpp
33         DemandUGens.cpp
34         DynNoiseUGens.cpp
35         FilterUGens.cpp
36         GendynUGens.cpp
37         GrainUGens.cpp
38         IOUGens.cpp
39         LFUGens.cpp
40         MulAddUGens.cpp
41         NoiseUGens.cpp
42         OscUGens.cpp
43         PanUGens.cpp
44         PhysicalModelingUGens.cpp
45         ReverbUGens.cpp
46         TestUGens.cpp
47         TriggerUGens.cpp
48         UnaryOpUGens.cpp
49         UnpackFFTUGens.cpp
51         KeyboardUGens.cpp
52         MouseUGens.cpp
55 set(plugins "")
56 set(supernova_plugins "")
58 set(CMAKE_SHARED_MODULE_PREFIX "")
59 if(APPLE OR WIN32)
60         set(CMAKE_SHARED_MODULE_SUFFIX ".scx")
61 endif()
63 if (${CMAKE_COMPILER_IS_GNUCXX})
64         add_definitions(-fno-finite-math-only)
65         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
66         if(NOT WIN32)
67                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
68         endif()
69 endif()
71 foreach(plugin ${plugin_sources})
72         string(REPLACE .cpp "" plugin_name ${plugin} )
73                 add_library(${plugin_name} MODULE ${plugin})
74         list(APPEND plugins ${plugin_name})
75 endforeach(plugin)
77 set(uiugens MouseUGens KeyboardUGens)
79 if (WIN32)
80     if(MSVC)
81         include_directories (../../platform/windows/compat_stuff) # for stdbool.h
82     endif()
83 endif()
85 add_library(FFT_UGens MODULE
86                         FFTInterfaceTable.cpp
87                         FFT_UGens.cpp
88                         PV_UGens.cpp
89                         PartitionedConvolution.cpp
90                         ${scplugin_common_sources}
91                         )
93 add_library(PV_ThirdParty MODULE
94                         Convolution.cpp
95                         FFT2InterfaceTable.cpp
96                         FeatureDetection.cpp
97                         PV_ThirdParty.cpp
98                         ${scplugin_common_sources}
99                         )
101 add_library(ML_UGens MODULE
102                         ML.cpp
103                         Loudness.cpp
104                         BeatTrack.cpp
105                         Onsets.cpp
106                         onsetsds.c
107                         KeyTrack.cpp
108                         MFCC.cpp
109                         BeatTrack2.cpp
110                         ML_SpecStats.cpp
111                         ${scplugin_common_sources}
112                         )
114 if(NOT NO_LIBSNDFILE)
115         set(diskio_sources DiskIO_UGens.cpp)
117         add_library(DiskIO_UGens MODULE ${diskio_sources})
119         if(SNDFILE_FOUND)
120                 include_directories(${SNDFILE_INCLUDE_DIR})
121                 target_link_libraries(DiskIO_UGens ${SNDFILE_LIBRARIES} ${MATH_LIBRARY} ${PTHREADS_LIBRARY})
123                 list(APPEND plugins DiskIO_UGens)
124         else()
125                 message(SEND_ERROR "Cannot find libsndfile")
126         endif(SNDFILE_FOUND)
127 endif()
129 set(fft_ugens FFT_UGens PV_ThirdParty ML_UGens)
130 list(APPEND plugins FFT_UGens PV_ThirdParty ML_UGens)
132 if (FFTW3F_FOUND)
133         include_directories (${FFTW3F_INCLUDE_DIR})
134 endif()
136 if (SUPERNOVA)
137         foreach(plugin ${plugin_sources})
138                 string(REPLACE .cpp "_supernova" plugin_name ${plugin} )
139                 add_library(${plugin_name} MODULE ${plugin})
140                 list(APPEND supernova_plugins ${plugin_name})
141                 set_property(TARGET ${plugin_name}
142                     APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
143         endforeach(plugin)
145         list(APPEND uiugens KeyboardUGens_supernova MouseUGens_supernova)
147         add_library(FFT_UGens_supernova MODULE
148                                 FFTInterfaceTable.cpp
149                                 FFT_UGens.cpp
150                                 PV_UGens.cpp
151                                 PartitionedConvolution.cpp
152                                 ${scplugin_common_sources}
153                                 )
155         add_library(PV_ThirdParty_supernova MODULE
156                                 Convolution.cpp
157                                 FFT2InterfaceTable.cpp
158                                 FeatureDetection.cpp
159                                 PV_ThirdParty.cpp
160                                 ${scplugin_common_sources}
161                                 )
163         add_library(ML_UGens_supernova MODULE
164                                 ML.cpp
165                                 Loudness.cpp
166                                 BeatTrack.cpp
167                                 Onsets.cpp
168                                 onsetsds.c
169                                 KeyTrack.cpp
170                                 MFCC.cpp
171                                 BeatTrack2.cpp
172                                 ML_SpecStats.cpp
173                                 ${scplugin_common_sources}
174                                 )
176         set_property(TARGET FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova
177                                 APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
179         list(APPEND fft_ugens FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova)
180         list(APPEND supernova_plugins FFT_UGens_supernova PV_ThirdParty_supernova ML_UGens_supernova)
182         if(NOT NO_LIBSNDFILE)
183                 add_library(DiskIO_UGens_supernova MODULE
184                                 DiskIO_UGens.cpp)
185                 set_property(TARGET DiskIO_UGens_supernova
186                                         APPEND PROPERTY COMPILE_DEFINITIONS  "SUPERNOVA")
188                 if(SNDFILE_FOUND)
189                         include_directories(${SNDFILE_INCLUDE_DIR})
190                         target_link_libraries(DiskIO_UGens_supernova ${SNDFILE_LIBRARIES} ${MATH_LIBRARY} ${PTHREADS_LIBRARY})
191                         list(APPEND supernova_plugins DiskIO_UGens_supernova)
192                 else()
193                         message(SEND_ERROR "Cannot find libsndfile")
194                 endif(SNDFILE_FOUND)
195         endif()
196 endif(SUPERNOVA)
198 foreach(ugen ${fft_ugens})
199         target_link_libraries(${ugen} ${MATH_LIBRARY})
201         if (APPLE)
202                 target_link_libraries(${ugen} "-framework vecLib")
203         endif()
204 endforeach()
206 foreach (ugen ${uiugens})
207     target_link_libraries(${ugen} ${PTHREADS_LIBRARY})
208 endforeach()
210 foreach (plugin ${plugins})
211     if (WIN32)
212         target_link_libraries(${plugin} wsock32 ws2_32)
213     endif()
214 endforeach()
217 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
218         find_package(X11 REQUIRED)
220         if (NOT X11_Xt_FOUND)
221                 message(FATAL_ERROR "libxt not found")
222         endif()
224         include_directories(X11_Xt_INCLUDE_PATH)
226         foreach (ugen ${uiugens})
227                 target_link_libraries(${ugen} ${X11_X11_LIB})
228         endforeach()
229 elseif (APPLE)
230         foreach (ugen ${uiugens})
231                 target_link_libraries(${ugen} "-framework CoreServices -framework Carbon")
232         endforeach()
234         if(NOT NO_LIBSNDFILE)
235                 target_link_libraries(DiskIO_UGens "-framework CoreServices")
236         endif()
238         add_definitions("-DSC_DARWIN")
239 endif()
241 if (APPLE)
242         # determines the app name and app install location (scappbundlename, scappdir):
243         include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
245         install(TARGETS ${plugins}
246                         DESTINATION "${scappauxresourcesdir}/plugins"
247                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
249 elseif (WIN32)
250         install(TARGETS ${plugins}
251                         DESTINATION "SuperCollider/plugins"
252                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
253 else()
254         install(TARGETS ${plugins}
255                         DESTINATION "lib/SuperCollider/plugins"
256                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
258         if (SUPERNOVA)
259                 install(TARGETS ${supernova_plugins}
260                         DESTINATION "lib/supernova/plugins"
261                         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
262         endif()
263 endif()