Skip to content
Browse files

cmake: osx - generate bundle with scide

when SC_IDE is enabled, the app bundle will default to scide. otherwise
it will generate a bundle with the cocoa application named
SuperColliderCocoa.

Signed-off-by: Tim Blechmann <tim@klingt.org>
  • Loading branch information...
1 parent 16c80f4 commit 5e9f8473e47232b8a1147617afdefb3f33f549a3 @timblechmann timblechmann committed Aug 14, 2012
Showing with 51 additions and 15 deletions.
  1. +8 −4 cmake_modules/MacAppFolder.cmake
  2. +40 −10 editors/sc-ide/CMakeLists.txt
  3. +3 −1 platform/CMakeLists.txt
View
12 cmake_modules/MacAppFolder.cmake
@@ -1,21 +1,25 @@
if(APPLE)
###### The user may set the app name, causing a standalone build
- ###### cmake -D standalone:string=MyFabApp ../
+ ###### cmake -D standalone:string=MyFabApp ../
if ("${standalone}" STREQUAL "")
- set(scappbundlename ${PROJECT_NAME})
+ if (SC_IDE)
+ set(scappbundlename ${PROJECT_NAME})
+ else()
+ set(scappbundlename ${PROJECT_NAME}Cocoa)
+ endif()
else()
# We're building a standalone, change the app name.
set(scappbundlename ${standalone})
message(STATUS "Building sc in STANDALONE mode. App name: " ${standalone})
endif()
-
+
set(scappauxresourcesdir "${scappbundlename}/${scappbundlename}.app/Contents/Resources")
###### Allow user to select a FHS-style install
# TODO not yet used
option(INSTALL_FHS
"use FHS-style install (e.g. to /usr/local) rather than to a mac-style app folder"
FALSE)
-
+
endif(APPLE)
View
50 editors/sc-ide/CMakeLists.txt
@@ -6,6 +6,13 @@ if(${CMAKE_COMPILER_IS_GNUCXX})
add_definitions(-Wreorder)
endif()
+if (APPLE)
+ include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
+ set(ide_name ${scappbundlename})
+else()
+ set(ide_name scide)
+endif()
+
set ( ide_moc_hdr
core/main.hpp
core/sig_mux.hpp
@@ -128,35 +135,58 @@ set(ide_sources ${ide_src} ${all_hdr} )
set(ide_rc_sources ${ide_moc_src} ${ide_forms_src} ${ide_rcc} ${translations_src})
-if(FINAL_BUILD) # sclang final-builds are broken
+if(FINAL_BUILD)
CREATE_FINAL_FILE(scide_final.cpp ${ide_sources})
- add_executable( scide scide_final.cpp ${ide_rc_sources} )
+ add_executable( ${ide_name} MACOSX_BUNDLE scide_final.cpp ${ide_rc_sources} )
else()
- add_executable( scide ${ide_sources} ${ide_rc_sources} )
+ add_executable( ${ide_name} MACOSX_BUNDLE ${ide_sources} ${ide_rc_sources} )
endif()
-target_link_libraries( scide ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARY} yaml)
+target_link_libraries( ${ide_name} ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARY} yaml)
if(APPLE)
- target_link_libraries( scide "-framework CoreServices")
+ target_link_libraries( ${ide_name} "-framework CoreServices")
elseif(WIN32)
- target_link_libraries( scide wsock32 )
+ target_link_libraries( ${ide_name} wsock32 )
# The following prevents a Windows console from showing up
# when the executable is started:
- set_target_properties( scide PROPERTIES WIN32_EXECUTABLE TRUE )
+ set_target_properties( ${ide_name} PROPERTIES WIN32_EXECUTABLE TRUE )
endif()
# Installation
if(APPLE)
- # no-op for now
+ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE PATH "Install path prefix" FORCE)
+ endif()
+
+ # set how it shows up in the Info.plist file
+ SET(MACOSX_BUNDLE_ICON_FILE ../../platform/mac/SCcube.icns)
+
+ install(DIRECTORY ../../platform/mac/Resources/ DESTINATION ${scappauxresourcesdir})
+
+ install(TARGETS ${ide_name}
+ DESTINATION ${scappbundlename}
+ )
+
+ # for processing into the plist:
+ set_property(TARGET ${ide_name}
+ PROPERTY MACOSX_BUNDLE_BUNDLE_NAME ${scappbundlename})
+
+ set(MACOSX_BUNDLE_BUNDLE_NAME "${scappbundlename}")
+
+ include(InstallRequiredSystemLibraries)
+
+ include(DeployQt4)
+ install_qt4_executable("${scappbundlename}/${scappbundlename}.app" "" "" "${CMAKE_BINARY_DIR}/server/scsynth;${CMAKE_BINARY_DIR}/external_libraries")
+
elseif(WIN32)
- install(TARGETS scide
+ install(TARGETS ${ide_name}
DESTINATION "SuperCollider"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
else()
- install(TARGETS scide
+ install(TARGETS ${ide_name}
RUNTIME DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
View
4 platform/CMakeLists.txt
@@ -1,5 +1,7 @@
if(APPLE)
- add_subdirectory(mac)
+ if (NOT SC_IDE)
+ add_subdirectory(mac)
+ endif()
elseif(WIN32)
add_subdirectory(windows)
endif()

0 comments on commit 5e9f847

Please sign in to comment.
Something went wrong with that request. Please try again.