summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/CMakeLists.txt2
-rw-r--r--externals/find-modules/FindCatch2.cmake51
-rw-r--r--externals/find-modules/FindOpus.cmake19
-rw-r--r--externals/find-modules/Findfmt.cmake71
-rw-r--r--externals/find-modules/Findlz4.cmake59
-rw-r--r--externals/find-modules/Findnlohmann_json.cmake51
-rw-r--r--externals/find-modules/Findopus.cmake44
-rw-r--r--externals/find-modules/Findzstd.cmake60
-rw-r--r--externals/opus/CMakeLists.txt2
-rw-r--r--src/core/CMakeLists.txt2
10 files changed, 44 insertions, 317 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 6d04ace1d..eea70fc27 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -128,7 +128,7 @@ endif()
128if (YUZU_USE_BUNDLED_OPUS) 128if (YUZU_USE_BUNDLED_OPUS)
129 add_subdirectory(opus EXCLUDE_FROM_ALL) 129 add_subdirectory(opus EXCLUDE_FROM_ALL)
130else() 130else()
131 find_package(opus 1.3 REQUIRED) 131 find_package(Opus 1.3 REQUIRED)
132endif() 132endif()
133 133
134# FFMpeg 134# FFMpeg
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake
deleted file mode 100644
index bded15951..000000000
--- a/externals/find-modules/FindCatch2.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig QUIET)
5pkg_check_modules(PC_Catch2 QUIET Catch2)
6
7find_path(Catch2_INCLUDE_DIR
8 NAMES catch.hpp
9 PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT}
10 PATH_SUFFIXES catch2
11)
12
13if(Catch2_INCLUDE_DIR)
14 file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
15 REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
16 string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
17 string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
18 string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
19 set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
20 unset(_Catch2_version_major)
21 unset(_Catch2_version_minor)
22 unset(_Catch2_version_patch)
23 unset(_Catch2_version_lines)
24endif()
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(Catch2
28 FOUND_VAR Catch2_FOUND
29 REQUIRED_VARS
30 Catch2_INCLUDE_DIR
31 Catch2_VERSION
32 VERSION_VAR Catch2_VERSION
33)
34
35if(Catch2_FOUND)
36 set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR})
37 set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER})
38endif()
39
40if(Catch2_FOUND AND NOT TARGET Catch2::Catch2)
41 add_library(Catch2::Catch2 UNKNOWN IMPORTED)
42 set_target_properties(Catch2::Catch2 PROPERTIES
43 IMPORTED_LOCATION "${Catch2_LIBRARY}"
44 INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}"
45 INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}"
46 )
47endif()
48
49mark_as_advanced(
50 Catch2_INCLUDE_DIR
51)
diff --git a/externals/find-modules/FindOpus.cmake b/externals/find-modules/FindOpus.cmake
new file mode 100644
index 000000000..b68a6046b
--- /dev/null
+++ b/externals/find-modules/FindOpus.cmake
@@ -0,0 +1,19 @@
1# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig)
5
6if (PKG_CONFIG_FOUND)
7 pkg_search_module(opus IMPORTED_TARGET GLOBAL opus)
8 if (opus_FOUND)
9 add_library(Opus::opus ALIAS PkgConfig::opus)
10 endif()
11endif()
12
13include(FindPackageHandleStandardArgs)
14find_package_handle_standard_args(Opus
15 REQUIRED_VARS
16 opus_LINK_LIBRARIES
17 opus_FOUND
18 VERSION_VAR opus_VERSION
19)
diff --git a/externals/find-modules/Findfmt.cmake b/externals/find-modules/Findfmt.cmake
deleted file mode 100644
index d11e98a69..000000000
--- a/externals/find-modules/Findfmt.cmake
+++ /dev/null
@@ -1,71 +0,0 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig QUIET)
5pkg_check_modules(PC_fmt QUIET fmt)
6
7find_path(fmt_INCLUDE_DIR
8 NAMES format.h
9 PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt}
10 PATH_SUFFIXES fmt
11)
12
13find_library(fmt_LIBRARY
14 NAMES fmt
15 PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
16)
17
18if(fmt_INCLUDE_DIR)
19 set(_fmt_version_file "${fmt_INCLUDE_DIR}/core.h")
20 if(NOT EXISTS "${_fmt_version_file}")
21 set(_fmt_version_file "${fmt_INCLUDE_DIR}/format.h")
22 endif()
23 if(EXISTS "${_fmt_version_file}")
24 # parse "#define FMT_VERSION 60200" to 6.2.0
25 file(STRINGS "${_fmt_version_file}" fmt_VERSION_LINE
26 REGEX "^#define[ \t]+FMT_VERSION[ \t]+[0-9]+$")
27 string(REGEX REPLACE "^#define[ \t]+FMT_VERSION[ \t]+([0-9]+)$"
28 "\\1" fmt_VERSION "${fmt_VERSION_LINE}")
29 foreach(ver "fmt_VERSION_PATCH" "fmt_VERSION_MINOR" "fmt_VERSION_MAJOR")
30 math(EXPR ${ver} "${fmt_VERSION} % 100")
31 math(EXPR fmt_VERSION "(${fmt_VERSION} - ${${ver}}) / 100")
32 endforeach()
33 set(fmt_VERSION
34 "${fmt_VERSION_MAJOR}.${fmt_VERSION_MINOR}.${fmt_VERSION_PATCH}")
35 endif()
36 unset(_fmt_version_file)
37 unset(fmt_VERSION_LINE)
38 unset(fmt_VERSION_MAJOR)
39 unset(fmt_VERSION_MINOR)
40 unset(fmt_VERSION_PATCH)
41endif()
42
43include(FindPackageHandleStandardArgs)
44find_package_handle_standard_args(fmt
45 FOUND_VAR fmt_FOUND
46 REQUIRED_VARS
47 fmt_LIBRARY
48 fmt_INCLUDE_DIR
49 fmt_VERSION
50 VERSION_VAR fmt_VERSION
51)
52
53if(fmt_FOUND)
54 set(fmt_LIBRARIES ${fmt_LIBRARY})
55 set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
56 set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER})
57endif()
58
59if(fmt_FOUND AND NOT TARGET fmt::fmt)
60 add_library(fmt::fmt UNKNOWN IMPORTED)
61 set_target_properties(fmt::fmt PROPERTIES
62 IMPORTED_LOCATION "${fmt_LIBRARY}"
63 INTERFACE_COMPILE_OPTIONS "${PC_fmt_CFLAGS_OTHER}"
64 INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
65 )
66endif()
67
68mark_as_advanced(
69 fmt_INCLUDE_DIR
70 fmt_LIBRARY
71)
diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake
index 56dcca8f6..13ca5de66 100644
--- a/externals/find-modules/Findlz4.cmake
+++ b/externals/find-modules/Findlz4.cmake
@@ -1,56 +1,19 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project 1# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3 3
4find_package(PkgConfig QUIET) 4find_package(PkgConfig)
5pkg_check_modules(PC_lz4 QUIET lz4)
6 5
7find_path(lz4_INCLUDE_DIR 6if (PKG_CONFIG_FOUND)
8 NAMES lz4.h 7 pkg_search_module(liblz4 IMPORTED_TARGET GLOBAL liblz4)
9 PATHS ${PC_lz4_INCLUDE_DIRS} 8 if (liblz4_FOUND)
10) 9 add_library(lz4::lz4 ALIAS PkgConfig::liblz4)
11find_library(lz4_LIBRARY 10 endif()
12 NAMES lz4
13 PATHS ${PC_lz4_LIBRARY_DIRS}
14)
15
16if(lz4_INCLUDE_DIR)
17 file(STRINGS "${lz4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
18 REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
19 string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
20 string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
21 string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
22 set(lz4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
23 unset(_lz4_version_major)
24 unset(_lz4_version_minor)
25 unset(_lz4_version_release)
26 unset(_lz4_version_lines)
27endif() 11endif()
28 12
29include(FindPackageHandleStandardArgs) 13include(FindPackageHandleStandardArgs)
30find_package_handle_standard_args(lz4 14find_package_handle_standard_args(lz4
31 FOUND_VAR lz4_FOUND 15 REQUIRED_VARS
32 REQUIRED_VARS 16 liblz4_LINK_LIBRARIES
33 lz4_LIBRARY 17 liblz4_FOUND
34 lz4_INCLUDE_DIR 18 VERSION_VAR liblz4_VERSION
35 VERSION_VAR lz4_VERSION
36)
37
38if(lz4_FOUND)
39 set(lz4_LIBRARIES ${lz4_LIBRARY})
40 set(lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
41 set(lz4_DEFINITIONS ${PC_lz4_CFLAGS_OTHER})
42endif()
43
44if(lz4_FOUND AND NOT TARGET lz4::lz4)
45 add_library(lz4::lz4 UNKNOWN IMPORTED)
46 set_target_properties(lz4::lz4 PROPERTIES
47 IMPORTED_LOCATION "${lz4_LIBRARY}"
48 INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}"
49 INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}"
50 )
51endif()
52
53mark_as_advanced(
54 lz4_INCLUDE_DIR
55 lz4_LIBRARY
56) 19)
diff --git a/externals/find-modules/Findnlohmann_json.cmake b/externals/find-modules/Findnlohmann_json.cmake
deleted file mode 100644
index 8a3958cf1..000000000
--- a/externals/find-modules/Findnlohmann_json.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig QUIET)
5pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
6
7find_path(nlohmann_json_INCLUDE_DIR
8 NAMES json.hpp
9 PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
10 PATH_SUFFIXES nlohmann
11)
12
13if(nlohmann_json_INCLUDE_DIR)
14 file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
15 REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
16 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
17 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
18 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
19 set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
20 unset(_nlohmann_json_version_major)
21 unset(_nlohmann_json_version_minor)
22 unset(_nlohmann_json_version_patch)
23 unset(_nlohmann_json_version_lines)
24endif()
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(nlohmann_json
28 FOUND_VAR nlohmann_json_FOUND
29 REQUIRED_VARS
30 nlohmann_json_INCLUDE_DIR
31 nlohmann_json_VERSION
32 VERSION_VAR nlohmann_json_VERSION
33)
34
35if(nlohmann_json_FOUND)
36 set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
37 set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
38endif()
39
40if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
41 add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
42 set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
43 IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
44 INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
45 INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
46 )
47endif()
48
49mark_as_advanced(
50 nlohmann_json_INCLUDE_DIR
51)
diff --git a/externals/find-modules/Findopus.cmake b/externals/find-modules/Findopus.cmake
deleted file mode 100644
index ec7b4f61f..000000000
--- a/externals/find-modules/Findopus.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig QUIET)
5pkg_check_modules(PC_opus QUIET opus)
6
7find_path(opus_INCLUDE_DIR
8 NAMES opus.h
9 PATHS ${PC_opus_INCLUDE_DIRS}
10 PATH_SUFFIXES opus
11)
12find_library(opus_LIBRARY
13 NAMES opus
14 PATHS ${PC_opus_LIBRARY_DIRS}
15)
16
17include(FindPackageHandleStandardArgs)
18find_package_handle_standard_args(opus
19 FOUND_VAR opus_FOUND
20 REQUIRED_VARS
21 opus_LIBRARY
22 opus_INCLUDE_DIR
23 VERSION_VAR opus_VERSION
24)
25
26if(opus_FOUND)
27 set(Opus_LIBRARIES ${opus_LIBRARY})
28 set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR})
29 set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER})
30endif()
31
32if(opus_FOUND AND NOT TARGET Opus::Opus)
33 add_library(Opus::Opus UNKNOWN IMPORTED GLOBAL)
34 set_target_properties(Opus::Opus PROPERTIES
35 IMPORTED_LOCATION "${opus_LIBRARY}"
36 INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}"
37 INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}"
38 )
39endif()
40
41mark_as_advanced(
42 opus_INCLUDE_DIR
43 opus_LIBRARY
44)
diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake
index f0c56f499..f4031eb70 100644
--- a/externals/find-modules/Findzstd.cmake
+++ b/externals/find-modules/Findzstd.cmake
@@ -1,57 +1,19 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project 1# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3 3
4find_package(PkgConfig QUIET) 4find_package(PkgConfig)
5pkg_check_modules(PC_zstd QUIET libzstd)
6 5
7find_path(zstd_INCLUDE_DIR 6if (PKG_CONFIG_FOUND)
8 NAMES zstd.h 7 pkg_search_module(libzstd IMPORTED_TARGET GLOBAL libzstd)
9 PATHS ${PC_zstd_INCLUDE_DIRS} 8 if (libzstd_FOUND)
10) 9 add_library(zstd::zstd ALIAS PkgConfig::libzstd)
11find_library(zstd_LIBRARY 10 endif()
12 NAMES zstd
13 PATHS ${PC_zstd_LIBRARY_DIRS}
14)
15
16if(zstd_INCLUDE_DIR)
17 file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
18 REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
19 string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
20 string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
21 string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
22 set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
23 unset(_zstd_version_major)
24 unset(_zstd_version_minor)
25 unset(_zstd_version_release)
26 unset(_zstd_version_lines)
27endif() 11endif()
28 12
29include(FindPackageHandleStandardArgs) 13include(FindPackageHandleStandardArgs)
30find_package_handle_standard_args(zstd 14find_package_handle_standard_args(zstd
31 FOUND_VAR zstd_FOUND 15 REQUIRED_VARS
32 REQUIRED_VARS 16 libzstd_LINK_LIBRARIES
33 zstd_LIBRARY 17 libzstd_FOUND
34 zstd_INCLUDE_DIR 18 VERSION_VAR libzstd_VERSION
35 zstd_VERSION
36 VERSION_VAR zstd_VERSION
37)
38
39if(zstd_FOUND)
40 set(zstd_LIBRARIES ${zstd_LIBRARY})
41 set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
42 set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
43endif()
44
45if(zstd_FOUND AND NOT TARGET zstd::zstd)
46 add_library(zstd::zstd UNKNOWN IMPORTED)
47 set_target_properties(zstd::zstd PROPERTIES
48 IMPORTED_LOCATION "${zstd_LIBRARY}"
49 INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
50 INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
51 )
52endif()
53
54mark_as_advanced(
55 zstd_INCLUDE_DIR
56 zstd_LIBRARY
57) 19)
diff --git a/externals/opus/CMakeLists.txt b/externals/opus/CMakeLists.txt
index a92ffbd69..410ff7c08 100644
--- a/externals/opus/CMakeLists.txt
+++ b/externals/opus/CMakeLists.txt
@@ -256,4 +256,4 @@ PRIVATE
256 opus/src 256 opus/src
257) 257)
258 258
259add_library(Opus::Opus ALIAS opus) 259add_library(Opus::opus ALIAS opus)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 3230d7199..8db9a3c65 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -786,7 +786,7 @@ endif()
786create_target_directory_groups(core) 786create_target_directory_groups(core)
787 787
788target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) 788target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
789target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus) 789target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::opus)
790if (MINGW) 790if (MINGW)
791 target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) 791 target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
792endif() 792endif()