2 message(SEND_ERROR "mac folder invoked by cmake, but not APPLE platform")
5 # determines the app name and app install location (scappbundlename, scappdir):
6 include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
9 ${CMAKE_SOURCE_DIR}/lang/LangSource/Bison
10 ${CMAKE_SOURCE_DIR}/include/common
11 ${CMAKE_SOURCE_DIR}/include/lang
12 ${CMAKE_SOURCE_DIR}/include/plugin_interface
13 ${CMAKE_SOURCE_DIR}/include/server
14 ${CMAKE_SOURCE_DIR}/editors/scapp/include
15 ${CMAKE_SOURCE_DIR}/editors/scapp/include/SMLAdvancedFind
16 ${CMAKE_SOURCE_DIR}/editors/scapp/include/SMLAdvancedFind/ICU
17 ${CMAKE_SOURCE_DIR}/external_libraries/icu/
18 ${CMAKE_SOURCE_DIR}/external_libraries/icu/unicode/
19 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}
20 ${CMAKE_SOURCE_DIR}/external_libraries/boost_lockfree
21 ${CMAKE_SOURCE_DIR}/external_libraries/boost
22 ${CMAKE_SOURCE_DIR}/external_libraries/threadpool
23 ${CMAKE_SOURCE_DIR}/external_libraries/yaml-cpp-0.2.6/include
24 ${CMAKE_SOURCE_DIR}/external_libraries/TLSF-2.4.6/src
30 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Wii.cpp
31 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSignalPrim.cpp
32 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSched.cpp
33 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrPrimitive.cpp
34 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrMathPrim.cpp
35 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_ComPort.cpp
36 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/OSCData.cpp
37 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrArchiver.cpp
38 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrArrayPrimitives.cpp
39 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrBitPrim.cpp
40 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrCharPrim.cpp
41 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrFilePrim.cpp
42 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrListPrim.cpp
43 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrPlatformPrim.cpp
44 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSerialPrim.cpp
45 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrStringPrim.cpp
46 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrSymbolPrim.cpp
47 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/PyrUnixPrim.cpp
48 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Speech.M
49 ${CMAKE_SOURCE_DIR}/lang/LangSource/AdvancingAllocPool.cpp
50 ${CMAKE_SOURCE_DIR}/lang/LangSource/ByteCodeArray.cpp
51 ${CMAKE_SOURCE_DIR}/lang/LangSource/DumpParseNode.cpp
52 ${CMAKE_SOURCE_DIR}/lang/LangSource/GC.cpp
53 ${CMAKE_SOURCE_DIR}/lang/LangSource/InitAlloc.cpp
54 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrFileUtils.cpp
55 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrInterpreter3.cpp
56 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrLexer.cpp
57 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMathOps.cpp
58 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMathSupport.cpp
59 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMessage.cpp
60 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrObject.cpp
61 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrParseNode.cpp
62 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrSignal.cpp
63 ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrSymbolTable.cpp
64 ${CMAKE_SOURCE_DIR}/lang/LangSource/SC_LibraryConfig.cpp
65 ${CMAKE_SOURCE_DIR}/lang/LangSource/Samp.cpp
66 ${CMAKE_SOURCE_DIR}/lang/LangSource/SimpleStack.cpp
67 ${CMAKE_SOURCE_DIR}/lang/LangSource/VMGlobals.cpp
68 ${CMAKE_SOURCE_DIR}/lang/LangSource/dumpByteCodes.cpp
69 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/WiiMote_OSX/wiiremote.c
70 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_HID.cpp
71 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Utilities.c
72 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Name_Lookup.c
73 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Queue_Utilities.c
74 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/HID_Error_Handler.c
75 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_CoreMIDI.cpp
76 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_CoreAudioPrim.cpp
78 ${CMAKE_SOURCE_DIR}/common/fftlib.c
79 ${CMAKE_SOURCE_DIR}/common/SC_fftlib.cpp
80 ${CMAKE_SOURCE_DIR}/common/SC_AllocPool.cpp
81 ${CMAKE_SOURCE_DIR}/common/SC_DirUtils.cpp
82 ${CMAKE_SOURCE_DIR}/common/SC_Sem.cpp
83 ${CMAKE_SOURCE_DIR}/common/SC_StandAloneInfo_Darwin.cpp
84 ${CMAKE_SOURCE_DIR}/common/SC_StringBuffer.cpp
85 ${CMAKE_SOURCE_DIR}/common/SC_StringParser.cpp
86 ${CMAKE_SOURCE_DIR}/common/scsynthsend.cpp
87 ${CMAKE_SOURCE_DIR}/common/sc_popen.cpp
89 ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaBridgePrimitives.M
90 ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaFilePrimitives.M
91 ${CMAKE_SOURCE_DIR}/editors/scapp/DrawBackground.M
92 ${CMAKE_SOURCE_DIR}/editors/scapp/GUIPrimitives.M
93 ${CMAKE_SOURCE_DIR}/editors/scapp/GetStringFromUser.m
94 ${CMAKE_SOURCE_DIR}/editors/scapp/GoToPanel.M
95 ${CMAKE_SOURCE_DIR}/editors/scapp/HTMLRenderer.m
96 ${CMAKE_SOURCE_DIR}/editors/scapp/MyDocument.M
97 ${CMAKE_SOURCE_DIR}/editors/scapp/RendezvousClient.M
98 ${CMAKE_SOURCE_DIR}/editors/scapp/SCCocoaView.M
99 ${CMAKE_SOURCE_DIR}/editors/scapp/SCDialog.mm
100 ${CMAKE_SOURCE_DIR}/editors/scapp/SCGraphView.M
101 ${CMAKE_SOURCE_DIR}/editors/scapp/SCImage.M
102 ${CMAKE_SOURCE_DIR}/editors/scapp/SCNSWindow.m
103 ${CMAKE_SOURCE_DIR}/editors/scapp/SCService.mm
104 ${CMAKE_SOURCE_DIR}/editors/scapp/SCSoundFileView.M
105 ${CMAKE_SOURCE_DIR}/editors/scapp/SCTextView.M
106 ${CMAKE_SOURCE_DIR}/editors/scapp/SCView.M
107 ${CMAKE_SOURCE_DIR}/editors/scapp/SCVirtualMachine.M
108 ${CMAKE_SOURCE_DIR}/editors/scapp/TabletEvents.m
109 ${CMAKE_SOURCE_DIR}/editors/scapp/TextFinder.m
110 ${CMAKE_SOURCE_DIR}/editors/scapp/UserPanel.M
111 ${CMAKE_SOURCE_DIR}/editors/scapp/main.M
112 ${CMAKE_SOURCE_DIR}/editors/scapp/post_queue.M
113 ${CMAKE_SOURCE_DIR}/editors/scapp/syntaxColorize.M
114 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLAdvancedFindController.m
115 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLStatusBarTextFieldCell.m
116 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUMatcher.m
117 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUPattern.m
118 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/NSStringICUAdditions.m
121 file(GLOB boost_system_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/system/src/*cpp)
122 file(GLOB boost_fs_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/filesystem/v3/src/*cpp)
123 file(GLOB boost_regex_sources ${CMAKE_SOURCE_DIR}/external_libraries/boost/libs/regex/src/*cpp)
124 list(APPEND scapp_sources ${boost_fs_sources} ${boost_system_sources} ${boost_regex_sources})
126 file(GLOB yaml_sources ${CMAKE_SOURCE_DIR}/external_libraries/yaml-cpp-0.2.6/src/*cpp)
127 list(APPEND scapp_sources ${yaml_sources})
130 include(${CMAKE_SOURCE_DIR}/QtCollider/CMakeLists.txt)
131 list(APPEND scapp_sources ${QT_COLLIDER_SRCS})
135 ${CMAKE_SOURCE_DIR}/lang/LangPrimSource/SC_Speech.M
136 ${CMAKE_SOURCE_DIR}/editors/scapp/main.M
137 ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaBridgePrimitives.M
138 ${CMAKE_SOURCE_DIR}/editors/scapp/CocoaFilePrimitives.M
139 ${CMAKE_SOURCE_DIR}/editors/scapp/DrawBackground.M
140 ${CMAKE_SOURCE_DIR}/editors/scapp/GUIPrimitives.M
141 ${CMAKE_SOURCE_DIR}/editors/scapp/GoToPanel.M
142 ${CMAKE_SOURCE_DIR}/editors/scapp/MyDocument.M
143 ${CMAKE_SOURCE_DIR}/editors/scapp/RendezvousClient.M
144 ${CMAKE_SOURCE_DIR}/editors/scapp/SCCocoaView.M
145 ${CMAKE_SOURCE_DIR}/editors/scapp/SCGraphView.M
146 ${CMAKE_SOURCE_DIR}/editors/scapp/SCImage.M
147 ${CMAKE_SOURCE_DIR}/editors/scapp/SCService.mm
148 ${CMAKE_SOURCE_DIR}/editors/scapp/SCSoundFileView.M
149 ${CMAKE_SOURCE_DIR}/editors/scapp/SCTextView.M
150 ${CMAKE_SOURCE_DIR}/editors/scapp/SCView.M
151 ${CMAKE_SOURCE_DIR}/editors/scapp/SCVirtualMachine.M
152 ${CMAKE_SOURCE_DIR}/editors/scapp/UserPanel.M
153 ${CMAKE_SOURCE_DIR}/editors/scapp/post_queue.M
154 ${CMAKE_SOURCE_DIR}/editors/scapp/syntaxColorize.M
158 ${CMAKE_SOURCE_DIR}/editors/scapp/GetStringFromUser.m
159 ${CMAKE_SOURCE_DIR}/editors/scapp/HTMLRenderer.m
160 ${CMAKE_SOURCE_DIR}/editors/scapp/SCNSWindow.m
161 ${CMAKE_SOURCE_DIR}/editors/scapp/TabletEvents.m
162 ${CMAKE_SOURCE_DIR}/editors/scapp/TextFinder.m
163 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLAdvancedFindController.m
164 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/SMLStatusBarTextFieldCell.m
165 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUMatcher.m
166 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/ICUPattern.m
167 ${CMAKE_SOURCE_DIR}/editors/scapp/SMLAdvancedFind/ICU/NSStringICUAdditions.m
170 if (CMAKE_COMPILER_IS_GNUCXX)
171 set_source_files_properties(${objcpp_sources}
172 PROPERTIES COMPILE_FLAGS "-x objective-c++ -fobjc-exceptions")
173 set_source_files_properties(${objc_sources}
174 PROPERTIES COMPILE_FLAGS "-fobjc-exceptions")
177 if(NOT (HID_UTIL_DIR MATCHES "HID_Utilities_10_4"))
178 list(APPEND scapp_sources
179 "${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/IOHIDElement_.c"
180 "${CMAKE_SOURCE_DIR}/lang/LangPrimSource/${HID_UTIL_DIR}/IOHIDDevice_.c"
184 set(scapp_parser_source ${CMAKE_SOURCE_DIR}/lang/LangSource/Bison/lang11d_tab.cpp)
186 add_definitions(-DYYSTACK_USE_ALLOCA -DHAVE_SPEECH)
188 # set how it shows up in the Info.plist file
189 SET(MACOSX_BUNDLE_ICON_FILE SCcube.icns)
190 # set where in the bundle to put the icns file
191 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/Resources/SCcube.icns
192 PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
193 # include the icns file in the target
194 SET(scapp_resources ${CMAKE_CURRENT_SOURCE_DIR}/Resources/SCcube.icns)
197 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${scappbundlename}.app/Contents
198 PATTERN Info.plist EXCLUDE
201 add_executable(${scappbundlename} MACOSX_BUNDLE
202 ${scapp_sources} ${scapp_parser_source}
207 target_link_libraries(${scappbundlename} libscsynth)
209 set_property(TARGET ${scappbundlename}
211 PROPERTY COMPILE_DEFINITIONS NO_INTERNAL_SERVER
216 target_link_libraries(${scappbundlename} ${QT_COLLIDER_LIBS})
219 # for processing into the plist:
220 set_property(TARGET ${scappbundlename}
221 PROPERTY MACOSX_BUNDLE_BUNDLE_NAME ${scappbundlename})
222 # also TODO, separate gui name? (currently using MACOSX_BUNDLE_BUNDLE_NAME twice)
224 target_link_libraries(${scappbundlename} icucore)
225 target_link_libraries(${scappbundlename} boost_thread)
227 target_link_libraries(${scappbundlename} "-framework ApplicationServices")
228 target_link_libraries(${scappbundlename} "-framework Carbon")
229 target_link_libraries(${scappbundlename} "-framework Cocoa")
230 target_link_libraries(${scappbundlename} "-framework CoreAudio")
231 target_link_libraries(${scappbundlename} "-framework CoreMIDI")
232 target_link_libraries(${scappbundlename} "-framework CoreServices")
233 target_link_libraries(${scappbundlename} "-framework IOBluetooth")
234 target_link_libraries(${scappbundlename} "-framework IOKit")
235 target_link_libraries(${scappbundlename} "-framework Quartz")
236 target_link_libraries(${scappbundlename} "-framework QuartzCore")
237 target_link_libraries(${scappbundlename} "-framework QuickTime")
238 target_link_libraries(${scappbundlename} "-framework QTKit")
239 target_link_libraries(${scappbundlename} "-framework WebKit")
242 include_directories(${SNDFILE_INCLUDE_DIR})
243 target_link_libraries(${scappbundlename} ${SNDFILE_LIBRARIES})
244 add_definitions("-DLIBSNDFILE_1018")
245 elseif(NOT NO_LIBSNDFILE)
246 message(SEND_ERROR "Cannot find libsndfile")
249 target_link_libraries(${scappbundlename} ${PTHREADS_LIBRARY})
251 install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${scappbundlename}.app"
252 DESTINATION ${scappdir}
253 USE_SOURCE_PERMISSIONS)
255 if (NOT ("${standalone}" STREQUAL ""))
256 # A synthdefs folder is expected in the bundle
257 file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${scappbundlename}.app/Contents/Resources/synthdefs")
259 # Standalones are also given a chance to overwrite things from their specially-manufactured resources dir.
260 # If "${scappbundlename} Resources" exists then that's used; otherwise it uses "Standalone Resources".
261 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${scappbundlename} Resources")
262 set(standaloneresourcesfrom "${scappbundlename} Resources")
264 set(standaloneresourcesfrom "Standalone Resources")
266 message(STATUS "Including standalone resources from folder named: " ${standaloneresourcesfrom})
268 # TODO: This globbing approach means cmake can't autodetect if files have changed and regenerate. Might be good if we can find a way that allows that.
269 file(GLOB_RECURSE standaloneresourceitems RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/${standaloneresourcesfrom}" "${standaloneresourcesfrom}/*")
271 foreach(onefile ${standaloneresourceitems})
272 GET_FILENAME_COMPONENT(onefiledir "${onefile}" PATH)
273 file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${standaloneresourcesfrom}/${onefile}"
274 DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${scappbundlename}.app/Contents/Resources/${onefiledir}"
279 # fixup_bundle will fix the dll referencing so the .app can be sent to other people:
280 option(SC_APP_BUNDLE_LIBS "Bundle frameworks and libraries in app" OFF)
281 if (SC_APP_BUNDLE_LIBS)
283 include(BundleUtilities)
284 set(BU_CHMOD_BUNDLE_ITEMS TRUE) # allow cmake>=2.8.3 to chmod libs it's including, rather than choking on readonly
285 fixup_bundle(\"${scappdir}/${scappbundlename}.app\" \"\" \"${CMAKE_CURRENT_BINARY_DIR}\")