clean up indentation and spacing
[supercollider.git] / server / supernova / CMakeLists.txt
blob3dda4d0e961f6b6c717459c17cc370af53750f3a
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/boost_move
35                     ${CMAKE_SOURCE_DIR}/external_libraries/oscpack
36                     ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src
37                     )
39 if(APPLE)
40     include_directories(${CMAKE_SOURCE_DIR}/external_libraries/libsndfile)
41 endif()
43 include_directories(${CMAKE_SOURCE_DIR}/include/plugin_interface
44                     ${CMAKE_SOURCE_DIR}/include/server
45                     ${CMAKE_SOURCE_DIR}/include/common
46                     .
47                     )
49 set(libsupernova_src
50     sc/sc_synth_prototype.cpp
51     sc/sc_osc_handler.cpp
52     sc/sc_plugin_interface.cpp
53     sc/sc_synth.cpp
54     sc/sc_synthdef.cpp
55     sc/sc_ugen_factory.cpp
56     ../scsynth/Samp.cpp
57     ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
58     ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
59     ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
60     server/buffer_manager.cpp
61     server/dsp_context.cpp
62     server/memory_pool.cpp
63     server/node_graph.cpp
64     server/server.cpp
65     server/server_args.cpp
68 if(COMPACT_BUILD)
69   CREATE_FINAL_FILE(libsupernova_final.cpp ${libsupernova_src})
70   add_library (libsupernova STATIC libsupernova_final.cpp)
71 else()
72   add_library (libsupernova STATIC ${libsupernova_src})
73 endif()
75 set_property(TARGET libsupernova
76              PROPERTY OUTPUT_NAME supernova)
78 add_executable(supernova server/main.cpp)
80 set_property(TARGET libsupernova supernova
81              APPEND
82              PROPERTY COMPILE_DEFINITIONS SUPERNOVA)
84 find_library(DL NAMES dl)
85 if (DL)
86     set_property(TARGET libsupernova
87                  APPEND
88                  PROPERTY COMPILE_DEFINITIONS DLOPEN)
89     target_link_libraries(libsupernova ${DL})
90 endif()
92 if (WIN32 OR APPLE)
93     find_package(Portaudio)
94     if(NOT PORTAUDIO_FOUND)
95         message(FATAL_ERROR "Portaudio missing")
96     endif()
97     add_definitions(-DPORTAUDIO_BACKEND ${PORTAUDIO_DEFINITIONS})
98     include_directories(${PORTAUDIO_INCLUDE_DIRS})
99     target_link_libraries(libsupernova ${PORTAUDIO_LIBRARIES})
100 else()
101     find_library(JACK NAMES jack)
102     if (JACK)
103         set_property(TARGET libsupernova supernova
104                     APPEND
105                     PROPERTY COMPILE_DEFINITIONS JACK_BACKEND)
106         target_link_libraries(libsupernova ${JACK})
107         include_directories(${JACK_INCLUDE_DIRS})
108     endif()
109 endif()
111 find_package(Sndfile)
112 if (NOT SNDFILE_FOUND)
113     message(SEND_ERROR "Cannot find libsndfile")
114 else()
115     target_link_libraries(libsupernova ${SNDFILE_LIBRARIES})
116     include_directories(${SNDFILE_INCLUDE_DIR})
117 endif()
119 if (FFTW3F_FOUND)
120         target_link_libraries(libsupernova ${FFTW3F_LIBRARY})
121 endif()
123 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
124     target_link_libraries(libsupernova rt)
125 endif()
127 target_link_libraries(libsupernova oscpack tlsf boost_thread boost_system boost_filesystem boost_program_options ${PTHREADS_LIBRARIES})
128 target_link_libraries(supernova libsupernova)
130 if(APPLE)
131         # determines the app name and app install location (scappbundlename, scappdir):
132         include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
134         install(TARGETS supernova
135                         DESTINATION ${scappauxresourcesdir}
136                         PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE)
137 else()
139 install(TARGETS supernova
140         DESTINATION "bin"
141         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
142 endif()
144 if(LTO)
145     set_property(TARGET supernova libsupernova
146                  APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report")
148     set_property(TARGET supernova libsupernova
149                  APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
150 endif()
152 if (APPLE)
153     target_link_libraries(supernova "-framework vecLib")
154     target_link_libraries(supernova "-framework CoreAudio -framework CoreServices")
155 endif()