1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
|
From f199b073c437c9ed3fc4f0d9dd3f3e78d4511225 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <anbe@debian.org>
Date: Sat, 1 Nov 2025 08:59:33 +0100
Subject: [PATCH] Revert "Cleanup. Assume static linking."
This reverts commit 1a6e70c9a0dd497a16fca627ae587343154742cb.
---
src/nvimage/Filter.cpp | 2 --
src/nvmath/CMakeLists.txt | 10 +++++++++-
src/nvmath/Color.h | 8 ++++----
src/nvmath/Fitting.h | 1 -
src/nvmath/Matrix.h | 10 +++++++---
src/nvmath/Matrix.inl | 6 +++++-
src/nvmath/Plane.h | 7 ++++++-
src/nvmath/SphericalHarmonic.h | 18 +++++++++---------
src/nvmath/Vector.h | 20 ++++++++++++++++----
src/nvmath/Vector.inl | 6 ++++--
src/nvmath/ftoi.h | 4 ++++
src/nvmath/nvmath.h | 19 +++++++++++++++++++
12 files changed, 83 insertions(+), 28 deletions(-)
diff --git a/src/nvimage/Filter.cpp b/src/nvimage/Filter.cpp
index da92ba4..e30fefe 100644
--- a/src/nvimage/Filter.cpp
+++ b/src/nvimage/Filter.cpp
@@ -35,9 +35,7 @@
#include "Filter.h"
-#include "nvmath/nvmath.h"
#include "nvmath/Vector.h" // Vector4
-
#include "nvcore/Utils.h" // swap
#include <string.h> // memset
diff --git a/src/nvmath/CMakeLists.txt b/src/nvmath/CMakeLists.txt
index 75efd55..a590353 100644
--- a/src/nvmath/CMakeLists.txt
+++ b/src/nvmath/CMakeLists.txt
@@ -14,7 +14,15 @@ SET(MATH_SRCS
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-ADD_LIBRARY(nvmath ${MATH_SRCS})
+# targets
+ADD_DEFINITIONS(-DNVMATH_EXPORTS)
+
+IF(NVMATH_SHARED)
+ ADD_DEFINITIONS(-DNVMATH_SHARED=1)
+ ADD_LIBRARY(nvmath SHARED ${MATH_SRCS})
+ELSE(NVMATH_SHARED)
+ ADD_LIBRARY(nvmath ${MATH_SRCS})
+ENDIF(NVMATH_SHARED)
TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore)
SET_TARGET_PROPERTIES(nvmath PROPERTIES
diff --git a/src/nvmath/Color.h b/src/nvmath/Color.h
index bdb9a8d..178c765 100644
--- a/src/nvmath/Color.h
+++ b/src/nvmath/Color.h
@@ -10,7 +10,7 @@ namespace nv
{
/// 64 bit color stored as BGRA.
- class Color64
+ class NVMATH_CLASS Color64
{
public:
Color64() { }
@@ -46,7 +46,7 @@ namespace nv
};
/// 32 bit color stored as BGRA.
- class Color32
+ class NVMATH_CLASS Color32
{
public:
Color32() { }
@@ -96,7 +96,7 @@ namespace nv
/// 16 bit 565 BGR color.
- struct Color16
+ struct NVMATH_CLASS Color16
{
Color16() { }
Color16(const Color16 & c) : u(c.u) { }
@@ -120,7 +120,7 @@ namespace nv
};
/// 16 bit 4444 BGRA color.
- class Color16_4444
+ class NVMATH_CLASS Color16_4444
{
public:
Color16_4444() { }
diff --git a/src/nvmath/Fitting.h b/src/nvmath/Fitting.h
index 4c5ee59..7728f10 100644
--- a/src/nvmath/Fitting.h
+++ b/src/nvmath/Fitting.h
@@ -1,7 +1,6 @@
// This code is in the public domain -- Ignacio CastaƱo <castano@gmail.com>
#pragma once
-#include "nvmath.h" // NV_EPSILON
#include "Vector.h"
#include "Plane.h"
diff --git a/src/nvmath/Matrix.h b/src/nvmath/Matrix.h
index 6bf0bf3..d1171a1 100644
--- a/src/nvmath/Matrix.h
+++ b/src/nvmath/Matrix.h
@@ -1,6 +1,8 @@
// This code is in the public domain -- castanyo@yahoo.es
#pragma once
+#ifndef NV_MATH_MATRIX_H
+#define NV_MATH_MATRIX_H
#include "Vector.h"
@@ -13,7 +15,7 @@ namespace nv
enum identity_t { identity };
// 2x2 matrix.
- class Matrix2
+ class NVMATH_CLASS Matrix2
{
public:
Matrix2();
@@ -53,7 +55,7 @@ namespace nv
// 3x3 matrix.
- class Matrix3
+ class NVMATH_CLASS Matrix3
{
public:
Matrix3();
@@ -94,7 +96,7 @@ namespace nv
// 4x4 matrix.
- class Matrix
+ class NVMATH_CLASS Matrix
{
public:
typedef Matrix const & Arg;
@@ -148,3 +150,5 @@ namespace nv
extern Matrix inverse(const Matrix & m);
} // nv namespace
+
+#endif // NV_MATH_MATRIX_H
diff --git a/src/nvmath/Matrix.inl b/src/nvmath/Matrix.inl
index 6f025c3..54c998f 100644
--- a/src/nvmath/Matrix.inl
+++ b/src/nvmath/Matrix.inl
@@ -1,9 +1,10 @@
// This code is in the public domain -- castanyo@yahoo.es
#pragma once
+#ifndef NV_MATH_MATRIX_INL
+#define NV_MATH_MATRIX_INL
#include "Matrix.h"
-#include "nvmath.h"
namespace nv
{
@@ -1461,3 +1462,6 @@ public:
};
#endif
+
+
+#endif // NV_MATH_MATRIX_INL
diff --git a/src/nvmath/Plane.h b/src/nvmath/Plane.h
index a4dff24..dc468b2 100644
--- a/src/nvmath/Plane.h
+++ b/src/nvmath/Plane.h
@@ -1,14 +1,17 @@
// This code is in the public domain -- Ignacio Castao <castano@gmail.com>
#pragma once
+#ifndef NV_MATH_PLANE_H
+#define NV_MATH_PLANE_H
+#include "nvmath.h"
#include "Vector.h"
namespace nv
{
class Matrix;
- class Plane
+ class NVMATH_CLASS Plane
{
public:
Plane();
@@ -35,3 +38,5 @@ namespace nv
} // nv namespace
+
+#endif // NV_MATH_PLANE_H
diff --git a/src/nvmath/SphericalHarmonic.h b/src/nvmath/SphericalHarmonic.h
index 962588f..f2eb741 100644
--- a/src/nvmath/SphericalHarmonic.h
+++ b/src/nvmath/SphericalHarmonic.h
@@ -14,11 +14,11 @@ namespace nv
class Vector3;
class Matrix;
- float legendrePolynomial( int l, int m, float x ) NV_CONST;
- float shBasis( int l, int m, float theta, float phi ) NV_CONST;
- float shBasis( int l, int m, const Vector3 & v ) NV_CONST;
- float hshBasis( int l, int m, float theta, float phi ) NV_CONST;
- float hshBasis( int l, int m, const Vector3 & v ) NV_CONST;
+ NVMATH_API float legendrePolynomial( int l, int m, float x ) NV_CONST;
+ NVMATH_API float shBasis( int l, int m, float theta, float phi ) NV_CONST;
+ NVMATH_API float shBasis( int l, int m, const Vector3 & v ) NV_CONST;
+ NVMATH_API float hshBasis( int l, int m, float theta, float phi ) NV_CONST;
+ NVMATH_API float hshBasis( int l, int m, const Vector3 & v ) NV_CONST;
class Sh;
float dot(const Sh & a, const Sh & b) NV_CONST;
@@ -395,10 +395,10 @@ namespace nv
}*/
- void multiply( const ShMatrix &A, const ShMatrix &B );
- void rotation( const Matrix & m );
- void rotation( int axis, float angles );
- void print();
+ NVMATH_API void multiply( const ShMatrix &A, const ShMatrix &B );
+ NVMATH_API void rotation( const Matrix & m );
+ NVMATH_API void rotation( int axis, float angles );
+ NVMATH_API void print();
private:
diff --git a/src/nvmath/Vector.h b/src/nvmath/Vector.h
index f525ef5..ad18672 100644
--- a/src/nvmath/Vector.h
+++ b/src/nvmath/Vector.h
@@ -1,12 +1,14 @@
// This code is in the public domain -- castanyo@yahoo.es
#pragma once
+#ifndef NV_MATH_VECTOR_H
+#define NV_MATH_VECTOR_H
-#include "nvcore/nvcore.h"
+#include "nvmath.h"
namespace nv
{
- class Vector2
+ class NVMATH_CLASS Vector2
{
public:
typedef Vector2 const & Arg;
@@ -31,6 +33,9 @@ namespace nv
void operator*=(float s);
void operator*=(Vector2::Arg v);
+ friend bool operator==(Vector2::Arg a, Vector2::Arg b);
+ friend bool operator!=(Vector2::Arg a, Vector2::Arg b);
+
union {
struct {
float x, y;
@@ -39,7 +44,7 @@ namespace nv
};
};
- class Vector3
+ class NVMATH_CLASS Vector3
{
public:
typedef Vector3 const & Arg;
@@ -70,6 +75,9 @@ namespace nv
void operator*=(Vector3::Arg v);
void operator/=(Vector3::Arg v);
+ friend bool operator==(Vector3::Arg a, Vector3::Arg b);
+ friend bool operator!=(Vector3::Arg a, Vector3::Arg b);
+
union {
struct {
float x, y, z;
@@ -78,7 +86,7 @@ namespace nv
};
};
- class Vector4
+ class NVMATH_CLASS Vector4
{
public:
typedef Vector4 const & Arg;
@@ -113,6 +121,9 @@ namespace nv
void operator*=(Vector4::Arg v);
void operator/=(Vector4::Arg v);
+ friend bool operator==(Vector4::Arg a, Vector4::Arg b);
+ friend bool operator!=(Vector4::Arg a, Vector4::Arg b);
+
union {
struct {
float x, y, z, w;
@@ -135,3 +146,4 @@ template <typename T> T to(const nv::Vector2 & v) { NV_COMPILER_CHECK(sizeof(T)
template <typename T> T to(const nv::Vector3 & v) { NV_COMPILER_CHECK(sizeof(T) == sizeof(nv::Vector3)); return T(v.x, v.y, v.z); }
template <typename T> T to(const nv::Vector4 & v) { NV_COMPILER_CHECK(sizeof(T) == sizeof(nv::Vector4)); return T(v.x, v.y, v.z, v.w); }
+#endif // NV_MATH_VECTOR_H
diff --git a/src/nvmath/Vector.inl b/src/nvmath/Vector.inl
index 1d87eb3..735b2a2 100644
--- a/src/nvmath/Vector.inl
+++ b/src/nvmath/Vector.inl
@@ -1,10 +1,10 @@
// This code is in the public domain -- castanyo@yahoo.es
#pragma once
+#ifndef NV_MATH_VECTOR_INL
+#define NV_MATH_VECTOR_INL
#include "Vector.h"
-#include "nvmath.h"
-
#include "nvcore/Utils.h" // min, max
#include "nvcore/Hash.h" // hash
@@ -905,3 +905,5 @@ namespace nv
#endif //NV_OS_IOS
} // nv namespace
+
+#endif // NV_MATH_VECTOR_INL
diff --git a/src/nvmath/ftoi.h b/src/nvmath/ftoi.h
index a99af8e..05c157f 100755
--- a/src/nvmath/ftoi.h
+++ b/src/nvmath/ftoi.h
@@ -1,6 +1,8 @@
// This code is in the public domain -- castano@gmail.com
#pragma once
+#ifndef NV_MATH_FTOI_H
+#define NV_MATH_FTOI_H
#include "nvmath/nvmath.h"
@@ -248,3 +250,5 @@ namespace nv
} // nv
+
+#endif // NV_MATH_FTOI_H
diff --git a/src/nvmath/nvmath.h b/src/nvmath/nvmath.h
index 2a4f887..65b8ecb 100644
--- a/src/nvmath/nvmath.h
+++ b/src/nvmath/nvmath.h
@@ -1,6 +1,8 @@
// This code is in the public domain -- castanyo@yahoo.es
#pragma once
+#ifndef NV_MATH_H
+#define NV_MATH_H
#include "nvcore/nvcore.h"
#include "nvcore/Debug.h" // nvDebugCheck
@@ -14,6 +16,21 @@
#include <float.h> // finite, isnan
#endif
+
+// Function linkage
+#if NVMATH_SHARED
+#ifdef NVMATH_EXPORTS
+#define NVMATH_API DLL_EXPORT
+#define NVMATH_CLASS DLL_EXPORT_CLASS
+#else
+#define NVMATH_API DLL_IMPORT
+#define NVMATH_CLASS DLL_IMPORT
+#endif
+#else // NVMATH_SHARED
+#define NVMATH_API
+#define NVMATH_CLASS
+#endif // NVMATH_SHARED
+
// Set some reasonable defaults.
#ifndef NV_USE_ALTIVEC
# define NV_USE_ALTIVEC NV_CPU_PPC
@@ -312,3 +329,5 @@ namespace nv
} // nv
+
+#endif // NV_MATH_H
--
2.39.5
|