cmake: build bundle and dmg on install/package

This commit is contained in:
Ronald Kinard 2015-01-28 19:29:16 -06:00
parent 0909fce2e3
commit 68f8a5b0f9
3 changed files with 38 additions and 6 deletions

View file

@ -82,12 +82,28 @@ git_describe(SRB2_COMP_REVISION "${CMAKE_CURRENT_SOURCE_DIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
# Mac bundle fixup
if(CLANG)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
\"\"
/Library/Frameworks
)"
)
endif()
##### PACKAGE CONFIGURATION ##### ##### PACKAGE CONFIGURATION #####
if(${CMAKE_SYSTEM} MATCHES "Windows") if(${CMAKE_SYSTEM} MATCHES "Windows")
set(CPACK_GENERATOR "ZIP") set(CPACK_GENERATOR "ZIP")
endif() endif()
if(${CMAKE_SYSTEM} MATCHES "Linux")
set(CPACK_GENERATOR "TGZ")
endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
set(CPACK_GENERATOR "DragNDrop")
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2")
set(CPACK_PACKAGE_VENDOR "Sonic Team Jr.") set(CPACK_PACKAGE_VENDOR "Sonic Team Jr.")

View file

@ -25,6 +25,13 @@ endforeach()
# Installation # Installation
install(FILES ${SRB2_ASSET_ALL} if(CLANG)
get_target_property(outname ${SRB2_SDL2_EXE_NAME} OUTPUT_NAME)
install(FILES ${SRB2_ASSET_ALL}
DESTINATION "${outname}.app/Contents/Resources"
)
else()
install(FILES ${SRB2_ASSET_ALL}
DESTINATION . DESTINATION .
) )
endif()

View file

@ -99,6 +99,7 @@ if(${SDL2_FOUND})
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
) )
set_target_properties(${SRB2_SDL2_EXE_NAME} PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2")
else() else()
add_executable(${SRB2_SDL2_EXE_NAME} WIN32 ${SRB2_SDL2_TOTAL_SOURCES}) add_executable(${SRB2_SDL2_EXE_NAME} WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
@ -112,6 +113,8 @@ if(${SDL2_FOUND})
endif() endif()
set_target_properties(${SRB2_SDL2_EXE_NAME} PROPERTIES VERSION ${SRB2_VERSION})
if(${CMAKE_SYSTEM} MATCHES Windows) if(${CMAKE_SYSTEM} MATCHES Windows)
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
ws2_32 ws2_32
@ -153,9 +156,15 @@ if(${SDL2_FOUND})
) )
#### Installation #### #### Installation ####
if (CLANG)
install(TARGETS ${SRB2_SDL2_EXE_NAME}
BUNDLE DESTINATION .
)
else()
install(TARGETS ${SRB2_SDL2_EXE_NAME} ${SRB2_SDL2_EXE_NAME} install(TARGETS ${SRB2_SDL2_EXE_NAME} ${SRB2_SDL2_EXE_NAME}
RUNTIME DESTINATION . RUNTIME DESTINATION .
) )
endif()
if(${CMAKE_SYSTEM} MATCHES Windows) if(${CMAKE_SYSTEM} MATCHES Windows)
find_library(SRB2_SDL2_DLL_SDL2 "SDL2.dll") find_library(SRB2_SDL2_DLL_SDL2 "SDL2.dll")