summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-11-22 17:42:35 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-11-23 14:27:42 (GMT)
commit54d80440840edd14a0c9f7324525dc0b0f4c3808 (patch)
treebd1d03f941f625cbe0b5f80fca031591d0637468 /Tests
parent9278ae6f1b80e2694300b5eed2d3dde6cc43b167 (diff)
downloadCMake-54d80440840edd14a0c9f7324525dc0b0f4c3808.zip
CMake-54d80440840edd14a0c9f7324525dc0b0f4c3808.tar.gz
CMake-54d80440840edd14a0c9f7324525dc0b0f4c3808.tar.bz2
Tests: Don't presume that Linux CUDA Toolkits provide static libs
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Cuda/CMakeLists.txt7
-rw-r--r--Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt11
-rw-r--r--Tests/Cuda/SharedRuntimePlusToolkit/main.cpp17
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt26
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp8
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/main.cpp27
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp14
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp8
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp10
-rw-r--r--Tests/Cuda/StaticRuntimePlusToolkit/static.cpp14
-rw-r--r--Tests/CudaOnly/CMakeLists.txt7
-rw-r--r--Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt10
-rw-r--r--Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu17
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt24
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu8
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu27
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu14
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu8
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu10
-rw-r--r--Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu14
20 files changed, 212 insertions, 69 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 669c412..0041b07 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -16,6 +16,7 @@ add_cuda_test_macro(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly)
add_cuda_test_macro(Cuda.Toolkit Toolkit)
add_cuda_test_macro(Cuda.IncludePathNoToolkit IncludePathNoToolkit)
add_cuda_test_macro(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit)
+add_cuda_test_macro(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit)
add_cuda_test_macro(Cuda.Complex CudaComplex)
add_cuda_test_macro(Cuda.ProperLinkFlags ProperLinkFlags)
@@ -24,10 +25,4 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
add_cuda_test_macro(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
endif()
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
-if(NOT WIN32)
- add_cuda_test_macro(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit)
-endif()
-
add_cuda_test_macro(Cuda.WithC CudaWithC)
diff --git a/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt
index 61a3190..088be3b 100644
--- a/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt
+++ b/Tests/Cuda/SharedRuntimePlusToolkit/CMakeLists.txt
@@ -15,16 +15,19 @@ add_library(SharedToolkit SHARED shared.cpp)
target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif)
target_link_libraries(SharedToolkit PUBLIC CUDA::cudart)
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
-if(NOT WIN32)
+# Verify the CUDA Toolkit has static libraries
+if(TARGET CUDA::curand_static AND
+ TARGET CUDA::nppif_static)
#shared runtime with static toolkit libraries
add_library(StaticToolkit SHARED static.cpp)
+ target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION")
target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
target_link_libraries(StaticToolkit PUBLIC CUDA::cudart)
- #static runtime with mixed toolkit libraries
+
+ #shared runtime with mixed toolkit libraries
add_library(MixedToolkit SHARED mixed.cpp)
+ target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION")
target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand_static CUDA::nppif)
target_link_libraries(MixedToolkit PUBLIC CUDA::cudart)
endif()
diff --git a/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp b/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp
index 2a4da22..d958c3a 100644
--- a/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp
+++ b/Tests/Cuda/SharedRuntimePlusToolkit/main.cpp
@@ -1,19 +1,28 @@
#ifdef _WIN32
# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
IMPORT int shared_version();
+
+#ifdef HAS_STATIC_VERSION
+IMPORT int static_version();
+#else
int static_version()
{
return 0;
}
+#endif
+
+#ifdef HAS_MIXED_VERSION
+IMPORT int mixed_version();
+#else
int mixed_version()
{
return 0;
}
-#else
-int shared_version();
-int static_version();
-int mixed_version();
#endif
int main()
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
index df6c392..bb3dadf 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/CMakeLists.txt
@@ -15,15 +15,23 @@ add_library(SharedToolkit SHARED shared.cpp)
target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif)
target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static)
-#static runtime with static toolkit libraries
-add_library(StaticToolkit SHARED static.cpp)
-target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
-target_link_libraries(StaticToolkit PUBLIC CUDA::cudart_static)
+# Verify the CUDA Toolkit has static libraries
+if(TARGET CUDA::curand_static AND
+ TARGET CUDA::nppif_static)
+ #static runtime with static toolkit libraries
+ add_library(StaticToolkit SHARED static.cpp)
+ target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION")
+ target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
+ target_link_libraries(StaticToolkit PUBLIC CUDA::cudart_static)
-#static runtime with mixed toolkit libraries
-add_library(MixedToolkit SHARED mixed.cpp)
-target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static)
-target_link_libraries(MixedToolkit PUBLIC CUDA::cudart_static)
+ #static runtime with mixed toolkit libraries
+ add_library(MixedToolkit SHARED mixed.cpp)
+ target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION")
+ target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static)
+ target_link_libraries(MixedToolkit PUBLIC CUDA::cudart_static)
+endif()
add_executable(StaticRuntimePlusToolkit main.cpp)
-target_link_libraries(StaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit)
+target_link_libraries(StaticRuntimePlusToolkit PRIVATE SharedToolkit
+ $<TARGET_NAME_IF_EXISTS:StaticToolkit>
+ $<TARGET_NAME_IF_EXISTS:MixedToolkit>)
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp
index 95872f0..fdd7b53 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/curand.cpp
@@ -1,6 +1,12 @@
// Comes from:
// https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example
+#ifdef _WIN32
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
+#endif
+
/*
* This program uses the host CURAND API to generate 100
* pseudorandom floats.
@@ -25,7 +31,7 @@
} \
} while (0)
-int curand_main()
+EXPORT int curand_main()
{
size_t n = 100;
size_t i;
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp
index 5a09f8e..d958c3a 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/main.cpp
@@ -1,8 +1,29 @@
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
-int shared_version();
-int static_version();
-int mixed_version();
+IMPORT int shared_version();
+
+#ifdef HAS_STATIC_VERSION
+IMPORT int static_version();
+#else
+int static_version()
+{
+ return 0;
+}
+#endif
+
+#ifdef HAS_MIXED_VERSION
+IMPORT int mixed_version();
+#else
+int mixed_version()
+{
+ return 0;
+}
+#endif
int main()
{
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp
index a05140d..6de6886 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/mixed.cpp
@@ -1,8 +1,16 @@
-int curand_main();
-int nppif_main();
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
-int mixed_version()
+IMPORT int curand_main();
+IMPORT int nppif_main();
+
+EXPORT int mixed_version()
{
return curand_main() == 0 && nppif_main() == 0;
}
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
index 2871090..ac5341c 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp
@@ -1,6 +1,12 @@
// Comes from
// https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066
+#ifdef _WIN32
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
+#endif
+
#include <cstdio>
#include <iostream>
@@ -8,7 +14,7 @@
#include <cuda_runtime_api.h>
#include <nppi_filtering_functions.h>
-int nppif_main()
+EXPORT int nppif_main()
{
/**
* 8-bit unsigned single-channel 1D row convolution.
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp
index 9967b66..f3c3dbc 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/shared.cpp
@@ -1,8 +1,16 @@
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
+
int curand_main();
int nppif_main();
-int shared_version()
+EXPORT int shared_version()
{
return curand_main() == 0 && nppif_main() == 0;
}
diff --git a/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp b/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp
index ca7eb4c..6932fa3 100644
--- a/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp
+++ b/Tests/Cuda/StaticRuntimePlusToolkit/static.cpp
@@ -1,8 +1,16 @@
-int curand_main();
-int nppif_main();
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
-int static_version()
+IMPORT int curand_main();
+IMPORT int nppif_main();
+
+EXPORT int static_version()
{
return curand_main() == 0 && nppif_main() == 0;
}
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 39634ac..db08076 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -10,6 +10,7 @@ add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags)
add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard)
add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
+add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98)
add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit)
add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
@@ -28,12 +29,6 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
endif()
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
-if(NOT WIN32)
- add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
-endif()
-
add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO)
if(MSVC)
diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt
index 03fba22..0b01085 100644
--- a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt
+++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt
@@ -16,16 +16,18 @@ target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::npp
set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none)
target_link_libraries(SharedToolkit PUBLIC CUDA::cudart)
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
-if(NOT WIN32)
+# Verify the CUDA Toolkit has static libraries
+if(TARGET CUDA::curand_static AND
+ TARGET CUDA::nppif_static)
#shared runtime with static toolkit libraries
add_library(StaticToolkit SHARED static.cu)
+ target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION")
target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
set_target_properties(StaticToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
- #static runtime with mixed toolkit libraries
+ #shared runtime with mixed toolkit libraries
add_library(MixedToolkit SHARED mixed.cu)
+ target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION")
target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand_static CUDA::nppif)
set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared)
endif()
diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu
index 2a4da22..d958c3a 100644
--- a/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu
+++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu
@@ -1,19 +1,28 @@
#ifdef _WIN32
# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
IMPORT int shared_version();
+
+#ifdef HAS_STATIC_VERSION
+IMPORT int static_version();
+#else
int static_version()
{
return 0;
}
+#endif
+
+#ifdef HAS_MIXED_VERSION
+IMPORT int mixed_version();
+#else
int mixed_version()
{
return 0;
}
-#else
-int shared_version();
-int static_version();
-int mixed_version();
#endif
int main()
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt
index 534bab2..ae03b66 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt
@@ -16,17 +16,25 @@ target_link_libraries(SharedToolkit PRIVATE Common CUDA::curand CUDA::nppif )
set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none)
target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static)
-#static runtime with static toolkit libraries
-add_library(StaticToolkit SHARED static.cu)
-target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
+# Verify the CUDA Toolkit has static libraries
+if(TARGET CUDA::curand_static AND
+ TARGET CUDA::nppif_static)
+ #static runtime with static toolkit libraries
+ add_library(StaticToolkit SHARED static.cu)
+ target_compile_definitions(StaticToolkit INTERFACE "HAS_STATIC_VERSION")
+ target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static)
-#static runtime with mixed toolkit libraries
-add_library(MixedToolkit SHARED mixed.cu)
-target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static)
-set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Static)
+ #static runtime with mixed toolkit libraries
+ add_library(MixedToolkit SHARED mixed.cu)
+ target_compile_definitions(MixedToolkit INTERFACE "HAS_MIXED_VERSION")
+ target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static)
+ set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Static)
+endif()
add_executable(CudaOnlyStaticRuntimePlusToolkit main.cu)
-target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit)
+target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit
+ $<TARGET_NAME_IF_EXISTS:StaticToolkit>
+ $<TARGET_NAME_IF_EXISTS:MixedToolkit>)
if(UNIX)
# Help the shared cuda runtime find libcurand and libnppif when they are not located
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu
index 95872f0..fdd7b53 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu
@@ -1,6 +1,12 @@
// Comes from:
// https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example
+#ifdef _WIN32
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
+#endif
+
/*
* This program uses the host CURAND API to generate 100
* pseudorandom floats.
@@ -25,7 +31,7 @@
} \
} while (0)
-int curand_main()
+EXPORT int curand_main()
{
size_t n = 100;
size_t i;
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu
index 5a09f8e..d958c3a 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu
@@ -1,8 +1,29 @@
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
-int shared_version();
-int static_version();
-int mixed_version();
+IMPORT int shared_version();
+
+#ifdef HAS_STATIC_VERSION
+IMPORT int static_version();
+#else
+int static_version()
+{
+ return 0;
+}
+#endif
+
+#ifdef HAS_MIXED_VERSION
+IMPORT int mixed_version();
+#else
+int mixed_version()
+{
+ return 0;
+}
+#endif
int main()
{
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu
index a05140d..6de6886 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu
@@ -1,8 +1,16 @@
-int curand_main();
-int nppif_main();
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
-int mixed_version()
+IMPORT int curand_main();
+IMPORT int nppif_main();
+
+EXPORT int mixed_version()
{
return curand_main() == 0 && nppif_main() == 0;
}
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
index 2871090..ac5341c 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu
@@ -1,6 +1,12 @@
// Comes from
// https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066
+#ifdef _WIN32
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
+#endif
+
#include <cstdio>
#include <iostream>
@@ -8,7 +14,7 @@
#include <cuda_runtime_api.h>
#include <nppi_filtering_functions.h>
-int nppif_main()
+EXPORT int nppif_main()
{
/**
* 8-bit unsigned single-channel 1D row convolution.
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu
index 9967b66..f3c3dbc 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu
@@ -1,8 +1,16 @@
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
+
int curand_main();
int nppif_main();
-int shared_version()
+EXPORT int shared_version()
{
return curand_main() == 0 && nppif_main() == 0;
}
diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu
index ca7eb4c..6932fa3 100644
--- a/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu
+++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu
@@ -1,8 +1,16 @@
-int curand_main();
-int nppif_main();
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+# define EXPORT __declspec(dllexport)
+#else
+# define IMPORT
+# define EXPORT
+#endif
-int static_version()
+IMPORT int curand_main();
+IMPORT int nppif_main();
+
+EXPORT int static_version()
{
return curand_main() == 0 && nppif_main() == 0;
}