Browse Source

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

GitOrigin-RevId: 2c6ba34dbd
release-1.6
Megvii Engine Team 3 years ago
parent
commit
af80d365be
2 changed files with 15 additions and 5 deletions
  1. +6
    -4
      scripts/cmake-build/host_build.sh
  2. +9
    -1
      scripts/cmake-build/utils/utils.sh

+ 6
- 4
scripts/cmake-build/host_build.sh View File

@@ -33,8 +33,8 @@ BUILD_DEVELOP=ON
NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install/strip"
if [[ $OS =~ "NT" ]]; then
echo "Windows do not support strip/install by defaut"
SPECIFIED_TARGET=""
echo "Windows no need strip, caused by pdb file always split with exe"
SPECIFIED_TARGET="install"
fi

echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}"
@@ -248,7 +248,10 @@ function cmake_build_windows() {
# windows do not support long path, so we cache the BUILD_DIR ASAP
prepare_env_for_windows_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_INFERENCE_ONLY=$2
BUILD_TYPE=$3
@@ -261,7 +264,6 @@ function cmake_build_windows() {

echo "create build dir"
mkdir -p $BUILD_DIR
mkdir -p $INSTALL_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


+ 9
- 1
scripts/cmake-build/utils/utils.sh View File

@@ -61,8 +61,16 @@ function try_remove_old_build() {

if [ $REMOVE_OLD_BUILD = "true" ]; then
echo "remove old build/install dir"
rm -rf ${BUILD_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
echo "strip remove old build"
fi


Loading…
Cancel
Save