OS X: move resources to res/.

pull/10/head
whitequark 2016-04-21 17:36:20 +00:00
parent e36ee32def
commit 4c01461316
14 changed files with 7 additions and 77 deletions

View File

@ -101,6 +101,9 @@ if(WIN32)
add_resource(win32/icon.ico RT_ICON_GROUP APP_ICON) add_resource(win32/icon.ico RT_ICON_GROUP APP_ICON)
add_resource(win32/manifest.xml RT_MANIFEST APP_MANIFEST) add_resource(win32/manifest.xml RT_MANIFEST APP_MANIFEST)
elseif(APPLE) elseif(APPLE)
add_iconset (cocoa/AppIcon.iconset)
add_xib (cocoa/MainMenu.xib)
add_xib (cocoa/SaveFormatAccessory.xib)
else() else()
install(FILES freedesktop/solvespace.desktop install(FILES freedesktop/solvespace.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)

View File

Before

Width:  |  Height:  |  Size: 891 B

After

Width:  |  Height:  |  Size: 891 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 586 B

View File

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 626 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 626 B

View File

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 746 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -141,16 +141,6 @@ elseif(APPLE)
cocoa/cocoamain.mm cocoa/cocoamain.mm
unix/gloffscreen.cpp) 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 set(platform_BUNDLED_LIBS
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}) ${FREETYPE_LIBRARIES})
@ -187,69 +177,6 @@ elseif(HAVE_GTK)
${GLEW_LIBRARIES}) ${GLEW_LIBRARIES})
endif() 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 # solvespace executable
set(solvespace_HEADERS set(solvespace_HEADERS
@ -314,7 +241,6 @@ add_executable(solvespace WIN32 MACOSX_BUNDLE
${libslvs_SOURCES} ${libslvs_SOURCES}
${util_SOURCES} ${util_SOURCES}
${platform_SOURCES} ${platform_SOURCES}
${platform_BUNDLED_RESOURCES}
${generated_SOURCES} ${generated_SOURCES}
${generated_HEADERS} ${generated_HEADERS}
${solvespace_HEADERS} ${solvespace_HEADERS}
@ -343,15 +269,17 @@ if(SPACEWARE_FOUND)
endif() endif()
if(APPLE) if(APPLE)
set(fixups)
foreach(lib ${platform_BUNDLED_LIBS}) foreach(lib ${platform_BUNDLED_LIBS})
get_filename_component(name ${lib} NAME) get_filename_component(name ${lib} NAME)
set(target ${CMAKE_CURRENT_BINARY_DIR}/solvespace.app/Contents/MacOS/${name})
execute_process(COMMAND otool -XD ${lib} execute_process(COMMAND otool -XD ${lib}
OUTPUT_VARIABLE canonical_lib OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_VARIABLE canonical_lib OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_command(TARGET solvespace POST_BUILD add_custom_command(TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${target}
COMMAND install_name_tool -change ${canonical_lib} @executable_path/${name} COMMAND install_name_tool -change ${canonical_lib} @executable_path/${name}
$<TARGET_FILE:solvespace> $<TARGET_FILE:solvespace>
COMMENT "Fixing up rpath for dylib ${name}" COMMENT "Bundling shared library ${lib}"
VERBATIM) VERBATIM)
endforeach() endforeach()
@ -363,7 +291,6 @@ if(APPLE)
DEPENDS $<TARGET_FILE:${bundle}> DEPENDS $<TARGET_FILE:${bundle}>
COMMENT "Building ${bundle}.dmg" COMMENT "Building ${bundle}.dmg"
VERBATIM) VERBATIM)
add_custom_target(${bundle}-dmg ALL add_custom_target(${bundle}-dmg ALL
DEPENDS ${CMAKE_BINARY_DIR}/${bundle}.dmg) DEPENDS ${CMAKE_BINARY_DIR}/${bundle}.dmg)
endif() endif()