2019-09-08 11:42:43 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Unicorn Emulator Engine (www.unicorn-engine.org)
|
2021-10-03 17:14:44 +03:00
|
|
|
# Usage: cmake.sh [mingw|msys] [x86] [arm] [aarch64] [m68k] [mips] [sparc] [ppc] [riscv]
|
2019-09-08 11:42:43 +03:00
|
|
|
# By chenhuitao 2019
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
# FLAGS="-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
FLAGS="-DCMAKE_BUILD_TYPE=Debug"
|
|
|
|
TOOLCHAIN=""
|
|
|
|
GENERATOR="Unix Makefiles"
|
|
|
|
CMAKE="cmake"
|
|
|
|
COMPILER=""
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
# process arguments
|
|
|
|
case "$1" in
|
|
|
|
"mingw" )
|
|
|
|
TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=../mingw-w64.cmake"
|
|
|
|
shift
|
|
|
|
UNICORN_ARCH="${*}";;
|
|
|
|
"msys" )
|
|
|
|
shift
|
|
|
|
UNICORN_ARCH="${*}"
|
|
|
|
CMAKE="/mingw64/bin/cmake"
|
|
|
|
GENERATOR="MSYS Makefiles";;
|
|
|
|
* )
|
|
|
|
UNICORN_ARCH="${*}";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -n "${COMPILER}" ]; then
|
|
|
|
TOOLCHAIN="${TOOLCHAIN} -DCMAKE_C_COMPILER=${COMPILER}"
|
|
|
|
fi
|
2019-09-08 11:42:43 +03:00
|
|
|
|
|
|
|
if [ -z "${UNICORN_ARCH}" ]; then
|
2021-10-03 17:14:44 +03:00
|
|
|
${CMAKE} "${FLAGS}" ${TOOLCHAIN} -G "${GENERATOR}" ..
|
2019-09-08 11:42:43 +03:00
|
|
|
else
|
2021-10-03 17:14:44 +03:00
|
|
|
${CMAKE} "${FLAGS}" ${TOOLCHAIN} "-DUNICORN_ARCH=${UNICORN_ARCH}" -G "${GENERATOR}" ..
|
2019-09-08 11:42:43 +03:00
|
|
|
fi
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
# now build
|
2019-09-08 11:42:43 +03:00
|
|
|
make -j8
|