sclang: remove obsolete cruft
[supercollider.git] / platform / mac / CMakeLists.txt
blob8f5fd9861e34fb81889cec72ac4a3fbabec90339
1 if(NOT APPLE)
2         message(SEND_ERROR "mac folder invoked by cmake, but not APPLE platform")
3 endif()
5 # determines the app name and app install location (scappbundlename, scappdir):
6 include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
8 # On OSX, everything is installed in a folder named after ${scappbundlename},
9 # which defaults to "SuperCollider". The folder is installed under ${CMAKE_INSTALL_PREFIX},
10 # which defaults to <build directory>/Install/
11 # This means the app will go in <build dir>/Install/SuperCollider/SuperCollider.app
12 # Class lib and similar goes into .app/Contents/Resources, as well as the external sclang and scsynth binaries.
13 # The contents of the install prefix folder will be packaged to a DMG with "make package"
15 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
16         set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE PATH "Install path prefix" FORCE)
17 endif()
18 message(STATUS "Install prefix ${CMAKE_INSTALL_PREFIX}")
20 include_directories(
21         ${CMAKE_SOURCE_DIR}/lang/LangSource/Bison
22         ${CMAKE_SOURCE_DIR}/include/common
23         ${CMAKE_SOURCE_DIR}/include/lang
24         ${CMAKE_SOURCE_DIR}/include/plugin_interface
25         ${CMAKE_SOURCE_DIR}/include/server
26         ${CMAKE_SOURCE_DIR}/common
27         ${CMAKE_SOURCE_DIR}/editors/scapp/include
28         ${CMAKE_SOURCE_DIR}/editors/scapp/include/SMLAdvancedFind
29         ${CMAKE_SOURCE_DIR}/editors/scapp/include/SMLAdvancedFind/ICU
30         ${CMAKE_SOURCE_DIR}/external_libraries/icu/
31         ${CMAKE_SOURCE_DIR}/external_libraries/icu/unicode/
32         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}
33         ${CMAKE_SOURCE_DIR}/external_libraries/boost-lockfree
34         ${CMAKE_SOURCE_DIR}/external_libraries/boost
35         ${CMAKE_SOURCE_DIR}/external_libraries/threadpool
36         ${CMAKE_SOURCE_DIR}/external_libraries/yaml-cpp-0.3.0/include
37         ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src
38         )
40 find_package(Sndfile)
42 set(scapp_sources
43         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Wii.cpp
44         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSignalPrim.cpp
45         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSched.cpp
46         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrPrimitive.cpp
47         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrMathPrim.cpp
48         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_ComPort.cpp
49         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/OSCData.cpp
50         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrArchiver.cpp
51         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrArrayPrimitives.cpp
52         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrBitPrim.cpp
53         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrCharPrim.cpp
54         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrFilePrim.cpp
55         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrListPrim.cpp
56         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrPlatformPrim.cpp
57         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSerialPrim.cpp
58         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrStringPrim.cpp
59         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSymbolPrim.cpp
60         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrUnixPrim.cpp
61         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Speech.M
62         ${CMAKE_SOURCE_DIR}/lang/LangSource/AdvancingAllocPool.cpp
63         ${CMAKE_SOURCE_DIR}/lang/LangSource/ByteCodeArray.cpp
64         ${CMAKE_SOURCE_DIR}/lang/LangSource/DumpParseNode.cpp
65         ${CMAKE_SOURCE_DIR}/lang/LangSource/GC.cpp
66         ${CMAKE_SOURCE_DIR}/lang/LangSource/InitAlloc.cpp
67         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrInterpreter3.cpp
68         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrLexer.cpp
69         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMathOps.cpp
70         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMathSupport.cpp
71         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMessage.cpp
72         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrObject.cpp
73         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrParseNode.cpp
74         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrSignal.cpp
75         ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrSymbolTable.cpp
76         ${CMAKE_SOURCE_DIR}/lang/LangSource/SC_LibraryConfig.cpp
77         ${CMAKE_SOURCE_DIR}/lang/LangSource/Samp.cpp
78         ${CMAKE_SOURCE_DIR}/lang/LangSource/SimpleStack.cpp
79         ${CMAKE_SOURCE_DIR}/lang/LangSource/VMGlobals.cpp
80         ${CMAKE_SOURCE_DIR}/lang/LangSource/dumpByteCodes.cpp
81         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/WiiMote_OSX/wiiremote.c
82         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_HID.cpp
83         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Utilities.c
84         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Name_Lookup.c
85         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Queue_Utilities.c
86         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Error_Handler.c
87         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_CoreMIDI.cpp
88         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_CoreAudioPrim.cpp
90         ${CMAKE_SOURCE_DIR}/common/fftlib.c
91         ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
92         ${CMAKE_SOURCE_DIR}/common/SC_AllocPool.cpp
93         ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
94         ${CMAKE_SOURCE_DIR}/common/SC_Sem.cpp
95         ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
96         ${CMAKE_SOURCE_DIR}/common/SC_StringBuffer.cpp
97         ${CMAKE_SOURCE_DIR}/common/SC_StringParser.cpp
98         ${CMAKE_SOURCE_DIR}/common/SC_TextUtils.cpp
100         ${CMAKE_SOURCE_DIR}/common/scsynthsend.cpp
101         ${CMAKE_SOURCE_DIR}/common/sc_popen.cpp
103         ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaBridgePrimitives.M
104         ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaFilePrimitives.M
105         ${CMAKE_SOURCE_DIR}/editors/scapp/DrawBackground.M
106         ${CMAKE_SOURCE_DIR}/editors/scapp/GUIPrimitives.M
107         ${CMAKE_SOURCE_DIR}/editors/scapp/GetStringFromUser.m
108         ${CMAKE_SOURCE_DIR}/editors/scapp/GoToPanel.M
109         ${CMAKE_SOURCE_DIR}/editors/scapp/HTMLRenderer.m
110         ${CMAKE_SOURCE_DIR}/editors/scapp/MyDocument.M
111         ${CMAKE_SOURCE_DIR}/editors/scapp/RendezvousClient.M
112         ${CMAKE_SOURCE_DIR}/editors/scapp/SCCocoaView.M
113         ${CMAKE_SOURCE_DIR}/editors/scapp/SCDialog.mm
114         ${CMAKE_SOURCE_DIR}/editors/scapp/SCGraphView.M
115         ${CMAKE_SOURCE_DIR}/editors/scapp/SCImage.M
116         ${CMAKE_SOURCE_DIR}/editors/scapp/SCNSWindow.M
117         ${CMAKE_SOURCE_DIR}/editors/scapp/SCService.mm
118         ${CMAKE_SOURCE_DIR}/editors/scapp/SCSoundFileView.M
119         ${CMAKE_SOURCE_DIR}/editors/scapp/SCTextView.M
120         ${CMAKE_SOURCE_DIR}/editors/scapp/SCView.M
121         ${CMAKE_SOURCE_DIR}/editors/scapp/SCVirtualMachine.M
122         ${CMAKE_SOURCE_DIR}/editors/scapp/TabletEvents.m
123         ${CMAKE_SOURCE_DIR}/editors/scapp/TextFinder.m
124         ${CMAKE_SOURCE_DIR}/editors/scapp/UserPanel.M
125         ${CMAKE_SOURCE_DIR}/editors/scapp/main.M
126         ${CMAKE_SOURCE_DIR}/editors/scapp/post_queue.M
127         ${CMAKE_SOURCE_DIR}/editors/scapp/syntaxColorize.M
128         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLAdvancedFindController.m
129         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLStatusBarTextFieldCell.m
130         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUMatcher.m
131         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUPattern.m
132         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/NSStringICUAdditions.m
133         )
135 file(GLOB boost_system_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/system/src/*cpp)
136 file(GLOB boost_fs_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/filesystem/src/*cpp)
137 file(GLOB boost_regex_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/regex/src/*cpp)
138 list(APPEND scapp_sources ${boost_fs_sources} ${boost_system_sources} ${boost_regex_sources})
140 if(SC_QT)
141         include(${CMAKE_SOURCE_DIR}/QtCollider/CMakeLists.txt)
142         list(APPEND scapp_sources ${QT_COLLIDER_SRCS})
143 endif()
145 include(${CMAKE_SOURCE_DIR}/SCDoc/CMakeLists.txt)
146 list(APPEND scapp_sources ${SCDOC_SRCS})
148 set(objcpp_sources
149         ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Speech.M
150         ${CMAKE_SOURCE_DIR}/editors/scapp/main.M
151         ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaBridgePrimitives.M
152         ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaFilePrimitives.M
153         ${CMAKE_SOURCE_DIR}/editors/scapp/DrawBackground.M
154         ${CMAKE_SOURCE_DIR}/editors/scapp/GUIPrimitives.M
155         ${CMAKE_SOURCE_DIR}/editors/scapp/GoToPanel.M
156         ${CMAKE_SOURCE_DIR}/editors/scapp/MyDocument.M
157         ${CMAKE_SOURCE_DIR}/editors/scapp/RendezvousClient.M
158         ${CMAKE_SOURCE_DIR}/editors/scapp/SCCocoaView.M
159         ${CMAKE_SOURCE_DIR}/editors/scapp/SCNSWindow.M
160         ${CMAKE_SOURCE_DIR}/editors/scapp/SCGraphView.M
161         ${CMAKE_SOURCE_DIR}/editors/scapp/SCImage.M
162         ${CMAKE_SOURCE_DIR}/editors/scapp/SCService.mm
163         ${CMAKE_SOURCE_DIR}/editors/scapp/SCSoundFileView.M
164         ${CMAKE_SOURCE_DIR}/editors/scapp/SCTextView.M
165         ${CMAKE_SOURCE_DIR}/editors/scapp/SCView.M
166         ${CMAKE_SOURCE_DIR}/editors/scapp/SCVirtualMachine.M
167         ${CMAKE_SOURCE_DIR}/editors/scapp/UserPanel.M
168         ${CMAKE_SOURCE_DIR}/editors/scapp/post_queue.M
169         ${CMAKE_SOURCE_DIR}/editors/scapp/syntaxColorize.M
170         )
172 set(objc_sources
173         ${CMAKE_SOURCE_DIR}/editors/scapp/GetStringFromUser.m
174         ${CMAKE_SOURCE_DIR}/editors/scapp/HTMLRenderer.m
175         ${CMAKE_SOURCE_DIR}/editors/scapp/TabletEvents.m
176         ${CMAKE_SOURCE_DIR}/editors/scapp/TextFinder.m
177         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLAdvancedFindController.m
178         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLStatusBarTextFieldCell.m
179         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUMatcher.m
180         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUPattern.m
181         ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/NSStringICUAdditions.m
184 if (CMAKE_COMPILER_IS_GNUCXX)
185         set_source_files_properties(${objcpp_sources}
186                                                                 PROPERTIES COMPILE_FLAGS "-x objective-c++ -fobjc-exceptions")
187         set_source_files_properties(${objc_sources}
188                                                                 PROPERTIES COMPILE_FLAGS "-fobjc-exceptions")
189 endif()
191 if(NOT (HID_UTIL_DIR MATCHES "HID_Utilities_10_4"))
192         list(APPEND scapp_sources
193                 "${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/IOHIDElement_.c"
194                 "${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/IOHIDDevice_.c"
195         )
196 endif()
198 set(scapp_parser_source ${CMAKE_SOURCE_DIR}/lang/LangSource/Bison/lang11d_tab.cpp)
200 add_definitions(-DYYSTACK_USE_ALLOCA -DHAVE_SPEECH)
202 # set how it shows up in the Info.plist file
203 SET(MACOSX_BUNDLE_ICON_FILE SCcube.icns)
205 install(DIRECTORY Resources/ DESTINATION ${scappauxresourcesdir})
207 add_executable(${scappbundlename} MACOSX_BUNDLE
208         ${scapp_sources} ${scapp_parser_source}
209         )
211 if (SCLANG_SERVER)
212         target_link_libraries(${scappbundlename} libscsynth)
213 else()
214         set_property(TARGET ${scappbundlename}
215                 APPEND
216                 PROPERTY COMPILE_DEFINITIONS NO_INTERNAL_SERVER
217                 )
218 endif()
220 if(SC_QT)
221         target_link_libraries(${scappbundlename} ${QT_COLLIDER_LIBS})
222 endif()
224 # for processing into the plist:
225 set_property(TARGET ${scappbundlename}
226         PROPERTY MACOSX_BUNDLE_BUNDLE_NAME ${scappbundlename})
227 # also TODO, separate gui name? (currently using MACOSX_BUNDLE_BUNDLE_NAME twice)
229 target_link_libraries(${scappbundlename} icucore)
230 if (Boost_FOUND)
231         target_link_libraries(${scappbundlename} ${Boost_THREAD_LIBRARY})
232 else()
233         target_link_libraries(${scappbundlename} boost_thread)
234 endif()
235 target_link_libraries(${scappbundlename} yaml)
237 target_link_libraries(${scappbundlename} "-framework ApplicationServices")
238 target_link_libraries(${scappbundlename} "-framework Carbon")
239 target_link_libraries(${scappbundlename} "-framework Cocoa")
240 target_link_libraries(${scappbundlename} "-framework CoreAudio")
241 target_link_libraries(${scappbundlename} "-framework CoreMIDI")
242 target_link_libraries(${scappbundlename} "-framework CoreServices")
243 target_link_libraries(${scappbundlename} "-framework IOBluetooth")
244 target_link_libraries(${scappbundlename} "-framework IOKit")
245 target_link_libraries(${scappbundlename} "-framework Quartz")
246 target_link_libraries(${scappbundlename} "-framework QuartzCore")
247 target_link_libraries(${scappbundlename} "-framework QuickTime")
248 target_link_libraries(${scappbundlename} "-framework QTKit")
249 target_link_libraries(${scappbundlename} "-framework WebKit")
251 if(SNDFILE_FOUND)
252         include_directories(${SNDFILE_INCLUDE_DIR})
253         target_link_libraries(${scappbundlename} ${SNDFILE_LIBRARIES})
254         add_definitions("-DLIBSNDFILE_1018")
255 elseif(NOT NO_LIBSNDFILE)
256         message(SEND_ERROR "Cannot find libsndfile")
257 endif(SNDFILE_FOUND)
259 target_link_libraries(${scappbundlename} ${PTHREADS_LIBRARY})
261 install(TARGETS ${scappbundlename} DESTINATION ${scappbundlename})
263 if (NOT ("${standalone}" STREQUAL ""))
264         # Standalones are also given a chance to overwrite things from their specially-manufactured resources dir.
265         # If "${scappbundlename} Resources" exists then that's used; otherwise it uses "Standalone Resources".
266         if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${scappbundlename} Resources")
267                 set(standaloneresourcesfrom "${scappbundlename} Resources")
268         else()
269                 set(standaloneresourcesfrom "Standalone Resources")
270         endif()
271         message(STATUS "Including standalone resources from folder named: " ${standaloneresourcesfrom})
272     install(DIRECTORY ${standaloneresourcesfrom}/ DESTINATION ${scappauxresourcesdir})
273     add_definitions(-DSC_STANDALONE)
274 endif()
276 set(MACOSX_BUNDLE_BUNDLE_NAME "${scappbundlename}")
278 include(InstallRequiredSystemLibraries)
280 include(DeployQt4)
281 install_qt4_executable("${scappbundlename}/${scappbundlename}.app" "" "" "${CMAKE_BINARY_DIR}/server/scsynth;${CMAKE_BINARY_DIR}/external_libraries")