diff --git a/CMakeLists.txt b/CMakeLists.txt index 8daaeff..6353a2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project (CPP_UTILS_LIB) add_subdirectory (build) add_subdirectory (test EXCLUDE_FROM_ALL) +add_subdirectory (other EXCLUDE_FROM_ALL) find_package(Doxygen) if(DOXYGEN_FOUND) diff --git a/other/CMakeLists.txt b/other/CMakeLists.txt new file mode 100644 index 0000000..bf70152 --- /dev/null +++ b/other/CMakeLists.txt @@ -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 ) diff --git a/other/compile.sh b/other/compile.sh index e97e8e5..ebb1f65 100755 --- a/other/compile.sh +++ b/other/compile.sh @@ -1,12 +1,15 @@ #!/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="/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 echo "Compiling $SRC_FILE" $GCC -c $SRC_FILE -I$INCLUDE_DIR $GCC_OPTIONS @@ -25,16 +28,16 @@ cd $BUILD_DIR 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" -$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" -$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" -$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" -$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