Build Mac OS X dmg installation image.
parent
95ab80d0ee
commit
d76d59ea64
|
@ -148,6 +148,9 @@ elseif(APPLE)
|
|||
set(platform_RESOURCES
|
||||
unix/solvespace-48x48.png)
|
||||
|
||||
set(platform_BUNDLED_LIBS
|
||||
${PNG_LIBRARY})
|
||||
|
||||
set(platform_LIBRARIES
|
||||
${APPKIT_LIBRARY})
|
||||
elseif(HAVE_FLTK)
|
||||
|
@ -235,6 +238,19 @@ foreach(res ${platform_RESOURCES})
|
|||
DEPENDS ${res})
|
||||
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})
|
||||
endforeach()
|
||||
|
||||
# solvespace executable
|
||||
|
||||
set(solvespace_HEADERS
|
||||
|
@ -319,6 +335,31 @@ if(SPACEWARE_FOUND)
|
|||
"${SPACEWARE_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(solvespace PROPERTIES INSTALL_RPATH ON)
|
||||
|
||||
set(fixups)
|
||||
foreach(lib ${platform_BUNDLED_LIBS})
|
||||
execute_process(COMMAND otool -XD ${lib}
|
||||
OUTPUT_VARIABLE canonical_lib OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
add_custom_command(TARGET solvespace POST_BUILD
|
||||
COMMAND install_name_tool -change "${canonical_lib}" "@executable_path/${name}"
|
||||
$<TARGET_FILE:solvespace>
|
||||
COMMENT "Fixing up rpath for dylib ${name}")
|
||||
endforeach()
|
||||
|
||||
set(bundle solvespace)
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${bundle}.dmg
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/${bundle}.dmg
|
||||
COMMAND hdiutil create -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${bundle}.app
|
||||
${CMAKE_BINARY_DIR}/${bundle}.dmg
|
||||
DEPENDS $<TARGET_FILE:${bundle}>
|
||||
COMMENT "Building ${bundle}.dmg")
|
||||
|
||||
add_custom_target(${bundle}-dmg ALL
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/${bundle}.dmg)
|
||||
endif()
|
||||
|
||||
install(TARGETS solvespace
|
||||
RUNTIME DESTINATION bin
|
||||
BUNDLE DESTINATION .)
|
||||
|
|
Loading…
Reference in New Issue