提交 3ea00eba 编写于 作者: M Megvii Engine Team

fix(cmake): fix cmake build failed at soft link workspace

GitOrigin-RevId: 78b50a4f3a4fd0b762d39a91259f34e72997d04a
上级 a8108522
......@@ -111,7 +111,7 @@ function cmake_build() {
echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
unset IFS
cmake -G "$MAKEFILE_TYPE Makefiles" \
-DCMAKE_TOOLCHAIN_FILE="$NDK_ROOT/build/cmake/android.toolchain.cmake" \
......
......@@ -108,7 +108,7 @@ function cmake_build() {
echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
cmake -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DIOS_TOOLCHAIN_ROOT=$TOOLCHAIN \
......
......@@ -131,7 +131,7 @@ function cmake_build() {
echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
cmake -G "$MAKEFILE_TYPE Makefiles" \
-DCMAKE_C_FLAGS=$CMAKE_C_FLAGS \
-DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \
......
......@@ -97,7 +97,7 @@ function cmake_build() {
echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
cmake \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DMGE_INFERENCE_ONLY=$MGE_INFERENCE_ONLY \
......@@ -229,7 +229,7 @@ function cmake_build_windows() {
echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
echo "now try build windows native with cmake/clang-ci/Ninja/Visual Studio ....."
export CFLAGS=-$MGE_WINDOWS_BUILD_MARCH
export CXXFLAGS=-$MGE_WINDOWS_BUILD_MARCH
......
......@@ -9,6 +9,18 @@ if [[ $OS =~ "NT" ]]; then
MAKEFILE_TYPE="Unix"
fi
READLINK=readlink
if [ $OS = "Darwin" ];then
READLINK=greadlink
fi
function cd_real_build_dir() {
REAL_DIR=$($READLINK -f $1)
echo "may alias dir: $1"
echo "cd real build dir: ${REAL_DIR}"
cd ${REAL_DIR}
}
function build_flatc() {
BUILD_DIR=$1/build_dir/host_flatc/build
INSTALL_DIR=$BUILD_DIR/../install
......@@ -25,7 +37,7 @@ function build_flatc() {
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd $BUILD_DIR
cd_real_build_dir $BUILD_DIR
cmake -G "$MAKEFILE_TYPE Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册