From 5bbba1c92b4730ef68b304cd668168539a11d13f Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Tue, 18 Jun 2019 07:36:07 +0800 Subject: [PATCH] [nvtt]Upgrade version to 2.1.1 and fix build error on windows. (#6765) * [nvtt]Upgrade version to 2.1.1 and fix build error on windows. * [nvtt]Fix build error on OSX. * [nvtt]Merge two patches. * [nvtt]Re-trigger CI system. * [nvtt]Fix build error on OSX. --- ...ne-value-for-HAVE_UNISTD_H-in-mac-os.patch | 32 +++++++-------- ports/nvtt/CONTROL | 2 +- ports/nvtt/fix-build-error.patch | 39 +++++++++++++++++++ ports/nvtt/portfile.cmake | 7 ++-- 4 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 ports/nvtt/fix-build-error.patch diff --git a/ports/nvtt/001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch b/ports/nvtt/001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch index 915f247c8..366cff84f 100644 --- a/ports/nvtt/001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch +++ b/ports/nvtt/001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch @@ -1,16 +1,16 @@ -diff --git a/src/nvconfig.h.in b/src/nvconfig.h.in -index 16da646..ada6be0 100644 ---- a/src/nvconfig.h.in -+++ b/src/nvconfig.h.in -@@ -1,7 +1,11 @@ - #ifndef NV_CONFIG - #define NV_CONFIG - -+#if NV_OS_DARWIN & !NV_OS_IOS -+#cmakedefine01 HAVE_UNISTD_H -+#else - #cmakedefine HAVE_UNISTD_H -+#endif - #cmakedefine HAVE_STDARG_H - #cmakedefine HAVE_SIGNAL_H - #cmakedefine HAVE_EXECINFO_H +diff --git a/src/nvconfig.h.in b/src/nvconfig.h.in +index 16da646..ada6be0 100644 +--- a/src/nvconfig.h.in ++++ b/src/nvconfig.h.in +@@ -1,7 +1,11 @@ + #ifndef NV_CONFIG + #define NV_CONFIG + ++#if NV_OS_DARWIN & !NV_OS_IOS ++#cmakedefine01 HAVE_UNISTD_H ++#else + #cmakedefine HAVE_UNISTD_H ++#endif + #cmakedefine HAVE_STDARG_H + #cmakedefine HAVE_SIGNAL_H + #cmakedefine HAVE_EXECINFO_H diff --git a/ports/nvtt/CONTROL b/ports/nvtt/CONTROL index e52645ba7..189ff6caf 100644 --- a/ports/nvtt/CONTROL +++ b/ports/nvtt/CONTROL @@ -1,3 +1,3 @@ Source: nvtt -Version: 2.1.0-3 +Version: 2.1.1 Description: Texture processing tools with support for Direct3D 10 and 11 formats. diff --git a/ports/nvtt/fix-build-error.patch b/ports/nvtt/fix-build-error.patch new file mode 100644 index 000000000..7ba1c1976 --- /dev/null +++ b/ports/nvtt/fix-build-error.patch @@ -0,0 +1,39 @@ +diff --git a/extern/butteraugli/butteraugli.h b/extern/butteraugli/butteraugli.h +index 31824b8..c116a73 100644 +--- a/extern/butteraugli/butteraugli.h ++++ b/extern/butteraugli/butteraugli.h +@@ -134,7 +134,14 @@ bool ButteraugliAdaptiveQuantization(size_t xsize, size_t ysize, + // The conventional syntax uint8_t* const RESTRICT is more confusing - it is + // not immediately obvious that the pointee is non-const. + template ++#ifdef _MSC_VER ++// Due to MSVC bug: ++// https://developercommunity.visualstudio.com/content/problem/32196/msvc-cant-compile-a-templated-using-without-instan.html ++// , we cannot use __restrict now. Loss some performance instead of can't use this code. ++using ConstRestrict = T const; ++#else + using ConstRestrict = T const BUTTERAUGLI_RESTRICT; ++#endif + + // Functions that depend on the cache line size. + class CacheAligned { +diff --git a/src/nvthread/Atomic.h b/src/nvthread/Atomic.h +index 212b9cb..b8eaedb 100644 +--- a/src/nvthread/Atomic.h ++++ b/src/nvthread/Atomic.h +@@ -183,7 +183,6 @@ namespace nv { + + + #elif NV_CC_CLANG && (NV_OS_IOS || NV_OS_DARWIN) +- NV_COMPILER_CHECK(sizeof(uint32) == sizeof(long)); + + //ACS: Use Apple's atomics instead? I don't know if these are better in any way; there are non-barrier versions too. There's no OSAtomicSwap32 tho' + /* +@@ -254,7 +253,6 @@ namespace nv { + + + #elif NV_CC_CLANG && POSH_CPU_STRONGARM +- NV_COMPILER_CHECK(sizeof(uint32) == sizeof(long)); + + inline uint32 atomicIncrement(uint32 * value) + { diff --git a/ports/nvtt/portfile.cmake b/ports/nvtt/portfile.cmake index cd6008853..bacdebbbc 100644 --- a/ports/nvtt/portfile.cmake +++ b/ports/nvtt/portfile.cmake @@ -5,14 +5,15 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO castano/nvidia-texture-tools - REF 2.1.0 - SHA512 6c5c9588af57023fc384de080cbe5c5ccd8707d04a9533384c606efd09730d780cb21bcf2d3576102a3facd2f281cacb2625958d74575e71550fd98da92e38b6 + REF 2.1.1 + SHA512 3e6fef5977ca29daa7dc97afe11d61de57a8556c9caf30902db8c5c167d9c38f736bcb62eebdaaf7558299b39975bc269d41ab980c813b67dd1fc85064c853c9 HEAD_REF master PATCHES 001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch bc6h.patch bc7.patch squish.patch + fix-build-error.patch ) vcpkg_configure_cmake( @@ -37,4 +38,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) # Handle copyright file(REMOVE ${CURRENT_PACKAGES_DIR}/share/doc/nvtt/LICENSE) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/nvtt) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/nvtt/LICENSE ${CURRENT_PACKAGES_DIR}/share/nvtt/copyright) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/nvtt/LICENSE ${CURRENT_PACKAGES_DIR}/share/nvtt/copyright) \ No newline at end of file