From 5cf2c7687068fd65eddf60268fbdd19b26bb2793 Mon Sep 17 00:00:00 2001 From: jarodruan Date: Fri, 7 Feb 2020 17:35:07 +0800 Subject: [PATCH] add win_create.bat --- servant/script/win_create.bat | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 servant/script/win_create.bat diff --git a/servant/script/win_create.bat b/servant/script/win_create.bat new file mode 100644 index 0000000..ed2afa0 --- /dev/null +++ b/servant/script/win_create.bat @@ -0,0 +1,62 @@ +#!/bin/sh + +if [ $# -lt 3 ] +then + echo "" + exit 0 +fi + +APP=$1 +SERVER=$2 +SERVANT=$3 + +if [ "$SERVER" == "$SERVANT" ] +then + echo "Error!(ServerName == ServantName)" + exit -1 +fi + +if [ ! -d $APP/$SERVER/src ] +then + echo "[mkdir: $APP/$SERVER/src]" + mkdir -p $APP/$SERVER/src + echo "[mkdir: $APP/$SERVER/build]" + mkdir -p $APP/$SERVER/build +fi + +echo "[create server: $APP.$SERVER ...]" + +DEMO_PATH=c:\\taf\\cpp\\script\\demo + +SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp DemoServant.jce makefile CMakeLists.txt" + +for FILE in $SRC_FILE +do + cp -rf $DEMO_PATH\\$FILE $APP\\$SERVER\\src +done + +cd $APP\\$SERVER\\src + +for FILE in $SRC_FILE +do + cat $FILE | sed "s/DemoServer/$SERVER/g" > $FILE.tmp + mv $FILE.tmp $FILE + + cat $FILE | sed "s/DemoApp/$APP/g" > $FILE.tmp + mv $FILE.tmp $FILE + + cat $FILE | sed "s/DemoServant/$SERVANT/g" > $FILE.tmp + mv $FILE.tmp $FILE +done + +mv DemoServer.h ${SERVER}.h +mv DemoServer.cpp ${SERVER}.cpp +mv DemoServantImp.h ${SERVANT}Imp.h +mv DemoServantImp.cpp ${SERVANT}Imp.cpp +mv DemoServant.jce ${SERVANT}.jce + +cd ..\\build +cmake ..\\src -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Debug +cmake ..\\src -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release + +echo "[done.]"