Then we need to specify the location of the LIEF include directory:
136
-
137
-
.. figure:: _static/windows_sdk/s2.png
138
-
:align: center
139
-
140
-
LIEF include directory
141
-
142
-
and the location of the ``LIEF.lib`` library:
143
-
144
-
145
-
.. figure:: _static/windows_sdk/s5.png
146
-
:align: center
147
-
148
-
LIEF library
149
-
150
-
As ``LIEF.lib`` was compiled with the ``\MT`` flag we have to set it:
151
-
152
-
.. figure:: _static/windows_sdk/s3.png
153
-
:align: center
154
-
155
-
*Multi-threaded* as runtime library
156
-
157
-
LIEF makes use of ``and, or, not`` C++ keywords. As **MSVC** doesn't support these keywords by default, we need to add the special file ``iso646.h``:
158
-
159
-
.. figure:: _static/windows_sdk/s4.png
160
-
:align: center
161
-
162
-
Add ``iso646.h`` file
163
-
164
-
XCode Integration
165
-
-----------------
166
-
167
-
To integrate LIEF within a XCode project, one needs to follow these steps:
168
-
169
-
First we create a new project:
170
-
171
-
.. figure:: _static/xcode_integration/step1.png
172
-
:align: center
173
-
174
-
New Project
175
-
176
-
For this example we select a *Command Line Tool*:
177
-
178
-
.. figure:: _static/xcode_integration/step2.png
179
-
:align: center
180
-
181
-
Command Line Tool
182
-
183
-
184
-
.. figure:: _static/xcode_integration/step3.png
185
-
:align: center
186
-
187
-
Project options
188
-
189
-
Then we need to add the static library ``libLIEF.a`` or the shared one (``libLIEF.dylib``)
190
-
191
-
.. figure:: _static/xcode_integration/step4.png
192
-
:align: center
193
-
194
-
Project configuration - Build Phases
195
-
196
-
197
-
.. figure:: _static/xcode_integration/step5.png
198
-
:align: center
199
-
200
-
Project configuration - Build Phases
201
-
202
-
203
-
.. figure:: _static/xcode_integration/step6.png
204
-
:align: center
205
-
206
-
Project configuration - Build Phases
207
-
208
-
In the `Build Settings - Search Paths` one needs to specify the paths to the **include directory** and to location of the LIEF libraries (``libLIEF.a`` and/or ``libLIEF.dylib``)
209
-
210
-
.. figure:: _static/xcode_integration/step7.png
211
-
:align: center
212
-
213
-
Libraries and Include search paths
214
-
215
-
Once the new project configured we can use LIEF:
216
-
217
-
218
-
.. figure:: _static/xcode_integration/code.png
219
-
:align: center
220
-
221
-
Source code
222
-
223
-
and run it:
224
-
225
-
.. figure:: _static/xcode_integration/result.png
226
-
:align: center
227
-
228
-
Output
42
+
For more details about the compilation options, see the :ref:`compilation-ref` section.
229
43
230
44
231
45
CMake Integration
232
46
-----------------
233
47
234
-
There are a few ways to integrate LIEF as a dependency in another project. The different methods are listed in order of preference and CMake best practice. These listings are only to show basic examples. Please refer to the CMake documentation for questions related to more complex project setup.
235
-
48
+
There are a few ways to integrate LIEF as a dependency in another project.
49
+
The different methods are listed in order of preference and CMake best practice.
50
+
These listings are only to show basic examples. Please refer to the CMake
51
+
documentation for questions related to more complex project setup.
236
52
237
53
find_package()
238
54
**************
skipped 16 lines
255
71
:start-line: 3
256
72
257
73
A *full* example is available in the ``examples/cmake/find_package`` directory.
258
-
259
74
260
75
add_subdirectory() or FetchContent
261
76
**********************************
skipped 52 lines
314
129
315
130
A *full* example is available in the ``examples/cmake/external_project`` directory.
316
131
132
+
Visual Studio Integration
133
+
-------------------------
134
+
135
+
Given a pre-compiled version of LIEF SDK (e.g. ``LIEF-0.14.1-win64.zip``):
136
+
137
+
.. code-block:: text
138
+
139
+
.
140
+
├── bin
141
+
│ ├── pe_reader.exe
142
+
│ └── vdex_reader.exe
143
+
├── include
144
+
│ └── LIEF
145
+
├── lib
146
+
│ ├── LIEF.dll
147
+
│ ├── LIEF.lib
148
+
│ └── pkgconfig
149
+
└── share
150
+
└── LIEF
151
+
152
+
One should add the ``include/`` directory in the compiler search path:
153
+
``Configuration Properties > C/C++ > General > Additional Include Directories``
154
+
and add either ``LIEF.lib`` or ``LIEF.dll`` in the link step: