summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.ci/scripts/clang/docker.sh13
-rwxr-xr-x.ci/scripts/linux/docker.sh1
-rwxr-xr-x.ci/scripts/windows/docker.sh5
-rw-r--r--CMakeLists.txt160
-rw-r--r--src/common/CMakeLists.txt5
5 files changed, 35 insertions, 149 deletions
diff --git a/.ci/scripts/clang/docker.sh b/.ci/scripts/clang/docker.sh
index 94a9ca0ec..e9719645c 100755
--- a/.ci/scripts/clang/docker.sh
+++ b/.ci/scripts/clang/docker.sh
@@ -6,7 +6,18 @@ set -e
6ccache -s 6ccache -s
7 7
8mkdir build || true && cd build 8mkdir build || true && cd build
9cmake .. -GNinja -DDISPLAY_VERSION=$1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/clang -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DCMAKE_INSTALL_PREFIX="/usr" 9cmake .. \
10 -DCMAKE_BUILD_TYPE=Release \
11 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ \
12 -DCMAKE_C_COMPILER=/usr/lib/ccache/clang \
13 -DCMAKE_INSTALL_PREFIX="/usr" \
14 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_TOOLCHAIN_FILE} \
15 -DDISPLAY_VERSION=$1 \
16 -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
17 -DENABLE_QT_TRANSLATION=ON \
18 -DUSE_DISCORD_PRESENCE=ON \
19 -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
20 -GNinja
10 21
11ninja 22ninja
12 23
diff --git a/.ci/scripts/linux/docker.sh b/.ci/scripts/linux/docker.sh
index 436155b3d..d4787f684 100755
--- a/.ci/scripts/linux/docker.sh
+++ b/.ci/scripts/linux/docker.sh
@@ -12,6 +12,7 @@ cmake .. \
12 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \ 12 -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \
13 -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \ 13 -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \
14 -DCMAKE_INSTALL_PREFIX="/usr" \ 14 -DCMAKE_INSTALL_PREFIX="/usr" \
15 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_TOOLCHAIN_FILE} \
15 -DDISPLAY_VERSION=$1 \ 16 -DDISPLAY_VERSION=$1 \
16 -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ 17 -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
17 -DENABLE_QT_TRANSLATION=ON \ 18 -DENABLE_QT_TRANSLATION=ON \
diff --git a/.ci/scripts/windows/docker.sh b/.ci/scripts/windows/docker.sh
index 5bd5f0b6b..9f34530d6 100755
--- a/.ci/scripts/windows/docker.sh
+++ b/.ci/scripts/windows/docker.sh
@@ -6,10 +6,6 @@ set -e
6 6
7ccache -sv 7ccache -sv
8 8
9mkdir -p "$HOME/.conan/profiles"
10wget -c "https://github.com/yuzu-emu/build-environments/raw/master/linux-mingw/default" -O "$HOME/.conan/profiles/default"
11wget -c "https://github.com/yuzu-emu/build-environments/raw/master/linux-mingw/settings.yml" -O "$HOME/.conan/settings.yml"
12
13mkdir -p build && cd build 9mkdir -p build && cd build
14export LDFLAGS="-fuse-ld=lld" 10export LDFLAGS="-fuse-ld=lld"
15# -femulated-tls required due to an incompatibility between GCC and Clang 11# -femulated-tls required due to an incompatibility between GCC and Clang
@@ -24,6 +20,7 @@ cmake .. \
24 -DUSE_CCACHE=ON \ 20 -DUSE_CCACHE=ON \
25 -DYUZU_USE_BUNDLED_SDL2=OFF \ 21 -DYUZU_USE_BUNDLED_SDL2=OFF \
26 -DYUZU_USE_EXTERNAL_SDL2=OFF \ 22 -DYUZU_USE_EXTERNAL_SDL2=OFF \
23 -DYUZU_TESTS=OFF \
27 -GNinja 24 -GNinja
28ninja yuzu yuzu-cmd 25ninja yuzu yuzu-cmd
29 26
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80a8d4ed8..aed076dea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -144,82 +144,34 @@ endif()
144set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 144set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
145 145
146# System imported libraries 146# System imported libraries
147# If not found, download any missing through Conan
148# ======================================================================= 147# =======================================================================
149set(CONAN_CMAKE_SILENT_OUTPUT TRUE)
150set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
151if (YUZU_CONAN_INSTALLED)
152 if (IS_MULTI_CONFIG)
153 include(${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake)
154 else()
155 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
156 endif()
157 list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
158 list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
159 conan_basic_setup()
160 message(STATUS "Adding conan installed libraries to the search path")
161endif()
162 148
163macro(yuzu_find_packages) 149find_package(fmt 8.0.1 REQUIRED CONFIG)
164 set(options FORCE_REQUIRED) 150find_package(lz4 1.8 REQUIRED)
165 cmake_parse_arguments(FN "${options}" "" "" ${ARGN}) 151find_package(nlohmann_json 3.8 REQUIRED CONFIG)
166 152find_package(ZLIB 1.2 REQUIRED)
167 # Cmake has a *serious* lack of 2D array or associative array...
168 # Capitalization matters here. We need the naming to match the generated paths from Conan
169 set(REQUIRED_LIBS
170 # Cmake Pkg Prefix Version Conan Pkg
171 "fmt 8.0.1 fmt/8.1.1"
172 "lz4 1.8 lz4/1.9.2"
173 "nlohmann_json 3.8 nlohmann_json/3.8.0"
174 "ZLIB 1.2 zlib/1.2.11"
175 "zstd 1.5 zstd/1.5.0"
176 # can't use opus until AVX check is fixed: https://github.com/yuzu-emu/yuzu/pull/4068
177 #"opus 1.3 opus/1.3.1"
178 )
179 if (YUZU_TESTS)
180 list(APPEND REQUIRED_LIBS
181 "Catch2 2.13.7 catch2/2.13.7"
182 )
183 endif()
184 153
185 foreach(PACKAGE ${REQUIRED_LIBS}) 154# Search for config-only package first (for vcpkg), then try non-config
186 string(REGEX REPLACE "[ \t\r\n]+" ";" PACKAGE_SPLIT ${PACKAGE}) 155find_package(zstd 1.5 CONFIG)
187 list(GET PACKAGE_SPLIT 0 PACKAGE_PREFIX) 156if (NOT zstd_FOUND)
188 list(GET PACKAGE_SPLIT 1 PACKAGE_VERSION) 157 find_package(zstd 1.5 REQUIRED)
189 list(GET PACKAGE_SPLIT 2 PACKAGE_CONAN) 158endif()
190 # This function is called twice, once to check if the packages exist on the system already
191 # and a second time to check if conan installed them properly. The second check passes in FORCE_REQUIRED
192 if (NOT ${PACKAGE_PREFIX}_FOUND)
193 if (FN_FORCE_REQUIRED)
194 find_package(${PACKAGE_PREFIX} ${PACKAGE_VERSION} REQUIRED)
195 else()
196 find_package(${PACKAGE_PREFIX} ${PACKAGE_VERSION})
197 endif()
198 endif()
199 if (NOT ${PACKAGE_PREFIX}_FOUND)
200 list(APPEND CONAN_REQUIRED_LIBS ${PACKAGE_CONAN})
201 else()
202 # Set a legacy findPackage.cmake style PACKAGE_LIBRARIES variable for subprojects that rely on this
203 set(${PACKAGE_PREFIX}_LIBRARIES "${PACKAGE_PREFIX}::${PACKAGE_PREFIX}")
204 endif()
205 endforeach()
206 unset(FN_FORCE_REQUIRED)
207endmacro()
208 159
209find_package(Boost 1.73.0 COMPONENTS context headers) 160if (YUZU_TESTS)
161 find_package(Catch2 2.13.7 REQUIRED CONFIG)
162endif()
163
164find_package(Boost 1.73.0 COMPONENTS context)
210if (Boost_FOUND) 165if (Boost_FOUND)
211 set(Boost_LIBRARIES Boost::boost) 166 set(Boost_LIBRARIES Boost::boost)
212 # Conditionally add Boost::context only if the active version of the Conan or system Boost package provides it 167 # Conditionally add Boost::context only if the found Boost package provides it
213 # The old version is missing Boost::context, so we want to avoid adding in that case 168 # The old version is missing Boost::context, so we want to avoid adding in that case
214 # The new version requires adding Boost::context to prevent linking issues 169 # The new version requires adding Boost::context to prevent linking issues
215 #
216 # This one is used by Conan on subsequent CMake configures, not the first configure.
217 if (TARGET Boost::context) 170 if (TARGET Boost::context)
218 list(APPEND Boost_LIBRARIES Boost::context) 171 list(APPEND Boost_LIBRARIES Boost::context)
219 endif() 172 endif()
220else() 173else()
221 message(STATUS "Boost 1.79.0 or newer not found, falling back to Conan") 174 message(FATAL_ERROR "Boost 1.73.0 or newer not found")
222 list(APPEND CONAN_REQUIRED_LIBS "boost/1.79.0")
223endif() 175endif()
224 176
225# boost:asio has functions that require AcceptEx et al 177# boost:asio has functions that require AcceptEx et al
@@ -227,19 +179,9 @@ if (MINGW)
227 find_library(MSWSOCK_LIBRARY mswsock REQUIRED) 179 find_library(MSWSOCK_LIBRARY mswsock REQUIRED)
228endif() 180endif()
229 181
230# Attempt to locate any packages that are required and report the missing ones in CONAN_REQUIRED_LIBS
231yuzu_find_packages()
232
233# Qt5 requires that we find components, so it doesn't fit our pretty little find package function 182# Qt5 requires that we find components, so it doesn't fit our pretty little find package function
234if(ENABLE_QT) 183if(ENABLE_QT)
235 set(QT_VERSION 5.15) 184 set(QT_VERSION 5.15)
236 # We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official
237 # Qt5Config inside the root folder instead of the conan generated one.
238 if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake)
239 include(${CMAKE_BINARY_DIR}/qtConfig.cmake)
240 list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}")
241 list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}")
242 endif()
243 185
244 # Check for system Qt on Linux, fallback to bundled Qt 186 # Check for system Qt on Linux, fallback to bundled Qt
245 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 187 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
@@ -330,9 +272,6 @@ if(ENABLE_QT)
330 272
331 set(YUZU_QT_NO_CMAKE_SYSTEM_PATH) 273 set(YUZU_QT_NO_CMAKE_SYSTEM_PATH)
332 274
333 # Workaround for an issue where conan tries to build Qt from scratch instead of download prebuilt binaries
334 set(QT_PREFIX_HINT)
335
336 if(YUZU_USE_BUNDLED_QT) 275 if(YUZU_USE_BUNDLED_QT)
337 if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) 276 if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
338 set(QT_BUILD qt-5.15.2-msvc2019_64) 277 set(QT_BUILD qt-5.15.2-msvc2019_64)
@@ -403,71 +342,8 @@ if (ENABLE_SDL2)
403 endif() 342 endif()
404endif() 343endif()
405 344
406# Install any missing dependencies with conan install 345# TODO(lat9nq): Determine what if any of this we still need
407if (CONAN_REQUIRED_LIBS) 346#
408 message(STATUS "Packages ${CONAN_REQUIRED_LIBS} not found!")
409 # Use Conan to fetch the libraries that aren't found
410 # Download conan.cmake automatically, you can also just copy the conan.cmake file
411 if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
412 message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
413 file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/release/0.18/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
414 endif()
415 include(${CMAKE_BINARY_DIR}/conan.cmake)
416
417 conan_check(VERSION 1.45.0 REQUIRED)
418
419 # Manually add iconv to fix a dep conflict between qt and sdl2
420 # We don't need to add it through find_package or anything since the other two can find it just fine
421 if ("${CONAN_REQUIRED_LIBS}" MATCHES "qt" AND "${CONAN_REQUIRED_LIBS}" MATCHES "sdl")
422 list(APPEND CONAN_REQUIRED_LIBS "libiconv/1.16")
423 endif()
424 if (IS_MULTI_CONFIG)
425 conan_cmake_run(REQUIRES ${CONAN_REQUIRED_LIBS}
426 OPTIONS ${CONAN_LIB_OPTIONS}
427 BUILD missing
428 CONFIGURATION_TYPES "Release;Debug"
429 GENERATORS cmake_multi cmake_find_package_multi)
430 include(${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake)
431 else()
432 conan_cmake_run(REQUIRES ${CONAN_REQUIRED_LIBS}
433 OPTIONS ${CONAN_LIB_OPTIONS}
434 BUILD missing
435 GENERATORS cmake cmake_find_package_multi)
436 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
437 endif()
438 list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
439 list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
440 conan_basic_setup()
441
442 set(YUZU_CONAN_INSTALLED TRUE CACHE BOOL "If true, the following builds will add conan to the lib search path" FORCE)
443
444 # Now that we've installed what we are missing, try to locate them again,
445 # this time with required, so we bail if its not found.
446 yuzu_find_packages(FORCE_REQUIRED)
447
448 if (NOT Boost_FOUND)
449 find_package(Boost 1.73.0 REQUIRED COMPONENTS context headers)
450 set(Boost_LIBRARIES Boost::boost)
451 # Conditionally add Boost::context only if the active version of the Conan Boost package provides it
452 # The old version is missing Boost::context, so we want to avoid adding in that case
453 # The new version requires adding Boost::context to prevent linking issues
454 if (TARGET Boost::context)
455 list(APPEND Boost_LIBRARIES Boost::context)
456 endif()
457 endif()
458
459 # Due to issues with variable scopes in functions, we need to also find_package(qt5) outside of the function
460 if(ENABLE_QT)
461 list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}")
462 list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}")
463 find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets)
464 if (YUZU_USE_QT_WEB_ENGINE)
465 find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets)
466 endif()
467 endif()
468
469endif()
470
471# Reexport some targets that are named differently when using the upstream CmakeConfig vs the generated Conan config 347# Reexport some targets that are named differently when using the upstream CmakeConfig vs the generated Conan config
472# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL 348# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL
473# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external 349# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 73bf626d4..566695fde 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -182,8 +182,9 @@ create_target_directory_groups(common)
182 182
183target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) 183target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
184target_link_libraries(common PRIVATE lz4::lz4 xbyak) 184target_link_libraries(common PRIVATE lz4::lz4 xbyak)
185if (MSVC) 185if (TARGET zstd::zstd)
186 target_link_libraries(common PRIVATE zstd::zstd) 186 target_link_libraries(common PRIVATE zstd::zstd)
187else() 187else()
188 target_link_libraries(common PRIVATE zstd) 188 target_link_libraries(common PRIVATE
189 $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
189endif() 190endif()