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
SERVANT=$3
echo "APP:$APP, SERVER:$SERVER, SERVANT:$SERVANT"
if [ "$SERVER" == "$SERVANT" ]
then
echo "Error!(ServerName == ServantName)"
exit -1
fi
if [ ! -d $APP/$SERVER ]
if [ ! -d $SERVER ]
then
echo "[mkdir: $APP/$SERVER]"
mkdir -p $APP/$SERVER
echo "[mkdir: $SERVER]"
mkdir -p $SERVER
fi
echo "[create server: $APP.$SERVER ...]"
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
do
@ -39,14 +43,20 @@ do
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
rename "DemoServer" "$SERVER" $SRC_FILE
rename "DemoServant" "$SERVANT" $SRC_FILE
mv DemoServer.h ${SERVER}.h
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.]"

View File

@ -12,12 +12,13 @@ else()
include (/usr/local/tars/cpp/makefile/tars-tools.cmake)
endif()
set(TARS_WEB_SERVER "upchina@taf.test.whup.com")
set(TARS_WEB_HOST "taf.test.whup.com:8080")
set(TARS_WEB_HOST "http://tars.test.com")
include_directories(/usr/local/taf/cpp/thirdparty/include)
link_directories(/usr/local/taf/cpp/thirdparty/lib)
include_directories(/usr/local/tars/cpp/thirdparty/include)
link_directories(/usr/local/tars/cpp/thirdparty/lib)
#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)