diff options
Diffstat (limited to 'externals')
-rw-r--r-- | externals/CMakeLists.txt | 48 | ||||
-rw-r--r-- | externals/ffmpeg/CMakeLists.txt | 75 | ||||
-rw-r--r-- | externals/glad/CMakeLists.txt | 2 | ||||
m--------- | externals/libadrenotools | 0 | ||||
-rw-r--r-- | externals/libusb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | externals/microprofile/microprofile.h | 8 | ||||
-rw-r--r-- | externals/opus/CMakeLists.txt | 2 | ||||
m--------- | externals/vcpkg | 0 |
8 files changed, 104 insertions, 33 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index e59eeb489..500eb21e3 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -8,15 +8,21 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # Disable tests in all externals supporting the standard option name set(BUILD_TESTING OFF) +# Build only static externals +set(BUILD_SHARED_LIBS OFF) + +# Skip install rules for all externals +set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) + # xbyak if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak) - add_subdirectory(xbyak EXCLUDE_FROM_ALL) + add_subdirectory(xbyak) endif() # Dynarmic if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmic) set(DYNARMIC_IGNORE_ASSERTS ON) - add_subdirectory(dynarmic EXCLUDE_FROM_ALL) + add_subdirectory(dynarmic) add_library(dynarmic::dynarmic ALIAS dynarmic) endif() @@ -34,7 +40,7 @@ if (NOT TARGET inih::INIReader) endif() # mbedtls -add_subdirectory(mbedtls EXCLUDE_FROM_ALL) +add_subdirectory(mbedtls) target_include_directories(mbedtls PUBLIC ./mbedtls/include) # MicroProfile @@ -48,7 +54,7 @@ endif() # libusb if (ENABLE_LIBUSB AND NOT TARGET libusb::usb) - add_subdirectory(libusb EXCLUDE_FROM_ALL) + add_subdirectory(libusb) endif() # SDL2 @@ -67,18 +73,16 @@ if (YUZU_USE_EXTERNAL_SDL2) set(HIDAPI ON) endif() - set(SDL_STATIC ON) - set(SDL_SHARED OFF) if (APPLE) set(SDL_FILE ON) endif() - add_subdirectory(SDL EXCLUDE_FROM_ALL) + add_subdirectory(SDL) endif() # ENet if (NOT TARGET enet::enet) - add_subdirectory(enet EXCLUDE_FROM_ALL) + add_subdirectory(enet) target_include_directories(enet INTERFACE ./enet/include) add_library(enet::enet ALIAS enet) endif() @@ -86,24 +90,26 @@ endif() # Cubeb if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb) set(BUILD_TESTS OFF) - add_subdirectory(cubeb EXCLUDE_FROM_ALL) + set(BUILD_TOOLS OFF) + add_subdirectory(cubeb) add_library(cubeb::cubeb ALIAS cubeb) endif() # DiscordRPC if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc) - add_subdirectory(discord-rpc EXCLUDE_FROM_ALL) + set(BUILD_EXAMPLES OFF) + add_subdirectory(discord-rpc) target_include_directories(discord-rpc INTERFACE ./discord-rpc/include) add_library(DiscordRPC::discord-rpc ALIAS discord-rpc) endif() # Sirit -add_subdirectory(sirit EXCLUDE_FROM_ALL) +add_subdirectory(sirit) # httplib if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib) set(HTTPLIB_REQUIRE_OPENSSL ON) - add_subdirectory(cpp-httplib EXCLUDE_FROM_ALL) + add_subdirectory(cpp-httplib) endif() # cpp-jwt @@ -111,12 +117,12 @@ if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt) set(CPP_JWT_BUILD_EXAMPLES OFF) set(CPP_JWT_BUILD_TESTS OFF) set(CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF) - add_subdirectory(cpp-jwt EXCLUDE_FROM_ALL) + add_subdirectory(cpp-jwt) endif() # Opus if (NOT TARGET Opus::opus) - add_subdirectory(opus EXCLUDE_FROM_ALL) + add_subdirectory(opus) endif() # FFMpeg @@ -130,16 +136,20 @@ endif() # Vulkan-Headers if (YUZU_USE_EXTERNAL_VULKAN_HEADERS) - add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL) + add_subdirectory(Vulkan-Headers) endif() if (NOT TARGET LLVM::Demangle) - add_library(demangle STATIC) + add_library(demangle demangle/ItaniumDemangle.cpp) target_include_directories(demangle PUBLIC ./demangle) - target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp) add_library(LLVM::Demangle ALIAS demangle) endif() -add_library(stb STATIC) +add_library(stb stb/stb_dxt.cpp) target_include_directories(stb PUBLIC ./stb) -target_sources(stb PRIVATE stb/stb_dxt.cpp) + +if (ANDROID) + if (ARCHITECTURE_arm64) + add_subdirectory(libadrenotools) + endif() +endif() diff --git a/externals/ffmpeg/CMakeLists.txt b/externals/ffmpeg/CMakeLists.txt index 0baac8e17..0a926e399 100644 --- a/externals/ffmpeg/CMakeLists.txt +++ b/externals/ffmpeg/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2021 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -if (NOT WIN32) +if (NOT WIN32 AND NOT ANDROID) # Build FFmpeg from externals message(STATUS "Using FFmpeg from externals") @@ -44,10 +44,12 @@ if (NOT WIN32) endforeach() find_package(PkgConfig REQUIRED) - pkg_check_modules(LIBVA libva) - pkg_check_modules(CUDA cuda) - pkg_check_modules(FFNVCODEC ffnvcodec) - pkg_check_modules(VDPAU vdpau) + if (NOT ANDROID) + pkg_check_modules(LIBVA libva) + pkg_check_modules(CUDA cuda) + pkg_check_modules(FFNVCODEC ffnvcodec) + pkg_check_modules(VDPAU vdpau) + endif() set(FFmpeg_HWACCEL_LIBRARIES) set(FFmpeg_HWACCEL_FLAGS) @@ -121,6 +123,26 @@ if (NOT WIN32) list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau) endif() + find_program(BASH_PROGRAM bash REQUIRED) + + set(FFmpeg_CROSS_COMPILE_FLAGS "") + if (ANDROID) + string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" FFmpeg_HOST_SYSTEM_NAME) + set(TOOLCHAIN "${ANDROID_NDK}/toolchains/llvm/prebuilt/${FFmpeg_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(SYSROOT "${TOOLCHAIN}/sysroot") + set(FFmpeg_CPU "armv8-a") + list(APPEND FFmpeg_CROSS_COMPILE_FLAGS + --arch=arm64 + #--cpu=${FFmpeg_CPU} + --enable-cross-compile + --cross-prefix=${TOOLCHAIN}/bin/aarch64-linux-android- + --sysroot=${SYSROOT} + --target-os=android + --extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld" + --extra-ldflags="-nostdlib" + ) + endif() + # `configure` parameters builds only exactly what yuzu needs from FFmpeg # `--disable-vdpau` is needed to avoid linking issues set(FFmpeg_CC ${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}) @@ -129,9 +151,8 @@ if (NOT WIN32) OUTPUT ${FFmpeg_MAKEFILE} COMMAND - /bin/bash ${FFmpeg_PREFIX}/configure + ${BASH_PROGRAM} ${FFmpeg_PREFIX}/configure --disable-avdevice - --disable-avfilter --disable-avformat --disable-doc --disable-everything @@ -143,15 +164,18 @@ if (NOT WIN32) --enable-decoder=h264 --enable-decoder=vp8 --enable-decoder=vp9 + --enable-filter=yadif --cc="${FFmpeg_CC}" --cxx="${FFmpeg_CXX}" ${FFmpeg_HWACCEL_FLAGS} + ${FFmpeg_CROSS_COMPILE_FLAGS} WORKING_DIRECTORY ${FFmpeg_BUILD_DIR} ) unset(FFmpeg_CC) unset(FFmpeg_CXX) unset(FFmpeg_HWACCEL_FLAGS) + unset(FFmpeg_CROSS_COMPILE_FLAGS) # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child # with context of the jobserver. Also helps ninja users. @@ -197,19 +221,50 @@ if (NOT WIN32) else() message(FATAL_ERROR "FFmpeg not found") endif() -else(WIN32) +elseif(ANDROID) + # Use yuzu FFmpeg binaries + if (ARCHITECTURE_arm64) + set(FFmpeg_EXT_NAME "ffmpeg-android-v5.1.LTS-aarch64") + elseif (ARCHITECTURE_x86_64) + set(FFmpeg_EXT_NAME "ffmpeg-android-v5.1.LTS-x86_64") + else() + message(FATAL_ERROR "Unsupported architecture for Android FFmpeg") + endif() + set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}") + download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "") + set(FFmpeg_FOUND YES) + set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) + set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/lib" CACHE PATH "Path to FFmpeg library directory" FORCE) + set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE) + set(FFmpeg_LIBRARIES + ${FFmpeg_LIBRARY_DIR}/libavcodec.so + ${FFmpeg_LIBRARY_DIR}/libavdevice.so + ${FFmpeg_LIBRARY_DIR}/libavfilter.so + ${FFmpeg_LIBRARY_DIR}/libavformat.so + ${FFmpeg_LIBRARY_DIR}/libavutil.so + ${FFmpeg_LIBRARY_DIR}/libswresample.so + ${FFmpeg_LIBRARY_DIR}/libswscale.so + ${FFmpeg_LIBRARY_DIR}/libvpx.a + ${FFmpeg_LIBRARY_DIR}/libx264.a + CACHE PATH "Paths to FFmpeg libraries" FORCE) + # exported variables + set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE) + set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE) + set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) + set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE) +elseif(WIN32) # Use yuzu FFmpeg binaries - set(FFmpeg_EXT_NAME "ffmpeg-4.4") + set(FFmpeg_EXT_NAME "ffmpeg-5.1.3") set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}") download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "") set(FFmpeg_FOUND YES) set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE) set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE) - set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE) set(FFmpeg_LIBRARIES ${FFmpeg_LIBRARY_DIR}/swscale.lib ${FFmpeg_LIBRARY_DIR}/avcodec.lib + ${FFmpeg_LIBRARY_DIR}/avfilter.lib ${FFmpeg_LIBRARY_DIR}/avutil.lib CACHE PATH "Paths to FFmpeg libraries" FORCE) # exported variables diff --git a/externals/glad/CMakeLists.txt b/externals/glad/CMakeLists.txt index 3dfcac2fd..0c8e285a4 100644 --- a/externals/glad/CMakeLists.txt +++ b/externals/glad/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2015 Yuri Kunde Schlesner <yuriks@yuriks.net> # SPDX-License-Identifier: GPL-2.0-or-later -add_library(glad STATIC +add_library(glad src/glad.c include/KHR/khrplatform.h include/glad/glad.h diff --git a/externals/libadrenotools b/externals/libadrenotools new file mode 160000 +Subproject 5cd3f5c5ceea6d9e9d435ccdd922d9b99e55d10 diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt index 6317ea807..6757b59da 100644 --- a/externals/libusb/CMakeLists.txt +++ b/externals/libusb/CMakeLists.txt @@ -122,7 +122,7 @@ else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_compile_options(/utf-8) endif() - add_library(usb STATIC EXCLUDE_FROM_ALL + add_library(usb libusb/libusb/core.c libusb/libusb/core.c libusb/libusb/descriptor.c diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index 639f3618c..8f75a25aa 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -1697,7 +1697,13 @@ void MicroProfileFlip() { int nTimer = MicroProfileLogTimerIndex(LE); uint8_t nGroup = pTimerToGroup[nTimer]; - MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); + + // To avoid crashing due to OOB memory accesses/asserts + // simply skip this iteration + // MP_ASSERT(nStackPos < MICROPROFILE_STACK_MAX); + if (nStackPos >= MICROPROFILE_STACK_MAX) { + break; + } MP_ASSERT(nGroup < MICROPROFILE_MAX_GROUPS); pGroupStackPos[nGroup]++; pStack[nStackPos++] = k; diff --git a/externals/opus/CMakeLists.txt b/externals/opus/CMakeLists.txt index 410ff7c08..d9a03423d 100644 --- a/externals/opus/CMakeLists.txt +++ b/externals/opus/CMakeLists.txt @@ -23,7 +23,7 @@ else() endif() endif() -add_library(opus STATIC +add_library(opus # CELT sources opus/celt/bands.c opus/celt/celt.c diff --git a/externals/vcpkg b/externals/vcpkg -Subproject a7b6122f6b6504d16d96117336a056269357993 +Subproject 656fcc6ab2b05c6d999b7eaca717027ac3738f7 |