Changeset 301 in pacpusframework for trunk


Ignore:
Timestamp:
Apr 8, 2014, 10:03:01 AM (11 years ago)
Author:
Marek Kurdej
Message:

Some Unix fixes

Location:
trunk
Files:
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11build
         2CMakeLists.txt.user*
  • trunk/CMakeLists.txt

    r250 r301  
    3333set(PACPUS_SCRIPTS_DIR      ${PACPUS_ROOT_DIR}/scripts)
    3434set(PACPUS_SOURCE_DIR       ${PACPUS_ROOT_DIR}/src)
     35set(PACPUS_TEST_DIR       ${PACPUS_ROOT_DIR}/test)
    3536set(IS_BUILDING_PACPUS      TRUE)
    3637
    3738set(PACPUS_DEFINITIONS "")
     39
     40################################################################################
     41set(PACPUS_BUILD_TESTS TRUE CACHE BOOL "Whether build the tests")
    3842
    3943################################################################################
     
    9397
    9498################################################################################
     99# TESTS
     100if(${PACPUS_BUILD_TESTS})
     101    enable_testing()
     102    #add_subdirectory(${PACPUS_TEST_DIR})
     103endif()
     104
     105################################################################################
    95106# SUMMARY
    96107pacpus_info("")
  • trunk/cmake/PacpusDependencies.cmake

    r285 r301  
    123123    list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
    124124endif()
     125
    125126if(PACPUS_USE_LOG)
    126127    find_package(Boost 1.54.0 REQUIRED
     
    130131            log_setup # log
    131132    )
    132     include_directories(${Boost_INCLUDE_DIRS})
    133     link_directories(${Boost_LIBRARY_DIRS})
     133    list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
     134    list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
     135endif()
     136if(PACPUS_BUILD_TESTS)
     137    find_package(Boost 1.21.0 REQUIRED
     138        COMPONENTS
     139            unit_test_framework
     140    )
    134141    list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
    135142    list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
  • trunk/cmake/PacpusUtilities.cmake

    r267 r301  
    378378endfunction()
    379379
     380################################################################################
     381# pacpus_add_test_executable(TEST_NAME SOURCES)
     382function(pacpus_add_test_executable TEST_NAME)
     383    set(SOURCES ${ARGN})
     384    if(DEBUG)
     385        message(STATUS "SOURCES = ${SOURCES}")
     386    endif()
     387    set(EXE_NAME ${TEST_NAME})
     388    pacpus_add_executable(${EXE_NAME} ${SOURCES})
     389    add_test(
     390        NAME ${TEST_NAME}
     391        WORKING_DIRECTORY ${PACPUS_INSTALL_DIR}/bin
     392        COMMAND ${EXE_NAME}
     393    )
     394    set_target_properties(${TEST_NAME} PROPERTIES FOLDER "tests")
     395    target_link_libraries(${EXE_NAME}
     396        ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
     397        ${PACPUS_LIBRARIES}
     398        ${PACPUS_DEPENDENCIES_LIB}
     399        #${QT_LIBRARIES}
     400    )
     401endfunction()
     402
    380403# ========================================
    381404# Get sub directories
  • trunk/examples/ProducerConsumerExample/CMakeLists.txt

    r189 r301  
    99
    1010################################################################################
    11 # INCLUDES
     11# DIRECTORIES
    1212include_directories(
    1313    ${PACPUSCITYVIP_INCLUDE_DIR}
     
    1616)
    1717
    18 ################################################################################
    19 # Link directories
    2018set(SRC_BINARY_DIR "${PROJECT_BINARY_DIR}/../../src")
    2119get_filename_component(SRC_BINARY_DIR "${SRC_BINARY_DIR}" ABSOLUTE)
     
    2422    ${SRC_BINARY_DIR}/PacpusLib
    2523    ${SRC_BINARY_DIR}/PacpusTools
    26         ${SRC_BINARY_DIR}/RoadTime
     24    ${SRC_BINARY_DIR}/RoadTime
    2725)
    2826
     
    7876    )
    7977endif()
    80 #message(STATUS "\${PACPUS_LIBRARIES} = ${PACPUS_LIBRARIES}")
    81 #message(STATUS "\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
     78
    8279# LIBS
    8380set(LIBS
    8481    ${PACPUS_LIBRARIES}
    85         ${PACPUS_DEPENDENCIES_LIB}
    86     #${OpenCV_LIBRARIES}
     82    ${PACPUS_DEPENDENCIES_LIB}
    8783    ${QT_LIBRARIES}
    8884)
  • trunk/examples/ProducerConsumerExample/ProducerExample.cpp

    r293 r301  
    6060    using boost::ref;
    6161
    62     std::fstream mFile(mOutputFileName, std::ios_base::out | std::ios_base::app);
     62    std::fstream mFile(mOutputFileName.c_str(), std::ios_base::out | std::ios_base::app);
    6363    if (!mFile.is_open()) {
    6464        LOG_ERROR("file '" << mOutputFileName << "' cannot be opened");
  • trunk/include/Pacpus/PacpusTools

    • Property svn:ignore
      •  

        old new  
        1 QSerialPort.h
        2 pacpusStruct.h
         1*Config.h
  • trunk/include/Pacpus/kernel

    • Property svn:ignore
      •  

        old new  
        1 CommunicationComponent.h
         1*Config.h
  • trunk/src/FileLib/CMakeLists.txt

    r111 r301  
    99project(FileLib)
    1010
    11 # ========================================
    12 # Compiler definitions
    13 # ========================================
    14 add_definitions(
    15     -DFILELIB_EXPORTS
     11################################################################################
     12create_export(EXPORT_HDR ${PROJECT_NAME} "${PACPUS_INCLUDE_DIR}/Pacpus/kernel")
     13
     14################################################################################
     15# DIRECTORIES
     16link_directories(
     17    ${PROJECT_BINARY_DIR}/../PacpusLib
    1618)
    1719
    18 # ========================================
    19 # Link directories
    20 # ========================================
    21 link_directories(
    22         ${PROJECT_BINARY_DIR}/../PacpusLib
     20################################################################################
     21# FILES
     22set(SRCS
     23    src/DbiteException.cpp
     24    src/DbiteFile.cpp
    2325)
    2426
    25 # ========================================
    26 # List of sources
    27 # ========================================
    28 set(
    29     PROJECT_SRCS
     27set(HDRS
     28    ${EXPORT_HDR}
     29
    3030    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/DbiteException.h
    3131    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/DbiteFile.h
    3232    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/DbiteFileTypes.h
    3333    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/FileLibConfig.h
    34     ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/hdfile_header_t
     34    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/hdfile_header_t.h
    3535    ${PACPUS_INCLUDE_DIR}/Pacpus/kernel/road_time.h
    36     src/DbiteException.cpp
    37     src/DbiteFile.cpp
    3836)
    3937
    40 # ========================================
    41 # Build a library
    42 # ========================================
    43 pacpus_add_library(
    44     ${PROJECT_NAME} SHARED
    45     ${PROJECT_SRCS}
     38################################################################################
     39# BUILD and LINK
     40pacpus_add_library(${PROJECT_NAME} SHARED
     41    ${SRCS}
     42    ${HDRS}
    4643)
    4744
    48 # ========================================
    49 # Libraries
    50 # ========================================
     45# LIBS
     46set(LIBS
     47    ${PACPUS_DEPENDENCIES_LIB}
     48)
     49
    5150if(WIN32)
    52 target_link_libraries(
    53     ${PROJECT_NAME}
    54     ${PACPUS_DEPENDENCIES_LIB}
    55     optimized PacpusLib debug PacpusLib_d
    56 )
     51    list(APPEND LIBS
     52        optimized PacpusLib debug PacpusLib_d
     53    )
    5754endif()
    5855
    59 # ========================================
     56# LINK
     57target_link_libraries(${PROJECT_NAME}
     58    ${LIBS}
     59)
     60
     61if(${PACPUS_BUILD_TESTS})
     62    link_directories(
     63        ${PROJECT_BINARY_DIR}/../FileLib
     64    )
     65    pacpus_add_test_executable(Test${PROJECT_NAME}
     66        test/TestFileLib.cpp
     67        ${HDRS}
     68    )
     69    list(APPEND LIBS
     70        ${QT_LIBRARIES}
     71        optimized PacpusLib debug PacpusLib_d
     72        optimized ${PROJECT_NAME} debug ${PROJECT_NAME}_d
     73    )
     74    target_link_libraries(Test${PROJECT_NAME}
     75        ${LIBS}
     76    )
     77endif()
     78
     79################################################################################
    6080# Install
    61 # ========================================
    6281pacpus_install(${PROJECT_NAME})
    6382
    64 # ========================================
    65 # Folder
    66 # ========================================
     83################################################################################
     84# FOLDER
    6785pacpus_folder(${PROJECT_NAME} "libraries")
  • trunk/src/FileLib/test/TestFileLib.cpp

    r89 r301  
    1717#endif // _MSC_VER
    1818
     19#include <Pacpus/kernel/DbiteException.h>
     20#include <Pacpus/kernel/DbiteFile.h>
     21#include <Pacpus/kernel/Log.h>
     22
    1923#include <boost/noncopyable.hpp>
    2024#include <cstdio>
    2125
    22 #include "kernel/DbiteException.h"
    23 #include "kernel/DbiteFile.h"
    24 #include "kernel/Log.h"
    25 
    26 DECLARE_STATIC_LOGGER("pacpus.core.TestFileLib");
     26DECLARE_STATIC_LOGGER("pacpus.framework.test.FileLib");
    2727
    2828using namespace boost;
  • trunk/src/PacpusLib/ColorSeverityFormatter.hpp

    r244 r301  
    2626#include <cstdlib>
    2727#include <sstream>
     28#include <string>
    2829
    2930// could use Boost.Predef with Boost >= 1.55
     
    141142#else
    142143    // On non-Windows platforms, we rely on the TERM variable.
    143     const char* const term = std::getenv("TERM");
     144    std::string const term = std::getenv("TERM");
    144145    const bool termSupportsColor = (term == "xterm")
    145             || (term, "xterm-color")
    146             || (term, "xterm-256color")
    147             || (term, "screen")
    148             || (term, "linux")
    149             || (term, "cygwin");
     146            || (term == "xterm-color")
     147            || (term == "xterm-256color")
     148            || (term == "screen")
     149            || (term == "linux")
     150            || (term == "cygwin");
    150151    return stdoutIsTty && termSupportsColor;
    151152#endif // defined(PACPUS_OS_WINDOWS) && !defined(PACPUS_OS_WINDOWS_MOBILE)
Note: See TracChangeset for help on using the changeset viewer.