Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nvtt]Upgrade version to 2.1.1 and fix build error on windows. #6765

Merged
merged 5 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions ports/nvtt/001-define-value-for-HAVE_UNISTD_H-in-mac-os.patch
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ports/nvtt/CONTROL
Original file line number Diff line number Diff line change
@@ -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.
39 changes: 39 additions & 0 deletions ports/nvtt/fix-build-error.patch
Original file line number Diff line number Diff line change
@@ -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 <typename T>
+#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)
{
7 changes: 4 additions & 3 deletions ports/nvtt/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)