FFT: Prevent user from attempting hops smaller than SC's block size
[supercollider.git] / server / supernova / CMakeLists.txt
blobf9723906fe6318610be7bab0df76e8714461d2b2
1 if(NOT APPLE)
2     find_package(FFTW3f)
4     if (FFTW3F_FOUND)
5         add_definitions("-DSC_FFT_FFTW")
6         include_directories (${FFTW3F_INCLUDE_DIR})
7     else()
8         message(SEND_ERROR "Cannot find libfftw3f")
9     endif()
11 endif()
13 if(CMAKE_COMPILER_IS_GNUCXX)
14   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-4096")
15   set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
17   if(APPLE)
18     if (CMAKE_SIZEOF_VOID_P MATCHES "4")
19       # cmpxchg8b is available on all intel apples
20       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686 -msse -msse2 -mfpmath=sse")
21     endif()
22   endif()
23 endif(CMAKE_COMPILER_IS_GNUCXX)
25 if(MEMORY_DEBUGGING)
26     set_property(DIRECTORY .
27                  APPEND
28                  PROPERTY COMPILE_DEFINITIONS_DEBUG NOVA_MEMORY_DEBUGGING)
29 endif()
33 include_directories(${CMAKE_SOURCE_DIR}/external_libraries/boost_endian
34                     ${CMAKE_SOURCE_DIR}/external_libraries/oscpack
35                     ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src
36                     )
38 if(APPLE)
39     include_directories(${CMAKE_SOURCE_DIR}/external_libraries/libsndfile)
40 endif()
42 include_directories(${CMAKE_SOURCE_DIR}/include/plugin_interface
43                     ${CMAKE_SOURCE_DIR}/include/server
44                     ${CMAKE_SOURCE_DIR}/include/common
45                     .
46                     )
48 set(libsupernova_src
49     sc/sc_synth_prototype.cpp
50     sc/sc_osc_handler.cpp
51     sc/sc_plugin_interface.cpp
52     sc/sc_synth.cpp
53     sc/sc_synthdef.cpp
54     sc/sc_ugen_factory.cpp
55     ../scsynth/Samp.cpp
56     ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
57     ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
58     ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
59     server/buffer_manager.cpp
60     server/dsp_context.cpp
61     server/memory_pool.cpp
62     server/node_graph.cpp
63     server/server.cpp
64     server/server_args.cpp
67 file(GLOB_RECURSE supernova_headers *hpp)
69 if(COMPACT_BUILD)
70   CREATE_FINAL_FILE(libsupernova_final.cpp ${libsupernova_src})
71   add_library (libsupernova STATIC libsupernova_final.cpp)
72 else()
73   add_library (libsupernova STATIC ${libsupernova_src})
74 endif()
76 set_property(TARGET libsupernova
77              PROPERTY OUTPUT_NAME supernova)
79 add_executable(supernova server/main.cpp ${supernova_headers})
81 set_property(TARGET libsupernova supernova
82              APPEND
83              PROPERTY COMPILE_DEFINITIONS SUPERNOVA)
85 find_library(DL NAMES dl)
86 if (DL)
87     set_property(TARGET libsupernova
88                  APPEND
89                  PROPERTY COMPILE_DEFINITIONS DLOPEN)
90     target_link_libraries(libsupernova ${DL})
91 endif()
93 if (WIN32 OR APPLE)
94     find_package(Portaudio)
95     if(NOT PORTAUDIO_FOUND)
96         message(FATAL_ERROR "Portaudio missing")
97     endif()
98     add_definitions(-DPORTAUDIO_BACKEND ${PORTAUDIO_DEFINITIONS})
99     include_directories(${PORTAUDIO_INCLUDE_DIRS})
100     target_link_libraries(libsupernova ${PORTAUDIO_LIBRARIES})
101 else()
102     find_library(JACK NAMES jack)
103     if (JACK)
104         set_property(TARGET libsupernova supernova
105                     APPEND
106                     PROPERTY COMPILE_DEFINITIONS JACK_BACKEND)
107         target_link_libraries(libsupernova ${JACK})
108         include_directories(${JACK_INCLUDE_DIRS})
109     endif()
110 endif()
112 find_package(Sndfile)
113 if (NOT SNDFILE_FOUND)
114     message(SEND_ERROR "Cannot find libsndfile")
115 else()
116     target_link_libraries(libsupernova ${SNDFILE_LIBRARIES})
117     include_directories(${SNDFILE_INCLUDE_DIR})
118 endif()
120 if (FFTW3F_FOUND)
121         target_link_libraries(libsupernova ${FFTW3F_LIBRARY})
122 endif()
124 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
125     target_link_libraries(libsupernova rt)
126 endif()
128 target_link_libraries(libsupernova oscpack tlsf ${PTHREADS_LIBRARIES})
130 if (Boost_FOUND)
131     target_link_libraries(libsupernova ${Boost_THREAD_LIBRARY}  ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
132 else()
133     target_link_libraries(libsupernova boost_thread boost_system boost_filesystem boost_program_options)
134 endif()
136 target_link_libraries(supernova libsupernova)
138 if(APPLE)
139         # determines the app name and app install location (scappbundlename, scappdir):
140         include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
142         install(TARGETS supernova
143                         DESTINATION ${scappauxresourcesdir}
144                         PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE)
145 else()
147 install(TARGETS supernova
148         DESTINATION "bin"
149         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
150 endif()
152 if(LTO)
153     set_property(TARGET supernova libsupernova
154                  APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report")
156     set_property(TARGET supernova libsupernova
157                  APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
158 endif()
160 if (APPLE)
161     target_link_libraries(libsupernova "-framework vecLib")
162     target_link_libraries(libsupernova "-framework CoreAudio -framework CoreServices")
163 endif()