Changeset 99 in pacpussensors for trunk/TelnetClient
- Timestamp:
- Oct 15, 2015, 2:47:01 PM (9 years ago)
- Location:
- trunk/TelnetClient
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TelnetClient/CMakeLists.txt
r54 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(TelnetClient) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DTelnetClient_EXPORTS ) 2 11 ################################################################################ 3 add_definitions(-DTelnetClient_EXPORTS) 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 4 15 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 16 find_package(Qt5Network REQUIRED) 17 ################################################################################ 18 # DIRECTORIES 26 19 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 24 ) 30 25 … … 32 27 # Link directories 33 28 # ======================================== 34 link_directories( 29 link_directories( 30 ${PACPUS_LIB_DIR} 35 31 ) 36 32 37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )38 33 39 # ======================================== 40 # List of sources 41 # ======================================== 42 set( 43 PROJECT_SRCS 44 TelnetClient.cpp 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 TelnetClient.h 39 xml/${PROJECT_NAME}.xml 40 xml/${PROJECT_NAME}_d.xml 41 ) 42 set(PROJECT_SRCS 45 43 ${PLUGIN_CPP} 44 TelnetClient.cpp 46 45 ) 47 46 48 # ======================================== 49 # Files to MOC 50 # ======================================== 51 set( 52 FILES_TO_MOC 53 TelnetClient.h 54 ${PLUGIN_H} 47 set(FILES_TO_MOC 48 ${PLUGIN_HDR} 49 TelnetClient.h 55 50 ) 56 51 57 set( 58 UI_FILES 59 52 set(UI_FILES 60 53 ) 61 54 62 # ======================================== 63 # Call MOC 64 # ======================================== 65 qt4_wrap_cpp( 66 PROJECT_MOC_SRCS 55 ################################################################################ 56 # Qt: call moc, uic 57 qt_wrap_cpp(PROJECT_MOC_SRCS 67 58 ${FILES_TO_MOC} 68 59 ) 69 60 70 qt4_wrap_ui( 71 PROJECT_UI_SRCS 61 qt_wrap_ui(PROJECT_UI_SRCS 72 62 ${UI_FILES} 73 63 ) 74 64 75 # ======================================== 76 # Build a library 77 # ======================================== 78 pacpus_add_library( 79 ${PROJECT_NAME} SHARED 65 ################################################################################ 66 # BUILD and LINK 67 pacpus_add_library(${PROJECT_NAME} SHARED 68 ${PROJECT_HDRS} 80 69 ${PROJECT_SRCS} 81 70 ${PROJECT_MOC_SRCS} … … 83 72 ) 84 73 74 85 75 # ======================================== 86 76 # Libraries 87 77 # ======================================== 88 # All the platform 89 target_link_libraries( 90 ${PROJECT_NAME} 91 ${PACPUS_LIBRARIES} 92 ${QT_LIBRARIES} 93 ${PACPUS_DEPENDENCIES_LIB} 78 set(LIBS 79 optimized FileLib debug FileLib_d 80 optimized PacpusLib debug PacpusLib_d 81 optimized PacpusTools debug PacpusTools_d 94 82 ) 95 96 # ======================================== 97 # Install 98 # ======================================== 99 pacpus_install(${PROJECT_NAME}) 100 83 if (WIN32) 84 list(APPEND LIBS 85 optimized ROAD_TIME debug ROAD_TIME_d 86 ) 87 endif() 88 # LINK 89 target_link_libraries(${PROJECT_NAME} 90 ${PACPUS_LIBRARIES} 91 ${PACPUS_DEPENDENCIES_LIB} 92 ${LIBS} 93 ${QT_LIBRARIES} 94 ) 95 qt5_use_modules(${PROJECT_NAME} Network) 96 ################################################################################ 97 # FOLDERS 98 pacpus_folder(${PROJECT_NAME} "components") 99 ################################################################################ 100 # INSTALL 101 pacpus_install(${PROJECT_NAME}) -
trunk/TelnetClient/TelnetClient.cpp
r54 r99 13 13 14 14 #include "TelnetClient.h" 15 15 #include <string> 16 16 17 17 using namespace pacpus; 18 using namespace std; 18 19 20 /// Default host address = 0.0.0.0 (any address) 21 static const string kDefaultHostAddress = "127.0.0.1"; 22 /// Default host port = 2368 23 static const uint16_t kDefaultHostPort = 2368; 19 24 20 25 DECLARE_STATIC_LOGGER("pacpus.base.TelnetClient"); … … 33 38 : ComponentBase(name) 34 39 { 40 address_.setAddress(kDefaultHostAddress.c_str()); 41 port_ = kDefaultHostPort; 35 42 } 36 43 … … 50 57 ComponentBase::COMPONENT_CONFIGURATION TelnetClient::configureComponent(XmlComponentConfig config) 51 58 { 52 address_.setAddress(param.getProperty("address"));53 port_ = param.getProperty("port").toUInt();54 59 55 60 return ComponentBase::CONFIGURED_OK;
Note:
See TracChangeset
for help on using the changeset viewer.