From 03e8d9aca73f3c6da2acc2c7e88a452bdf515c3b Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Thu, 15 Jun 2023 23:03:54 -0400 Subject: nx_tzdb: Correct Antarctica spelling --- externals/nx_tzdb/CMakeLists.txt | 2 +- externals/nx_tzdb/include/nx_tzdb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 2f625c108..119ffe8d6 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -49,7 +49,7 @@ CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Argentina america_argentina) CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Indiana america_indiana) CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Kentucky america_kentucky) CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/North_Dakota america_north_dakota) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Antartica antartica) +CreateHeader(${NX_TZDB_DIR}/zoneinfo/Antarctica antarctica) CreateHeader(${NX_TZDB_DIR}/zoneinfo/Arctic arctic) CreateHeader(${NX_TZDB_DIR}/zoneinfo/Asia asia) CreateHeader(${NX_TZDB_DIR}/zoneinfo/Atlantic atlantic) diff --git a/externals/nx_tzdb/include/nx_tzdb.h b/externals/nx_tzdb/include/nx_tzdb.h index d7b1e4304..1f7c6069a 100644 --- a/externals/nx_tzdb/include/nx_tzdb.h +++ b/externals/nx_tzdb/include/nx_tzdb.h @@ -9,7 +9,7 @@ #include "nx_tzdb/america_indiana.h" #include "nx_tzdb/america_kentucky.h" #include "nx_tzdb/america_north_dakota.h" -#include "nx_tzdb/antartica.h" +#include "nx_tzdb/antarctica.h" #include "nx_tzdb/arctic.h" #include "nx_tzdb/asia.h" #include "nx_tzdb/atlantic.h" -- cgit v1.2.3 From cdc73498e3863c1ac60dc08db24661be79b1b426 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 04:00:19 -0400 Subject: nx_tzdb: Support submoduling tzdb_to_nx Fix for flatpak having no internet access during CMake configure. --- externals/nx_tzdb/CMakeLists.txt | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'externals') 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}) -- cgit v1.2.3 From b23c358e3d837bc4aab1444d23dd1d5915a79777 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 04:15:19 -0400 Subject: externals: submodule tzdb_to_nx Fix for Flatpak being unable to download during CMake configure. --- externals/nx_tzdb/tzdb_to_nx | 1 + 1 file changed, 1 insertion(+) create mode 160000 externals/nx_tzdb/tzdb_to_nx (limited to 'externals') diff --git a/externals/nx_tzdb/tzdb_to_nx b/externals/nx_tzdb/tzdb_to_nx new file mode 160000 index 000000000..34df65eff --- /dev/null +++ b/externals/nx_tzdb/tzdb_to_nx @@ -0,0 +1 @@ +Subproject commit 34df65eff295c2bd9ee9e6a077d662486d5cabb3 -- cgit v1.2.3 From e9701a3cda5907a2789457bc93771d87915920d4 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 04:32:31 -0400 Subject: cmake: Add option to always download time zone data --- externals/nx_tzdb/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index d7e69a2ef..c15110fd6 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -24,11 +24,12 @@ if ("${GNU_DATE}" STREQUAL "GNU_DATE-NOTFOUND") 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_VERSION "220816") +set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") + +if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) 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") file(DOWNLOAD ${NX_TZDB_DOWNLOAD_URL} ${NX_TZDB_ARCHIVE}) -- cgit v1.2.3 From 7ffb96f474ec970823111d6274c495df95081a66 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 01:03:46 -0400 Subject: cmake: Extra time zone data download checks Extra sanitization for Windows hosts, and fail loudly when the download fails. cmake: Fix status code reading --- externals/nx_tzdb/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index c15110fd6..67599faf4 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -12,27 +12,35 @@ 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 ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # tzdb_to_nx currently requires a posix-compliant host set(CAN_BUILD_NX_TZDB false) endif() set(NX_TZDB_VERSION "220816") set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") +set(NX_TZDB_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") + if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip") - set(NX_TZDB_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb" CACHE PATH "Path to Switch-style time zone data") + message(STATUS "Downloading time zone data from ${NX_TZDB_DOWNLOAD_URL}...") + file(DOWNLOAD ${NX_TZDB_DOWNLOAD_URL} ${NX_TZDB_ARCHIVE} + STATUS NX_TZDB_DOWNLOAD_STATUS) + list(GET NX_TZDB_DOWNLOAD_STATUS 0 NX_TZDB_DOWNLOAD_STATUS_CODE) + if (NOT "${NX_TZDB_DOWNLOAD_STATUS_CODE}" STREQUAL "0") + message(FATAL_ERROR "Time zone data download failed (status code ${NX_TZDB_DOWNLOAD_STATUS_CODE})") + endif() - file(DOWNLOAD ${NX_TZDB_DOWNLOAD_URL} ${NX_TZDB_ARCHIVE}) file(ARCHIVE_EXTRACT INPUT ${NX_TZDB_ARCHIVE} -- cgit v1.2.3 From d35c9899020acdedf4ea7c23a5986fc2e2ceedeb Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 05:07:30 -0400 Subject: cmake: Use non-conflicting variable names --- externals/nx_tzdb/CMakeLists.txt | 52 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 67599faf4..1ec72d418 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -28,7 +28,7 @@ endif() set(NX_TZDB_VERSION "220816") set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") -set(NX_TZDB_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") +set(NX_TZDB_ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip") @@ -45,10 +45,12 @@ if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS INPUT ${NX_TZDB_ARCHIVE} DESTINATION - ${NX_TZDB_DIR}) -elseif (${CAN_BUILD_NX_TZDB}) + ${NX_TZDB_ROMFS_DIR}) +elseif (${CAN_BUILD_NX_TZDB} AND NOT ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) add_subdirectory(tzdb_to_nx) add_dependencies(nx_tzdb x80e) + + set(NX_TZDB_ROMFS_DIR "${NX_TZDB_DIR}") endif() target_include_directories(nx_tzdb @@ -73,25 +75,25 @@ function(CreateHeader ZONE_PATH HEADER_NAME) target_sources(nx_tzdb PRIVATE ${HEADER_PATH}) endfunction() -CreateHeader(${NX_TZDB_DIR} base) -CreateHeader(${NX_TZDB_DIR}/zoneinfo zoneinfo) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Africa africa) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/America america) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Argentina america_argentina) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Indiana america_indiana) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/Kentucky america_kentucky) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/America/North_Dakota america_north_dakota) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Antarctica antarctica) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Arctic arctic) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Asia asia) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Atlantic atlantic) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Australia australia) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Brazil brazil) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Canada canada) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Chile chile) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Etc etc) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Europe europe) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Indian indian) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Mexico mexico) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/Pacific pacific) -CreateHeader(${NX_TZDB_DIR}/zoneinfo/US us) +CreateHeader(${NX_TZDB_ROMFS_DIR} base) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo zoneinfo) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Africa africa) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/America america) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/America/Argentina america_argentina) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/America/Indiana america_indiana) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/America/Kentucky america_kentucky) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/America/North_Dakota america_north_dakota) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Antarctica antarctica) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Arctic arctic) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Asia asia) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Atlantic atlantic) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Australia australia) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Brazil brazil) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Canada canada) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Chile chile) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Etc etc) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Europe europe) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Indian indian) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Mexico mexico) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/Pacific pacific) +CreateHeader(${NX_TZDB_ROMFS_DIR}/zoneinfo/US us) -- cgit v1.2.3 From d9e2824c4e64b5bcfe3acbeaafdfe278320087d2 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 05:32:11 -0400 Subject: cmake: Check for target is Windows MinGW has issues building tzdb2nx due to the headers being Windows specific. Download for this toolchain as well. --- externals/nx_tzdb/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 1ec72d418..db00e9d40 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -20,7 +20,7 @@ endif() if ("${GNU_DATE}" STREQUAL "GNU_DATE-NOTFOUND") set(CAN_BUILD_NX_TZDB false) endif() -if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") # tzdb_to_nx currently requires a posix-compliant host set(CAN_BUILD_NX_TZDB false) endif() -- cgit v1.2.3 From 1fa16bc5943b997c28b2832b2f19a77eb689895b Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 16 Jun 2023 05:38:33 -0400 Subject: cmake: Add warn about cross compiling, disable android --- externals/nx_tzdb/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index db00e9d40..8429f82e5 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -20,8 +20,10 @@ endif() if ("${GNU_DATE}" STREQUAL "GNU_DATE-NOTFOUND") set(CAN_BUILD_NX_TZDB false) endif() -if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") +if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR ANDROID) # tzdb_to_nx currently requires a posix-compliant host + # MinGW and Android are handled here due to the executable format being different from the host system + # TODO (lat9nq): cross-compiling support set(CAN_BUILD_NX_TZDB false) endif() -- cgit v1.2.3 From 4cbdce17b69f4ab1f8da29c6718bec09e11b8125 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sat, 17 Jun 2023 01:35:35 -0400 Subject: nx_tzdb: Directly reference variables in if statements Addresses review feedback. --- externals/nx_tzdb/CMakeLists.txt | 14 +++++++------- externals/nx_tzdb/NxTzdbCreateHeader.cmake | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'externals') diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 8429f82e5..d5a1c6317 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -11,16 +11,16 @@ find_program(GNU_DATE date) set(CAN_BUILD_NX_TZDB true) -if ("${GIT}" STREQUAL "GIT-NOTFOUND") +if (NOT GIT) set(CAN_BUILD_NX_TZDB false) endif() -if ("${GNU_MAKE}" STREQUAL "GNU_MAKE-NOTFOUND") +if (NOT GNU_MAKE) set(CAN_BUILD_NX_TZDB false) endif() -if ("${GNU_DATE}" STREQUAL "GNU_DATE-NOTFOUND") +if (NOT GNU_DATE) set(CAN_BUILD_NX_TZDB false) endif() -if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR ANDROID) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR ANDROID) # tzdb_to_nx currently requires a posix-compliant host # MinGW and Android are handled here due to the executable format being different from the host system # TODO (lat9nq): cross-compiling support @@ -32,14 +32,14 @@ set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") set(NX_TZDB_ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") -if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) +if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip") message(STATUS "Downloading time zone data from ${NX_TZDB_DOWNLOAD_URL}...") file(DOWNLOAD ${NX_TZDB_DOWNLOAD_URL} ${NX_TZDB_ARCHIVE} STATUS NX_TZDB_DOWNLOAD_STATUS) list(GET NX_TZDB_DOWNLOAD_STATUS 0 NX_TZDB_DOWNLOAD_STATUS_CODE) - if (NOT "${NX_TZDB_DOWNLOAD_STATUS_CODE}" STREQUAL "0") + if (NOT NX_TZDB_DOWNLOAD_STATUS_CODE EQUAL 0) message(FATAL_ERROR "Time zone data download failed (status code ${NX_TZDB_DOWNLOAD_STATUS_CODE})") endif() @@ -48,7 +48,7 @@ if ((NOT ${CAN_BUILD_NX_TZDB} OR ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) AND NOT EXISTS ${NX_TZDB_ARCHIVE} DESTINATION ${NX_TZDB_ROMFS_DIR}) -elseif (${CAN_BUILD_NX_TZDB} AND NOT ${YUZU_DOWNLOAD_TIME_ZONE_DATA}) +elseif (CAN_BUILD_NX_TZDB AND NOT YUZU_DOWNLOAD_TIME_ZONE_DATA) add_subdirectory(tzdb_to_nx) add_dependencies(nx_tzdb x80e) diff --git a/externals/nx_tzdb/NxTzdbCreateHeader.cmake b/externals/nx_tzdb/NxTzdbCreateHeader.cmake index 69166aa5b..8c29e1167 100644 --- a/externals/nx_tzdb/NxTzdbCreateHeader.cmake +++ b/externals/nx_tzdb/NxTzdbCreateHeader.cmake @@ -15,7 +15,7 @@ set(DIRECTORY_NAME ${HEADER_NAME}) set(FILE_DATA "") foreach(ZONE_FILE ${FILE_LIST}) - if ("${ZONE_FILE}" STREQUAL "\n") + if (ZONE_FILE STREQUAL "\n") continue() endif() @@ -26,13 +26,13 @@ foreach(ZONE_FILE ${FILE_LIST}) foreach(I RANGE 0 ${ZONE_DATA_LEN} 2) math(EXPR BREAK_LINE "(${I} + 2) % 38") - string(SUBSTRING "${ZONE_DATA}" "${I}" "2" HEX_DATA) - if ("${HEX_DATA}" STREQUAL "") + string(SUBSTRING "${ZONE_DATA}" "${I}" 2 HEX_DATA) + if (NOT HEX_DATA) break() endif() string(APPEND FILE_DATA "0x${HEX_DATA},") - if ("${BREAK_LINE}" STREQUAL "0") + if (BREAK_LINE EQUAL 0) string(APPEND FILE_DATA "\n") else() string(APPEND FILE_DATA " ") -- cgit v1.2.3