all repos — mgba @ 929f21002dfe6bc9703a43fbd53c8cf9ce5ee2ec

mGBA Game Boy Advance Emulator

All: CMake improvements
Jeffrey Pfau jeffrey@endrift.com
Sat, 02 Jan 2016 13:19:11 -0800
commit

929f21002dfe6bc9703a43fbd53c8cf9ce5ee2ec

parent

88bf7b58adcac0b3120a696cebf086ace94b49fe

1 files changed, 82 insertions(+), 32 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -18,11 +18,14 @@ set(USE_LZMA ON CACHE BOOL "Whether or not to enable 7-Zip support")

set(BUILD_QT ON CACHE BOOL "Build Qt frontend") set(BUILD_SDL ON CACHE BOOL "Build SDL frontend") set(BUILD_LIBRETRO OFF CACHE BOOL "Build libretro core") -set(BUILD_OPENEMU OFF CACHE BOOL "Build OpenEmu core") +if(APPLE) + set(BUILD_OPENEMU OFF CACHE BOOL "Build OpenEmu core") +endif() set(BUILD_PERF OFF CACHE BOOL "Build performance profiling tool") set(BUILD_TEST OFF CACHE BOOL "Build testing harness") set(BUILD_STATIC OFF CACHE BOOL "Build a static library") set(BUILD_SHARED ON CACHE BOOL "Build a shared library") +set(SKIP_LIBRARY OFF CACHE BOOL "Skip building the library (useful for only building libretro or OpenEmu cores)") 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")

@@ -278,12 +281,18 @@ if(NOT OPENGL_FOUND)

set(BUILD_GL OFF CACHE BOOL "OpenGL not found" FORCE) endif() endif() +if(NOT BUILD_GL) + set(OPENGLE_LIBRARY "" CACHE PATH "" FORCE) +endif() if(BUILD_GLES2 AND NOT BUILD_RASPI) find_path(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h) find_library(OPENGLES2_LIBRARY NAMES GLESv2 GLESv2_CM) if(NOT OPENGLES2_INCLUDE_DIR OR NOT OPENGLES2_LIBRARY) set(BUILD_GLES2 OFF CACHE BOOL "OpenGL|ES 2 not found" FORCE) endif() +endif() +if(NOT BUILD_GLES2) + set(OPENGLES2_LIBRARY "" CACHE PATH "" FORCE) endif() set(WANT_ZLIB ${USE_ZLIB}) set(WANT_PNG ${USE_PNG})

@@ -505,37 +514,48 @@ else()

set(SRC ${CORE_SRC} ${VFS_SRC}) endif() -if(NOT BUILD_STATIC AND NOT BUILD_SHARED) - set(BUILD_SHARED ON) -endif() +if(NOT SKIP_LIBRARY) + if(NOT BUILD_STATIC AND NOT BUILD_SHARED) + set(BUILD_SHARED ON) + endif() -if(BUILD_SHARED) - add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC}) - if(BUILD_STATIC) - add_library(${BINARY_NAME}-static STATIC ${SRC}) - set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") - install(TARGETS ${BINARY_NAME}-static DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) - add_dependencies(${BINARY_NAME}-static version-info) + if(BUILD_SHARED) + add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC}) + if(BUILD_STATIC) + add_library(${BINARY_NAME}-static STATIC ${SRC}) + set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") + install(TARGETS ${BINARY_NAME}-static DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) + add_dependencies(${BINARY_NAME}-static version-info) + endif() + else() + add_library(${BINARY_NAME} STATIC ${SRC}) endif() -else() - add_library(${BINARY_NAME} STATIC ${SRC}) -endif() -add_dependencies(${BINARY_NAME} version-info) -set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") + add_dependencies(${BINARY_NAME} version-info) + set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") -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) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) - install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + 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) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) + endif() +else() + set(BUILD_SHARED OFF) + set(BUILD_STATIC OFF) + find_library(${BINARY_NAME} ${BINARY_NAME}) + if(NOT ${BINARY_NAME}_FOUND) + set(DISABLE_FRONTENDS ON) + set(BUILD_PERF OFF) + set(BUILD_TEST OFF) + endif() endif() if(BUILD_GL)

@@ -626,20 +646,50 @@

include(CPack) # Summaries -message(STATUS "Feature summary:") +set(SUMMARY_GL_LIST) +if(USE_EPOXY) + set(SUMMARY_GL_LIST "libepoxy") +else() + if(BUILD_GL) + list(APPEND SUMMARY_GL_LIST "OpenGL") + endif() + if(BUILD_GLES2) + list(APPEND SUMMARY_GL_LIST "OpenGL|ES 2") + endif() +endif() +if(NOT SUMMARY_GL_LIST) + set(SUMMARY_GL OFF) +else() + string(REPLACE ";" ", " SUMMARY_GL "${SUMMARY_GL_LIST}") +endif() +if(USE_LIBZIP) + set(SUMMARY_ZIP libzip) +elseif(USE_ZLIB) + set(SUMMARY_ZIP minizip) +else() + set(SUMMARY_ZIP OFF) +endif() + +message(STATUS "Features:") message(STATUS " CLI debugger: ${USE_CLI_DEBUGGER}") message(STATUS " GDB stub: ${USE_GDB_STUB}") message(STATUS " Video recording: ${USE_FFMPEG}") message(STATUS " GIF recording: ${USE_MAGICK}") message(STATUS " Screenshot/advanced savestate support: ${USE_PNG}") +message(STATUS " ZIP support: ${SUMMARY_ZIP}") message(STATUS " 7-Zip support: ${USE_LZMA}") message(STATUS " Better audio resampling: ${USE_BLIP}") -message(STATUS "Frontend summary:") +message(STATUS " OpenGL support: ${SUMMARY_GL}") +message(STATUS "Frontends:") message(STATUS " Qt: ${BUILD_QT}") message(STATUS " SDL (${SDL_VERSION}): ${BUILD_SDL}") -message(STATUS " Libretro core: ${BUILD_LIBRETRO}") message(STATUS " Profiling: ${BUILD_PERF}") message(STATUS " Test harness: ${BUILD_TEST}") -message(STATUS "Library summary:") +message(STATUS "Cores:") +message(STATUS " Libretro core: ${BUILD_LIBRETRO}") +if(APPLE) + message(STATUS " OpenEmu core: ${BUILD_OPENEMU}") +endif() +message(STATUS "Libraries:") message(STATUS " Static: ${BUILD_STATIC}") message(STATUS " Shared: ${BUILD_SHARED}")