brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 2d612e5 Raw
63 lines · plain
1if (FLANG_EXPERIMENTAL_CUDA_RUNTIME)2  # If Fortran runtime is built as CUDA library, the linking3  # of targets that link flang_rt.runtime must be done4  # with CUDA_RESOLVE_DEVICE_SYMBOLS.5  # CUDA language must be enabled for CUDA_RESOLVE_DEVICE_SYMBOLS6  # to take effect.7  enable_language(CUDA)8endif()9 10add_custom_target(FlangUnitTests)11set_target_properties(FlangUnitTests PROPERTIES FOLDER "Flang/Tests")12 13function(add_flang_unittest test_dirname)14  add_unittest(FlangUnitTests ${test_dirname} ${ARGN})15  if (FLANG_PARALLEL_COMPILE_JOBS)16    set_property(TARGET ${test_dirname} PROPERTY JOB_POOL_COMPILE flang_compile_job_pool)17  endif ()18endfunction()19 20if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)21  add_compile_options("-Wno-suggest-override")22endif()23 24function(add_flang_nongtest_unittest test_name)25  cmake_parse_arguments(ARG26    "SLOW_TEST"27    ""28    ""29    ${ARGN})30 31  if(ARG_SLOW_TEST)32      set(suffix .slow)33  else()34      set(suffix .test)35  endif()36 37  set(test_filepath "${test_name}.cpp")38 39  add_executable(${test_name}${suffix} "${test_filepath}")40  set_target_properties(${test_name}${suffix} PROPERTIES FOLDER "Flang/Tests/Unit")41  if (FLANG_PARALLEL_COMPILE_JOBS)42    set_property(TARGET ${test_name}${suffix} PROPERTY JOB_POOL_COMPILE flang_compile_job_pool)43  endif ()44 45  if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)46    set(llvm_libs LLVM)47  else()48    llvm_map_components_to_libnames(llvm_libs Support)49  endif()50  target_link_libraries(${test_name}${suffix} ${llvm_libs} ${ARG_UNPARSED_ARGUMENTS})51  set_unittest_link_flags(${test_name}${suffix})52 53  if(NOT ARG_SLOW_TEST)54    add_dependencies(FlangUnitTests ${test_name}${suffix})55  endif()56endfunction()57 58add_subdirectory(Optimizer)59add_subdirectory(Common)60add_subdirectory(Decimal)61add_subdirectory(Evaluate)62add_subdirectory(Frontend)63