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

fix(cmake/windows): fix cmake install failed on Windows

GitOrigin-RevId: 2c6ba34dbd92c2def2b20a84f9f247db68852aa9
上级 8e4c3c53
...@@ -33,8 +33,8 @@ BUILD_DEVELOP=ON ...@@ -33,8 +33,8 @@ BUILD_DEVELOP=ON
NINJA_DRY_RUN=OFF NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install/strip" SPECIFIED_TARGET="install/strip"
if [[ $OS =~ "NT" ]]; then if [[ $OS =~ "NT" ]]; then
echo "Windows do not support strip/install by defaut" echo "Windows no need strip, caused by pdb file always split with exe"
SPECIFIED_TARGET="" SPECIFIED_TARGET="install"
fi fi
echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}" echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}"
...@@ -248,7 +248,10 @@ function cmake_build_windows() { ...@@ -248,7 +248,10 @@ function cmake_build_windows() {
# windows do not support long path, so we cache the BUILD_DIR ASAP # windows do not support long path, so we cache the BUILD_DIR ASAP
prepare_env_for_windows_build prepare_env_for_windows_build
BUILD_DIR=$SRC_DIR/build_dir/host/build BUILD_DIR=$SRC_DIR/build_dir/host/build
INSTALL_DIR=$BUILD_DIR/../install # ninja have compat issue with bash env, which fork from windows-git
# which will map C: to /c/c/ dir, which will lead to install file to /c/c/..
# as a solution, we use relative path to INSTALL_DIR
INSTALL_DIR=../install
MGE_WITH_CUDA=$1 MGE_WITH_CUDA=$1
MGE_INFERENCE_ONLY=$2 MGE_INFERENCE_ONLY=$2
BUILD_TYPE=$3 BUILD_TYPE=$3
...@@ -261,7 +264,6 @@ function cmake_build_windows() { ...@@ -261,7 +264,6 @@ function cmake_build_windows() {
echo "create build dir" echo "create build dir"
mkdir -p $BUILD_DIR mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
cd_real_build_dir $BUILD_DIR cd_real_build_dir $BUILD_DIR
echo "now try build windows native with cmake/clang-ci/Ninja/Visual Studio ....." echo "now try build windows native with cmake/clang-ci/Ninja/Visual Studio ....."
export CFLAGS=-$MGE_WINDOWS_BUILD_MARCH export CFLAGS=-$MGE_WINDOWS_BUILD_MARCH
......
...@@ -61,8 +61,16 @@ function try_remove_old_build() { ...@@ -61,8 +61,16 @@ function try_remove_old_build() {
if [ $REMOVE_OLD_BUILD = "true" ]; then if [ $REMOVE_OLD_BUILD = "true" ]; then
echo "remove old build/install dir" echo "remove old build/install dir"
rm -rf ${BUILD_DIR}
rm -rf ${INSTALL_DIR} rm -rf ${INSTALL_DIR}
# compat install is relative path for BUILD_DIR
if [ -d ${BUILD_DIR} ]; then
cd ${BUILD_DIR}
rm -rf ${INSTALL_DIR}
cd -
fi
rm -rf ${BUILD_DIR}
else else
echo "strip remove old build" echo "strip remove old build"
fi fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册