Skip to content

Commit

Permalink
cmake/apple: compile targets directly into the app bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
timblechmann committed Sep 3, 2014
1 parent dc84b30 commit f31909c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 48 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ file(GLOB_RECURSE Sounds sounds/*)
file(GLOB_RECURSE Examples examples/*)


if(APPLE)
include(cmake_modules/MacAppFolder.cmake)
set(ide_name ${scappbundlename})
else()
set(ide_name scide)
endif()

add_subdirectory(server)
add_subdirectory(lang)
add_subdirectory(platform)
Expand All @@ -320,7 +327,6 @@ endif()
if (WIN32)
set(auxresourcesdir "SuperCollider")
elseif(APPLE)
include(cmake_modules/MacAppFolder.cmake)
set(auxresourcesdir ${scappbundlename})
else()
set(auxresourcesdir "share/SuperCollider")
Expand Down
26 changes: 0 additions & 26 deletions editors/sc-ide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ 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()

if(APPLE)
if(NOT SC_SYMLINK_CLASSLIB)
foreach(file ${ClassLibrary} ${HelpSource})
Expand Down Expand Up @@ -282,25 +275,6 @@ endif()
# Installation

if(APPLE)
add_dependencies(SuperCollider sclang scsynth ${plugins} ${supernova_plugins})
add_custom_command(TARGET SuperCollider POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:sclang> $<TARGET_FILE_DIR:SuperCollider>/../Resources)

add_custom_command(TARGET SuperCollider POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:scsynth> $<TARGET_FILE_DIR:SuperCollider>/../Resources)

if(TARGET supernova)
add_dependencies(SuperCollider supernova)
add_custom_command(TARGET SuperCollider POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:supernova> $<TARGET_FILE_DIR:SuperCollider>/../Resources)
endif()

foreach(plugin ${plugins} ${supernova_plugins})
add_custom_command(TARGET SuperCollider POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:SuperCollider>/../Resources/plugins/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${plugin}> $<TARGET_FILE_DIR:SuperCollider>/../Resources/plugins/)
endforeach()


if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE PATH "Install path prefix" FORCE)
Expand Down
7 changes: 5 additions & 2 deletions lang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,14 @@ if(LTO)
APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
endif()

if(WIN32)
if(APPLE)
set_property(TARGET sclang
PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/editors/sc-ide/${ide_name}.app/Contents/Resources/")
elseif(WIN32)
install(TARGETS sclang
DESTINATION "SuperCollider"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
elseif(NOT APPLE)
else()
install(TARGETS sclang
RUNTIME DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Expand Down
3 changes: 3 additions & 0 deletions server/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ if (WIN32)
install(TARGETS ${plugins} ${supernova_plugins}
DESTINATION "SuperCollider/plugins"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
elseif(APPLE)
set_property(TARGET ${plugins} ${supernova_plugins}
PROPERTY LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/editors/sc-ide/${ide_name}.app/Contents/Resources/plugins/")
elseif(NOT APPLE)
install(TARGETS ${plugins} ${supernova_plugins}
DESTINATION "lib/SuperCollider/plugins"
Expand Down
9 changes: 2 additions & 7 deletions server/scsynth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,8 @@ else()
endif()

if(APPLE)
# TODO allow apple users to install to fhs-ish path if INSTALL_FHS option is enabled
# determines the app name and app install location (scappbundlename, scappdir):
include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)
install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION "${scappauxresourcesdir}"
LIBRARY DESTINATION "${scappauxresourcesdir}"
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE)
set_property(TARGET scsynth
PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/editors/sc-ide/${ide_name}.app/Contents/Resources/")
elseif(WIN32)
install(TARGETS ${INSTALL_TARGETS}
DESTINATION "SuperCollider"
Expand Down
17 changes: 5 additions & 12 deletions server/supernova/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,16 @@ target_link_libraries(supernova libsupernova)


if(APPLE)
# determines the app name and app install location (scappbundlename, scappdir):
include (${CMAKE_SOURCE_DIR}/cmake_modules/MacAppFolder.cmake)

install(TARGETS supernova
DESTINATION ${scappauxresourcesdir}
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE OWNER_WRITE)

set_property(TARGET supernova
PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/editors/sc-ide/${ide_name}.app/Contents/Resources/")
elseif(WIN32)
install(TARGETS supernova
DESTINATION "SuperCollider"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

else()

install(TARGETS supernova
DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(TARGETS supernova
DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()

if(LTO)
Expand Down

0 comments on commit f31909c

Please sign in to comment.