From 4c01461316cf8921a87809e2c50b138819ec564d Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 21 Apr 2016 17:36:20 +0000 Subject: [PATCH] OS X: move resources to res/. --- res/CMakeLists.txt | 3 + .../cocoa/AppIcon.iconset/icon_128x128.png | Bin .../cocoa/AppIcon.iconset/icon_128x128@2x.png | Bin .../cocoa/AppIcon.iconset/icon_16x16.png | Bin .../cocoa/AppIcon.iconset/icon_16x16@2x.png | Bin .../cocoa/AppIcon.iconset/icon_256x256.png | Bin .../cocoa/AppIcon.iconset/icon_256x256@2x.png | Bin .../cocoa/AppIcon.iconset/icon_32x32.png | Bin .../cocoa/AppIcon.iconset/icon_32x32@2x.png | Bin .../cocoa/AppIcon.iconset/icon_512x512.png | Bin .../cocoa/AppIcon.iconset/icon_512x512@2x.png | Bin {src => res}/cocoa/MainMenu.xib | 0 {src => res}/cocoa/SaveFormatAccessory.xib | 0 src/CMakeLists.txt | 81 +----------------- 14 files changed, 7 insertions(+), 77 deletions(-) rename {src => res}/cocoa/AppIcon.iconset/icon_128x128.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_128x128@2x.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_16x16.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_16x16@2x.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_256x256.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_256x256@2x.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_32x32.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_32x32@2x.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_512x512.png (100%) rename {src => res}/cocoa/AppIcon.iconset/icon_512x512@2x.png (100%) rename {src => res}/cocoa/MainMenu.xib (100%) rename {src => res}/cocoa/SaveFormatAccessory.xib (100%) diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index 53842c09..4e37b58f 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -101,6 +101,9 @@ if(WIN32) add_resource(win32/icon.ico RT_ICON_GROUP APP_ICON) add_resource(win32/manifest.xml RT_MANIFEST APP_MANIFEST) elseif(APPLE) + add_iconset (cocoa/AppIcon.iconset) + add_xib (cocoa/MainMenu.xib) + add_xib (cocoa/SaveFormatAccessory.xib) else() install(FILES freedesktop/solvespace.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) diff --git a/src/cocoa/AppIcon.iconset/icon_128x128.png b/res/cocoa/AppIcon.iconset/icon_128x128.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_128x128.png rename to res/cocoa/AppIcon.iconset/icon_128x128.png diff --git a/src/cocoa/AppIcon.iconset/icon_128x128@2x.png b/res/cocoa/AppIcon.iconset/icon_128x128@2x.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_128x128@2x.png rename to res/cocoa/AppIcon.iconset/icon_128x128@2x.png diff --git a/src/cocoa/AppIcon.iconset/icon_16x16.png b/res/cocoa/AppIcon.iconset/icon_16x16.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_16x16.png rename to res/cocoa/AppIcon.iconset/icon_16x16.png diff --git a/src/cocoa/AppIcon.iconset/icon_16x16@2x.png b/res/cocoa/AppIcon.iconset/icon_16x16@2x.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_16x16@2x.png rename to res/cocoa/AppIcon.iconset/icon_16x16@2x.png diff --git a/src/cocoa/AppIcon.iconset/icon_256x256.png b/res/cocoa/AppIcon.iconset/icon_256x256.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_256x256.png rename to res/cocoa/AppIcon.iconset/icon_256x256.png diff --git a/src/cocoa/AppIcon.iconset/icon_256x256@2x.png b/res/cocoa/AppIcon.iconset/icon_256x256@2x.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_256x256@2x.png rename to res/cocoa/AppIcon.iconset/icon_256x256@2x.png diff --git a/src/cocoa/AppIcon.iconset/icon_32x32.png b/res/cocoa/AppIcon.iconset/icon_32x32.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_32x32.png rename to res/cocoa/AppIcon.iconset/icon_32x32.png diff --git a/src/cocoa/AppIcon.iconset/icon_32x32@2x.png b/res/cocoa/AppIcon.iconset/icon_32x32@2x.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_32x32@2x.png rename to res/cocoa/AppIcon.iconset/icon_32x32@2x.png diff --git a/src/cocoa/AppIcon.iconset/icon_512x512.png b/res/cocoa/AppIcon.iconset/icon_512x512.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_512x512.png rename to res/cocoa/AppIcon.iconset/icon_512x512.png diff --git a/src/cocoa/AppIcon.iconset/icon_512x512@2x.png b/res/cocoa/AppIcon.iconset/icon_512x512@2x.png similarity index 100% rename from src/cocoa/AppIcon.iconset/icon_512x512@2x.png rename to res/cocoa/AppIcon.iconset/icon_512x512@2x.png diff --git a/src/cocoa/MainMenu.xib b/res/cocoa/MainMenu.xib similarity index 100% rename from src/cocoa/MainMenu.xib rename to res/cocoa/MainMenu.xib diff --git a/src/cocoa/SaveFormatAccessory.xib b/res/cocoa/SaveFormatAccessory.xib similarity index 100% rename from src/cocoa/SaveFormatAccessory.xib rename to res/cocoa/SaveFormatAccessory.xib diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0eeac865..9548e8a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -141,16 +141,6 @@ elseif(APPLE) cocoa/cocoamain.mm unix/gloffscreen.cpp) - set(platform_XIBS - cocoa/MainMenu.xib - cocoa/SaveFormatAccessory.xib) - - set(platform_ICONS - cocoa/AppIcon.iconset) - - set(platform_RESOURCES - unix/solvespace-48x48.png) - set(platform_BUNDLED_LIBS ${PNG_LIBRARIES} ${FREETYPE_LIBRARIES}) @@ -187,69 +177,6 @@ elseif(HAVE_GTK) ${GLEW_LIBRARIES}) endif() -set(platform_BUNDLED_RESOURCES) - -foreach(xib ${platform_XIBS}) - get_filename_component(nib ${xib} NAME_WE) - set(source ${CMAKE_CURRENT_SOURCE_DIR}/${xib}) - set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${nib}.nib) - list(APPEND platform_BUNDLED_RESOURCES ${target}) - - add_custom_command( - OUTPUT ${target} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources - COMMAND ibtool --errors --warnings --notices - --output-format human-readable-text --compile - ${target} ${source} - COMMENT "Building Interface Builder file ${xib}" - DEPENDS ${xib} - VERBATIM) -endforeach() - -foreach(icon ${platform_ICONS}) - get_filename_component(name ${icon} NAME_WE) - set(source ${CMAKE_CURRENT_SOURCE_DIR}/${icon}) - set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${name}.icns) - list(APPEND platform_BUNDLED_RESOURCES ${target}) - - add_custom_command( - OUTPUT ${target} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources - COMMAND iconutil -c icns -o ${target} ${source} - COMMENT "Building icon set ${icon}" - DEPENDS ${source} - VERBATIM) -endforeach() - -foreach(res ${platform_RESOURCES}) - get_filename_component(name ${res} NAME) - set(source ${CMAKE_CURRENT_SOURCE_DIR}/${res}) - set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources/${name}) - list(APPEND platform_BUNDLED_RESOURCES ${target}) - - add_custom_command( - OUTPUT ${target} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources - COMMAND ${CMAKE_COMMAND} -E copy ${source} ${target} - COMMENT "Copying resource file ${res}" - DEPENDS ${res} - VERBATIM) -endforeach() - -foreach(lib ${platform_BUNDLED_LIBS}) - get_filename_component(name ${lib} NAME) - set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/MacOS/${name}) - list(APPEND platform_BUNDLED_RESOURCES ${target}) - - add_custom_command( - OUTPUT ${target} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/Resources - COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${target} - COMMENT "Bundling shared library ${lib}" - DEPENDS ${lib} - VERBATIM) -endforeach() - # solvespace executable set(solvespace_HEADERS @@ -314,7 +241,6 @@ add_executable(solvespace WIN32 MACOSX_BUNDLE ${libslvs_SOURCES} ${util_SOURCES} ${platform_SOURCES} - ${platform_BUNDLED_RESOURCES} ${generated_SOURCES} ${generated_HEADERS} ${solvespace_HEADERS} @@ -343,15 +269,17 @@ if(SPACEWARE_FOUND) endif() if(APPLE) - set(fixups) foreach(lib ${platform_BUNDLED_LIBS}) get_filename_component(name ${lib} NAME) + set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/MacOS/${name}) + execute_process(COMMAND otool -XD ${lib} OUTPUT_VARIABLE canonical_lib OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_command(TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${target} COMMAND install_name_tool -change ${canonical_lib} @executable_path/${name} $ - COMMENT "Fixing up rpath for dylib ${name}" + COMMENT "Bundling shared library ${lib}" VERBATIM) endforeach() @@ -363,7 +291,6 @@ if(APPLE) DEPENDS $ COMMENT "Building ${bundle}.dmg" VERBATIM) - add_custom_target(${bundle}-dmg ALL DEPENDS ${CMAKE_BINARY_DIR}/${bundle}.dmg) endif()