2019-02-27 19:47:03 +01:00
|
|
|
termux_step_configure_cmake() {
|
|
|
|
termux_setup_cmake
|
|
|
|
|
2020-05-07 23:26:19 +02:00
|
|
|
local BUILD_TYPE=Release
|
2019-08-13 17:43:08 +02:00
|
|
|
[ "$TERMUX_DEBUG" = "true" ] && BUILD_TYPE=Debug
|
2019-02-27 19:47:03 +01:00
|
|
|
|
|
|
|
local CMAKE_PROC=$TERMUX_ARCH
|
|
|
|
test $CMAKE_PROC == "arm" && CMAKE_PROC='armv7-a'
|
|
|
|
local MAKE_PROGRAM_PATH
|
2019-08-13 00:39:35 +02:00
|
|
|
if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then
|
2019-02-27 19:47:03 +01:00
|
|
|
termux_setup_ninja
|
2019-08-13 00:39:35 +02:00
|
|
|
MAKE_PROGRAM_PATH=$(command -v ninja)
|
2019-02-27 19:47:03 +01:00
|
|
|
else
|
2019-08-13 00:39:35 +02:00
|
|
|
MAKE_PROGRAM_PATH=$(command -v make)
|
2019-02-27 19:47:03 +01:00
|
|
|
fi
|
2019-08-06 14:39:42 +02:00
|
|
|
|
|
|
|
local CMAKE_ADDITIONAL_ARGS=()
|
2019-08-12 23:16:07 +02:00
|
|
|
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
|
2019-08-06 14:39:42 +02:00
|
|
|
CXXFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
|
|
|
|
CFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
|
|
|
|
LDFLAGS+=" --target=$CCTERMUX_HOST_PLATFORM"
|
|
|
|
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_CROSSCOMPILING=True")
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$TERMUX_STANDALONE_TOOLCHAIN/bin/$LD $LDFLAGS")
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_NAME=Android")
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_VERSION=$TERMUX_PKG_API_LEVEL")
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_PROCESSOR=$CMAKE_PROC")
|
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN")
|
|
|
|
else
|
2019-08-13 00:39:35 +02:00
|
|
|
CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$(command -v $LD) $LDFLAGS")
|
2019-08-06 14:39:42 +02:00
|
|
|
fi
|
2019-02-27 19:47:03 +01:00
|
|
|
|
|
|
|
# XXX: CMAKE_{AR,RANLIB} needed for at least jsoncpp build to not
|
2019-08-06 14:39:42 +02:00
|
|
|
# pick up cross compiled binutils tool in $TERMUX_PREFIX/bin:
|
2019-02-27 19:47:03 +01:00
|
|
|
cmake -G "$TERMUX_CMAKE_BUILD" "$TERMUX_PKG_SRCDIR" \
|
2019-08-13 00:39:35 +02:00
|
|
|
-DCMAKE_AR="$(command -v $AR)" \
|
|
|
|
-DCMAKE_UNAME="$(command -v uname)" \
|
|
|
|
-DCMAKE_RANLIB="$(command -v $RANLIB)" \
|
2019-02-27 19:47:03 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS" \
|
|
|
|
-DCMAKE_CXX_FLAGS="$CXXFLAGS $CPPFLAGS" \
|
|
|
|
-DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \
|
2019-04-06 05:47:42 +02:00
|
|
|
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
|
2019-02-27 19:47:03 +01:00
|
|
|
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
|
|
|
|
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
|
|
|
|
-DCMAKE_MAKE_PROGRAM=$MAKE_PROGRAM_PATH \
|
|
|
|
-DCMAKE_SKIP_INSTALL_RPATH=ON \
|
|
|
|
-DCMAKE_USE_SYSTEM_LIBRARIES=True \
|
|
|
|
-DDOXYGEN_EXECUTABLE= \
|
|
|
|
-DBUILD_TESTING=OFF \
|
2019-08-06 14:39:42 +02:00
|
|
|
"${CMAKE_ADDITIONAL_ARGS[@]}" \
|
|
|
|
$TERMUX_PKG_EXTRA_CONFIGURE_ARGS
|
2019-02-27 19:47:03 +01:00
|
|
|
}
|