Sync documents
This commit is contained in:
parent
fd4c6ef082
commit
db821ad005
@ -1,5 +1,7 @@
|
|||||||
This HOWTO introduces how to build Unicorn2 natively on Linux/Mac/Windows or cross-build to Windows from Linux host.
|
This HOWTO introduces how to build Unicorn2 natively on Linux/Mac/Windows or cross-build to Windows from Linux host.
|
||||||
|
|
||||||
|
Note: Please run `make clean` before you switch to `dev` branch.
|
||||||
|
|
||||||
## Native build on Linux/macOS
|
## Native build on Linux/macOS
|
||||||
|
|
||||||
This builds Unicorn2 on Linux/macOS. Note that this also applies to Apple Silicon M1 users.
|
This builds Unicorn2 on Linux/macOS. Note that this also applies to Apple Silicon M1 users.
|
||||||
@ -9,24 +11,24 @@ This builds Unicorn2 on Linux/macOS. Note that this also applies to Apple Silico
|
|||||||
Ubuntu:
|
Ubuntu:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ sudo apt install cmake pkg-config
|
sudo apt install cmake pkg-config
|
||||||
```
|
```
|
||||||
|
|
||||||
macOS:
|
macOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ brew install cmake pkg-config
|
brew install cmake pkg-config
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build with the following commands.
|
- Build with the following commands.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mkdir build; cd build
|
mkdir build; cd build
|
||||||
$ cmake .. -DCMAKE_BUILD_TYPE=Release
|
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||||
$ make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
### Native build on Windows, with MSVC
|
## Native build on Windows, with MSVC
|
||||||
|
|
||||||
This builds Unicorn2 on Windows, using Microsoft MSVC compiler.
|
This builds Unicorn2 on Windows, using Microsoft MSVC compiler.
|
||||||
|
|
||||||
@ -42,31 +44,51 @@ nmake
|
|||||||
|
|
||||||
Note, other generators like `Ninja` and `Visual Studio 16 2019` would also work.
|
Note, other generators like `Ninja` and `Visual Studio 16 2019` would also work.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
mkdir build; cd build
|
mkdir build; cd build
|
||||||
cmake .. -G "Visual Studio 16 2019" -A "win32" -DCMAKE_BUILD_TYPE=Release
|
cmake .. -G "Visual Studio 16 2019" -A "win32" -DCMAKE_BUILD_TYPE=Release
|
||||||
msbuild unicorn.sln -p:Plaform=Win32 -p:Configuration=Release
|
msbuild unicorn.sln -p:Plaform=Win32 -p:Configuration=Release
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cross build from Linux host to Windows, with Mingw
|
## Cross build with NDK
|
||||||
|
|
||||||
|
To build Unicorn2 on the Android platform, firstly you need to download [NDK](https://developer.android.com/ndk/downloads).
|
||||||
|
|
||||||
|
For newer NDK, please make sure your cmake version is above 3.19.
|
||||||
|
|
||||||
|
Then generate the project like:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build; cd build;
|
||||||
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$MINSDKVERSION
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
You may get the possible values from this [page](https://developer.android.com/ndk/guides/cmake).
|
||||||
|
|
||||||
|
Unicorn2 support cross-build for `armeabi-v7a`, `arm64-v8a`, `x86` and `x86_64`.
|
||||||
|
|
||||||
|
Note the build is only tested and guaranteed to work under Linux, however, other systems may still work.
|
||||||
|
|
||||||
|
## Cross build from Linux host to Windows, with Mingw
|
||||||
|
|
||||||
This cross-builds Unicorn2 from **Linux host** to Windows, using `Mingw` compiler.
|
This cross-builds Unicorn2 from **Linux host** to Windows, using `Mingw` compiler.
|
||||||
|
|
||||||
- Install required package.
|
- Install required package.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ sudo apt install mingw-w64-x86-64-dev
|
sudo apt install mingw-w64-x86-64-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build Unicorn and samples with the following commands.
|
- Build Unicorn and samples with the following commands.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ mkdir build; cd build
|
mkdir build; cd build
|
||||||
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../mingw64-w64.cmake
|
cmake .. -DCMAKE_TOOLCHAIN_FILE=../mingw64-w64.cmake
|
||||||
$ make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
### Native build on Windows host, with MSYS2/Mingw
|
## Native build on Windows host, with MSYS2/Mingw
|
||||||
|
|
||||||
This builds Unicorn2 on **Windows host**, using **MSYS2/Mingw** compiler.
|
This builds Unicorn2 on **Windows host**, using **MSYS2/Mingw** compiler.
|
||||||
|
|
||||||
@ -74,13 +96,13 @@ This requires MSYS2 to be installed on the Windows machine. You need to download
|
|||||||
|
|
||||||
Then from MSYS2 console, install packages below:
|
Then from MSYS2 console, install packages below:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
|
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build Unicorn and samples with the following commands.
|
- Build Unicorn and samples with the following commands.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
mkdir build; cd build
|
mkdir build; cd build
|
||||||
/mingw64/bin/cmake .. -G "MSYS Makefiles" -DCMAKE_C_COMPILER=/mingw64/bin/gcc.exe -DCMAKE_MAKE_PROGRAM=/mingw64/bin/mingw32-make.exe -DCMAKE_AR=/mingw64/bin/ar.exe -DUNICORN_ARCH=x86
|
/mingw64/bin/cmake .. -G "MSYS Makefiles" -DCMAKE_C_COMPILER=/mingw64/bin/gcc.exe -DCMAKE_MAKE_PROGRAM=/mingw64/bin/mingw32-make.exe -DCMAKE_AR=/mingw64/bin/ar.exe -DUNICORN_ARCH=x86
|
||||||
mingw32-make
|
mingw32-make
|
||||||
@ -88,20 +110,20 @@ mingw32-make
|
|||||||
|
|
||||||
Note that the way to build on MSYS changes as time goes, please keep in mind that always use the cmake shipped with mingw64 and choose MSYS Makefiles.
|
Note that the way to build on MSYS changes as time goes, please keep in mind that always use the cmake shipped with mingw64 and choose MSYS Makefiles.
|
||||||
|
|
||||||
### Cross build from Linux host to other architectures
|
## Cross build from Linux host to other architectures
|
||||||
|
|
||||||
This cross-builds Unicorn2 from **Linux host** to other architectures, using a cross compiler.
|
This cross-builds Unicorn2 from **Linux host** to other architectures, using a cross compiler.
|
||||||
|
|
||||||
- Install cross compiler package. For example, cross-compile to ARM requires the below command.
|
- Install cross compiler package. For example, cross-compile to ARM requires the below command.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ sudo apt install gcc-arm-linux-gnueabihf
|
sudo apt install gcc-arm-linux-gnueabihf
|
||||||
```
|
```
|
||||||
|
|
||||||
- Build Unicorn and samples with the following commands. The compiler name differs according to your targets.
|
- Build Unicorn and samples with the following commands. The compiler name differs according to your targets.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ mkdir build; cd build
|
mkdir build; cd build
|
||||||
$ cmake .. -DCMAKE_C_COMPILER=gcc-arm-linux-gnueabihf
|
cmake .. -DCMAKE_C_COMPILER=gcc-arm-linux-gnueabihf
|
||||||
$ make
|
make
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user