mirror of https://github.com/mgba-emu/mgba.git
All: Ability to disable dependencies, forced on platforms which require it
This commit is contained in:
parent
fee9fc688f
commit
9914fcbb2b
|
@ -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_SHARED ON CACHE BOOL "Build a shared library")
|
||||||
set(BUILD_GL ON CACHE STRING "Build with OpenGL")
|
set(BUILD_GL ON CACHE STRING "Build with OpenGL")
|
||||||
set(BUILD_GLES2 OFF CACHE STRING "Build with OpenGL|ES 2")
|
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 ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c)
|
||||||
file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c)
|
file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c)
|
||||||
file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c)
|
file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c)
|
||||||
|
@ -64,6 +65,10 @@ function(find_feature FEATURE_NAME FEATURE_REQUIRES)
|
||||||
if (NOT ${FEATURE_NAME})
|
if (NOT ${FEATURE_NAME})
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
if (DISABLE_DEPS)
|
||||||
|
set(${FEATURE_NAME} OFF PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
foreach(REQUIRE ${FEATURE_REQUIRES})
|
foreach(REQUIRE ${FEATURE_REQUIRES})
|
||||||
if(NOT ${REQUIRE}_FOUND)
|
if(NOT ${REQUIRE}_FOUND)
|
||||||
find_package(${REQUIRE} QUIET)
|
find_package(${REQUIRE} QUIET)
|
||||||
|
@ -119,34 +124,6 @@ elseif(BUILD_PGO AND PGO_STAGE_2)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_POST_FLAGS}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_POST_FLAGS}")
|
||||||
endif()
|
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
|
# Platform support
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}")
|
set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}")
|
||||||
|
@ -237,17 +214,22 @@ endif()
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
check_function_exists(strdup HAVE_STRDUP)
|
check_function_exists(strdup HAVE_STRDUP)
|
||||||
check_function_exists(strndup HAVE_STRNDUP)
|
check_function_exists(strndup HAVE_STRNDUP)
|
||||||
check_function_exists(snprintf_l HAVE_SNPRINTF_L)
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
check_function_exists(snprintf_l HAVE_SNPRINTF_L)
|
||||||
# The strtof_l on Linux not actually exposed nor actually strtof_l
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(HAVE_STRTOF_L OFF)
|
# 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()
|
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()
|
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)
|
if(HAVE_STRDUP)
|
||||||
add_definitions(-DHAVE_STRDUP)
|
add_definitions(-DHAVE_STRDUP)
|
||||||
|
@ -271,11 +253,47 @@ if(HAVE_SETLOCALE)
|
||||||
add_definitions(-DHAVE_SETLOCALE)
|
add_definitions(-DHAVE_SETLOCALE)
|
||||||
endif()
|
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
|
# Features
|
||||||
set(DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/debugger.c ${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c)
|
set(DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/debugger.c ${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c)
|
||||||
set(FEATURE_SRC)
|
set(FEATURE_SRC)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
|
||||||
|
|
||||||
|
if(DISABLE_DEPS)
|
||||||
|
set(USE_LZMA OFF)
|
||||||
|
set(USE_GDB_STUB OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(USE_CLI_DEBUGGER)
|
if(USE_CLI_DEBUGGER)
|
||||||
list(APPEND FEATURES CLI_DEBUGGER)
|
list(APPEND FEATURES CLI_DEBUGGER)
|
||||||
list(APPEND FEATURE_SRC ${CMAKE_SOURCE_DIR}/src/debugger/cli-debugger.c)
|
list(APPEND FEATURE_SRC ${CMAKE_SOURCE_DIR}/src/debugger/cli-debugger.c)
|
||||||
|
@ -452,6 +470,11 @@ if(BUILD_GLES2)
|
||||||
add_definitions(-DBUILD_GLES2)
|
add_definitions(-DBUILD_GLES2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(DISABLE_FRONTENDS)
|
||||||
|
set(BUILD_SDL OFF)
|
||||||
|
set(BUILD_QT OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_LIBRETRO)
|
if(BUILD_LIBRETRO)
|
||||||
file(GLOB RETRO_SRC ${CMAKE_SOURCE_DIR}/src/platform/libretro/*.c)
|
file(GLOB RETRO_SRC ${CMAKE_SOURCE_DIR}/src/platform/libretro/*.c)
|
||||||
add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})
|
add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})
|
||||||
|
|
Loading…
Reference in New Issue