You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. include_directories("./src/include")
  2. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
  3. file(
  4. GLOB_RECURSE
  5. SOURCES
  6. ./*.cpp
  7. ../src/core/test/*.cpp
  8. ../src/gopt/test/*.cpp
  9. ../src/opr/test/*.cpp
  10. ../src/plugin/test/*.cpp
  11. ../src/serialization/test/*.cpp)
  12. if(MGE_WITH_JIT)
  13. file(GLOB_RECURSE SOURCES_ ../src/jit/test/*.cpp)
  14. list(APPEND SOURCES ${SOURCES_})
  15. endif()
  16. if(MGE_WITH_DISTRIBUTED)
  17. file(GLOB_RECURSE SOURCES_ ../src/opr-mm/test/*.cpp)
  18. list(APPEND SOURCES ${SOURCES_})
  19. endif()
  20. if(MGE_WITH_CUDA AND MGE_WITH_TRT)
  21. file(GLOB_RECURSE SOURCES_ ../src/tensorrt/test/*.cpp)
  22. list(APPEND SOURCES ${SOURCES_})
  23. endif()
  24. add_executable(megbrain_test ${SOURCES})
  25. if(WIN32 OR MSVC)
  26. target_compile_definitions(megbrain_test PRIVATE MGE_WINDOWS_STATIC_LINK)
  27. endif()
  28. target_link_libraries(megbrain_test gtest gmock)
  29. target_link_libraries(megbrain_test megbrain megdnn ${MGE_CUDA_LIBS})
  30. if(MGE_WITH_CUDA)
  31. target_include_directories(megbrain_test PRIVATE ${CUDNN_INCLUDE_DIR})
  32. endif()
  33. if(CXX_SUPPORT_WCLASS_MEMACCESS)
  34. if(MGE_WITH_CUDA)
  35. target_compile_options(
  36. megbrain_test
  37. PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-Wno-class-memaccess>"
  38. "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-class-memaccess>")
  39. else()
  40. target_compile_options(megbrain_test PRIVATE "-Wno-class-memaccess")
  41. endif()
  42. endif()
  43. if(UNIX)
  44. if(APPLE OR ANDROID)
  45. target_link_libraries(megbrain_test dl)
  46. else()
  47. target_link_libraries(megbrain_test dl rt)
  48. endif()
  49. endif()
  50. if(MGE_WITH_DISTRIBUTED)
  51. target_link_libraries(megbrain_test megray)
  52. endif()
  53. if(MGE_WITH_JIT)
  54. if(MGE_WITH_JIT_MLIR)
  55. add_subdirectory(${PROJECT_SOURCE_DIR}/src/jit/test/mlir
  56. ${CMAKE_CURRENT_BINARY_DIR}/../src/jit/test/mlir)
  57. endif()
  58. endif()