Changeset 185 in pacpusframework


Ignore:
Timestamp:
10/23/13 10:32:21 (11 years ago)
Author:
morasjul
Message:

Fixed: dependencies.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r175 r185  
    1212
    1313if(POLICY CMP0020)
    14     cmake_policy(SET CMP0020  NEW) # for QT5.1 on windows / not work on linux
     14    cmake_policy(SET CMP0020 NEW) # for QT5.1 on windows / not work on linux
    1515endif()
    1616
    17 # ========================================
     17################################################################################
    1818# Pacpus version
    19 # ========================================
    20 set(PACPUS_MAJOR_VERSION 0)
    21 set(PACPUS_MINOR_VERSION 1)
    22 set(PACPUS_PATCH_VERSION 0)
    23 set(PACPUS_VERSION
    24     "${PACPUS_MAJOR_VERSION}.${PACPUS_MINOR_VERSION}.${PACPUS_PATCH_VERSION}")
     19set(${PROJECT_NAME}_MAJOR_VERSION 0)
     20set(${PROJECT_NAME}_MINOR_VERSION 1)
     21set(${PROJECT_NAME}_PATCH_VERSION 0)
     22set(${PROJECT_NAME}_VERSION
     23    "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}")
    2524
    26 # ========================================
     25################################################################################
    2726# CMake variables
    28 # ========================================
    2927set(PACPUS_ROOT_DIR         ${CMAKE_SOURCE_DIR})
    3028set(PACPUS_3RD_PARTY_DIR    ${PACPUS_ROOT_DIR}/3rd)
    3129set(PACPUS_CMAKE_DIR        ${PACPUS_ROOT_DIR}/cmake)
    3230set(PACPUS_DOC_DIR          ${PACPUS_ROOT_DIR}/doc)
     31set(PACPUS_EXAMPLES_DIR     ${PACPUS_ROOT_DIR}/examples)
    3332set(PACPUS_INCLUDE_DIR      ${PACPUS_ROOT_DIR}/include/)
    3433set(PACPUS_SCRIPTS_DIR      ${PACPUS_ROOT_DIR}/scripts)
     
    3635set(IS_BUILDING_PACPUS      TRUE)
    3736
    38 # ========================================
     37################################################################################
    3938# Configure CMake
    40 # ========================================
    4139list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
    4240
    43 # ========================================
     41################################################################################
    4442# Import some functions
    45 # ========================================
    4643include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
    4744
    48 # ========================================
     45################################################################################
    4946# Configure Pacpus
    50 # ========================================
    5147include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
    5248
    53 # ========================================
     49################################################################################
    5450# Find dependencies
    55 # ========================================
    5651include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
    5752
    58 # ========================================
     53################################################################################
    5954# Handle platform-specific behaviour
    60 # ========================================
    6155include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
    6256
    63 # ========================================
     57################################################################################
    6458# Compiler flags coming from PacpusDependencies and PacpusPlatforms
    65 # ========================================
    6659#message(STATUS "\${PACPUS_DEFINITIONS} = ${PACPUS_DEFINITIONS}")
    6760add_definitions(${PACPUS_DEFINITIONS})
    6861
    69 # ========================================
    70 # Pre-configuration of the compiler
    71 # ========================================
     62################################################################################
    7263# Includes directories
    7364include_directories(
     
    7667)
    7768
    78 # ========================================
     69################################################################################
    7970# Build the Pacpus' modules
    80 # ========================================
    8171add_subdirectory(${PACPUS_SOURCE_DIR})
    82 if(PACPUS_BUILD_EXAMPLES)
    83     add_subdirectory(examples)
    84 endif()
    8572
    86 # ========================================
    87 # Build the documentation if enabled
    88 # ========================================
     73################################################################################
     74# DOCUMENTATION
    8975if(PACPUS_BUILD_DOC)
    9076    add_subdirectory(${PACPUS_DOC_DIR})
    9177endif()
    9278
    93 # ========================================
     79################################################################################
    9480# Pacpus Installation
    95 # ========================================
    9681include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
    9782set(ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR})
    9883
    99 # ========================================
    100 # Summary
    101 # ========================================
     84################################################################################
     85# EXAMPLES
     86if(PACPUS_BUILD_EXAMPLES)
     87    add_subdirectory(${PACPUS_EXAMPLES_DIR})
     88endif()
     89
     90################################################################################
     91# SUMMARY
    10292pacpus_info("")
    10393pacpus_info("=====================================================================")
    104 pacpus_info("Configuration for Pacpus ${PACPUS_VERSION}")
     94pacpus_info("Configuration for Pacpus ${${PROJECT_NAME}_VERSION}")
    10595pacpus_info("=====================================================================")
    10696pacpus_info("")
  • trunk/cmake/PacpusInstall.cmake

    r89 r185  
    88#################################################
    99
    10 # ========================================
    11 # CMake files
    12 # ========================================
     10################################################################################
     11# CMake
    1312install(
    1413    DIRECTORY
     
    1817)
    1918
    20 # ========================================
    21 # Include files
    22 # ========================================
     19################################################################################
     20# INCLUDES
    2321install(
    2422    DIRECTORY
     
    2826)
    2927
    30 # ========================================
     28################################################################################
    3129# Installation of the 3rd party
    32 # ========================================
    3330if(PACPUS_INSTALL_3RD)
    3431    install(
     
    4037endif()
    4138
    42 # ========================================
     39################################################################################
    4340# Installation of the documentation
    44 # ========================================
    4541if(PACPUS_BUILD_DOC)
    4642    install(
  • trunk/examples/ProducerConsumerExample/CMakeLists.txt

    r181 r185  
    11project(ProducerConsumerExample)
    22
    3 # ========================================
    4 # Basic Definitions
    5 # ========================================
    63set(${PROJECT_NAME}_VERSION_MAJOR 0)
    74set(${PROJECT_NAME}_VERSION_MINOR 1)
    85
     6################################################################################
    97create_export(EXPORT_HDR ${PROJECT_NAME})
    10 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME})
     8pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
    119
    12 # ========================================
    13 # Compiler definitions
    14 # ========================================
    15 add_definitions(${QT_DEFINITIONS})
    16 
    17 # ========================================
    18 # Include directories
    19 # ========================================
     10################################################################################
     11# INCLUDES
    2012include_directories(
    2113    ${PACPUSCITYVIP_INCLUDE_DIR}
     
    2416)
    2517
    26 # ========================================
     18################################################################################
    2719# Link directories
    28 # ========================================
    2920set(SRC_BINARY_DIR "${PROJECT_BINARY_DIR}/../../src")
    3021get_filename_component(SRC_BINARY_DIR "${SRC_BINARY_DIR}" ABSOLUTE)
     
    3627)
    3728
    38 # ========================================
    39 # List of sources
    40 # ========================================
     29################################################################################
     30# FILES
    4131set(PROJECT_HDRS
     32    ${EXPORT_HDR}
    4233    ProducerExample.h
    4334    ConsumerExample.h
    44     ${PROJECT_NAME}.xml
    45     ${EXPORT_HDR}
     35    XML/${PROJECT_NAME}.xml
     36    XML/${PROJECT_NAME}_d.xml
    4637)
    4738set(PROJECT_SRCS
     
    5142)
    5243
    53 # ========================================
    54 # Files to MOC
    55 # ========================================
    5644set(FILES_TO_MOC
    57     ${PLUGIN_H}
     45    ${PLUGIN_HDR}
    5846    ProducerExample.h
    5947    ConsumerExample.h
     
    6351)
    6452
    65 # ========================================
    66 # Call MOC
    67 # ========================================
    68 qt_wrap_cpp(
    69     PROJECT_MOC_SRCS
     53################################################################################
     54# Qt: call moc, uic
     55qt_wrap_cpp(PROJECT_MOC_SRCS
    7056    ${FILES_TO_MOC}
    71  )
     57)
    7258
    73 qt_wrap_ui(
    74     PROJECT_UI_SRCS
     59qt_wrap_ui(PROJECT_UI_SRCS
    7560    ${UI_FILES}
    7661)
    7762
    78 # ========================================
    79 # Build a library
    80 # ========================================
    81 pacpus_add_library(
    82     ${PROJECT_NAME} SHARED
     63################################################################################
     64# BUILD and LINK
     65pacpus_add_library(${PROJECT_NAME} SHARED
    8366    ${PROJECT_HDRS}
    8467    ${PROJECT_SRCS}
     
    8669    ${PROJECT_UI_SRCS}
    8770)
     71
    8872list(APPEND PACPUS_LIBRARIES
    8973    optimized PacpusLib debug PacpusLib_d
    9074)
    91 if(WIN32)
    92     list(APPEND PACPUS_LIBRARIES
    93         optimized road_time debug road_time_d
    94     )
    95 endif()
    96 #message("\${PACPUS_LIBRARIES} = ${PACPUS_LIBRARIES}")
    97 #message("\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
    98 
    99 # ========================================
    100 # Libraries
    101 # ========================================
    102 # All the platform
    103 target_link_libraries(${PROJECT_NAME}
     75message(STATUS "\${PACPUS_LIBRARIES} = ${PACPUS_LIBRARIES}")
     76message(STATUS "\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
     77# LIBS
     78set(LIBS
    10479    ${PACPUS_LIBRARIES}
    10580        ${PACPUS_DEPENDENCIES_LIB}
     81    #${OpenCV_LIBRARIES}
    10682    ${QT_LIBRARIES}
    107     #${OpenCV_LIBRARIES}
    10883)
    10984
    110 # ========================================
    111 # Install
    112 # ========================================
     85# LINK
     86target_link_libraries(${PROJECT_NAME} ${LIBS})
     87
     88################################################################################
     89# FOLDERS
     90pacpus_folder(${PROJECT_NAME} "examples")
     91
     92################################################################################
     93# INSTALL
    11394pacpus_install(${PROJECT_NAME})
    11495
    11596# Installation of the headers
    11697#install(DIRECTORY ${PACPUSCITYVIP_INCLUDE_DIR} DESTINATION "${PACPUS_ROOT}")
    117 
    118 # ========================================
    119 # Folder
    120 # ========================================
    121 pacpus_folder(${PROJECT_NAME} "examples")
  • trunk/include/Pacpus/kernel/InputOutputBase.h

    r182 r185  
    6666    virtual ~InputInterfaceBase();
    6767
    68     virtual void customEvent(QEvent* e);
     68    virtual void customEvent(QEvent * e);
    6969
    7070    ReadingMode & readingMode();
    71     const ReadingMode & readingMode() const;
     71    const ReadingMode & getReadingMode() const;
    7272    void setReadingMode(ReadingMode mode);
    7373
     
    9696    QStringList getInputConnectedList();
    9797
    98     // TODO for serialization prupose (not yet implemented !!!)
    9998    void send(/*const*/ QByteArray & data);
    10099};
    101 
    102 namespace {
    103 
    104 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
    105 
    106 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)
    107 {
    108     if (out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) {
    109         // Add connection
    110         out->addConnection(ConnectionBase(in, priority));  // TODO make connect function
    111         in->addConnection(ConnectionBase(out, priority));
    112         in->setReadingMode(mode);
    113         //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
    114         return true;
    115     } else {
    116         //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " <<  QString(typeid(QByteArray).name()));
    117         return false;
    118     }
    119 }
    120 
    121 } // namespace
    122100
    123101} // namespace pacpus
  • trunk/include/Pacpus/kernel/InputOutputInterface.h

    r184 r185  
    9696
    9797    // TODO for Pulling mode (not yet implemented !!!)
    98     T& getData() {
     98    T & getData() {
    9999        T data;
    100100        // TODO ask output data;
     
    105105protected:
    106106    void (C::*method)(const T&);
    107 
    108107};
    109108
    110109template <typename T, class C>
    111 class OutputInterface : public OutputInterfaceBase
     110class OutputInterface
     111    : public OutputInterfaceBase
    112112{
    113113public:
    114114    OutputInterface(QString name, C * component)
    115         :OutputInterfaceBase(name,component,component)
     115        : OutputInterfaceBase(name, component, component)
    116116    {}
    117117    ~OutputInterface() {}
     
    120120    void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0);
    121121   
    122     void send(const T & data, road_time_t t, road_timerange_t tr)
    123     {
    124         // FIXME Data Shared
    125         //QSharedPointer<T> sharedPointer = new T(data);
    126 
    127         for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {
    128             QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler
    129             //qDebug() << "sender " << it->getInterface()->getSignature() <<  " thread " << QThread::currentThread() << " Data & " << &data << " ";
    130         }
    131     }
    132 
    133122    size_t getDataSize()
    134123    {
     
    142131};
    143132
     133template <typename T, class C>
     134void OutputInterface<T, C>::send(const T & data, road_time_t t, road_timerange_t tr)
     135{
     136    // FIXME Data Shared
     137    //QSharedPointer<T> sharedPointer = new T(data);
     138
     139    for (QList<ConnectionBase>::iterator it = connections().begin(); it != connections().end(); ++it) {
     140        QApplication::postEvent(it->getInterface(),new PacpusTypedEvent<T>(TYPED_EVENT,data,t,tr),it->getPriority()); // Event is delete by the event loop handler
     141        //qDebug() << "sender " << it->getInterface()->getSignature() <<  " thread " << QThread::currentThread() << " Data & " << &data << " ";
     142    }
     143}
     144
    144145} // namespace pacpus
    145146
  • trunk/src/PacpusLib/CMakeLists.txt

    r182 r185  
    1111create_export(EXPORT_HDR ${PROJECT_NAME} "${PACPUS_INCLUDE_DIR}/Pacpus/kernel")
    1212
    13 # ========================================
    14 # Configure qt4
    15 # ========================================
    16 #if(QT4_FOUND)
    17 #    set(QT_USE_QTXML true)
    18 #    include(${QT_USE_FILE})
    19 #else()
    20 #    message(ERROR "Qt4 needed")
    21 #endif()
    22 
    23 
    24 # ========================================
    25 # Compiler definitions
    26 # ========================================
     13################################################################################
    2714add_definitions(
    2815    -DQT_NO_KEYWORDS
     
    3017)
    3118
    32 # ========================================
    33 # Include directories
    34 # ========================================
     19################################################################################
     20# INCLUDES
    3521include_directories(
    3622    ${QT_INCLUDE_DIR}
    3723)
    3824
    39 # ========================================
    40 # Link directories
    41 # ========================================
     25################################################################################
     26# LINK
    4227link_directories(
    4328    ${PROJECT_BINARY_DIR}/../RoadTime
     
    4530)
    4631
    47 # ========================================
    48 # List of sources
    49 # ========================================
     32################################################################################
     33# FILES
    5034set(PROJECT_HDRS
    5135    ${EXPORT_HDR}
     36
    5237    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/cstdint.h
    5338    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/ComponentBase.h
     
    8974)
    9075
    91 qt_wrap_cpp(
    92      PROJECT_MOC_SRCS
    93      ${FILES_TO_MOC}
    94  )
    95 
    96 # ========================================
    97 # Build a library
    98 # ========================================
     76qt_wrap_cpp(PROJECT_MOC_SRCS
     77    ${FILES_TO_MOC}
     78)
     79 
     80################################################################################
     81# BUILD AND LINK
    9982pacpus_add_library(${PROJECT_NAME} SHARED
    10083    ${PROJECT_HDRS}
     
    10992endif()
    11093
    111 # ========================================
    112 # Libraries
    113 # ========================================
     94################################################################################
     95# LIBS
    11496target_link_libraries(
    11597    ${PROJECT_NAME}
     
    119101)
    120102
    121 # ========================================
    122 # Install
    123 # ========================================
     103################################################################################
     104# INSTALL
    124105pacpus_install(${PROJECT_NAME})
    125106
    126 # ========================================
    127 # Folder
    128 # ========================================
     107################################################################################
     108# FOLDER
    129109pacpus_folder(${PROJECT_NAME} "libraries")
  • trunk/src/PacpusLib/ComponentManager.cpp

    r184 r185  
    1818
    1919DECLARE_STATIC_LOGGER("pacpus.core.ComponentManager");
     20
     21////////////////////////////////////////////////////////////////////////////////
     22
     23bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
     24
     25////////////////////////////////////////////////////////////////////////////////
     26
     27bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)
     28{
     29    if (out->getDataType() == in->getDataType() || out->getDataType() == QString(typeid(QByteArray).name()) || in->getDataType() == QString(typeid(QByteArray).name())) {
     30        // Add connection
     31        out->addConnection(ConnectionBase(in, priority));  // TODO make connect function
     32        in->addConnection(ConnectionBase(out, priority));
     33        in->setReadingMode(mode);
     34        //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
     35        return true;
     36    } else {
     37        //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " <<  QString(typeid(QByteArray).name()));
     38        return false;
     39    }
     40}
     41
     42////////////////////////////////////////////////////////////////////////////////
    2043
    2144ComponentManager * ComponentManager::mInstance = NULL;
  • trunk/src/PacpusLib/InputOutputBase.cpp

    r182 r185  
    9797}
    9898
    99 const InputInterfaceBase::ReadingMode & InputInterfaceBase::readingMode() const
     99const InputInterfaceBase::ReadingMode & InputInterfaceBase::getReadingMode() const
    100100{
    101101    return m_readingMode;
Note: See TracChangeset for help on using the changeset viewer.