summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/NinjaMultiConfig
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-01-06 16:03:16 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-01-13 17:50:37 (GMT)
commitc7ac13e8ed471497e672578816570535440e5815 (patch)
treed12e24ef3745ab1ab766fc3ae9485225100c9d84 /Tests/RunCMake/NinjaMultiConfig
parent4bac5b628ea1e854ab23b6e713ad3eb211b3a9e3 (diff)
downloadCMake-c7ac13e8ed471497e672578816570535440e5815.zip
CMake-c7ac13e8ed471497e672578816570535440e5815.tar.gz
CMake-c7ac13e8ed471497e672578816570535440e5815.tar.bz2
CUDA: Mult-Config Ninja generator now supports CUDA
Diffstat (limited to 'Tests/RunCMake/NinjaMultiConfig')
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CudaSimple-all-clean-build-check.cmake21
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake27
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake21
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/main.cu15
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/simplelib.cu9
6 files changed, 101 insertions, 0 deletions
diff --git a/Tests/RunCMake/NinjaMultiConfig/CudaSimple-all-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-all-clean-build-check.cmake
new file mode 100644
index 0000000..45f684b
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-all-clean-build-check.cmake
@@ -0,0 +1,21 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${GENERATED_FILES}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_simplecudaexe_Debug}
+ ${TARGET_OBJECT_FILES_simplecudashared_Debug}
+ ${TARGET_OBJECT_FILES_simplecudaobj_Debug}
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_Release}
+ ${TARGET_OBJECT_FILES_simplecudashared_Release}
+ ${TARGET_OBJECT_FILES_simplecudaobj_Release}
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simplecudashared_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simplecudaobj_MinSizeRel}
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simplecudashared_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simplecudaobj_RelWithDebInfo}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake
new file mode 100644
index 0000000..b0fca18
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake
@@ -0,0 +1,27 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${GENERATED_FILES}
+
+ ${TARGET_FILE_simplecudaexe_Debug}
+ ${TARGET_OBJECT_FILES_simplecudaexe_Debug}
+
+ ${TARGET_FILE_simplecudashared_Debug}
+ ${TARGET_LINKER_FILE_simplecudashared_Debug}
+ ${TARGET_OBJECT_FILES_simplecudashared_Debug}
+
+ ${TARGET_OBJECT_FILES_simplecudaobj_Debug}
+
+ EXCLUDE
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_Release}
+ ${TARGET_OBJECT_FILES_simplecudashared_Release}
+ ${TARGET_OBJECT_FILES_simplecudaobj_Release}
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simplecudashared_MinSizeRel}
+ ${TARGET_OBJECT_FILES_simplecudaobj_MinSizeRel}
+
+ ${TARGET_OBJECT_FILES_simplecudaexe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simplecudashared_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_simplecudaobj_RelWithDebInfo}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake b/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake
new file mode 100644
index 0000000..2e9b1cb
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CudaSimple.cmake
@@ -0,0 +1,21 @@
+enable_language(CUDA)
+file(TOUCH ${CMAKE_BINARY_DIR}/empty.cmake)
+
+add_library(simplecudaobj OBJECT simplelib.cu)
+set_target_properties(simplecudaobj
+ PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+
+add_library(simplecudashared SHARED )
+target_link_libraries(simplecudashared PRIVATE simplecudaobj)
+set_target_properties(simplecudaobj simplecudashared
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
+
+add_executable(simplecudaexe main.cu )
+target_link_libraries(simplecudaexe PRIVATE simplecudashared)
+
+include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
+generate_output_files(simplecudaexe simplecudashared simplecudaobj)
+
+file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(GENERATED_FILES [==[${CMAKE_BINARY_DIR}/empty.cmake]==])\n")
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 1271999..4b9d3ed 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -184,6 +184,14 @@ run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Deb
#run_cmake_configure(AutoMocExecutable)
#run_cmake_build(AutoMocExecutable debug-in-release-graph Release exe)
+if(CMake_TEST_CUDA)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build)
+ run_cmake_configure(CudaSimple)
+ include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+ run_cmake_build(CudaSimple debug-target Debug simplecudaexe)
+ run_ninja(CudaSimple all-clean build-Debug.ninja clean:Debug)
+endif()
+
if(CMake_TEST_Qt5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_CROSS_CONFIG_ENABLE=ON")
diff --git a/Tests/RunCMake/NinjaMultiConfig/main.cu b/Tests/RunCMake/NinjaMultiConfig/main.cu
new file mode 100644
index 0000000..563b9b2
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/main.cu
@@ -0,0 +1,15 @@
+
+#include <cuda.h>
+
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
+IMPORT int simplelib();
+
+int main(void)
+{
+ return simplelib();
+}
diff --git a/Tests/RunCMake/NinjaMultiConfig/simplelib.cu b/Tests/RunCMake/NinjaMultiConfig/simplelib.cu
new file mode 100644
index 0000000..7fc0812
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/simplelib.cu
@@ -0,0 +1,9 @@
+#include <cuda.h>
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int simplelib()
+{
+ return 0;
+}