2019-09-08 11:42:43 +03:00
|
|
|
This documentation explains how to compile Unicorn with CMake on Windows or
|
|
|
|
*nix.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
Requirements:
|
2019-09-08 12:08:00 +03:00
|
|
|
|
|
|
|
- Windows: MicroSoft Visual Studio(>=2013).
|
2020-04-30 08:58:33 +03:00
|
|
|
- *nix: GNU gcc or clang to generate dynamic source files.
|
2019-09-08 11:42:43 +03:00
|
|
|
|
|
|
|
Get CMake for free from http://www.cmake.org.
|
|
|
|
|
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
[1] To build Unicorn using Nmake of Windows SDK, do:
|
2019-09-08 11:42:43 +03:00
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
..\nmake.bat
|
|
|
|
|
|
|
|
After this, find the samples test*.exe, unicorn.lib & unicorn.dll
|
|
|
|
in the same directory.
|
|
|
|
|
|
|
|
|
|
|
|
- To build Unicorn using Visual Studio, choose the generator accordingly to the
|
|
|
|
version of Visual Studio on your machine. For example, with Visual Studio 2013, do:
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake -G "Visual Studio 12" ..
|
|
|
|
|
|
|
|
After this, find unicorn.sln in the same directory. Open it with Visual Studio
|
|
|
|
and build the solution including libraries & all test as usual.
|
|
|
|
|
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
[2] You can make sure the prior steps successfully worked by launching one of the
|
2019-09-08 11:42:43 +03:00
|
|
|
sample binary (sample_*.exe).
|
|
|
|
|
2019-09-08 11:47:38 +03:00
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
[3] You can also enable just one specific architecture by passing the architecture name
|
2019-09-08 11:42:43 +03:00
|
|
|
to either the cmake.sh or nmake.bat scripts. e.g.:
|
2019-09-08 11:47:38 +03:00
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
..\nmake.bat x86
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
Will just target the x86 architecture. The list of available architectures are:
|
2019-09-08 11:42:43 +03:00
|
|
|
X86 ARM AARCH64 M68K MIPS SPARC.
|
2019-09-08 11:47:38 +03:00
|
|
|
|
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
[4] You can also create an installation image with cmake, by using the 'install' target.
|
2019-09-08 11:42:43 +03:00
|
|
|
Use:
|
|
|
|
|
|
|
|
cmake --build . --config Release --target install
|
|
|
|
|
2019-09-08 12:05:51 +03:00
|
|
|
This will normally install an image in a default location (on MacOS and Linux, but this is not supported
|
|
|
|
on Windows). So in case you want to change the install location, set this when configuring CMake.
|
|
|
|
Use: `-DCMAKE_INSTALL_PREFIX=path` for instance, to put the installation in the 'path' subdirectory of
|
|
|
|
the build directory.
|
|
|
|
The default value of 'CMAKE_INSTALL_PREFIX' on *nix is '/usr/local'.
|