Changeset 99 in pacpussensors for trunk/TelnetClient


Ignore:
Timestamp:
Oct 15, 2015, 2:47:01 PM (9 years ago)
Author:
nguyenhu
Message:

compilation under linux with 0.2.X framework

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################################################################################
    17project(TelnetClient)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DTelnetClient_EXPORTS )
    211################################################################################
    3 add_definitions(-DTelnetClient_EXPORTS)
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    415
    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 # ========================================
     16find_package(Qt5Network REQUIRED)
     17################################################################################
     18# DIRECTORIES
    2619include_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/
    2924)
    3025
     
    3227# Link directories
    3328# ========================================
    34 link_directories(
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3531)
    3632
    37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
    3833
    39 # ========================================
    40 # List of sources
    41 # ========================================
    42 set(
    43     PROJECT_SRCS
    44     TelnetClient.cpp   
     34################################################################################
     35# FILES
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    TelnetClient.h 
     39    xml/${PROJECT_NAME}.xml
     40    xml/${PROJECT_NAME}_d.xml
     41)
     42set(PROJECT_SRCS
    4543    ${PLUGIN_CPP}
     44    TelnetClient.cpp 
    4645)
    4746
    48 # ========================================
    49 # Files to MOC
    50 # ========================================
    51 set(
    52     FILES_TO_MOC
    53     TelnetClient.h
    54     ${PLUGIN_H}
     47set(FILES_TO_MOC
     48    ${PLUGIN_HDR}
     49    TelnetClient.h
    5550)
    5651
    57 set(
    58     UI_FILES
    59 
     52set(UI_FILES
    6053)
    6154
    62 # ========================================
    63 # Call MOC
    64 # ========================================
    65 qt4_wrap_cpp(
    66     PROJECT_MOC_SRCS
     55################################################################################
     56# Qt: call moc, uic
     57qt_wrap_cpp(PROJECT_MOC_SRCS
    6758    ${FILES_TO_MOC}
    6859)
    6960
    70 qt4_wrap_ui(
    71     PROJECT_UI_SRCS
     61qt_wrap_ui(PROJECT_UI_SRCS
    7262    ${UI_FILES}
    7363)
    7464
    75 # ========================================
    76 # Build a library
    77 # ========================================
    78 pacpus_add_library(
    79     ${PROJECT_NAME} SHARED
     65################################################################################
     66# BUILD and LINK
     67pacpus_add_library(${PROJECT_NAME} SHARED
     68    ${PROJECT_HDRS}
    8069    ${PROJECT_SRCS}
    8170    ${PROJECT_MOC_SRCS}
     
    8372)
    8473
     74
    8575# ========================================
    8676# Libraries
    8777# ========================================
    88 # All the platform
    89 target_link_libraries(
    90     ${PROJECT_NAME}
    91     ${PACPUS_LIBRARIES}
    92     ${QT_LIBRARIES}
    93         ${PACPUS_DEPENDENCIES_LIB}
     78set(LIBS
     79    optimized FileLib debug FileLib_d
     80    optimized PacpusLib debug PacpusLib_d
     81    optimized PacpusTools debug PacpusTools_d
    9482)
    95 
    96 # ========================================
    97 # Install
    98 # ========================================
    99 pacpus_install(${PROJECT_NAME})
    100 
     83if (WIN32)
     84    list(APPEND LIBS
     85        optimized ROAD_TIME debug ROAD_TIME_d
     86    )
     87endif()
     88# LINK
     89target_link_libraries(${PROJECT_NAME}
     90                      ${PACPUS_LIBRARIES}
     91                      ${PACPUS_DEPENDENCIES_LIB}
     92                      ${LIBS}
     93                      ${QT_LIBRARIES}
     94                     )
     95qt5_use_modules(${PROJECT_NAME} Network)
     96################################################################################
     97# FOLDERS
     98pacpus_folder(${PROJECT_NAME} "components")
     99################################################################################
     100# INSTALL
     101pacpus_install(${PROJECT_NAME})
  • trunk/TelnetClient/TelnetClient.cpp

    r54 r99  
    1313
    1414#include "TelnetClient.h"
    15 
     15#include <string>
    1616
    1717using namespace pacpus;
     18using namespace std;
    1819
     20/// Default host address = 0.0.0.0 (any address)
     21static const string kDefaultHostAddress = "127.0.0.1";
     22/// Default host port = 2368
     23static const uint16_t kDefaultHostPort = 2368;
    1924
    2025DECLARE_STATIC_LOGGER("pacpus.base.TelnetClient");
     
    3338    : ComponentBase(name)
    3439{
     40    address_.setAddress(kDefaultHostAddress.c_str());
     41    port_ = kDefaultHostPort;
    3542}
    3643
     
    5057ComponentBase::COMPONENT_CONFIGURATION  TelnetClient::configureComponent(XmlComponentConfig config)
    5158{
    52         address_.setAddress(param.getProperty("address"));
    53         port_ = param.getProperty("port").toUInt();
    5459
    5560        return ComponentBase::CONFIGURED_OK;
Note: See TracChangeset for help on using the changeset viewer.