all repos — mgba @ 9914fcbb2b0dfc775e2f254080aef5676046473c

mGBA Game Boy Advance Emulator

All: Ability to disable dependencies, forced on platforms which require it
Jeffrey Pfau jeffrey@endrift.com
Thu, 27 Aug 2015 01:46:51 -0700
commit

9914fcbb2b0dfc775e2f254080aef5676046473c

parent

fee9fc688f6ddb9b7abac63044c3799279d61db4

1 files changed, 60 insertions(+), 37 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -23,6 +23,7 @@ set(BUILD_STATIC OFF CACHE BOOL "Build a static library")

set(BUILD_SHARED ON CACHE BOOL "Build a shared library") set(BUILD_GL ON CACHE STRING "Build with OpenGL") set(BUILD_GLES2 OFF CACHE STRING "Build with OpenGL|ES 2") +set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies") file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c) file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c) file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c)

@@ -62,6 +63,10 @@ # Function definitions

include(FindPkgConfig) function(find_feature FEATURE_NAME FEATURE_REQUIRES) if (NOT ${FEATURE_NAME}) + return() + endif() + if (DISABLE_DEPS) + set(${FEATURE_NAME} OFF PARENT_SCOPE) return() endif() foreach(REQUIRE ${FEATURE_REQUIRES})

@@ -119,34 +124,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PGO_POST_FLAGS}")

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_POST_FLAGS}") endif() -# Feature dependencies -set(FEATURES) -if(CMAKE_SYSTEM_NAME MATCHES .*BSD) - set(LIBEDIT_LIBRARIES -ledit) - if (CMAKE_SYSTEM_NAME STREQUAL OpenBSD) - list(APPEND LIBEDIT_LIBRARIES -ltermcap) - endif() -else() - find_feature(USE_CLI_DEBUGGER "libedit") -endif() -if(BUILD_GL) - find_package(OpenGL QUIET) - if(NOT OPENGL_FOUND) - set(BUILD_GL OFF CACHE BOOL "OpenGL not found" FORCE) - endif() -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() -find_feature(USE_FFMPEG "libavcodec;libavformat;libavresample;libavutil;libswscale") -find_feature(USE_PNG "ZLIB;PNG") -find_feature(USE_LIBZIP "libzip") -find_feature(USE_MAGICK "MagickWand") - # Platform support if(WIN32) set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}")

@@ -237,17 +214,22 @@

include(CheckFunctionExists) check_function_exists(strdup HAVE_STRDUP) check_function_exists(strndup HAVE_STRNDUP) -check_function_exists(snprintf_l HAVE_SNPRINTF_L) -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # The strtof_l on Linux not actually exposed nor actually strtof_l - set(HAVE_STRTOF_L OFF) +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + check_function_exists(snprintf_l HAVE_SNPRINTF_L) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # The strtof_l on Linux not actually exposed nor actually strtof_l + set(HAVE_STRTOF_L OFF) + else() + check_function_exists(strtof_l HAVE_STRTOF_L) + endif() + check_function_exists(newlocale HAVE_NEWLOCALE) + check_function_exists(freelocale HAVE_FREELOCALE) + check_function_exists(uselocale HAVE_USELOCALE) + check_function_exists(setlocale HAVE_SETLOCALE) else() - check_function_exists(strtof_l HAVE_STRTOF_L) + set(DISABLE_DEPS ON CACHE BOOL "PS Vita cannot build with dependencies" FORCE) + set(DISABLE_FRONTENDS ON) endif() -check_function_exists(newlocale HAVE_NEWLOCALE) -check_function_exists(freelocale HAVE_FREELOCALE) -check_function_exists(uselocale HAVE_USELOCALE) -check_function_exists(setlocale HAVE_SETLOCALE) if(HAVE_STRDUP) add_definitions(-DHAVE_STRDUP)

@@ -271,10 +253,46 @@ if(HAVE_SETLOCALE)

add_definitions(-DHAVE_SETLOCALE) endif() +if(DISABLE_DEPS) +endif() + +# Feature dependencies +set(FEATURES) +if(CMAKE_SYSTEM_NAME MATCHES .*BSD) + set(LIBEDIT_LIBRARIES -ledit) + if (CMAKE_SYSTEM_NAME STREQUAL OpenBSD) + list(APPEND LIBEDIT_LIBRARIES -ltermcap) + endif() +else() + find_feature(USE_CLI_DEBUGGER "libedit") +endif() +if(BUILD_GL) + find_package(OpenGL QUIET) + if(NOT OPENGL_FOUND) + set(BUILD_GL OFF CACHE BOOL "OpenGL not found" FORCE) + endif() +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() +find_feature(USE_FFMPEG "libavcodec;libavformat;libavresample;libavutil;libswscale") +find_feature(USE_PNG "ZLIB;PNG") +find_feature(USE_LIBZIP "libzip") +find_feature(USE_MAGICK "MagickWand") + # Features set(DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/debugger.c ${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c) set(FEATURE_SRC) set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6") + +if(DISABLE_DEPS) + set(USE_LZMA OFF) + set(USE_GDB_STUB OFF) +endif() if(USE_CLI_DEBUGGER) list(APPEND FEATURES CLI_DEBUGGER)

@@ -450,6 +468,11 @@ endif()

if(BUILD_GLES2) add_definitions(-DBUILD_GLES2) +endif() + +if(DISABLE_FRONTENDS) + set(BUILD_SDL OFF) + set(BUILD_QT OFF) endif() if(BUILD_LIBRETRO)