forked from chenshuo/muduo-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
33 lines (29 loc) · 941 Bytes
/
build.sh
File metadata and controls
33 lines (29 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
##########################################################
# File Name: build.sh
# Author: ims
##########################################################
#!/bin/bash
set -e
project_name=${1:-http}
CUR_DIR=$(cd `dirname $0`;pwd)
SOURCE_DIR=$CUR_DIR/cmake-submodule
BUILD_DIR=${BUILD_DIR:-$CUR_DIR/build}
OUTDIR_DIR=$CUR_DIR/output
BUILD_TYPE=${BUILD_TYPE:-debug}
INSTALL_DIR=${INSTALL_DIR:-../${BUILD_TYPE}-install-cpp11}
CXX=${CXX:-g++}
if [ ! "$(ls -A $SOURCE_DIR/muduo)" ]; then
set -x
git submodule update --init
fi
ln -sf $BUILD_DIR/$BUILD_TYPE-cpp11/compile_commands.json
rm -rf $OUTDIR_DIR
mkdir -p $BUILD_DIR/$BUILD_TYPE-cpp11 $OUTDIR_DIR\
&& cd $BUILD_DIR/$BUILD_TYPE-cpp11 \
&& cmake \
-DPROJECT_NAME=$project_name \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$OUTDIR_DIR \
$SOURCE_DIR \
&& make $*