aboutsummaryrefslogtreecommitdiffhomepage
path: root/externals
diff options
context:
space:
mode:
authorlat9nq <[email protected]>2023-06-16 04:00:19 -0400
committerlat9nq <[email protected]>2023-06-16 04:00:19 -0400
commitcdc73498e3863c1ac60dc08db24661be79b1b426 (patch)
treed57149b3b1e80f52ca2ce9f6cd0bcad5240605b1 /externals
parent8d8f850bd6d32e3f7b0cbbf40d771d49f6f22b1a (diff)
downloadyuzu-mainline-cdc73498e3863c1ac60dc08db24661be79b1b426.tar.gz
yuzu-mainline-cdc73498e3863c1ac60dc08db24661be79b1b426.zip
nx_tzdb: Support submoduling tzdb_to_nx
Fix for flatpak having no internet access during CMake configure.
Diffstat (limited to 'externals')
-rw-r--r--externals/nx_tzdb/CMakeLists.txt37
1 files changed, 30 insertions, 7 deletions
diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt
index 119ffe8d6..d7e69a2ef 100644
--- a/externals/nx_tzdb/CMakeLists.txt
+++ b/externals/nx_tzdb/CMakeLists.txt
@@ -1,24 +1,47 @@
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
-set(NX_TZDB_VERSION "220816")
-set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip")
+set(NX_TZDB_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
-set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip")
-set(NX_TZDB_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb")
+add_library(nx_tzdb INTERFACE)
-set(NX_TZDB_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
+find_program(GIT git)
+find_program(GNU_MAKE make)
+find_program(GNU_DATE date)
+
+set(CAN_BUILD_NX_TZDB true)
+
+if ("${GIT}" STREQUAL "GIT-NOTFOUND")
+ message("git program not found")
+ set(CAN_BUILD_NX_TZDB false)
+endif()
+if ("${GNU_MAKE}" STREQUAL "GNU_MAKE-NOTFOUND")
+ message("GNU make program not found")
+ set(CAN_BUILD_NX_TZDB false)
+endif()
+if ("${GNU_DATE}" STREQUAL "GNU_DATE-NOTFOUND")
+ message("GNU date program not found")
+ set(CAN_BUILD_NX_TZDB false)
+endif()
+
+if (NOT ${CAN_BUILD_NX_TZDB} AND NOT EXISTS ${NX_TZDB_ARCHIVE})
+ set(NX_TZDB_VERSION "220816")
+ set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip")
+
+ set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip")
+ set(NX_TZDB_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb" CACHE PATH "Path to Switch-style time zone data")
-if (NOT EXISTS ${NX_TZDB_ARCHIVE})
file(DOWNLOAD ${NX_TZDB_DOWNLOAD_URL} ${NX_TZDB_ARCHIVE})
file(ARCHIVE_EXTRACT
INPUT
${NX_TZDB_ARCHIVE}
DESTINATION
${NX_TZDB_DIR})
+elseif (${CAN_BUILD_NX_TZDB})
+ add_subdirectory(tzdb_to_nx)
+ add_dependencies(nx_tzdb x80e)
endif()
-add_library(nx_tzdb INTERFACE)
target_include_directories(nx_tzdb
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include
INTERFACE ${NX_TZDB_INCLUDE_DIR})