* add nvtt

* fix nvtt

* fix nvtt

* update sqlite3
pull/1410/head
Hoildkv 2 years ago committed by GitHub
parent fa215a6f0c
commit 46b8287b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 143
      packages/n/nvtt/patches/2.1.2/build.patch
  2. 49
      packages/n/nvtt/xmake.lua
  3. 6
      packages/s/sqlite3/xmake.lua

@ -0,0 +1,143 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 668cd7e..365f2f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NV_CMAKE_DIR}")
# Compiler check (needs -std:c++11 flag)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
-if(COMPILER_SUPPORTS_CXX11)
+if(TRUE)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
diff --git a/cmake/OptimalOptions.cmake b/cmake/OptimalOptions.cmake
index e4d5c56..5d391cb 100644
--- a/cmake/OptimalOptions.cmake
+++ b/cmake/OptimalOptions.cmake
@@ -11,11 +11,11 @@ IF(MSVC)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast")
# Optimization flags.
- SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Oi /Ot /Oy /GL")
- SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
- SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
- SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
+ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /Oy")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /Oy")
+# SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
+# SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
+# SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
# Definitions.
ADD_DEFINITIONS(-D__SSE2__ -D__SSE__ -D__MMX__)
diff --git a/extern/CMP_Core/source/cmp_math_func.h b/extern/CMP_Core/source/cmp_math_func.h
index c2f8908..b652497 100644
--- a/extern/CMP_Core/source/cmp_math_func.h
+++ b/extern/CMP_Core/source/cmp_math_func.h
@@ -32,6 +32,7 @@
// Core API which have have GPU equivalents, defined here for HPC_CPU usage
//============================================================================
+#include <cmath>
#include <algorithm>
using namespace std;
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index ca90fa0..d8fbe1c 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -5,7 +5,7 @@ ADD_SUBDIRECTORY(EtcLib)
ADD_SUBDIRECTORY(rg_etc1_v104)
#ADD_SUBDIRECTORY(etcpack)
-ADD_SUBDIRECTORY(libsquish-1.15)
+#ADD_SUBDIRECTORY(libsquish-1.15)
ADD_SUBDIRECTORY(CMP_Core)
diff --git a/src/bc6h/CMakeLists.txt b/src/bc6h/CMakeLists.txt
index fd75e74..bba50d5 100644
--- a/src/bc6h/CMakeLists.txt
+++ b/src/bc6h/CMakeLists.txt
@@ -15,3 +15,8 @@ SET(BC6H_SRCS
ADD_LIBRARY(bc6h STATIC ${BC6H_SRCS})
TARGET_LINK_LIBRARIES(bc6h nvcore nvmath)
+
+INSTALL(TARGETS bc6h
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static)
diff --git a/src/bc7/CMakeLists.txt b/src/bc7/CMakeLists.txt
index 566fe1f..10b37cc 100644
--- a/src/bc7/CMakeLists.txt
+++ b/src/bc7/CMakeLists.txt
@@ -23,3 +23,8 @@ SET(BC7_SRCS
ADD_LIBRARY(bc7 STATIC ${BC7_SRCS})
TARGET_LINK_LIBRARIES(bc7 nvcore nvmath)
+
+INSTALL(TARGETS bc7
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static)
diff --git a/src/nvmath/nvmath.h b/src/nvmath/nvmath.h
index 38532eb..e68d8f8 100644
--- a/src/nvmath/nvmath.h
+++ b/src/nvmath/nvmath.h
@@ -118,12 +118,12 @@ inline float asinf_assert(const float f)
#endif
#if NV_CC_MSVC
-NV_FORCEINLINE float log2f(float x)
+NV_FORCEINLINE float nv_log2f(float x)
{
nvCheck(x >= 0);
return logf(x) / logf(2.0f);
}
-NV_FORCEINLINE float exp2f(float x)
+NV_FORCEINLINE float nv_exp2f(float x)
{
return powf(2.0f, x);
}
diff --git a/src/nvtt/CMakeLists.txt b/src/nvtt/CMakeLists.txt
index 8285f99..16500ca 100644
--- a/src/nvtt/CMakeLists.txt
+++ b/src/nvtt/CMakeLists.txt
@@ -47,9 +47,15 @@ ADD_DEFINITIONS(-DNVTT_EXPORTS)
#ADD_DEFINITIONS(-DHAVE_RGETC)
#ADD_DEFINITIONS(-DHAVE_ETCPACK)
+if(APPLE)
+ add_compile_options(-mbmi2 -mfma)
+endif()
+
IF(NVTT_SHARED)
+ ADD_DEFINITIONS(-DNVTT_SHARED=1)
ADD_LIBRARY(nvtt SHARED ${NVTT_SRCS})
ELSE(NVTT_SHARED)
+ ADD_DEFINITIONS(-DNVTT_SHARED=0)
ADD_LIBRARY(nvtt ${NVTT_SRCS})
ENDIF(NVTT_SHARED)
@@ -64,4 +70,4 @@ INSTALL(FILES nvtt.h nvtt_wrapper.h DESTINATION include/nvtt)
ADD_SUBDIRECTORY(tools)
-ADD_SUBDIRECTORY(tests)
+#ADD_SUBDIRECTORY(tests)
diff --git a/src/nvtt/squish/CMakeLists.txt b/src/nvtt/squish/CMakeLists.txt
index 65a5dd3..1ee51e3 100644
--- a/src/nvtt/squish/CMakeLists.txt
+++ b/src/nvtt/squish/CMakeLists.txt
@@ -21,3 +21,8 @@ SET(SQUISH_SRCS
simd_ve.h)
ADD_LIBRARY(nvsquish STATIC ${SQUISH_SRCS})
+
+INSTALL(TARGETS nvsquish
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static)

@ -0,0 +1,49 @@
package("nvtt")
set_homepage("https://developer.nvidia.com/legacy-texture-tools")
set_description("The NVIDIA Texture Tools is a collection of image processing and texture manipulation tools.")
set_license("MIT")
add_urls("https://github.com/castano/nvidia-texture-tools/archive/refs/tags/$(version).tar.gz",
"https://github.com/castano/nvidia-texture-tools.git")
add_versions("2.1.2", "0187336b0285038fab4f4a6b7654f51beaebab040b6aad53c147c917c5ab519b")
add_patches("2.1.2", path.join(os.scriptdir(), "patches", "2.1.2", "build.patch"), "ed9b5884d6a644445bd1e3407a6575ca2a72b24a9edb9b01afe5f4f8e7272b8e")
add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
add_deps("cmake")
if is_plat("windows") then
add_syslinks("user32")
elseif is_plat("linux") then
add_syslinks("pthread")
end
add_links("nvtt", "nvimage", "nvthread", "bc6h", "bc7", "nvmath", "nvcore", "nvsquish")
on_load("windows", "macosx", "linux", function (package)
if package:config("cuda") then
package:add("deps", "cuda")
end
if not package:config("shared") or package:is_plat("windows") then
package:add("linkdirs", "lib/static")
end
if package:config("shared") and package:is_plat("windows") then
package:add("defines", "NVTT_SHARED=1")
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DNVTT_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_CUDA=" .. (package:config("cuda") and "OFF" or "ON"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
nvtt::CompressionOptions o;
o.setFormat(nvtt::Format_BC7);
}
]]}, {configs = {languages = "c++11"}, includes = "nvtt/nvtt.h"}))
end)

@ -5,11 +5,10 @@ package("sqlite3")
set_urls("https://sqlite.org/$(version)", {version = function (version)
local year = "2022"
if version:le("3.36") then
year = "2021"
end
if version:le("3.24") then
year = "2018"
elseif version:le("3.36") then
year = "2021"
end
local version_str = version:gsub("[.+]", "")
if #version_str < 7 then
@ -25,6 +24,7 @@ package("sqlite3")
add_versions("3.35.0+400", "7771525dff0185bfe9638ccce23faa0e1451757ddbda5a6c853bb80b923a512d")
add_versions("3.36.0+0", "bd90c3eb96bee996206b83be7065c9ce19aef38c3f4fb53073ada0d0b69bbce3")
add_versions("3.37.0+200", "4089a8d9b467537b3f246f217b84cd76e00b1d1a971fe5aca1e30e230e46b2d8")
add_versions("3.39.0+200", "852be8a6183a17ba47cee0bbff7400b7aa5affd283bf3beefc34fcd088a239de")
if is_plat("macosx", "linux", "bsd") then
add_syslinks("pthread", "dl")

Loading…
Cancel
Save