[59] | 1 | project(SpanCPTComponent)
|
---|
| 2 |
|
---|
| 3 | ################################################################################
|
---|
| 4 | add_definitions( -DCPTCOMPONENT_EXPORTS )
|
---|
| 5 | add_definitions( -DPLUGINLIB_EXPORTS )
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | # ========================================
|
---|
| 9 | # Configure qt4
|
---|
| 10 | # ========================================
|
---|
| 11 | if(QT4_FOUND)
|
---|
| 12 | set(QT_USE_QTXML true)
|
---|
| 13 | set(QT_USE_QTNETWORK true)
|
---|
| 14 | include(${QT_USE_FILE})
|
---|
| 15 | else()
|
---|
| 16 | message(ERROR "Qt4 needed")
|
---|
| 17 | endif()
|
---|
| 18 |
|
---|
| 19 | # ========================================
|
---|
| 20 | # Compiler definitions
|
---|
| 21 | # ========================================
|
---|
| 22 | add_definitions(
|
---|
| 23 | ${QT_DEFINITIONS}
|
---|
| 24 | )
|
---|
| 25 |
|
---|
| 26 | # ========================================
|
---|
| 27 | # Include directories
|
---|
| 28 | # ========================================
|
---|
| 29 | include_directories(
|
---|
| 30 | ${PROJECT_BINARY_DIR}
|
---|
| 31 | ${QT_INCLUDE_DIR}
|
---|
| 32 | )
|
---|
| 33 |
|
---|
| 34 | # ========================================
|
---|
| 35 | # Link directories
|
---|
| 36 | # ========================================
|
---|
| 37 | link_directories(
|
---|
| 38 | ${PACPUS_LIB_DIR}
|
---|
| 39 | )
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
|
---|
| 43 |
|
---|
| 44 | # ========================================
|
---|
| 45 | # List of sources
|
---|
| 46 | # ========================================
|
---|
| 47 | set(
|
---|
| 48 | PROJECT_SRCS
|
---|
| 49 | CPTComponent.h
|
---|
| 50 | CPTComponent.cpp
|
---|
| 51 | ../driver/AbstractSerialPort.h
|
---|
| 52 | ../driver/AbstractSerialPort.cpp
|
---|
| 53 | ${PLUGIN_CPP}
|
---|
| 54 | )
|
---|
| 55 |
|
---|
| 56 | if(WIN32)
|
---|
| 57 | set(PROJECT_SRCS
|
---|
| 58 | ${PROJECT_SRCS}
|
---|
| 59 | ../driver/Win32SerialPort.cpp
|
---|
| 60 | ../driver/Win32SerialPort.h
|
---|
| 61 | )
|
---|
| 62 | endif(WIN32)
|
---|
| 63 |
|
---|
| 64 | if(UNIX)
|
---|
| 65 | set(PROJECT_SRCS
|
---|
| 66 | ${PROJECT_SRCS}
|
---|
| 67 | ../driver/PosixSerialPort.cpp
|
---|
| 68 | ../driver/PosixSerialPort.h
|
---|
| 69 | )
|
---|
| 70 | endif(UNIX)
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | # ========================================
|
---|
| 74 | # Files to MOC
|
---|
| 75 | # ========================================
|
---|
| 76 |
|
---|
| 77 | if(UNIX)
|
---|
| 78 | set(FILES_TO_MOC
|
---|
| 79 | # add here the header files that you want to MOC
|
---|
| 80 | CPTComponent.h
|
---|
| 81 | ../driver/PosixSerialPort.h
|
---|
| 82 | ${PLUGIN_H}
|
---|
| 83 | )
|
---|
| 84 | endif(UNIX)
|
---|
| 85 |
|
---|
| 86 | if(WIN32)
|
---|
| 87 | set(FILES_TO_MOC
|
---|
| 88 | # add here the header files that you want to MOC
|
---|
| 89 | CPTComponent.h
|
---|
| 90 | ../driver/Win32SerialPort.h
|
---|
| 91 | ${PLUGIN_H}
|
---|
| 92 | )
|
---|
| 93 | endif(WIN32)
|
---|
| 94 |
|
---|
| 95 | set(
|
---|
| 96 | UI_FILES
|
---|
| 97 | )
|
---|
| 98 |
|
---|
| 99 | # ========================================
|
---|
| 100 | # Call MOC
|
---|
| 101 | # ========================================
|
---|
| 102 | qt4_wrap_cpp(
|
---|
| 103 | PROJECT_MOC_SRCS
|
---|
| 104 | ${FILES_TO_MOC}
|
---|
| 105 | )
|
---|
| 106 |
|
---|
| 107 | qt4_wrap_ui(
|
---|
| 108 | PROJECT_UI_SRCS
|
---|
| 109 | ${UI_FILES}
|
---|
| 110 | )
|
---|
| 111 |
|
---|
| 112 | # ========================================
|
---|
| 113 | # Build a library
|
---|
| 114 | # ========================================
|
---|
| 115 | pacpus_add_library(
|
---|
| 116 | ${PROJECT_NAME} SHARED
|
---|
| 117 | ${PROJECT_SRCS}
|
---|
| 118 | ${PROJECT_MOC_SRCS}
|
---|
| 119 | ${PROJECT_UI_SRCS}
|
---|
| 120 | )
|
---|
| 121 |
|
---|
| 122 | # ========================================
|
---|
| 123 | # Libraries
|
---|
| 124 | # ========================================
|
---|
| 125 | if(WIN32)
|
---|
| 126 | set(LIBS
|
---|
| 127 | # add your specific libraries to link here
|
---|
| 128 | optimized NMEA0183LIB debug NMEA0183LIB_d
|
---|
| 129 | optimized PacpusTools debug PacpusTools_d
|
---|
| 130 | )
|
---|
| 131 | endif(WIN32)
|
---|
| 132 |
|
---|
| 133 | if(UNIX)
|
---|
| 134 | set(LIBS
|
---|
| 135 | # add your specific libraries to link here
|
---|
| 136 |
|
---|
| 137 | )
|
---|
| 138 | endif(UNIX)
|
---|
| 139 |
|
---|
| 140 | # All the platform
|
---|
| 141 | target_link_libraries(
|
---|
| 142 | ${PROJECT_NAME}
|
---|
| 143 | ${PACPUS_LIBRARIES}
|
---|
| 144 | ${QT_LIBRARIES}
|
---|
| 145 | ${PACPUS_DEPENDENCIES_LIB}
|
---|
| 146 | ${LIBS}
|
---|
| 147 | # optimized PacpusTools debug PacpusTools_d
|
---|
| 148 | )
|
---|
| 149 | pacpus_folder(${PROJECT_NAME} "components")
|
---|
| 150 |
|
---|
| 151 | # ========================================
|
---|
| 152 | # Install
|
---|
| 153 | # ========================================
|
---|
| 154 | pacpus_install(${PROJECT_NAME})
|
---|
| 155 |
|
---|