[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / lldb / utils / lldb-dotest / CMakeLists.txt
blob3b8c88b6dc78cb5e85e0c8c425cbbff93f5d5f12
1 # Make lldb-dotest a custom target.
2 add_custom_target(lldb-dotest)
3 add_dependencies(lldb-dotest lldb-test-depends)
4 set_target_properties(lldb-dotest PROPERTIES FOLDER "LLDB/Utils")
6 get_property(LLDB_TEST_USER_ARGS GLOBAL PROPERTY LLDB_TEST_USER_ARGS_PROPERTY)
7 get_property(LLDB_TEST_COMMON_ARGS GLOBAL PROPERTY LLDB_TEST_COMMON_ARGS_PROPERTY)
8 set(LLDB_LIBS_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
10 llvm_canonicalize_cmake_booleans(
11   LLDB_BUILD_INTEL_PT
12   LLDB_HAS_LIBCXX
15 if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES)
16   set(LLDB_HAS_LIBCXX ON)
17   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
18     set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
19     set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
20     set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
21   else()
22     set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
23     set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
24   endif()
25 endif()
27 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
28 set(vars
29   LLDB_TEST_COMMON_ARGS
30   LLDB_TEST_USER_ARGS
31   LLDB_SOURCE_DIR
32   LLDB_FRAMEWORK_DIR
33   LLDB_TEST_BUILD_DIRECTORY
34   LLDB_TEST_EXECUTABLE
35   LLDB_TEST_COMPILER
36   LLDB_TEST_DSYMUTIL
37   LLDB_TEST_MAKE
38   LLDB_LIBS_DIR
39   LLVM_TOOLS_DIR
40   LIBCXX_LIBRARY_DIR
41   LIBCXX_GENERATED_INCLUDE_DIR
42   LIBCXX_GENERATED_INCLUDE_TARGET_DIR
43   )
45 llvm_canonicalize_cmake_booleans(LLDB_HAS_LIBCXX)
47 # Generate lldb-dotest Python driver script for each build mode.
48 if(LLDB_BUILT_STANDALONE)
49   set(config_types ".")
50   if(CMAKE_CONFIGURATION_TYPES)
51     set(config_types ${CMAKE_CONFIGURATION_TYPES})
52   endif()
53   foreach(config_type ${config_types})
54     # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our actual configuration names.
55     string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
56     foreach(var ${vars})
57       string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} "${var}_CONFIGURED" "${${var}}")
58     endforeach()
60     # Remaining ones must be paths to the provided LLVM build-tree.
61     if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
62       # Multi-configuration generator like Xcode (with a matching config).
63       foreach(var ${vars})
64         string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} "${var}_CONFIGURED" "${${var}}")
65       endforeach()
66     else()
67       # Single-configuration generator like Ninja.
68       foreach(var ${vars})
69         string(REPLACE ${CMAKE_CFG_INTDIR} "." "${var}_CONFIGURED" "${${var}}")
70       endforeach()
71     endif()
73     configure_file(
74       lldb-dotest.in
75       ${config_runtime_output_dir}/lldb-dotest @ONLY
76     )
77   endforeach()
78 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
79   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
80     string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
81     foreach(var ${vars})
82       string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} "${var}_CONFIGURED" "${${var}}")
83     endforeach()
85     configure_file(
86       lldb-dotest.in
87       ${LLDB_DOTEST_DIR}/lldb-dotest
88       )
89   endforeach()
90 else()
91   foreach(var ${vars})
92     set("${var}_CONFIGURED" "${${var}}")
93   endforeach()
95   configure_file(
96     lldb-dotest.in
97     ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest
98     )
99 endif()