3 find_package(Portaudio)
6 # here we choose who provides us with the FFT lib
8 add_definitions("-DSC_FFT_GREEN")
10 add_definitions("-DSC_FFT_VDSP")
15 add_definitions("-DSC_FFT_FFTW")
17 message(SEND_ERROR "Cannot find libfftw3f")
25 add_definitions(-DUSE_RENDEZVOUS=1)
29 add_definitions(-DUSE_RENDEZVOUS=1)
33 # Here we work out which audio API to use, from system type and/or user option.
34 string(TOLOWER "$ENV{AUDIOAPI}" AUDIOAPI)
35 if(AUDIOAPI STREQUAL "")
37 set(AUDIOAPI coreaudio)
39 set(AUDIOAPI portaudio)
45 if(NOT AUDIOAPI MATCHES "^(jack|coreaudio|portaudio)$")
46 message(WARNING "Unrecognised audio API: ${AUDIOAPI}")
49 if(AUDIOAPI STREQUAL jack)
52 message(FATAL_ERROR "Jack selected as audio API, but development files not found")
54 elseif(AUDIOAPI STREQUAL portaudio)
55 find_package(Portaudio)
56 if(NOT PORTAUDIO_FOUND)
57 message(FATAL_ERROR "Portaudio selected as audio API, but development files not found")
60 message(STATUS "Audio API: ${AUDIOAPI}")
78 SC_SequencedCommand.cpp
85 ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
86 ${CMAKE_SOURCE_DIR}/common/SC_AllocPool.cpp
87 ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
88 ${CMAKE_SOURCE_DIR}/common/SC_Sem.cpp
89 ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
90 ${CMAKE_SOURCE_DIR}/common/SC_StringBuffer.cpp
91 ${CMAKE_SOURCE_DIR}/common/SC_StringParser.cpp
92 ${CMAKE_SOURCE_DIR}/common/scsynthsend.cpp
93 ${CMAKE_SOURCE_DIR}/common/sc_popen.cpp
95 ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src/tlsf.c
99 list(APPEND scsynth_sources ${CMAKE_SOURCE_DIR}/common/SC_Win32Utils.cpp)
103 list(APPEND scsynth_sources ../../common/fftlib.c)
107 include_directories (${FFTW3F_INCLUDE_DIR})
111 include_directories(${CMAKE_SOURCE_DIR}/include/common
112 ${CMAKE_SOURCE_DIR}/common
113 ${CMAKE_SOURCE_DIR}/include/server
114 ${CMAKE_SOURCE_DIR}/include/plugin_interface)
116 include_directories (${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src)
118 set_property(DIRECTORY
120 PROPERTY COMPILE_DEFINITIONS SC_MEMORY_ALIGNMENT=32)
122 if (AUDIOAPI STREQUAL jack)
123 list(APPEND scsynth_sources SC_Jack.cpp)
124 add_definitions("-DSC_AUDIO_API=SC_AUDIO_API_JACK" ${JACK_DEFINITIONS})
125 include_directories(${JACK_INCLUDE_DIRS})
126 elseif (AUDIOAPI STREQUAL portaudio)
127 add_definitions("-DSC_AUDIO_API=SC_AUDIO_API_PORTAUDIO" ${PORTAUDIO_DEFINITIONS})
128 include_directories(${PORTAUDIO_INCLUDE_DIRS})
131 set (FINAL_BUILD 0) # disable final build for scsynth
134 CREATE_FINAL_FILE(libscsynth_final.cpp ${scsynth_sources})
135 add_library(libscsynth SHARED libscsynth_final.cpp)
137 add_library(libscsynth SHARED ${scsynth_sources})
140 set_property(TARGET libscsynth
142 PROPERTY COMPILE_DEFINITIONS BUILDING_SUPERCOLLIDER)
144 find_library(DL NAMES dl)
146 target_link_libraries(libscsynth ${DL})
150 add_definitions("-DHAVE_AVAHI=1")
151 include_directories(${AVAHI_INCLUDE_DIRS})
152 target_link_libraries(libscsynth ${AVAHI_LIBRARIES})
156 include_directories(${SNDFILE_INCLUDE_DIR})
157 target_link_libraries(libscsynth ${SNDFILE_LIBRARIES})
158 elseif(NOT NO_LIBSNDFILE)
159 message(SEND_ERROR "Cannot find libsndfile")
162 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
163 add_definitions(-DSC_PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/lib/SuperCollider/plugins")
166 if (AUDIOAPI STREQUAL jack)
167 target_link_libraries(libscsynth ${JACK_LIBRARIES})
168 elseif(AUDIOAPI STREQUAL portaudio)
169 target_link_libraries(libscsynth ${PORTAUDIO_LIBRARIES})
170 elseif(AUDIOAPI STREQUAL coreaudio)
171 target_link_libraries(libscsynth "-framework CoreAudio")
175 target_link_libraries(libscsynth ${PTHREADS_LIBRARIES})
180 target_link_libraries(libscsynth wsock32 ws2_32)
184 set_property(TARGET libscsynth PROPERTY OUTPUT_NAME scsynth)
185 # These two properties are ABI version info, not sc version:
186 set_property(TARGET libscsynth PROPERTY VERSION 1.0.0)
187 set_property(TARGET libscsynth PROPERTY SOVERSION 1)
191 target_link_libraries(libscsynth ${FFTW3F_LIBRARY})
195 target_link_libraries(libscsynth "-framework vecLib -framework CoreServices")
198 add_executable(scsynth scsynth_main.cpp)
199 target_link_libraries(scsynth libscsynth ${PTHREADS_LIBRARY})
202 set_property(TARGET scsynth libscsynth
203 APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report")
205 set_property(TARGET scsynth libscsynth
206 APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
209 #TODO allow apple users to install to fhs-ish path if INSTALL_FHS option is enabled
212 # determines the app name and app install location (scappbundlename, scappdir):
213 include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
215 install(TARGETS libscsynth scsynth
216 DESTINATION ${scappauxresourcesdir}
217 RUNTIME DESTINATION ${scappauxresourcesdir}
218 PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE
221 install(TARGETS libscsynth scsynth
222 DESTINATION "SuperCollider"
223 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
225 install(TARGETS libscsynth scsynth
226 LIBRARY DESTINATION "lib"
227 RUNTIME DESTINATION "bin"
228 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)