change http-demo to cmake

This commit is contained in:
ruanshudong 2020-03-10 20:38:16 +08:00
parent 0339acf26a
commit b2ca1d68c1
7 changed files with 31 additions and 15 deletions

View File

@ -10,27 +10,31 @@ APP=$1
SERVER=$2 SERVER=$2
SERVANT=$3 SERVANT=$3
echo "APP:$APP, SERVER:$SERVER, SERVANT:$SERVANT"
if [ "$SERVER" == "$SERVANT" ] if [ "$SERVER" == "$SERVANT" ]
then then
echo "Error!(ServerName == ServantName)" echo "Error!(ServerName == ServantName)"
exit -1 exit -1
fi fi
if [ ! -d $APP/$SERVER ] if [ ! -d $SERVER ]
then then
echo "[mkdir: $APP/$SERVER]" echo "[mkdir: $SERVER]"
mkdir -p $APP/$SERVER mkdir -p $SERVER
fi fi
echo "[create server: $APP.$SERVER ...]" echo "[create server: $APP.$SERVER ...]"
DEMO_PATH=/usr/local/tars/cpp/script/http_demo DEMO_PATH=/usr/local/tars/cpp/script/http_demo
cp $DEMO_PATH/* $APP/$SERVER/ #make cleanall -C $DEMO_PATH
cd $APP/$SERVER/ cp -rf $DEMO_PATH/* $SERVER/
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp makefile" cd $SERVER/src
SRC_FILE="DemoServer.h DemoServer.cpp DemoServantImp.h DemoServantImp.cpp CMakeLists.txt"
for FILE in $SRC_FILE for FILE in $SRC_FILE
do do
@ -39,14 +43,20 @@ do
cat $FILE | sed "s/DemoApp/$APP/g" > $FILE.tmp cat $FILE | sed "s/DemoApp/$APP/g" > $FILE.tmp
mv $FILE.tmp $FILE mv $FILE.tmp $FILE
cat $FILE | sed "s/DemoServant/$SERVANT/g" > $FILE.tmp cat $FILE | sed "s/DemoServant/$SERVANT/g" > $FILE.tmp
mv $FILE.tmp $FILE mv $FILE.tmp $FILE
done done
rename "DemoServer" "$SERVER" $SRC_FILE mv DemoServer.h ${SERVER}.h
rename "DemoServant" "$SERVANT" $SRC_FILE mv DemoServer.cpp ${SERVER}.cpp
mv DemoServantImp.h ${SERVANT}Imp.h
mv DemoServantImp.cpp ${SERVANT}Imp.cpp
cd ../../ cd ..
mkdir build; cd build
cmake ..; make
#cd ../../
echo "[done.]" echo "[done.]"

View File

@ -12,12 +12,13 @@ else()
include (/usr/local/tars/cpp/makefile/tars-tools.cmake) include (/usr/local/tars/cpp/makefile/tars-tools.cmake)
endif() endif()
set(TARS_WEB_SERVER "upchina@taf.test.whup.com") set(TARS_WEB_HOST "http://tars.test.com")
set(TARS_WEB_HOST "taf.test.whup.com:8080")
include_directories(/usr/local/taf/cpp/thirdparty/include) include_directories(/usr/local/tars/cpp/thirdparty/include)
link_directories(/usr/local/taf/cpp/thirdparty/lib) link_directories(/usr/local/tars/cpp/thirdparty/lib)
#include_directories(/home/tarsprotol/App/OtherServer) #include_directories(/home/tarsprotol/App/OtherServer)
gen_server(Demo DemoServer) add_subdirectory(src)
#target_link_libraries(mysqlclient ssl crypto nghttp2-static)

View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8)
project(DemoApp-DemoServer)
gen_server(DemoApp DemoServer)