| 1 | project(CanGateway)
 | 
|---|
| 2 | ################################################################################
 | 
|---|
| 3 | 
 | 
|---|
| 4 | add_definitions( -DCANGATEWAY_EXPORTS )
 | 
|---|
| 5 | add_definitions( -DDBTRAWCANREADER_EXPORTS )
 | 
|---|
| 6 | 
 | 
|---|
| 7 | # ========================================
 | 
|---|
| 8 | # Configure qt4
 | 
|---|
| 9 | # ========================================
 | 
|---|
| 10 | #if(QT4_FOUND)
 | 
|---|
| 11 | #  set(QT_USE_QTXML true)
 | 
|---|
| 12 | #  set(QT_USE_QTNETWORK true)
 | 
|---|
| 13 | #  include(${QT_USE_FILE})
 | 
|---|
| 14 | #else()
 | 
|---|
| 15 | #  message(ERROR "Qt4 needed")
 | 
|---|
| 16 | #endif()
 | 
|---|
| 17 | 
 | 
|---|
| 18 | # ========================================
 | 
|---|
| 19 | # Compiler definitions
 | 
|---|
| 20 | # ========================================
 | 
|---|
| 21 | add_definitions(
 | 
|---|
| 22 |   ${QT_DEFINITIONS}
 | 
|---|
| 23 | )
 | 
|---|
| 24 | 
 | 
|---|
| 25 | # ========================================
 | 
|---|
| 26 | # Include directories
 | 
|---|
| 27 | # ========================================
 | 
|---|
| 28 | include_directories(
 | 
|---|
| 29 |   ${PROJECT_BINARY_DIR}
 | 
|---|
| 30 |   ${QT_INCLUDE_DIR}
 | 
|---|
| 31 | )
 | 
|---|
| 32 | 
 | 
|---|
| 33 | # ========================================
 | 
|---|
| 34 | # Link directories
 | 
|---|
| 35 | # ========================================
 | 
|---|
| 36 | link_directories( 
 | 
|---|
| 37 |         ${PACPUS_LIB_DIR}
 | 
|---|
| 38 |         ${CanGateway_SOURCE_DIR}/driver/libs
 | 
|---|
| 39 |         ${CanGateway_SOURCE_DIR}/driver/libs/kvaser/MS
 | 
|---|
| 40 | )
 | 
|---|
| 41 | 
 | 
|---|
| 42 | 
 | 
|---|
| 43 | pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
 | 
|---|
| 44 | 
 | 
|---|
| 45 | # ========================================
 | 
|---|
| 46 | # List of sources
 | 
|---|
| 47 | # ========================================
 | 
|---|
| 48 | set(
 | 
|---|
| 49 |     PROJECT_SRCS
 | 
|---|
| 50 |         CanFrameBase.h
 | 
|---|
| 51 |         CanDecoderBase.cpp
 | 
|---|
| 52 |         CanDecoderBase.h
 | 
|---|
| 53 |         CanGateway.cpp
 | 
|---|
| 54 |         CanGateway.h
 | 
|---|
| 55 |         CanSubscription.cpp
 | 
|---|
| 56 |         CanSubscription.h
 | 
|---|
| 57 |         Win32CanInterface.cpp
 | 
|---|
| 58 |         Win32CanInterface.h
 | 
|---|
| 59 |         DbtRawCanReader.h
 | 
|---|
| 60 |         DbtRawCanReader.cpp
 | 
|---|
| 61 |         structureCan.h
 | 
|---|
| 62 |         driver/KVaserCanDriver.cpp
 | 
|---|
| 63 |         driver/KVaserCanDriver.h
 | 
|---|
| 64 |     ${PLUGIN_CPP}
 | 
|---|
| 65 | )
 | 
|---|
| 66 | 
 | 
|---|
| 67 | if(WIN32)
 | 
|---|
| 68 |     list(APPEND PROJECT_SRCS
 | 
|---|
| 69 |         # Works only on Windows XP
 | 
|---|
| 70 |                 #driver/VectorCanDriver.cpp
 | 
|---|
| 71 |         #driver/VectorCanDriver.h
 | 
|---|
| 72 |         
 | 
|---|
| 73 |                 driver/XLVectorCanDriver.cpp
 | 
|---|
| 74 |         driver/XLVectorCanDriver.h
 | 
|---|
| 75 |         driver/PeakCanDriverWin.h
 | 
|---|
| 76 |         driver/PeakCanDriverWin.cpp
 | 
|---|
| 77 |     )
 | 
|---|
| 78 | endif(WIN32)
 | 
|---|
| 79 | if(UNIX)
 | 
|---|
| 80 |     list(APPEND PROJECT_SRCS
 | 
|---|
| 81 | #        driver/PeakCanDriver.cpp
 | 
|---|
| 82 |         driver/PeakCanDriver.h
 | 
|---|
| 83 |         driver/igepCanDriver.h
 | 
|---|
| 84 |         driver/igepCanDriver.cpp
 | 
|---|
| 85 |     )
 | 
