diff options
| -rw-r--r-- | CMakeLists.txt | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7276ac9dd..bcd88784b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -11,6 +11,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modul | |||
| 11 | include(DownloadExternals) | 11 | include(DownloadExternals) |
| 12 | include(CMakeDependentOption) | 12 | include(CMakeDependentOption) |
| 13 | include(CTest) | 13 | include(CTest) |
| 14 | include(FetchContent) | ||
| 14 | 15 | ||
| 15 | # Set bundled sdl2/qt as dependent options. | 16 | # Set bundled sdl2/qt as dependent options. |
| 16 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON | 17 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON |
| @@ -19,7 +20,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON | |||
| 19 | # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion | 20 | # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion |
| 20 | CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF) | 21 | CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF) |
| 21 | 22 | ||
| 22 | option(ENABLE_LIBUSB "Enable the use of LibUSB" ON) | 23 | option(ENABLE_LIBUSB "Enable the use of LibUSB" "NOT ${ANDROID}") |
| 23 | 24 | ||
| 24 | option(ENABLE_OPENGL "Enable OpenGL" ON) | 25 | option(ENABLE_OPENGL "Enable OpenGL" ON) |
| 25 | mark_as_advanced(FORCE ENABLE_OPENGL) | 26 | mark_as_advanced(FORCE ENABLE_OPENGL) |
| @@ -48,7 +49,7 @@ option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}") | |||
| 48 | 49 | ||
| 49 | option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) | 50 | option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) |
| 50 | 51 | ||
| 51 | option(YUZU_ROOM "Compile LDN room server" ON) | 52 | option(YUZU_ROOM "Compile LDN room server" "NOT ${ANDROID}") |
| 52 | 53 | ||
| 53 | CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) | 54 | CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) |
| 54 | 55 | ||
| @@ -60,7 +61,56 @@ option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF) | |||
| 60 | 61 | ||
| 61 | CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) | 62 | CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) |
| 62 | 63 | ||
| 64 | # On Android, fetch and compile libcxx before doing anything else | ||
| 65 | if (ANDROID) | ||
| 66 | set(CMAKE_SKIP_INSTALL_RULES ON) | ||
| 67 | set(LLVM_VERSION "15.0.6") | ||
| 68 | |||
| 69 | # Note: even though libcxx and libcxxabi have separate releases on the project page, | ||
| 70 | # the separated releases cannot be compiled. Only in-tree builds work. Therefore we | ||
| 71 | # must fetch the source release for the entire llvm tree. | ||
| 72 | FetchContent_Declare(llvm | ||
| 73 | URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz" | ||
| 74 | URL_HASH SHA256=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 | ||
| 75 | TLS_VERIFY TRUE | ||
| 76 | ) | ||
| 77 | FetchContent_MakeAvailable(llvm) | ||
| 78 | |||
| 79 | # libcxx has support for most of the range library, but it's gated behind a flag: | ||
| 80 | add_compile_definitions(_LIBCPP_ENABLE_EXPERIMENTAL) | ||
| 81 | |||
| 82 | # Disable standard header inclusion | ||
| 83 | set(ANDROID_STL "none") | ||
| 84 | |||
| 85 | # libcxxabi | ||
| 86 | set(LIBCXXABI_INCLUDE_TESTS OFF) | ||
| 87 | set(LIBCXXABI_ENABLE_SHARED FALSE) | ||
| 88 | set(LIBCXXABI_ENABLE_STATIC TRUE) | ||
| 89 | set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXX_TARGET_INCLUDE_DIRECTORY}" CACHE STRING "" FORCE) | ||
| 90 | add_subdirectory("${llvm_SOURCE_DIR}/libcxxabi" "${llvm_BINARY_DIR}/libcxxabi") | ||
| 91 | link_libraries(cxxabi_static) | ||
| 92 | |||
| 93 | # libcxx | ||
| 94 | set(LIBCXX_ABI_NAMESPACE "__ndk1" CACHE STRING "" FORCE) | ||
| 95 | set(LIBCXX_CXX_ABI "libcxxabi") | ||
| 96 | set(LIBCXX_INCLUDE_TESTS OFF) | ||
| 97 | set(LIBCXX_INCLUDE_BENCHMARKS OFF) | ||
| 98 | set(LIBCXX_INCLUDE_DOCS OFF) | ||
| 99 | set(LIBCXX_ENABLE_SHARED FALSE) | ||
| 100 | set(LIBCXX_ENABLE_STATIC TRUE) | ||
| 101 | set(LIBCXX_ENABLE_ASSERTIONS FALSE) | ||
| 102 | add_subdirectory("${llvm_SOURCE_DIR}/libcxx" "${llvm_BINARY_DIR}/libcxx") | ||
| 103 | set_target_properties(cxx-headers PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem${CMAKE_BINARY_DIR}/${LIBCXX_INSTALL_INCLUDE_DIR}") | ||
| 104 | link_libraries(cxx_static cxx-headers) | ||
| 105 | endif() | ||
| 106 | |||
| 63 | if (YUZU_USE_BUNDLED_VCPKG) | 107 | if (YUZU_USE_BUNDLED_VCPKG) |
| 108 | if (ANDROID) | ||
| 109 | set(VCPKG_TARGET_TRIPLET "arm64-android") | ||
| 110 | set(ENV{ANDROID_NDK_HOME} "${ANDROID_NDK}") | ||
| 111 | list(APPEND VCPKG_MANIFEST_FEATURES "android") | ||
| 112 | endif() | ||
| 113 | |||
| 64 | if (YUZU_TESTS) | 114 | if (YUZU_TESTS) |
| 65 | list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests") | 115 | list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests") |
| 66 | endif() | 116 | endif() |
| @@ -457,7 +507,7 @@ set(FFmpeg_COMPONENTS | |||
| 457 | avutil | 507 | avutil |
| 458 | swscale) | 508 | swscale) |
| 459 | 509 | ||
| 460 | if (UNIX AND NOT APPLE) | 510 | if (UNIX AND NOT APPLE AND NOT ANDROID) |
| 461 | find_package(PkgConfig REQUIRED) | 511 | find_package(PkgConfig REQUIRED) |
| 462 | pkg_check_modules(LIBVA libva) | 512 | pkg_check_modules(LIBVA libva) |
| 463 | endif() | 513 | endif() |