mirror of https://github.com/mgba-emu/mgba.git
CMake: Revamp CPack packaging
This commit is contained in:
parent
aa9c9c40f7
commit
4f19d5e105
108
CMakeLists.txt
108
CMakeLists.txt
|
@ -48,6 +48,7 @@ set(BUILD_GL ON CACHE STRING "Build with OpenGL")
|
|||
set(BUILD_GLES2 OFF CACHE STRING "Build with OpenGL|ES 2")
|
||||
set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
|
||||
set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
|
||||
set(DISTBUILD OFF CACHE BOOL "Build distribution packages")
|
||||
if(WIN32)
|
||||
set(WIN32_UNIX_PATHS OFF CACHE BOOL "Use Unix-like paths")
|
||||
mark_as_advanced(WIN32_UNIX_PATHS)
|
||||
|
@ -89,7 +90,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 OR WIN32_UNIX_PATHS)
|
||||
if(UNIX OR WIN32_UNIX_PATHS)
|
||||
include(GNUInstallDirs)
|
||||
else()
|
||||
set(CMAKE_INSTALL_LIBDIR ".")
|
||||
|
@ -112,6 +113,11 @@ if (BUILD_OPENEMU)
|
|||
mark_as_advanced(OE_LIBDIR)
|
||||
endif()
|
||||
|
||||
if (DISTBUILD)
|
||||
set(EXTRA_LICENSES "" CACHE FILEPATH "Extra licenses to include in distribution packaages")
|
||||
mark_as_advanced(EXTRA_LICENSES)
|
||||
endif()
|
||||
mark_as_advanced(DISTBUILD)
|
||||
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
|
||||
|
||||
|
@ -278,6 +284,7 @@ if(PSP2 OR WII)
|
|||
endif()
|
||||
|
||||
if(DEFINED 3DS OR DEFINED PSP2 OR DEFINED WII)
|
||||
set(IS_EMBEDDED ON)
|
||||
set(USE_DEBUGGERS OFF)
|
||||
set(USE_SQLITE3 OFF)
|
||||
endif()
|
||||
|
@ -337,9 +344,11 @@ else()
|
|||
check_function_exists(setlocale HAVE_SETLOCALE)
|
||||
unset(CMAKE_REQUIRED_FLAGS)
|
||||
endif()
|
||||
if(NOT DEFINED 3DS AND NOT DEFINED PSP2 AND NOT DEFINED WII)
|
||||
if(NOT IS_EMBEDDED)
|
||||
set(DISABLE_DEPS ON CACHE BOOL "This platform cannot build with dependencies" FORCE)
|
||||
endif()
|
||||
set(BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(DISABLE_FRONTENDS ON)
|
||||
set(MINIMAL_CORE ON)
|
||||
set(ENABLE_EXTRA ON)
|
||||
|
@ -804,15 +813,15 @@ if(NOT SKIP_LIBRARY)
|
|||
target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB})
|
||||
install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
|
||||
if(UNIX AND NOT APPLE AND NOT HAIKU)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT ${BINARY_NAME})
|
||||
endif()
|
||||
else()
|
||||
set(BUILD_SHARED OFF)
|
||||
|
@ -940,20 +949,35 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_B
|
|||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT lib${BINARY_NAME})
|
||||
|
||||
# Packaging
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/licenses DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME})
|
||||
if(DEFINED EXTRA_LICENSES)
|
||||
install(FILES ${EXTRA_LICENSES} DESTINATION ${CMAKE_INSTALL_DOCDIR}/licenses COMPONENT lib${BINARY_NAME})
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/licenses DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
|
||||
if(EXTRA_LICENSES)
|
||||
install(FILES ${EXTRA_LICENSES} DESTINATION ${CMAKE_INSTALL_DOCDIR}/licenses COMPONENT ${BINARY_NAME})
|
||||
endif()
|
||||
|
||||
file(GLOB READMES ${CMAKE_CURRENT_SOURCE_DIR}/README*.md)
|
||||
install(FILES ${READMES} ${CMAKE_CURRENT_SOURCE_DIR}/CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME})
|
||||
|
||||
find_program(DOS2UNIX NAMES dos2unix)
|
||||
find_program(MARKDOWN NAMES markdown kramdown pandoc)
|
||||
|
||||
if(UNIX OR NOT DOS2UNIX)
|
||||
if(UNIX OR NOT MARKDOWN)
|
||||
install(FILES ${READMES} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
|
||||
endif()
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES" "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
|
||||
else()
|
||||
add_custom_command(OUTPUT CHANGES.txt COMMAND ${DOS2UNIX} -n "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES" "${CMAKE_CURRENT_BINARY_DIR}/CHANGES.txt" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES")
|
||||
add_custom_command(OUTPUT LICENSE.txt COMMAND ${DOS2UNIX} -n "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
add_custom_target(CHANGES ALL DEPENDS CHANGES.txt)
|
||||
add_custom_target(LICENSE ALL DEPENDS LICENSE.txt)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CHANGES.txt ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
|
||||
endif()
|
||||
|
||||
if(MARKDOWN)
|
||||
foreach(README ${READMES})
|
||||
get_filename_component(README_BASE "${README}" NAME_WE)
|
||||
set(README_HTML "${README_BASE}.html")
|
||||
install(CODE "execute_process(COMMAND \"${MARKDOWN}\" \"${README}\" OUTPUT_FILE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}/${README_HTML}\")")
|
||||
add_custom_command(OUTPUT ${README_BASE}.html COMMAND ${MARKDOWN} "${README}" > ${README_BASE}.html MAIN_DEPENDENCY "${README}")
|
||||
add_custom_target(${README_BASE} ALL DEPENDS ${README_BASE}.html)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${README_BASE}.html DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT ${BINARY_NAME})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
@ -974,8 +998,58 @@ SET(CPACK_DEB_COMPONENT_INSTALL ON)
|
|||
|
||||
set(CPACK_STRIP_FILES ${BINARY_NAME})
|
||||
|
||||
if(DISTBUILD)
|
||||
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
||||
if(WIN32 OR APPLE)
|
||||
set(CPACK_COMPONENTS_ALL ${BINARY_NAME} ${BINARY_NAME}-qt ${BINARY_NAME}-sdl ${BINARY_NAME}-perf)
|
||||
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
|
||||
elseif(3DS)
|
||||
set(CPACK_COMPONENTS_ALL ${BINARY_NAME} ${BINARY_NAME}-3ds ${BINARY_NAME}-perf)
|
||||
elseif(WII)
|
||||
set(CPACK_COMPONENTS_ALL ${BINARY_NAME} ${BINARY_NAME}-wii)
|
||||
elseif(PSP2)
|
||||
set(CPACK_COMPONENTS_ALL ${BINARY_NAME} ${BINARY_NAME}-psp2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
|
||||
cpack_add_component_group(base)
|
||||
cpack_add_component(${BINARY_NAME} GROUP base)
|
||||
|
||||
cpack_add_component_group(dev PARENT_GROUP base)
|
||||
if(BUILD_SHARED)
|
||||
cpack_add_component(lib${BINARY_NAME} GROUP base)
|
||||
if(BUILD_STATIC)
|
||||
cpack_add_component(lib${BINARY_NAME}-static GROUP dev)
|
||||
endif()
|
||||
elseif(BUILD_STATIC)
|
||||
cpack_add_component(lib${BINARY_NAME} GROUP dev)
|
||||
endif()
|
||||
|
||||
if(3DS)
|
||||
cpack_add_component(${BINARY_NAME}-3ds GROUP base)
|
||||
elseif(PSP2)
|
||||
cpack_add_component(${BINARY_NAME}-psp2 GROUP base)
|
||||
elseif(WII)
|
||||
cpack_add_component(${BINARY_NAME}-wii GROUP base)
|
||||
endif()
|
||||
|
||||
if(BUILD_QT)
|
||||
cpack_add_component_group(qt PARENT_GROUP base)
|
||||
cpack_add_component(${BINARY_NAME}-qt GROUP qt DEPENDS base)
|
||||
endif()
|
||||
|
||||
if(BUILD_SDL)
|
||||
cpack_add_component_group(sdl PARENT_GROUP base)
|
||||
cpack_add_component(${BINARY_NAME}-sdl GROUP sdl DEPENDS base)
|
||||
endif()
|
||||
|
||||
cpack_add_component_group($test PARENT_GROUP dev)
|
||||
cpack_add_component(${BINARY_NAME}-perf GROUP test DEPENDS dev)
|
||||
cpack_add_component(${BINARY_NAME}-fuzz GROUP test DEPENDS dev)
|
||||
cpack_add_component(tbl-fuzz GROUP test DEPENDS dev)
|
||||
|
||||
# Summaries
|
||||
set(SUMMARY_GL_LIST)
|
||||
if(USE_EPOXY)
|
||||
|
|
|
@ -109,7 +109,7 @@ if(BUILD_PERF)
|
|||
DEPENDS ${BINARY_NAME}-perf ${BINARY_NAME}.smdh)
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}-perf.3dsx
|
||||
DESTINATION . COMPONENT ${BINARY_NAME}-3ds)
|
||||
DESTINATION . COMPONENT ${BINARY_NAME}-perf)
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cia.rsf.in ${CMAKE_CURRENT_BINARY_DIR}/cia.rsf)
|
||||
|
|
Loading…
Reference in New Issue