bumping version to 3.5-rc1
[supercollider.git] / server / supernova / CMakeLists.txt
blobec340ecf5fb65d943e3fb786b49b7feb5026e63b
1 find_package(FFTW3f)
3 if (FFTW3F_FOUND)
4   add_definitions("-DSC_FFT_FFTW")
5   include_directories (${FFTW3F_INCLUDE_DIR})
6 else()
7   message(SEND_ERROR "Cannot find libfftw3f")
8 endif()
10 if(CMAKE_COMPILER_IS_GNUCXX)
11   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-4096")
12   set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
14   if(APPLE)
15     if (CMAKE_SIZEOF_VOID_P MATCHES "4")
16       # cmpxchg8b is available on all intel apples
17       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686 -msse -msse2 -mfpmath=sse")
18     endif()
19   endif()
20 endif(CMAKE_COMPILER_IS_GNUCXX)
22 if(MEMORY_DEBUGGING)
23     set_property(DIRECTORY .
24                  APPEND
25                  PROPERTY COMPILE_DEFINITIONS_DEBUG NOVA_MEMORY_DEBUGGING)
26 endif()
30 include_directories(${CMAKE_SOURCE_DIR}/external_libraries/boost_endian
31                     ${CMAKE_SOURCE_DIR}/external_libraries/boost_move
32                     ${CMAKE_SOURCE_DIR}/external_libraries/oscpack
33                     ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src
34                     )
37 include_directories(${CMAKE_SOURCE_DIR}/include/plugin_interface
38                     ${CMAKE_SOURCE_DIR}/include/server
39                     ${CMAKE_SOURCE_DIR}/include/common
40                     .
41                     )
43 set(libsupernova_src
44     sc/sc_synth_prototype.cpp
45     sc/sc_osc_handler.cpp
46     sc/sc_plugin_interface.cpp
47     sc/sc_synth.cpp
48     sc/sc_synthdef.cpp
49     sc/sc_ugen_factory.cpp
50     ../scsynth/Samp.cpp
51     ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
52     ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
53     ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
54     server/buffer_manager.cpp
55     server/dsp_context.cpp
56     server/memory_pool.cpp
57     server/node_graph.cpp
58     server/server.cpp
59     server/server_args.cpp
62 if(COMPACT_BUILD)
63   CREATE_FINAL_FILE(libsupernova_final.cpp ${libsupernova_src})
64   add_library (libsupernova STATIC libsupernova_final.cpp)
65 else()
66   add_library (libsupernova STATIC ${libsupernova_src})
67 endif()
69 set_property(TARGET libsupernova
70              PROPERTY OUTPUT_NAME supernova)
72 add_executable(supernova server/main.cpp)
74 set_property(TARGET libsupernova supernova
75              APPEND
76              PROPERTY COMPILE_DEFINITIONS SUPERNOVA)
78 find_library(DL NAMES dl)
79 if (DL)
80     set_property(TARGET libsupernova
81                  APPEND
82                  PROPERTY COMPILE_DEFINITIONS DLOPEN)
83     target_link_libraries(libsupernova ${DL})
84 endif()
86 find_library(JACK NAMES jack)
87 if (JACK)
88     set_property(TARGET libsupernova supernova
89                  APPEND
90                  PROPERTY COMPILE_DEFINITIONS JACK_BACKEND)
91     target_link_libraries(libsupernova ${JACK})
92 endif()
94 find_library(SNDFILE NAMES sndfile)
95 if (NOT SNDFILE)
96     message(SEND_ERROR "Cannot find libsndfile")
97 else()
98     target_link_libraries(libsupernova ${SNDFILE})
99 endif()
101 if (FFTW3F_FOUND)
102         target_link_libraries(libsupernova ${FFTW3F_LIBRARY})
103 endif()
105 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
106     target_link_libraries(libsupernova rt)
107 endif()
109 target_link_libraries(libsupernova oscpack tlsf boost_thread boost_system boost_filesystem boost_program_options ${PTHREADS_LIBRARIES})
110 target_link_libraries(supernova libsupernova)
112 if(APPLE)
113         # determines the app name and app install location (scappbundlename, scappdir):
114         include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
116         install(TARGETS supernova
117                         DESTINATION ${scappauxresourcesdir}
118                         PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE)
119 else()
121 install(TARGETS supernova
122         DESTINATION "bin"
123         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
124 endif()
126 if(LTO)
127     set_property(TARGET supernova libsupernova
128                  APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report")
130     set_property(TARGET supernova libsupernova
131                  APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
132 endif()
134 if (APPLE)
135     target_link_libraries(supernova "-framework vecLib")
136     target_link_libraries(supernova "-framework CoreAudio -framework CoreServices")
137 endif()