-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
195 lines (173 loc) · 4.56 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
cmake_minimum_required(VERSION 3.10)
add_library(llvmir-emul STATIC
llvmir_emul.cpp
)
#add_library(retdec::llvmir-emul ALIAS llvmir-emul)
target_compile_features(llvmir-emul PUBLIC cxx_std_14)
target_include_directories(llvmir-emul
PUBLIC
$<BUILD_INTERFACE:${EMUL_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${EMUL_INSTALL_INCLUDE_DIR}>
)
find_package(LLVM
REQUIRED
CONFIG
PATHS ${LLVM_HOME_PATH})
if (LLVM_HOME_PATH)
find_package(LLVM
REQUIRED
CONFIG
PATHS ${LLVM_HOME_PATH})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
# Set your project compile flags.
# E.g. if using the C++ header files
# you will need to enable C++11 support
# for your compiler.
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
# Now build our tools
# add_executable(UnitTest main.cpp)
# Find the libraries that correspond to the LLVM components
# that we wish to use
llvm_map_components_to_libnames(llvm_libs ${LLVM_LINK_COMPONENTS})
else()
message(FATAL_ERROR)
endif()
target_link_libraries(llvmir-emul
PUBLIC
${llvm_libs}
)
set_target_properties(llvmir-emul
PROPERTIES
OUTPUT_NAME "llvmir-emul"
)
# Install includes.
install(
DIRECTORY ${EMUL_INCLUDE_DIR}/llvmir-emul
DESTINATION ${EMUL_INSTALL_INCLUDE_DIR}/llvmir-emul
)
# Install libs.
install(TARGETS llvmir-emul
EXPORT llvmir-emul-targets
ARCHIVE DESTINATION ${EMUL_INSTALL_LIB_DIR}
LIBRARY DESTINATION ${EMUL_INSTALL_LIB_DIR}
)
## Export targets.
#install(EXPORT llvmir-emul-targets
# FILE "retdec-llvmir-emul-targets.cmake"
# NAMESPACE retdec::
# DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
# )
#
# Install CMake files.
configure_file(
"retdec-llvmir-emul-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/retdec-llvmir-emul-config.cmake"
@ONLY
)
#install(
# FILES
# "${CMAKE_CURRENT_BINARY_DIR}/retdec-llvmir-emul-config.cmake"
# DESTINATION
# "${RETDEC_INSTALL_CMAKE_DIR}"
#)
#cmake_minimum_required(VERSION 3.10)
#project(UnitTest)
#
#set(CMAKE_CXX_STANDARD 14)
#
#set(LLVM_LINK_COMPONENTS
# BitWriter
# IRReader
# Object
# InstCombine
# ipo
# AsmParser
# BitReader
# MCParser
# CodeGen
# ProfileData # needed by ScalarOpts
# Support # has to be after LLVMProfileData
# ScalarOpts
# TransformUtils
# Analysis
# Target
# Core
# MC
# Object
# )
#
#add_executable(UnitTest
# llvm_emul_tests.cpp
# )
#
#target_include_directories(UnitTest
# PRIVATE
# ${RETDEC_TESTS_DIR}
# )
#
#set_target_properties(UnitTest
# PROPERTIES
# OUTPUT_NAME "UniTest"
# )
#
#if (LLVM_HOME_PATH)
#
# find_package(LLVM
# REQUIRED
# CONFIG
# PATHS ${LLVM_HOME_PATH})
#
# find_package(GTest
# REQUIRED
# CONFIG
# PATHS ${GTEST_HOME_PATH})
#
# include_directories(${GTEST_HOME_PATH}/include)
#
# #include_directories(${LLVM_INCLUDE_DIRS})
# #add_definitions(${LLVM_DEFINITIONS})
#
# #add_executable(LLVMEmu main.cpp)
#
# #llvm_map_components_to_libnames(llvm_libs ${LLVM_LINK_COMPONENTS})
# ##llvm_map_components_to_libnames(llvm_libs clang)
#
# #target_link_libraries(LLVMEmu ${llvm_libs})
#
#
# message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
# message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
#
# # Set your project compile flags.
# # E.g. if using the C++ header files
# # you will need to enable C++11 support
# # for your compiler.
#
# include_directories(${LLVM_INCLUDE_DIRS})
# add_definitions(${LLVM_DEFINITIONS})
#
# # Now build our tools
## add_executable(UnitTest main.cpp)
#
# # Find the libraries that correspond to the LLVM components
# # that we wish to use
# #llvm_map_components_to_libnames(llvm_libs support core irreader)
# llvm_map_components_to_libnames(llvm_libs ${LLVM_LINK_COMPONENTS})
# #message(STATUS "${LLVM_LINK_COMPONENTS}")
#
# # Link against LLVM libraries
## LINK_DIRECTORIES(/home/lichengpeng/local/googletest/lib64)
# target_link_libraries(UnitTest ${llvm_libs} GTest)
#
#else()
# message(FATAL_ERROR)
#endif()
#
#
#
#
#install(TARGETS UnitTest
# RUNTIME DESTINATION ${RETDEC_INSTALL_TESTS_DIR}
# )