Skip to content

Commit

Permalink
[nvtt] Control CUDA dependency, fix linkage (#24888)
Browse files Browse the repository at this point in the history
* Control CUDA dependency

* Fix release build flags for MSVC

* Update versions
  • Loading branch information
dg0yt authored May 25, 2022
1 parent 8abb3a5 commit ee0d840
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
15 changes: 15 additions & 0 deletions ports/nvtt/fix-release-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/cmake/OptimalOptions.cmake b/cmake/OptimalOptions.cmake
index e4d5c56..eba8624 100644
--- a/cmake/OptimalOptions.cmake
+++ b/cmake/OptimalOptions.cmake
@@ -11,8 +11,8 @@ 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_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /Oy /GL")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /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")
13 changes: 12 additions & 1 deletion ports/nvtt/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@ vcpkg_from_github(
add-compile-options-for-osx.patch
skip-building-libsquish.patch
fix-intrinsic-function.patch
fix-release-flags.patch
)

vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cuda CMAKE_REQUIRE_FIND_PACKAGE_CUDA
INVERTED_FEATURES
cuda CMAKE_DISABLE_FIND_PACKAGE_CUDA
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DNVTT_SHARED=0
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=_d # required by OSG
)

vcpkg_cmake_install()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

Expand Down
12 changes: 10 additions & 2 deletions ports/nvtt/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nvtt",
"version": "2.1.2",
"port-version": 4,
"port-version": 5,
"description": "Texture processing tools with support for Direct3D 10 and 11 formats.",
"homepage": "https://github.com/castano/nvidia-texture-tools",
"license": "MIT",
Expand All @@ -12,5 +12,13 @@
"name": "vcpkg-cmake",
"host": true
}
]
],
"features": {
"cuda": {
"description": "Enable CUDA support",
"dependencies": [
"cuda"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4938,7 +4938,7 @@
},
"nvtt": {
"baseline": "2.1.2",
"port-version": 4
"port-version": 5
},
"oatpp": {
"baseline": "1.3.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/n-/nvtt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b1a685fa7402dce13182820ddd1dce2c6126b69f",
"version": "2.1.2",
"port-version": 5
},
{
"git-tree": "5889b2b68d1c3b13bf681c75e0b8347fff3d72fc",
"version": "2.1.2",
Expand Down

0 comments on commit ee0d840

Please sign in to comment.