WIP: [cmake, doc] update CMake/docs for macOS #310
8 changed files with 140 additions and 79 deletions
123
CMakeLists.txt
123
CMakeLists.txt
|
@ -75,7 +75,9 @@ option(ENABLE_WIFI_SCAN "Enable WiFi scanning" OFF)
|
|||
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ${EXT_DEFAULT})
|
||||
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ${EXT_DEFAULT})
|
||||
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ${EXT_DEFAULT})
|
||||
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ${EXT_DEFAULT})
|
||||
|
||||
# I hate Apple with a burning passion
|
||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ${EXT_DEFAULT} "NOT APPLE" ON)
|
||||
|
||||
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
|
||||
|
||||
|
@ -437,10 +439,33 @@ if (YUZU_USE_CPM)
|
|||
endif()
|
||||
|
||||
# zstd
|
||||
AddJsonPackage(zstd)
|
||||
AddPackage(
|
||||
NAME zstd
|
||||
REPO facebook/zstd
|
||||
SHA f8745da6ff
|
||||
HASH 3037007f990040fe32573b46f9bef8762fd5dbeeb07ffffcbfeba51ec98167edae39bb9c87f9299efcd61c4e467c5e84f7c19f0df7799bc1fc04864a278792ee
|
||||
VERSION 1.5
|
||||
SOURCE_SUBDIR build/cmake
|
||||
FIND_PACKAGE_ARGUMENTS "MODULE"
|
||||
OPTIONS
|
||||
"ZSTD_BUILD_SHARED OFF"
|
||||
"ZSTD_BUILD_STATIC ON"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
BUNDLED_PACKAGE ${APPLE}
|
||||
)
|
||||
|
||||
if (zstd_ADDED)
|
||||
add_library(zstd::zstd ALIAS libzstd_static)
|
||||
if (zstd_ADDED AND NOT TARGET zstd::zstd)
|
||||
if (TARGET zstd::libzstd_shared)
|
||||
add_library(zstd::zstd ALIAS zstd::libzstd_shared)
|
||||
elseif (TARGET zstd::libzstd_static)
|
||||
add_library(zstd::zstd ALIAS zstd::libzstd_static)
|
||||
elseif (TARGET libzstd_shared)
|
||||
add_library(zstd::zstd ALIAS libzstd_shared)
|
||||
elseif (TARGET libzstd_static)
|
||||
add_library(zstd::zstd ALIAS libzstd_static)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not determine zstd target")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Catch2
|
||||
|
@ -456,7 +481,62 @@ if (YUZU_USE_CPM)
|
|||
endif()
|
||||
|
||||
# Opus
|
||||
AddJsonPackage(opus)
|
||||
AddPackage(
|
||||
NAME Opus
|
||||
VERSION 1.3
|
||||
REPO "xiph/opus"
|
||||
SHA 5ded705cf4
|
||||
HASH 0dc89e58ddda1f3bc6a7037963994770c5806c10e66f5cc55c59286fc76d0544fe4eca7626772b888fd719f434bc8a92f792bdb350c807968b2ac14cfc04b203
|
||||
FIND_PACKAGE_ARGUMENTS "MODULE"
|
||||
OPTIONS
|
||||
"OPUS_BUILD_TESTING OFF"
|
||||
"OPUS_BUILD_PROGRAMS OFF"
|
||||
"OPUS_INSTALL_PKG_CONFIG_MODULE OFF"
|
||||
"OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
)
|
||||
|
||||
if (Opus_ADDED AND NOT TARGET Opus::opus)
|
||||
add_library(Opus::opus ALIAS opus)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
AddPackage(
|
||||
NAME cubeb
|
||||
REPO "mozilla/cubeb"
|
||||
SHA fa02160712
|
||||
HASH 82d808356752e4064de48c8fecbe7856715ade1e76b53937116bf07129fc1cc5b3de5e4b408de3cd000187ba8dc32ca4109661cb7e0355a52e54bd81b9be1c61
|
||||
FIND_PACKAGE_ARGUMENTS "CONFIG" # not sure this works outside of gentoo
|
||||
OPTIONS
|
||||
"USE_SANITIZERS OFF"
|
||||
"BUILD_TESTS OFF"
|
||||
"BUILD_TOOLS OFF"
|
||||
"BUNDLE_SPEEX ON"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
)
|
||||
|
||||
if (cubeb_ADDED)
|
||||
if (NOT MSVC)
|
||||
if (TARGET speex)
|
||||
target_compile_options(speex PRIVATE -Wno-sign-compare)
|
||||
endif()
|
||||
|
||||
set_target_properties(cubeb PROPERTIES COMPILE_OPTIONS "")
|
||||
target_compile_options(cubeb INTERFACE
|
||||
-Wno-implicit-const-int-float-conversion
|
||||
-Wno-shadow
|
||||
-Wno-missing-declarations
|
||||
-Wno-return-type
|
||||
-Wno-uninitialized
|
||||
)
|
||||
else()
|
||||
target_compile_options(cubeb PRIVATE
|
||||
/wd4456
|
||||
/wd4458
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# Enforce the search mode of non-required packages for better and shorter failure messages
|
||||
find_package(fmt 8 REQUIRED)
|
||||
|
@ -470,6 +550,10 @@ else()
|
|||
find_package(ZLIB 1.2 REQUIRED)
|
||||
find_package(zstd 1.5 REQUIRED MODULE)
|
||||
|
||||
if (ENABLE_CUBEB)
|
||||
find_package(cubeb CONFIG)
|
||||
endif()
|
||||
|
||||
if (YUZU_TESTS)
|
||||
find_package(Catch2 3.0.1 REQUIRED)
|
||||
endif()
|
||||
|
@ -506,33 +590,6 @@ endif()
|
|||
# SimpleIni
|
||||
AddJsonPackage(simpleini)
|
||||
|
||||
# Most linux distros don't package cubeb, so enable regardless of cpm settings
|
||||
if(ENABLE_CUBEB)
|
||||
AddJsonPackage(cubeb)
|
||||
|
||||
if (cubeb_ADDED)
|
||||
if (NOT MSVC)
|
||||
if (TARGET speex)
|
||||
target_compile_options(speex PRIVATE -Wno-sign-compare)
|
||||
endif()
|
||||
|
||||
set_target_properties(cubeb PROPERTIES COMPILE_OPTIONS "")
|
||||
target_compile_options(cubeb INTERFACE
|
||||
-Wno-implicit-const-int-float-conversion
|
||||
-Wno-shadow
|
||||
-Wno-missing-declarations
|
||||
-Wno-return-type
|
||||
-Wno-uninitialized
|
||||
)
|
||||
else()
|
||||
target_compile_options(cubeb PRIVATE
|
||||
/wd4456
|
||||
/wd4458
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package
|
||||
if (ENABLE_SDL2)
|
||||
if (YUZU_USE_EXTERNAL_SDL2)
|
||||
|
@ -616,6 +673,8 @@ if (ENABLE_SDL2)
|
|||
find_package(SDL2)
|
||||
endif()
|
||||
|
||||
find_package(SPIRV-Tools)
|
||||
|
||||
if (ENABLE_QT)
|
||||
if (YUZU_USE_BUNDLED_QT)
|
||||
download_qt(6.8.3)
|
||||
|
|
40
docs/build/macOS.md
vendored
40
docs/build/macOS.md
vendored
|
@ -1,6 +1,6 @@
|
|||
Please note this article is intended for development, and eden on macOS is not currently ready for regular use.
|
||||
Please note this article is intended for development, and Eden on macOS is not currently ready for regular use.
|
||||
|
||||
This article was written for developers. eden support for macOS is not ready for casual use.
|
||||
This article was written for developers. Eden support for macOS is not ready for casual use.
|
||||
|
||||
## Method I: ninja
|
||||
---
|
||||
|
@ -14,30 +14,21 @@ brew install autoconf automake boost ccache ffmpeg fmt glslang hidapi libtool li
|
|||
Clone the repo
|
||||
```sh
|
||||
git clone --recursive https://git.eden-emu.dev/eden-emu/eden
|
||||
|
||||
cd eden
|
||||
```
|
||||
|
||||
Build for release
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
|
||||
export Qt6_DIR="/opt/homebrew/opt/qt@6/lib/cmake"
|
||||
|
||||
export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib
|
||||
|
||||
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON
|
||||
|
||||
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON
|
||||
ninja
|
||||
```
|
||||
|
||||
You may also want to include support for Discord Rich Presence by adding `-DUSE_DISCORD_PRESENCE=ON` after `cmake ..`
|
||||
|
||||
Build with debug symbols (vcpkg is not currently used due to broken boost-context library):
|
||||
You may also want to include support for Discord Rich Presence by adding `-DUSE_DISCORD_PRESENCE=ON`
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
export Qt6_DIR="/opt/homebrew/opt/qt@6/lib/cmake"
|
||||
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
|
||||
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
|
||||
ninja
|
||||
```
|
||||
|
||||
|
@ -59,30 +50,23 @@ brew install autoconf automake boost ccache ffmpeg fmt glslang hidapi libtool li
|
|||
Clone the repo
|
||||
```sh
|
||||
git clone --recursive https://git.eden-emu.dev/eden-emu/eden
|
||||
|
||||
cd eden
|
||||
```
|
||||
|
||||
Build for release
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
|
||||
export Qt6_DIR="/opt/homebrew/opt/qt@6/lib/cmake"
|
||||
|
||||
export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib
|
||||
|
||||
cmake .. -GXcode -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON
|
||||
|
||||
xcodebuild build -project eden.xcodeproj -scheme "eden" -configuration "RelWithDebInfo"
|
||||
# Only if having errors about Xcode 15.0
|
||||
sudo /usr/bin/xcode-select --switch /Users/admin/Downloads/Xcode.ap
|
||||
cmake -B build -GXcode -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=ON -DENABLE_LIBUSB=OFF -DCLANG_FORMAT=ON -DSDL2_DISABLE_INSTALL=ON -DSDL_ALTIVEC=ON
|
||||
xcodebuild build -project yuzu.xcodeproj -scheme "yuzu" -configuration "RelWithDebInfo"
|
||||
```
|
||||
|
||||
You may also want to include support for Discord Rich Presence by adding `-DUSE_DISCORD_PRESENCE=ON` after `cmake ..`
|
||||
|
||||
Build with debug symbols (vcpkg is not currently used due to broken boost-context library):
|
||||
Build with debug symbols:
|
||||
```sh
|
||||
mkdir build && cd build
|
||||
export Qt6_DIR="/opt/homebrew/opt/qt@6/lib/cmake"
|
||||
cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
|
||||
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF
|
||||
ninja
|
||||
```
|
||||
|
||||
|
@ -102,4 +86,4 @@ Run with Vulkan loader path:
|
|||
```sh
|
||||
export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib
|
||||
bin/eden.app/Contents/MacOS/eden
|
||||
```
|
||||
```
|
||||
|
|
39
externals/CMakeLists.txt
vendored
39
externals/CMakeLists.txt
vendored
|
@ -54,7 +54,15 @@ endif()
|
|||
add_subdirectory(glad)
|
||||
|
||||
# mbedtls
|
||||
AddJsonPackage(mbedtls)
|
||||
AddPackage(
|
||||
NAME mbedtls
|
||||
REPO "Mbed-TLS/mbedtls"
|
||||
SHA "8c88150ca1"
|
||||
HASH 769ad1e94c570671071e1f2a5c0f1027e0bf6bcdd1a80ea8ac970f2c86bc45ce4e31aa88d6d8110fc1bed1de81c48bc624df1b38a26f8b340a44e109d784a966
|
||||
PATCHES
|
||||
${CMAKE_SOURCE_DIR}/.patch/mbedtls/0001-cmake-version.patch
|
||||
BUNDLED_PACKAGE ON
|
||||
)
|
||||
|
||||
if (mbedtls_ADDED)
|
||||
target_include_directories(mbedtls PUBLIC ${mbedtls_SOURCE_DIR}/include)
|
||||
|
@ -72,9 +80,15 @@ if (ENABLE_LIBUSB AND NOT TARGET libusb::usb)
|
|||
endif()
|
||||
|
||||
# Sirit
|
||||
# TODO(crueter): spirv-tools doesn't work w/ system
|
||||
set(SPIRV_WERROR OFF)
|
||||
AddJsonPackage(spirv-headers)
|
||||
AddPackage(
|
||||
NAME SPIRV-Headers
|
||||
REPO "KhronosGroup/SPIRV-Headers"
|
||||
SHA 4e209d3d7e
|
||||
HASH f48bbe18341ed55ea0fe280dbbbc0a44bf222278de6e716e143ca1e95ca320b06d4d23d6583fbf8d03e1428f3dac8fa00e5b82ddcd6b425e6236d85af09550a4
|
||||
# spirv-tools is stupid and doesn't know how to utilize system spirv headers
|
||||
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS}
|
||||
)
|
||||
|
||||
AddJsonPackage(sirit)
|
||||
|
||||
|
@ -130,16 +144,19 @@ AddJsonPackage(
|
|||
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES}
|
||||
)
|
||||
|
||||
# SPIRV Tools
|
||||
AddJsonPackage(
|
||||
NAME spirv-tools
|
||||
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS}
|
||||
# SPIRV-Tools
|
||||
AddPackage(
|
||||
NAME SPIRV-Tools
|
||||
REPO "KhronosGroup/SPIRV-Tools"
|
||||
SHA 40eb301f32
|
||||
HASH 58d0fb1047d69373cf24c73e6f78c73a72a6cca3b4df1d9f083b9dcc0962745ef154abf3dbe9b3623b835be20c6ec769431cf11733349f45e7568b3525f707aa
|
||||
OPTIONS
|
||||
"SPIRV_SKIP_EXECUTABLES ON"
|
||||
"SPIRV_TOOLS_BUILD_STATIC ON"
|
||||
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_SPIRV_TOOLS}
|
||||
)
|
||||
|
||||
if (SPIRV-Tools_ADDED)
|
||||
add_library(SPIRV-Tools::SPIRV-Tools ALIAS SPIRV-Tools-static)
|
||||
target_link_libraries(SPIRV-Tools-static PRIVATE SPIRV-Tools-opt SPIRV-Tools-link)
|
||||
endif()
|
||||
set(SPIRV-Tools_ADDED "${SPIRV-Tools_ADDED}" PARENT_SCOPE)
|
||||
|
||||
# TZDB (Time Zone Database)
|
||||
add_subdirectory(nx_tzdb)
|
||||
|
|
|
@ -227,7 +227,7 @@ else()
|
|||
endif()
|
||||
|
||||
target_include_directories(audio_core PRIVATE ${OPUS_INCLUDE_DIRS})
|
||||
target_link_libraries(audio_core PUBLIC common core opus)
|
||||
target_link_libraries(audio_core PUBLIC common core Opus::opus)
|
||||
|
||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
||||
target_link_libraries(audio_core PRIVATE dynarmic::dynarmic)
|
||||
|
|
|
@ -274,11 +274,6 @@ endif()
|
|||
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads)
|
||||
target_link_libraries(common PRIVATE lz4::lz4 LLVM::Demangle zstd::zstd)
|
||||
|
||||
if (TARGET unordered_dense::unordered_dense)
|
||||
# weird quirk of system installs
|
||||
target_link_libraries(common PUBLIC unordered_dense::unordered_dense)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# For ASharedMemory_create
|
||||
target_link_libraries(common PRIVATE android)
|
||||
|
|
|
@ -1184,7 +1184,6 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(core PRIVATE ${OPUS_INCLUDE_DIRS})
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core hid_core network video_core nx_tzdb tz)
|
||||
|
||||
if (BOOST_NO_HEADERS)
|
||||
|
|
|
@ -68,7 +68,12 @@ NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id)
|
|||
: header(std::make_unique<NAXHeader>()),
|
||||
file(std::move(file_)), keys{Core::Crypto::KeyManager::Instance()} {
|
||||
Core::Crypto::SHA256Hash hash{};
|
||||
#ifdef MBEDTLS_DEPRECATED_REMOVED
|
||||
mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0);
|
||||
#else
|
||||
// Compatibility with macOS Xcode-15
|
||||
mbedtls_sha256(nca_id.data(), nca_id.size(), hash.data(), 0);
|
||||
#endif
|
||||
status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0],
|
||||
Common::HexToString(nca_id, false)));
|
||||
}
|
||||
|
|
|
@ -246,7 +246,9 @@ add_library(shader_recompiler STATIC
|
|||
|
||||
)
|
||||
|
||||
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools::SPIRV-Tools)
|
||||
# This can actually cause issues e.g. with Apple
|
||||
# but forcing external spirv-tools works there
|
||||
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools-opt SPIRV-Tools SPIRV-Tools-link)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(shader_recompiler PRIVATE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue