Cmake-4 support for nvtt

Fix nvtt build to support cmake-4, while at it also fix other
related outstanding cmake issues in nvtt.

Fixes: #7538
Fixes: #7764
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2025-04-27 08:33:11 +02:00
parent 7275f590e9
commit 263b481442
No known key found for this signature in database
4 changed files with 100 additions and 1 deletions

View file

@ -6,7 +6,7 @@ set -e
cd "$(dirname "$0")"
PV=28209
LIB_VERSION=${PV}
LIB_VERSION=${PV}+wfg1
fetch()
{
@ -46,6 +46,11 @@ fi
rm -Rf nvtt-${PV}
"${TAR}" xf nvtt-${PV}.tar.xz
# patch
patch -d nvtt-${PV} -p1 <patches/0001-Don-t-overspecify-flags.patch
patch -d nvtt-${PV} -p1 <patches/0002-Bump-cmake-min-version-to-3.10.patch
patch -d nvtt-${PV} -p1 <patches/0003-Use-execute_process-insted-of-exec_program.patch
# build
(
cd nvtt-${PV}

View file

@ -0,0 +1,41 @@
From fee966a8d44afc26005df9b539b16a5ee7f99107 Mon Sep 17 00:00:00 2001
From: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Date: Sun, 27 Apr 2025 07:53:42 +0200
Subject: [PATCH] Don't overspecify flags
Cmake picks flags like CFALGS CXXFLAGS and LDFLAGS from environment. The
use of CMAKE_LINK_FLAGS even triggers a warning.
Fixes: #7538
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
---
build.sh | 6 ------
1 file changed, 6 deletions(-)
diff --git a/build.sh b/build.sh
index dae3bcf..935c6ff 100755
--- a/build.sh
+++ b/build.sh
@@ -29,9 +29,6 @@ if [ "$(uname -s)" = "Darwin" ]; then
# but they're not as flexible for cross-compiling
# Disable png support (avoids some conflicts with MacPorts)
cmake .. \
- -DCMAKE_LINK_FLAGS="$LDFLAGS" \
- -DCMAKE_C_FLAGS="$CFLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
$CMAKE_FLAGS \
-DBINDIR=bin \
@@ -40,9 +37,6 @@ if [ "$(uname -s)" = "Darwin" ]; then
-G "Unix Makefiles"
else
cmake .. \
- -DCMAKE_LINK_FLAGS="$LDFLAGS" \
- -DCMAKE_C_FLAGS="$CFLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
$CMAKE_FLAGS \
--
2.49.0

View file

@ -0,0 +1,27 @@
From cc07839eff9be49e2c3df4e68ce18f3134caafd2 Mon Sep 17 00:00:00 2001
From: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Date: Sun, 27 Apr 2025 07:57:10 +0200
Subject: [PATCH] Bump cmake min version to 3.10
Cmake-4 removes support for cmake < cmake-3.5 and deprecates cmake <
cmake-3.10
Fixes: #7764
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
---
src/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b18b791..b517b52 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(NV)
ENABLE_TESTING()
--
2.49.0

View file

@ -0,0 +1,26 @@
From 324f50d1ccf5ca38e0f3817c8d18208bd72e01f2 Mon Sep 17 00:00:00 2001
From: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Date: Sun, 27 Apr 2025 08:05:59 +0200
Subject: [PATCH] Use execute_process insted of exec_program
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
---
src/cmake/DetermineProcessor.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmake/DetermineProcessor.cmake b/src/cmake/DetermineProcessor.cmake
index 7db7a95..13d39de 100644
--- a/src/cmake/DetermineProcessor.cmake
+++ b/src/cmake/DetermineProcessor.cmake
@@ -8,7 +8,7 @@ IF(UNIX)
#EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
#IF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
- EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val)
+ execute_process(COMMAND uname -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR ERROR_VARIABLE val)
#ENDIF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown")
IF(NV_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
--
2.49.0