Changeset 120 in pacpusframework


Ignore:
Timestamp:
Jul 15, 2013, 4:59:37 PM (11 years ago)
Author:
morasjul
Message:
  • add PacpusSerialport (QT 5.1 required)
  • add part of QT4 / QT5 cmake script
  • fix CMake (link)
  • add ComponentBase virtual function addInput() & addOutput() call before component configuration
Location:
branches/2.0-beta1
Files:
2 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0-beta1/cmake/PacpusDependencies.cmake

    r119 r120  
    4242find_package(Qt5OpenGL REQUIRED)
    4343find_package(Qt5Network REQUIRED)
     44find_package(Qt5SerialPort REQUIRED)
    4445
    4546set(QT_DEFINITIONS
     
    5051${Qt5OpenGL_DEFINITIONS}
    5152${Qt5Network_DEFINITIONS}
     53${Qt5SerialPort_DEFINITIONS}
    5254)
    5355set(QT_INCLUDE_DIR
     
    5860${Qt5OpenGL_INCLUDE_DIRS}
    5961${Qt5Network_INCLUDE_DIRS}
     62${Qt5SerialPort_INCLUDE_DIRS}
    6063)
    6164
     
    6770${Qt5OpenGL_LIBRARIES}
    6871${Qt5Network_LIBRARIES}
     72${Qt5SerialPort_LIBRARIES}
    6973)
    7074
  • branches/2.0-beta1/cmake/PacpusUtilities.cmake

    r99 r120  
    88#################################################
    99
    10 # ========================================
    11 # Create a Pacpus plugin
     10
     11# TODO  Compatibility macro
     12## ========================================
     13## Qt macro compatibility Qt4 / Qt5
     14## ========================================
     15#function(qt_wrap_moc MOC_SRCS FILES_TO_MOC)
     16
     17#    if(QT4_FOUNDED)
     18#        qt4_wrap_cpp(TEMP_VAR ${FILES_TO_MOC})
     19
     20#    elseif(Qt5Core_FOUND)
     21#        qt5_wrap_cpp(${MOC_SRCS} ${FILES_TO_MOC} PARENT_SCOPE)
     22
     23#    else()
     24#        message(WARNING "QT ui found, can't wrap moc File")
     25#    endif()
     26
     27#    #set(${MOC_SRCS} ${TEMP_VAR} PARENT_SCOPE)
     28
     29#endfunction(qt_wrap_moc)
     30
     31## ========================================
     32## Qt macro compatibility Qt4 / Qt5
     33## ========================================
     34#function(qt_wrap_ui UI_SRCS UI_FILES)
     35#    if(QT4_FOUND)
     36#        qt4_wrap_ui( TEMP_VAR ${UI_FILES})
     37
     38#    elseif(Qt5Core_FOUND)
     39#        qt5_wrap_ui( TEMP_VAR ${UI_FILES})
     40
     41#    else()
     42#        message(WARNING "QT ui found, can't wrap ui File")
     43#    endif()
     44
     45#    set(${UI_SRCS} ${TEMP_VAR} PARENT_SCOPE)
     46#endfunction()
     47
     48# ========================================
     49# Generic macro for Pacpus plugin
    1250# ========================================
    1351function(PACPUS_PLUGIN OUT_CPP OUT_H PLUGIN_NAME)
     52
     53    if(QT4_FOUND)
     54        pacpus_plugin_qt4(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
     55
     56    elseif(Qt5Core_FOUND)
     57        pacpus_plugin_qt5(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
     58
     59    else()
     60        message(WARNING "QT not found, can't create Plugin")
     61    endif()
     62
     63
     64endfunction(PACPUS_PLUGIN)
     65
     66# ========================================
     67# Create a Pacpus plugin QT4
     68# ========================================
     69function(PACPUS_PLUGIN_QT4 OUT_CPP OUT_H PLUGIN_NAME)
     70
     71    set(PLUGIN_NAME ${PLUGIN_NAME}Plugin)
     72    set(${OUT_CPP} ${PLUGIN_NAME}.cpp PARENT_SCOPE)
     73    set(${OUT_H} ${PLUGIN_NAME}.h PARENT_SCOPE)
     74
     75    string(TOUPPER ${PLUGIN_NAME} PLUGIN_NAME_UPPER)
     76
     77    # create the header file
     78    file(WRITE ${PLUGIN_NAME}.h
     79        "// Autogenerated file by PacpusPlugin.cmake\n"
     80        "// DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE\n"
     81        "\n"
     82        "#ifndef __${PLUGIN_NAME_UPPER}_H__\n"
     83        "#define __${PLUGIN_NAME_UPPER}_H__\n"
     84        "\n"
     85        "#include <QObject>\n"
     86        "#include <qplugin.h>\n"
     87        "\n"
     88        "#include <Pacpus/kernel/PacpusPluginInterface.h>\n"
     89        "\n"
     90        "/// Auto-generated plugin class\n"
     91        "class ${PLUGIN_NAME}\n"
     92        "    : public QObject\n"
     93        "    , public PacpusPluginInterface\n"
     94        "{\n"
     95        "    Q_OBJECT\n"
     96        "    Q_INTERFACES(PacpusPluginInterface)\n"
     97        "\n"
     98        "public:\n"
     99        "    ${PLUGIN_NAME}();\n"
     100        "    ~${PLUGIN_NAME}();\n"
     101        "\n"
     102        "protected:\n"
     103        "    QString name();\n"
     104        "};\n"
     105        "\n"
     106        "#endif // __${PLUGIN_NAME_UPPER}_H__\n"
     107    )
     108
     109    # create the cpp file
     110    file(WRITE ${PLUGIN_NAME}.cpp
     111        "// Autogenerated file by PacpusPlugin.cmake\n"
     112        "// DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE\n"
     113        "\n"
     114        "#include \"${PLUGIN_NAME}.h\"\n"
     115        "\n"
     116        "${PLUGIN_NAME}::${PLUGIN_NAME}()\n"
     117        "{\n"
     118        "}\n"
     119        "\n"
     120        "${PLUGIN_NAME}::~${PLUGIN_NAME}()\n"
     121        "{\n"
     122        "}\n"
     123        "\n"
     124        "QString ${PLUGIN_NAME}::name()\n"
     125        "{\n"
     126        "    return \"${PLUGIN_NAME}\";\n"
     127        "}\n"
     128        "\n"
     129        "Q_EXPORT_PLUGIN2(${PLUGIN_NAME}, ${PLUGIN_NAME})\n"
     130    )
     131endfunction(PACPUS_PLUGIN_QT4)
     132
     133# ========================================
     134# Create a Pacpus plugin QT5
     135# ========================================
     136function(PACPUS_PLUGIN_QT5 OUT_CPP OUT_H PLUGIN_NAME)
    14137
    15138    set(PLUGIN_NAME ${PLUGIN_NAME}Plugin)
     
    82205        "}\n"
    83206        )
    84 endfunction(PACPUS_PLUGIN)
     207endfunction(PACPUS_PLUGIN_QT5)
    85208
    86209# ========================================
  • branches/2.0-beta1/include/Pacpus/kernel/ComponentBase.h

    r110 r120  
    113113
    114114    // virtual QString getType() = 0;
     115
     116    virtual void addInput();
     117
     118    virtual void addOutput();
    115119   
    116120protected:
  • branches/2.0-beta1/src/DBITEPlayer/CMakeLists.txt

    r111 r120  
    6767# Libraries & Dependencies
    6868# ========================================
     69
     70set(OPT_LIBRARIES
     71    optimized dbiteplayerlib debug dbiteplayerlib_d
     72    optimized FileLib debug FileLib_d
     73    optimized PacpusLib debug PacpusLib_d
     74)
     75
    6976# Windows platform
    7077if(WIN32)
    71 set(LIBS
     78    LIST(APPEND OPT_LIBRARIES
    7279        optimized ROAD_TIME debug ROAD_TIME_d
    7380        Winmm
    74 )
     81    )
    7582endif()
    7683
     
    7986    ${PROJECT_NAME}
    8087    ${QT_LIBRARIES}
    81     ${LIBS}
     88    ${OPT_LIBRARIES}
    8289    ${PACPUS_DEPENDENCIES_LIB}
    83     optimized dbiteplayerlib debug dbiteplayerlib_d
    84     optimized FileLib debug FileLib_d
    85     optimized PacpusLib debug PacpusLib_d
    8690)
    8791
  • branches/2.0-beta1/src/DBITEPlayerLib/CMakeLists.txt

    r111 r120  
    8888# Libraries
    8989# ========================================
     90set(OPT_LIBRARIES
     91        optimized FileLib debug FileLib_d
     92        optimized PacpusLib debug PacpusLib_d
     93)
     94
    9095# Windows platform
    9196if(WIN32)
    92 set(LIBS
     97    LIST(APPEND OPT_LIBRARIES
    9398        optimized ROAD_TIME debug ROAD_TIME_d
    9499        Winmm
     
    100105    ${PROJECT_NAME}
    101106    ${PACPUS_DEPENDENCIES_LIB}
    102     ${LIBS}
    103     optimized FileLib debug FileLib_d
    104     optimized PacpusLib debug PacpusLib_d
     107    ${OPT_LIBRARIES}
    105108    ${QT_LIBRARIES}
    106109)
  • branches/2.0-beta1/src/PacpusLib/CMakeLists.txt

    r111 r120  
    6565    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/inputOutputInterface.h
    6666    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/PacpusEvent.h
    67     #${PACPUS_INCLUDE_DIR}/Pacpus/kernel/CommunicationComponent.h
     67    #${PACPUS_INCLUDE_DIR}/Pacpus/kernel/pacpusStruct.h
    6868
    6969    ./ComponentBase.cpp
     
    7575    ./XmlConfigFile.cpp
    7676    ./inputOutputBase.cpp
     77    #./pacpusStruct.cpp
    7778)
    7879
     
    8283)
    8384
    84  qt5_wrap_cpp(
     85qt5_wrap_cpp(
    8586     PROJECT_MOC_SRCS
    8687     ${FILES_TO_MOC}
     
    9798
    9899if(UNIX)
    99         set(LIBS optimized FileLib debug FileLib_d)
     100    set(OPT_LIBRARIES optimized FileLib debug FileLib_d)
    100101else()
    101     set(LIBS
    102         optimized ROAD_TIME debug ROAD_TIME_d
    103         )
     102    set(OPT_LIBRARIES optimized ROAD_TIME debug ROAD_TIME_d)
    104103endif()
    105104
     
    111110    ${QT_LIBRARIES}
    112111    ${PACPUS_DEPENDENCIES_LIB}
    113     ${LIBS}
     112    ${OPT_LIBRARIES}
    114113)
    115114
  • branches/2.0-beta1/src/PacpusLib/ComponentBase.cpp

    r110 r120  
    104104    }
    105105}
     106
     107void ComponentBase::addInput()
     108{
     109
     110}
     111
     112void ComponentBase::addOutput()
     113{
     114
     115}
  • branches/2.0-beta1/src/PacpusLib/ComponentManager.cpp

    r110 r120  
    263263            LOG_WARN("component '" << componentName << "' does not exist");
    264264        } else {
     265           // Pacpus 2.0 : add input and output
     266            component->addInput();
     267            component->addOutput();
     268
    265269            if (component->configuration_ == ComponentBase::CONFIGURATION_DELAYED) {
    266270                LOG_DEBUG("try to configure component '" << componentName << "'");
     
    299303        int connectionPriority = cfg.getConnectionPriority();
    300304
     305
     306        //TODO set connection mode from string
     307
     308        //InputInterfaceBase::GetLast;
     309        //InputInterfaceBase::NeverSkip;
     310        //InputInterfaceBase::TimeBounded;
     311
     312
    301313        if (!createConnection(connectionOutput, connectionInput, connectionType,connectionPriority)) {
    302314            LOG_ERROR("cannot create connection '" << connectionOutput+"=>"+connectionInput << "'");
    303315            continue;
    304316        }
    305     }
     317    } // for
    306318
    307319    return componentMap_.count();
  • branches/2.0-beta1/src/PacpusSensor/CMakeLists.txt

    r111 r120  
    2929    ${PROJECT_BINARY_DIR}/../PacpusLib
    3030    ${PROJECT_BINARY_DIR}/../FileLib
     31    ${PROJECT_BINARY_DIR}/../PacpusTools
    3132)
    3233
     
    4647set(SENSOR_UI_CLASSES src/ui/pacpusmainwindow.ui)
    4748set(SENSOR_MOC_CLASSES src/ui/pacpusmainwindow.h)
     49
    4850qt5_wrap_ui(SENSOR_UI_SOURCES_H ${SENSOR_UI_CLASSES})
    4951qt5_wrap_cpp(SENSOR_MOC_SOURCES ${SENSOR_MOC_CLASSES})
     52
    5053source_group(Main_ui FILES ${PROJECT_SRCS} )
    5154source_group(moc FILES ${SENSOR_MOC_SOURCES} ${SENSOR_UI_SOURCES_H} )
     
    6669# Libraries
    6770# ========================================
     71
     72set(OPT_LIBRARIES
     73        optimized FileLib debug FileLib_d
     74        optimized PacpusLib debug PacpusLib_d
     75        optimized PacpusTools debug PacpusTools_d
     76)
     77
    6878# Windows platform
    6979if(WIN32)
    70 set(LIBS
     80    LIST(APPEND OPT_LIBRARIES
    7181        optimized ROAD_TIME debug ROAD_TIME_d
    7282        Winmm
     
    7888    ${PROJECT_NAME}
    7989    ${PACPUS_DEPENDENCIES_LIB}
    80     optimized FileLib debug FileLib_d
    81     optimized PacpusLib debug PacpusLib_d
    82     ${LIBS}
     90    ${OPT_LIBRARIES}
    8391    ${QT_LIBRARIES}
    8492)
  • branches/2.0-beta1/src/PacpusTools/CMakeLists.txt

    r119 r120  
    4040    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/geodesie.h
    4141    #${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/pacpusStruct.h
    42     #${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PacpusSerialPort.h
     42    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PacpusSerialPort.h
    4343    ./src/matrice.cpp
    4444    ./src/geodesie.cpp
    4545    ./src/AsyncWorkerBase.cpp
    4646    ./src/PeriodicWorker.cpp
    47     #./src/PacpusSerialPort.cpp
     47    ./src/PacpusSerialPort.cpp
    4848)
    4949
     
    5555    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/AsyncWorkerBase.h
    5656    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PeriodicWorker.h
    57     #${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PacpusSerialPort.h
     57    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PacpusSerialPort.h
    5858)
    5959
Note: See TracChangeset for help on using the changeset viewer.