diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7858d0450..166024844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modul include(DownloadExternals) include(CMakeDependentOption) include(CTest) -include(FetchContent) # Set bundled sdl2/qt as dependent options. # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON @@ -49,6 +48,8 @@ option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}") option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) +option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON) + CMAKE_DEPENDENT_OPTION(YUZU_ROOM "Compile LDN room server" ON "NOT ANDROID" OFF) CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) @@ -61,6 +62,8 @@ option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF) option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" OFF) +option(YUZU_ENABLE_PORTABLE "Allow yuzu to enable portable mode if a user folder is found in the CWD" ON) + CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) @@ -77,47 +80,26 @@ if (ANDROID OR WIN32 OR APPLE) endif() option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL}) -# On Android, fetch and compile libcxx before doing anything else +if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL) + set(vvl_version "sdk-1.3.261.1") + set(vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android.zip") + if (NOT EXISTS "${vvl_zip_file}") + # Download and extract validation layer release to externals directory + set(vvl_base_url "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download") + file(DOWNLOAD "${vvl_base_url}/${vvl_version}/android-binaries-${vvl_version}-android.zip" + "${vvl_zip_file}" SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${vvl_zip_file}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals") + endif() + + # Copy the arm64 binary to src/android/app/main/jniLibs + set(vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/arm64-v8a/") + file(COPY "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}/arm64-v8a/libVkLayer_khronos_validation.so" + DESTINATION "${vvl_lib_path}") +endif() + if (ANDROID) set(CMAKE_SKIP_INSTALL_RULES ON) - set(LLVM_VERSION "15.0.6") - - # Note: even though libcxx and libcxxabi have separate releases on the project page, - # the separated releases cannot be compiled. Only in-tree builds work. Therefore we - # must fetch the source release for the entire llvm tree. - FetchContent_Declare(llvm - URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz" - URL_HASH SHA256=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 - TLS_VERIFY TRUE - ) - FetchContent_MakeAvailable(llvm) - - # libcxx has support for most of the range library, but it's gated behind a flag: - add_compile_definitions(_LIBCPP_ENABLE_EXPERIMENTAL) - - # Disable standard header inclusion - set(ANDROID_STL "none") - - # libcxxabi - set(LIBCXXABI_INCLUDE_TESTS OFF) - set(LIBCXXABI_ENABLE_SHARED FALSE) - set(LIBCXXABI_ENABLE_STATIC TRUE) - set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXX_TARGET_INCLUDE_DIRECTORY}" CACHE STRING "" FORCE) - add_subdirectory("${llvm_SOURCE_DIR}/libcxxabi" "${llvm_BINARY_DIR}/libcxxabi") - link_libraries(cxxabi_static) - - # libcxx - set(LIBCXX_ABI_NAMESPACE "__ndk1" CACHE STRING "" FORCE) - set(LIBCXX_CXX_ABI "libcxxabi") - set(LIBCXX_INCLUDE_TESTS OFF) - set(LIBCXX_INCLUDE_BENCHMARKS OFF) - set(LIBCXX_INCLUDE_DOCS OFF) - set(LIBCXX_ENABLE_SHARED FALSE) - set(LIBCXX_ENABLE_STATIC TRUE) - set(LIBCXX_ENABLE_ASSERTIONS FALSE) - add_subdirectory("${llvm_SOURCE_DIR}/libcxx" "${llvm_BINARY_DIR}/libcxx") - set_target_properties(cxx-headers PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem${CMAKE_BINARY_DIR}/${LIBCXX_INSTALL_INCLUDE_DIR}") - link_libraries(cxx_static cxx-headers) endif() if (YUZU_USE_BUNDLED_VCPKG) @@ -307,10 +289,11 @@ find_package(Boost 1.79.0 REQUIRED context) find_package(enet 1.3 MODULE) find_package(fmt 9 REQUIRED) find_package(inih 52 MODULE COMPONENTS INIReader) -find_package(LLVM 17 MODULE COMPONENTS Demangle) +find_package(LLVM 17.0.2 MODULE COMPONENTS Demangle) find_package(lz4 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED) find_package(Opus 1.3 MODULE) +find_package(RenderDoc MODULE) find_package(VulkanMemoryAllocator CONFIG) find_package(ZLIB 1.2 REQUIRED) find_package(zstd 1.5 REQUIRED) @@ -377,6 +360,9 @@ function(set_yuzu_qt_components) if (ENABLE_QT_TRANSLATION) list(APPEND YUZU_QT_COMPONENTS2 LinguistTools) endif() + if (USE_DISCORD_PRESENCE) + list(APPEND YUZU_QT_COMPONENTS2 Network) + endif() set(YUZU_QT_COMPONENTS ${YUZU_QT_COMPONENTS2} PARENT_SCOPE) endfunction(set_yuzu_qt_components) @@ -524,7 +510,7 @@ if (ENABLE_SDL2) if (YUZU_USE_BUNDLED_SDL2) # Detect toolchain and platform if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) - set(SDL2_VER "SDL2-2.28.1") + set(SDL2_VER "SDL2-2.28.2") else() message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") endif() |