build system updated for the standalone executables under 'other'

master
Denes Matetelki 12 years ago
parent 08fd005217
commit 9e7142f77f

@ -3,6 +3,7 @@ project (CPP_UTILS_LIB)
add_subdirectory (build) add_subdirectory (build)
add_subdirectory (test EXCLUDE_FROM_ALL) add_subdirectory (test EXCLUDE_FROM_ALL)
add_subdirectory (other EXCLUDE_FROM_ALL)
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)

@ -0,0 +1,28 @@
set (CXX_FLAGS "-Wall -Wextra -pedantic -Weffc++ -Wshadow "
"-Wpointer-arith -Wcast-qual "
"-ggdb -fprofile-arcs -ftest-coverage --std=c++0x " )
add_definitions( ${CXX_FLAGS} )
include_directories (. ../lib)
add_executable ( tcpserver tcpserver_main.cpp )
target_link_libraries ( tcpserver CppUtils )
add_executable ( tcpclient tcpclient_main.cpp )
target_link_libraries ( tcpclient CppUtils )
add_executable ( sslserver sslserver_main.cpp )
target_link_libraries ( sslserver CppUtils ssl pthread rt )
add_executable ( sslclient sslclient_main.cpp )
target_link_libraries ( sslclient CppUtils ssl pthread rt )
add_executable ( mysqlclient mysqlclient_main.cpp )
add_library ( lib_mysql_client SHARED IMPORTED )
# TODO use find_library
set_target_properties ( lib_mysql_client PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libmysqlclient.so )
target_link_libraries ( mysqlclient CppUtils lib_mysql_client )
add_custom_target( other DEPENDS tcpserver tcpclient sslserver sslclient mysqlclient )

@ -1,12 +1,15 @@
#!/bin/bash #!/bin/bash
INCLUDE_DIR="../include" WORKING_DIR=`pwd`
INCLUDE_DIR="$WORKING_DIR/../lib"
LIB_DIR=/home/denes/projects/cpp_utils/cpp_utils/build
GCC_OPTIONS="-Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-qual -ggdb -Weffc++ -std=c++0x" GCC_OPTIONS="-Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-qual -ggdb -Weffc++ -std=c++0x"
GCC="/usr/lib/colorgcc/bin/g++" GCC="g++"
BUILD_DIR="tmp/" BUILD_DIR="$WORKING_DIR/tmp"
for SRC_FILE in $(ls ../src/*.cpp) for SRC_FILE in $(ls $INCLUDE_DIR/cpp_utils/*.cpp)
do do
echo "Compiling $SRC_FILE" echo "Compiling $SRC_FILE"
$GCC -c $SRC_FILE -I$INCLUDE_DIR $GCC_OPTIONS $GCC -c $SRC_FILE -I$INCLUDE_DIR $GCC_OPTIONS
@ -25,16 +28,16 @@ cd $BUILD_DIR
echo "Linking tcpclient_main.o" echo "Linking tcpclient_main.o"
$GCC tcpclient_main.o Logger.o SocketClient.o TcpConnection.o Socket.o AddrInfo.o Connection.o Thread.o Poll.o -lpthread -o tcpclient $GCC tcpclient_main.o -L$LIB_DIR -lCppUtils -lpthread -o tcpclient
echo "Linking tcpserver_main.o" echo "Linking tcpserver_main.o"
$GCC tcpserver_main.o Logger.o SocketServer.o TcpConnection.o Socket.o AddrInfo.o Connection.o Thread.o Poll.o -lpthread -o tcpserver $GCC tcpserver_main.o -L$LIB_DIR -lCppUtils -lpthread -o tcpserver
echo "Linking sslclient_main.o" echo "Linking sslclient_main.o"
$GCC sslclient_main.o Logger.o SocketClient.o TimerUser.o Timer.o TimedTcpConnection.o TcpConnection.o Socket.o AddrInfo.o Connection.o Thread.o Poll.o SslConnection.o -lpthread -lssl -lrt -o sslclient $GCC sslclient_main.o -L$LIB_DIR -lCppUtils -lpthread -lssl -lrt -o sslclient
echo "Linking sslserver_main.o" echo "Linking sslserver_main.o"
$GCC sslserver_main.o Logger.o SocketServer.o TimerUser.o Timer.o TimedTcpConnection.o TcpConnection.o Socket.o AddrInfo.o Connection.o Thread.o Poll.o SslConnection.o -lpthread -lssl -lrt -o sslserver $GCC sslserver_main.o -L$LIB_DIR -lCppUtils -lpthread -lssl -lrt -o sslserver
echo "Linking mysqlclient_main.o" echo "Linking mysqlclient_main.o"
$GCC mysqlclient_main.o Logger.o ArgParse.o ConditionVariable.o ScopedLock.o MysqlClient.o Mutex.o MysqlConnectionPool.o -lrt -lpthread -L/usr/lib/mysql -lmysqlclient -o mysqlclient $GCC mysqlclient_main.o -L$LIB_DIR -lCppUtils -lrt -lpthread -L/usr/lib/mysql -lmysqlclient -o mysqlclient

Loading…
Cancel
Save