summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--externals/find-modules/FindCatch2.cmake14
-rw-r--r--externals/find-modules/FindLibzip.cmake25
-rw-r--r--externals/find-modules/Findfmt.cmake26
-rw-r--r--externals/find-modules/Findnlohmann_json.cmake14
-rw-r--r--externals/find-modules/Findzstd.cmake14
6 files changed, 83 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0381e4af7..61321bf0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,6 +157,7 @@ macro(yuzu_find_packages)
157 #"libzip 1.5 libzip/1.5.2@bincrafters/stable" 157 #"libzip 1.5 libzip/1.5.2@bincrafters/stable"
158 "lz4 1.8 lz4/1.9.2" 158 "lz4 1.8 lz4/1.9.2"
159 "nlohmann_json 3.7 nlohmann_json/3.7.3" 159 "nlohmann_json 3.7 nlohmann_json/3.7.3"
160 # we need to be careful as the version check might be broken https://github.com/xiph/opus/issues/110
160 "opus 1.3 opus/1.3.1" 161 "opus 1.3 opus/1.3.1"
161 "ZLIB 1.2 zlib/1.2.11" 162 "ZLIB 1.2 zlib/1.2.11"
162 "zstd 1.4 zstd/1.4.4" 163 "zstd 1.4 zstd/1.4.4"
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake
index a83c668bf..ce1d40bae 100644
--- a/externals/find-modules/FindCatch2.cmake
+++ b/externals/find-modules/FindCatch2.cmake
@@ -8,11 +8,25 @@ find_path(Catch2_INCLUDE_DIR
8 PATH_SUFFIXES catch2 8 PATH_SUFFIXES catch2
9) 9)
10 10
11if(Catch2_INCLUDE_DIR)
12 file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
13 REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
14 string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
15 string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
16 string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
17 set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
18 unset(_Catch2_version_major)
19 unset(_Catch2_version_minor)
20 unset(_Catch2_version_patch)
21 unset(_Catch2_version_lines)
22endif()
23
11include(FindPackageHandleStandardArgs) 24include(FindPackageHandleStandardArgs)
12find_package_handle_standard_args(Catch2 25find_package_handle_standard_args(Catch2
13 FOUND_VAR Catch2_FOUND 26 FOUND_VAR Catch2_FOUND
14 REQUIRED_VARS 27 REQUIRED_VARS
15 Catch2_INCLUDE_DIR 28 Catch2_INCLUDE_DIR
29 Catch2_VERSION
16 VERSION_VAR Catch2_VERSION 30 VERSION_VAR Catch2_VERSION
17) 31)
18 32
diff --git a/externals/find-modules/FindLibzip.cmake b/externals/find-modules/FindLibzip.cmake
index 0b5148856..f36b1687a 100644
--- a/externals/find-modules/FindLibzip.cmake
+++ b/externals/find-modules/FindLibzip.cmake
@@ -28,26 +28,27 @@ find_library(LIBZIP_LIBRARY
28 "$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib 28 "$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib
29) 29)
30 30
31include(FindPackageHandleStandardArgs)
32find_package_handle_standard_args(Libzip
33 FOUND_VAR LIBZIP_FOUND
34 REQUIRED_VARS
35 LIBZIP_LIBRARY
36 LIBZIP_INCLUDE_DIR
37 LIBZIP_INCLUDE_DIR_ZIPCONF
38)
39
40set(LIBZIP_VERSION 0)
41
42if (LIBZIP_INCLUDE_DIR_ZIPCONF) 31if (LIBZIP_INCLUDE_DIR_ZIPCONF)
43 FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS) 32 FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS)
44 if (_LIBZIP_VERSION_CONTENTS) 33 if (_LIBZIP_VERSION_CONTENTS)
45 STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}") 34 STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}")
46 endif() 35 endif()
36 unset(_LIBZIP_VERSION_CONTENTS)
47endif() 37endif()
48 38
49set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip") 39set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip")
50 40
41include(FindPackageHandleStandardArgs)
42find_package_handle_standard_args(Libzip
43 FOUND_VAR LIBZIP_FOUND
44 REQUIRED_VARS
45 LIBZIP_LIBRARY
46 LIBZIP_INCLUDE_DIR
47 LIBZIP_INCLUDE_DIR_ZIPCONF
48 LIBZIP_VERSION
49 VERSION_VAR LIBZIP_VERSION
50)
51
51if(LIBZIP_FOUND) 52if(LIBZIP_FOUND)
52 set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY}) 53 set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY})
53 set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR}) 54 set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR})
@@ -65,5 +66,7 @@ endif()
65 66
66mark_as_advanced( 67mark_as_advanced(
67 LIBZIP_INCLUDE_DIR 68 LIBZIP_INCLUDE_DIR
69 LIBZIP_INCLUDE_DIR_ZIPCONF
68 LIBZIP_LIBRARY 70 LIBZIP_LIBRARY
71 LIBZIP_VERSION
69) 72)
diff --git a/externals/find-modules/Findfmt.cmake b/externals/find-modules/Findfmt.cmake
index e0a04a344..8ba51cbea 100644
--- a/externals/find-modules/Findfmt.cmake
+++ b/externals/find-modules/Findfmt.cmake
@@ -13,12 +13,38 @@ find_library(fmt_LIBRARY
13 PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt} 13 PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
14) 14)
15 15
16if(fmt_INCLUDE_DIR)
17 set(_fmt_version_file "${fmt_INCLUDE_DIR}/core.h")
18 if(NOT EXISTS "${_fmt_version_file}")
19 set(_fmt_version_file "${fmt_INCLUDE_DIR}/format.h")
20 endif()
21 if(EXISTS "${_fmt_version_file}")
22 # parse "#define FMT_VERSION 60200" to 6.2.0
23 file(STRINGS "${_fmt_version_file}" fmt_VERSION_LINE
24 REGEX "^#define[ \t]+FMT_VERSION[ \t]+[0-9]+$")
25 string(REGEX REPLACE "^#define[ \t]+FMT_VERSION[ \t]+([0-9]+)$"
26 "\\1" fmt_VERSION "${fmt_VERSION_LINE}")
27 foreach(ver "fmt_VERSION_PATCH" "fmt_VERSION_MINOR" "fmt_VERSION_MAJOR")
28 math(EXPR ${ver} "${fmt_VERSION} % 100")
29 math(EXPR fmt_VERSION "(${fmt_VERSION} - ${${ver}}) / 100")
30 endforeach()
31 set(fmt_VERSION
32 "${fmt_VERSION_MAJOR}.${fmt_VERSION_MINOR}.${fmt_VERSION_PATCH}")
33 endif()
34 unset(_fmt_version_file)
35 unset(fmt_VERSION_LINE)
36 unset(fmt_VERSION_MAJOR)
37 unset(fmt_VERSION_MINOR)
38 unset(fmt_VERSION_PATCH)
39endif()
40
16include(FindPackageHandleStandardArgs) 41include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(fmt 42find_package_handle_standard_args(fmt
18 FOUND_VAR fmt_FOUND 43 FOUND_VAR fmt_FOUND
19 REQUIRED_VARS 44 REQUIRED_VARS
20 fmt_LIBRARY 45 fmt_LIBRARY
21 fmt_INCLUDE_DIR 46 fmt_INCLUDE_DIR
47 fmt_VERSION
22 VERSION_VAR fmt_VERSION 48 VERSION_VAR fmt_VERSION
23) 49)
24 50
diff --git a/externals/find-modules/Findnlohmann_json.cmake b/externals/find-modules/Findnlohmann_json.cmake
index a3bf1d774..b0c5b3e4e 100644
--- a/externals/find-modules/Findnlohmann_json.cmake
+++ b/externals/find-modules/Findnlohmann_json.cmake
@@ -8,11 +8,25 @@ find_path(nlohmann_json_INCLUDE_DIR
8 PATH_SUFFIXES nlohmann 8 PATH_SUFFIXES nlohmann
9) 9)
10 10
11if(nlohmann_json_INCLUDE_DIR)
12 file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
13 REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
14 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
15 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
16 string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
17 set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
18 unset(_nlohmann_json_version_major)
19 unset(_nlohmann_json_version_minor)
20 unset(_nlohmann_json_version_patch)
21 unset(_nlohmann_json_version_lines)
22endif()
23
11include(FindPackageHandleStandardArgs) 24include(FindPackageHandleStandardArgs)
12find_package_handle_standard_args(nlohmann_json 25find_package_handle_standard_args(nlohmann_json
13 FOUND_VAR nlohmann_json_FOUND 26 FOUND_VAR nlohmann_json_FOUND
14 REQUIRED_VARS 27 REQUIRED_VARS
15 nlohmann_json_INCLUDE_DIR 28 nlohmann_json_INCLUDE_DIR
29 nlohmann_json_VERSION
16 VERSION_VAR nlohmann_json_VERSION 30 VERSION_VAR nlohmann_json_VERSION
17) 31)
18 32
diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake
index cd0158b0c..539abbafc 100644
--- a/externals/find-modules/Findzstd.cmake
+++ b/externals/find-modules/Findzstd.cmake
@@ -11,12 +11,26 @@ find_library(zstd_LIBRARY
11 PATHS ${PC_zstd_LIBRARY_DIRS} 11 PATHS ${PC_zstd_LIBRARY_DIRS}
12) 12)
13 13
14if(zstd_INCLUDE_DIR)
15 file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
16 REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
17 string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
18 string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
19 string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
20 set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
21 unset(_zstd_version_major)
22 unset(_zstd_version_minor)
23 unset(_zstd_version_release)
24 unset(_zstd_version_lines)
25endif()
26
14include(FindPackageHandleStandardArgs) 27include(FindPackageHandleStandardArgs)
15find_package_handle_standard_args(zstd 28find_package_handle_standard_args(zstd
16 FOUND_VAR zstd_FOUND 29 FOUND_VAR zstd_FOUND
17 REQUIRED_VARS 30 REQUIRED_VARS
18 zstd_LIBRARY 31 zstd_LIBRARY
19 zstd_INCLUDE_DIR 32 zstd_INCLUDE_DIR
33 zstd_VERSION
20 VERSION_VAR zstd_VERSION 34 VERSION_VAR zstd_VERSION
21) 35)
22 36