From 265d1d697935ec65e31d55fc424d96276d41a8c9 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Fri, 22 Jul 2022 14:49:43 -0400 Subject: [PATCH] ci,CMake: Integrate vcpkg into CMakeLists Uses manifest mode if the bundled vcpkg is used. --- .ci/scripts/clang/docker.sh | 1 - .ci/scripts/linux/docker.sh | 1 - .ci/templates/build-msvc.yml | 4 +--- .github/workflows/verify.yml | 3 +-- .gitmodules | 3 +++ CMakeLists.txt | 10 ++++++++++ externals/vcpkg | 1 + vcpkg.json | 29 +++++++++++++++++++++++++++++ 8 files changed, 45 insertions(+), 7 deletions(-) create mode 160000 externals/vcpkg create mode 100644 vcpkg.json diff --git a/.ci/scripts/clang/docker.sh b/.ci/scripts/clang/docker.sh index e9719645c..db736f72b 100755 --- a/.ci/scripts/clang/docker.sh +++ b/.ci/scripts/clang/docker.sh @@ -11,7 +11,6 @@ cmake .. \ -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ \ -DCMAKE_C_COMPILER=/usr/lib/ccache/clang \ -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_TOOLCHAIN_FILE=${VCPKG_TOOLCHAIN_FILE} \ -DDISPLAY_VERSION=$1 \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ -DENABLE_QT_TRANSLATION=ON \ diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh index d4787f684..436155b3d 100755 --- a/.ci/scripts/linux/docker.sh +++ b/.ci/scripts/linux/docker.sh @@ -12,7 +12,6 @@ cmake .. \ -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \ -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \ -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_TOOLCHAIN_FILE=${VCPKG_TOOLCHAIN_FILE} \ -DDISPLAY_VERSION=$1 \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ -DENABLE_QT_TRANSLATION=ON \ diff --git a/.ci/templates/build-msvc.yml b/.ci/templates/build-msvc.yml index cca3189fa..5d2e86179 100644 --- a/.ci/templates/build-msvc.yml +++ b/.ci/templates/build-msvc.yml @@ -6,9 +6,7 @@ parameters: steps: - script: choco install vulkan-sdk displayName: 'Install vulkan-sdk' -- script: python -m pip install --upgrade pip conan - displayName: 'Install conan' -- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 17 2022" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd .. +- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 17 2022" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_TESTS=OFF -DYUZU_USE_BUNDLED_VCPKG=ON .. && cd .. displayName: 'Configure CMake' - task: MSBuild@1 displayName: 'Build' diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index c1886b9f3..88e3a9a72 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -80,7 +80,6 @@ jobs: shell: cmd run: | choco install vulkan-sdk wget - python -m pip install --upgrade pip conan call refreshenv wget https://github.com/mbitsnbites/buildcache/releases/download/v0.27.6/buildcache-windows.zip 7z x buildcache-windows.zip @@ -100,7 +99,7 @@ jobs: run: | glslangValidator --version mkdir build - cmake . -B build -GNinja -DCMAKE_TOOLCHAIN_FILE="CMakeModules/MSVCCache.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DCMAKE_BUILD_TYPE=Release + cmake . -B build -GNinja -DCMAKE_TOOLCHAIN_FILE="CMakeModules/MSVCCache.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DCMAKE_BUILD_TYPE=Release -DYUZU_TESTS=OFF -DYUZU_USE_BUNDLED_VCPKG=ON - name: Build run: cmake --build build - name: Cache Summary diff --git a/.gitmodules b/.gitmodules index dc92d0a4b..846e41d26 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,3 +40,6 @@ [submodule "externals/ffmpeg/ffmpeg"] path = externals/ffmpeg/ffmpeg url = https://git.ffmpeg.org/ffmpeg.git +[submodule "externals/vcpkg"] + path = externals/vcpkg + url = https://github.com/Microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index aed076dea..6993b6967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,16 @@ option(YUZU_USE_BUNDLED_OPUS "Compile bundled opus" ON) option(YUZU_TESTS "Compile tests" ON) +option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" OFF) + +if (YUZU_USE_BUNDLED_VCPKG) + include(${CMAKE_SOURCE_DIR}/externals/vcpkg/scripts/buildsystems/vcpkg.cmake) +elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "") + # Disable manifest mode (use vcpkg classic mode) when using a custom vcpkg installation + option(VCPKG_MANIFEST_MODE "") + include("$ENV{VCPKG_TOOLCHAIN_FILE}") +endif() + # Default to a Release build get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) diff --git a/externals/vcpkg b/externals/vcpkg new file mode 160000 index 000000000..cef0b3ec7 --- /dev/null +++ b/externals/vcpkg @@ -0,0 +1 @@ +Subproject commit cef0b3ec767df6e83806899fe9525f6cf8d7bc91 diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..8d3c5919a --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", + "name": "yuzu", + "version": "1.0", + "dependencies": [ + "boost-algorithm", + "boost-asio", + "boost-bind", + "boost-config", + "boost-container", + "boost-context", + "boost-crc", + "boost-functional", + "boost-icl", + "boost-intrusive", + "boost-mpl", + "boost-process", + "boost-range", + "boost-spirit", + "boost-test", + "boost-timer", + "boost-variant", + "fmt", + "lz4", + "nlohmann-json", + "zlib", + "zstd" + ] +}