|---|
| 86 | endif(UNIX)
 | 
|---|
| 87 | 
 | 
|---|
| 88 | # ========================================
 | 
|---|
| 89 | # Files to MOC
 | 
|---|
| 90 | # ========================================
 | 
|---|
| 91 | 
 | 
|---|
| 92 | set(
 | 
|---|
| 93 |     FILES_TO_MOC
 | 
|---|
| 94 |     CanGateway.h
 | 
|---|
| 95 |     DbtRawCanReader.h
 | 
|---|
| 96 |     ${PLUGIN_H}
 | 
|---|
| 97 | )
 | 
|---|
| 98 | 
 | 
|---|
| 99 | set(
 | 
|---|
| 100 |     UI_FILES
 | 
|---|
| 101 | )
 | 
|---|
| 102 | 
 | 
|---|
| 103 | # ========================================
 | 
|---|
| 104 | # Call MOC
 | 
|---|
| 105 | # ========================================
 | 
|---|
| 106 | qt_wrap_cpp(
 | 
|---|
| 107 |     PROJECT_MOC_SRCS
 | 
|---|
| 108 |     ${FILES_TO_MOC}
 | 
|---|
| 109 | )
 | 
|---|
| 110 | 
 | 
|---|
| 111 | qt_wrap_ui(
 | 
|---|
| 112 |     PROJECT_UI_SRCS
 | 
|---|
| 113 |     ${UI_FILES}
 | 
|---|
| 114 | )
 | 
|---|
| 115 | 
 | 
|---|
| 116 | # ========================================
 | 
|---|
| 117 | # Build a library
 | 
|---|
| 118 | # ========================================
 | 
|---|
| 119 | pacpus_add_library(
 | 
|---|
| 120 |     ${PROJECT_NAME} SHARED
 | 
|---|
| 121 |     ${PROJECT_SRCS}
 | 
|---|
| 122 |     ${PROJECT_MOC_SRCS}
 | 
|---|
| 123 |     ${PROJECT_UI_SRCS}
 | 
|---|
| 124 | )
 | 
|---|
| 125 | 
 | 
|---|
| 126 | # ========================================
 | 
|---|
| 127 | # Libraries
 | 
|---|
| 128 | # ========================================
 | 
|---|
| 129 | if(WIN32)
 | 
|---|
| 130 |     set(LIBS
 | 
|---|
| 131 |         # add your specific libraries to link here
 | 
|---|
| 132 |         
 | 
|---|
| 133 |                 # Works only on Windows XP
 | 
|---|
| 134 |                 #optimized vcandm32.lib  debug vcandm32.lib
 | 
|---|
| 135 |         optimized vxlapi.lib    debug vxlapi.lib
 | 
|---|
| 136 |                 optimized PCANBasic.lib debug PCANBasic.lib
 | 
|---|
| 137 |                 optimized canlib32.lib  debug canlib32.lib
 | 
|---|
| 138 |     )
 | 
|---|
| 139 | endif(WIN32)
 | 
|---|
| 140 | 
 | 
|---|
| 141 | if(UNIX)
 | 
|---|
| 142 |     set(LIBS
 | 
|---|
| 143 |         # add your specific libraries to link here
 | 
|---|
| 144 |         # pcan
 | 
|---|
| 145 |         canlib
 | 
|---|
| 146 |     )
 | 
|---|
| 147 | endif(UNIX)
 | 
|---|
| 148 | 
 | 
|---|
| 149 | # All the platform
 | 
|---|
| 150 | target_link_libraries(
 | 
|---|
| 151 |     ${PROJECT_NAME}
 | 
|---|
| 152 |     ${PACPUS_LIBRARIES}
 | 
|---|
| 153 |     ${QT_LIBRARIES}
 | 
|---|
| 154 |     ${PACPUS_DEPENDENCIES_LIB}
 | 
|---|
| 155 |     ${LIBS}
 | 
|---|
| 156 |     #optimized PacpusTools debug PacpusTools_d
 | 
|---|
| 157 | )
 | 
|---|
| 158 | pacpus_folder(${PROJECT_NAME} "components")
 | 
|---|
| 159 | 
 | 
|---|
| 160 | # ========================================
 | 
|---|
| 161 | # Install
 | 
|---|
| 162 | # ========================================
 | 
|---|
| 163 | # install plugin
 | 
|---|
| 164 | pacpus_install(${PROJECT_NAME})
 | 
|---|
| 165 | # install headers
 | 
|---|
| 166 | install(
 | 
|---|
| 167 |     DIRECTORY
 | 
|---|
| 168 |         ${CanGateway_SOURCE_DIR}
 | 
|---|
| 169 |     DESTINATION
 | 
|---|
| 170 |         ${PACPUS_INSTALL_DIR}/include
 | 
|---|
| 171 |     FILES_MATCHING PATTERN "*.h"
 | 
|---|
| 172 | )
 | 
|---|
| 173 | # if WIN32 install driver dependencies
 | 
|---|