diff options
Diffstat (limited to 'Tests/RunCMake')
7 files changed, 104 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index b8ac45b..0534974 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -140,6 +140,9 @@ if(CMAKE_GENERATOR MATCHES "Ninja") if(CMake_TEST_Qt5 AND Qt5Core_FOUND) list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1) endif() + if(DEFINED CMake_TEST_CUDA) + list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) + endif() add_RunCMake_test(NinjaMultiConfig) endif() add_RunCMake_test(CTest) 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; +} |