Debian Codegraph @

clang/unittests/Interpreter/CMakeLists.txt

raw
1 if(EMSCRIPTEN)
2 set(LLVM_COMPONENTS_TO_LINK
3 ""
4 )
5 set(LLVM_LIBS_TO_LINK
6 ""
7 )
8 set(CLANG_LIBS_TO_LINK
9 clangInterpreter
10 )
11 else()
12 set(LLVM_COMPONENTS_TO_LINK
13 ${LLVM_TARGETS_TO_BUILD}
14 Core
15 MC
16 OrcJIT
17 Support
18 TargetParser
19 )
20 set(LLVM_LIBS_TO_LINK
21 LLVMTestingSupport
22 )
23 set(CLANG_LIBS_TO_LINK
24 clangAST
25 clangBasic
26 clangInterpreter
27 clangFrontend
28 clangSema
29 )
30 endif()
31
32 set(CLANG_REPL_TEST_SOURCES
33 IncrementalCompilerBuilderTest.cpp
34 IncrementalProcessingTest.cpp
35 InterpreterTest.cpp
36 InterpreterExtensionsTest.cpp
37 CodeCompletionTest.cpp
38 )
39
40 if(TARGET compiler-rt AND LLVM_ON_UNIX)
41 list(APPEND CLANG_REPL_TEST_SOURCES
42 OutOfProcessInterpreterTests.cpp
43 )
44 message(STATUS "Compiler-RT found, enabling out of process JIT tests")
45 endif()
46
47 add_distinct_clang_unittest(ClangReplInterpreterTests
48 ${CLANG_REPL_TEST_SOURCES}
49
50 PARTIAL_SOURCES_INTENDED
51
52 EXPORT_SYMBOLS
53
54 CLANG_LIBS
55 ${CLANG_LIBS_TO_LINK}
56
57 LINK_LIBS
58 ${LLVM_LIBS_TO_LINK}
59
60 LLVM_COMPONENTS
61 ${LLVM_COMPONENTS_TO_LINK}
62 )
63
64 if(TARGET compiler-rt AND LLVM_ON_UNIX)
65 add_dependencies(ClangReplInterpreterTests
66 llvm-jitlink-executor
67 compiler-rt
68 )
69 message(STATUS "Adding dependency on compiler-rt for out of process JIT tests")
70 endif()
71
72 if(EMSCRIPTEN)
73 # Without the above you try to link to LLVMSupport twice, and end
74 # up with a duplicate symbol error when creating the main module
75 get_target_property(LINKED_LIBS ClangReplInterpreterTests LINK_LIBRARIES)
76 list(REMOVE_ITEM LINKED_LIBS LLVMSupport)
77 set_target_properties(ClangReplInterpreterTests PROPERTIES LINK_LIBRARIES "${LINKED_LIBS}")
78 target_link_options(ClangReplInterpreterTests
79 PUBLIC "SHELL: -s MAIN_MODULE=1"
80 PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
81 PUBLIC "SHELL: -s STACK_SIZE=32mb"
82 PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
83 PUBLIC "SHELL: --emrun"
84 PUBLIC "SHELL: -Wl,--export=__clang_Interpreter_SetValueWithAlloc"
85 PUBLIC "SHELL: -Wl,--export=__clang_Interpreter_SetValueNoAlloc"
86 PUBLIC "SHELL: -Wl,--export=_ZnwmPv26__clang_Interpreter_NewTag"
87 PUBLIC "SHELL: -Wl,--export=_Z9getGlobalv"
88 PUBLIC "SHELL: -Wl,--export=_Z9setGlobali"
89 )
90 set_target_properties(ClangReplInterpreterTests PROPERTIES
91 SUFFIX ".html"
92 )
93 endif()
94
95 # Exceptions on Windows are not yet supported.
96 if(NOT WIN32)
97 add_subdirectory(ExceptionTests)
98 endif()
99
100 if(MSVC)
101 set_target_properties(ClangReplInterpreterTests PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1)
102
103 # RTTI/C++ symbols
104 set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports} ??_7type_info@@6B@
105 ?__type_info_root_node@@3U__type_info_node@@A
106 ?nothrow@std@@3Unothrow_t@1@B
107 )
108
109 # Compiler added symbols for static variables. NOT for VStudio < 2015
110 set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports} _Init_thread_abort _Init_thread_epoch
111 _Init_thread_footer _Init_thread_header _tls_index
112 )
113
114 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
115 # new/delete variants needed when linking to static msvc runtime (esp. Debug)
116 set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports}
117 ??2@YAPEAX_K@Z
118 ??3@YAXPEAX@Z
119 ??_U@YAPEAX_K@Z
120 ??_V@YAXPEAX@Z
121 ??3@YAXPEAX_K@Z
122 )
123 else()
124 set(ClangReplInterpreterTests_exports ${ClangReplInterpreterTests_exports}
125 ??2@YAPAXI@Z
126 ??3@YAXPAX@Z
127 ??3@YAXPAXI@Z
128 ??_U@YAPAXI@Z
129 ??_V@YAXPAX@Z
130 ??_V@YAXPAXI@Z
131 )
132 endif()
133
134 # List to '/EXPORT:sym0 /EXPORT:sym1 /EXPORT:sym2 ...'
135 list(TRANSFORM ClangReplInterpreterTests_exports PREPEND "LINKER:/EXPORT:")
136 set_property(TARGET ClangReplInterpreterTests APPEND PROPERTY LINK_OPTIONS ${ClangReplInterpreterTests_exports})
137
138 endif(MSVC)