CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Copyright (C) Microsoft Corporation. All rights reserved.
  2. # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
  3. if(WIN32)
  4. find_package(TAEF REQUIRED)
  5. find_package(DiaSDK REQUIRED) # Used for constants and declarations.
  6. find_package(D3D12 REQUIRED) # Used for ExecutionTest.cpp.
  7. endif(WIN32)
  8. set( LLVM_LINK_COMPONENTS
  9. support
  10. mssupport
  11. dxcsupport
  12. dxil
  13. dxilcontainer
  14. dxilrootsignature
  15. hlsl
  16. option
  17. bitreader
  18. bitwriter
  19. analysis
  20. ipa
  21. irreader
  22. transformutils # for CloneModule
  23. )
  24. if(WIN32)
  25. set(HLSL_IGNORE_SOURCES
  26. TestMain.cpp
  27. HLSLTestOptions.cpp
  28. )
  29. add_clang_library(clang-hlsl-tests SHARED
  30. AllocatorTest.cpp
  31. CompilerTest.cpp
  32. DxilContainerTest.cpp
  33. DxilModuleTest.cpp
  34. DXIsenseTest.cpp
  35. ExecutionTest.cpp
  36. ExtensionTest.cpp
  37. FunctionTest.cpp
  38. LinkerTest.cpp
  39. MSFileSysTest.cpp
  40. Objects.cpp
  41. OptimizerTest.cpp
  42. OptionsTest.cpp
  43. RewriterTest.cpp
  44. ShaderOpTest.cpp
  45. SystemValueTest.cpp
  46. ValidationTest.cpp
  47. VerifierTest.cpp
  48. clang-hlsl-tests.rc
  49. )
  50. else (WIN32)
  51. set(HLSL_IGNORE_SOURCES
  52. ExecutionTest.cpp
  53. LinkerTest.cpp
  54. MSFileSysTest.cpp
  55. RewriterTest.cpp
  56. ShaderOpTest.cpp
  57. DxilContainerTest.cpp
  58. ValidationTest.cpp
  59. CompilerTest.cpp
  60. )
  61. add_clang_unittest(clang-hlsl-tests
  62. AllocatorTest.cpp
  63. DxilModuleTest.cpp
  64. DXIsenseTest.cpp
  65. ExtensionTest.cpp
  66. FunctionTest.cpp
  67. HLSLTestOptions.cpp
  68. Objects.cpp
  69. OptimizerTest.cpp
  70. OptionsTest.cpp
  71. SystemValueTest.cpp
  72. TestMain.cpp
  73. VerifierTest.cpp
  74. )
  75. endif(WIN32)
  76. set_target_properties(clang-hlsl-tests PROPERTIES FOLDER "Clang tests")
  77. if (WIN32)
  78. target_link_libraries(clang-hlsl-tests PRIVATE
  79. dxcompiler
  80. HLSLTestLib
  81. ${TAEF_LIBRARIES}
  82. ${DIASDK_LIBRARIES}
  83. ${D3D12_LIBRARIES}
  84. )
  85. else(WIN32)
  86. target_link_libraries(clang-hlsl-tests
  87. dxcompiler
  88. HLSLTestLib
  89. )
  90. endif(WIN32)
  91. if(WIN32)
  92. # Add includes for platform helpers and dxc API.
  93. include_directories(${TAEF_INCLUDE_DIRS})
  94. include_directories(${DIASDK_INCLUDE_DIRS})
  95. include_directories(${D3D12_INCLUDE_DIRS})
  96. endif(WIN32)
  97. # Add includes to directly reference intrinsic tables.
  98. include_directories(../../lib/Sema)
  99. add_dependencies(clang-hlsl-tests dxcompiler)
  100. if(WIN32)
  101. install(TARGETS clang-hlsl-tests
  102. RUNTIME DESTINATION bin)
  103. else(WIN32)
  104. set_output_directory(clang-hlsl-tests
  105. ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
  106. endif(WIN32)
  107. if(WIN32)
  108. # Add a .user file with settings for te.exe.
  109. file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" DOS_STYLE_SOURCE_DIR)
  110. file(TO_NATIVE_PATH "${TAEF_BIN_DIR}" DOS_TAEF_BIN_DIR)
  111. configure_file(clang-hlsl-tests.vcxproj.user.txt clang-hlsl-tests.vcxproj.user)
  112. endif(WIN32)
  113. add_test(NAME test-hlsl-codegen
  114. COMMAND clang-hlsl-tests --HlslDataDir
  115. ${PROJECT_SOURCE_DIR}/tools/clang/test/HLSL)