[99] | 1 | #########################quick start############################################
|
---|
| 2 | #cmake ../ -G "CodeBlocks - Unix Makefiles"
|
---|
| 3 | #make
|
---|
| 4 | #make install
|
---|
| 5 | #make clean
|
---|
| 6 | ################################################################################
|
---|
[59] | 7 | project(SpanCPTComponent)
|
---|
| 8 |
|
---|
| 9 | ################################################################################
|
---|
| 10 | add_definitions( -DCPTCOMPONENT_EXPORTS )
|
---|
| 11 | add_definitions( -DPLUGINLIB_EXPORTS )
|
---|
[99] | 12 | ################################################################################
|
---|
| 13 | create_export(EXPORT_HDR ${PROJECT_NAME})
|
---|
| 14 | pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
|
---|
| 15 | add_definitions (${QT_DEFINITIONS})
|
---|
[59] | 16 |
|
---|
[99] | 17 | find_package(Qt5Network REQUIRED)
|
---|
| 18 | ################################################################################
|
---|
| 19 | # DIRECTORIES
|
---|
| 20 | include_directories(
|
---|
| 21 | ${PROJECT_BINARY_DIR}
|
---|
| 22 | ${QT_INCLUDE_DIR}
|
---|
| 23 | ${PACPUS_INCLUDE_DIR}
|
---|
| 24 | ${PACPUS_INCLUDE_DIR}/Pacpus/
|
---|
[59] | 25 | )
|
---|
| 26 |
|
---|
| 27 | # ========================================
|
---|
| 28 | # Link directories
|
---|
| 29 | # ========================================
|
---|
| 30 | link_directories(
|
---|
| 31 | ${PACPUS_LIB_DIR}
|
---|
| 32 | )
|
---|
| 33 |
|
---|
| 34 |
|
---|
[99] | 35 | ################################################################################
|
---|
| 36 | # FILES
|
---|
| 37 | set(PROJECT_HDRS
|
---|
| 38 | ${EXPORT_HDR}
|
---|
| 39 | CPTComponent.h
|
---|
[59] | 40 | ../driver/AbstractSerialPort.h
|
---|
[100] | 41 | spancpt.xml
|
---|
[99] | 42 | )
|
---|
| 43 | set(PROJECT_SRCS
|
---|
[59] | 44 | ${PLUGIN_CPP}
|
---|
[99] | 45 | CPTComponent.cpp
|
---|
| 46 | ../driver/AbstractSerialPort.cpp
|
---|
[59] | 47 | )
|
---|
| 48 |
|
---|
| 49 | if(WIN32)
|
---|
| 50 | set(PROJECT_SRCS
|
---|
| 51 | ${PROJECT_SRCS}
|
---|
| 52 | ../driver/Win32SerialPort.cpp
|
---|
| 53 | ../driver/Win32SerialPort.h
|
---|
| 54 | )
|
---|
| 55 | endif(WIN32)
|
---|
| 56 |
|
---|
| 57 | if(UNIX)
|
---|
| 58 | set(PROJECT_SRCS
|
---|
| 59 | ${PROJECT_SRCS}
|
---|
| 60 | ../driver/PosixSerialPort.cpp
|
---|
| 61 | ../driver/PosixSerialPort.h
|
---|
| 62 | )
|
---|
| 63 | endif(UNIX)
|
---|
| 64 |
|
---|
| 65 | if(UNIX)
|
---|
| 66 | set(FILES_TO_MOC
|
---|
| 67 | # add here the header files that you want to MOC
|
---|
| 68 | CPTComponent.h
|
---|
| 69 | ../driver/PosixSerialPort.h
|
---|
[99] | 70 | ${PLUGIN_HDR}
|
---|
[59] | 71 | )
|
---|
| 72 | endif(UNIX)
|
---|
| 73 |
|
---|
| 74 | if(WIN32)
|
---|
| 75 | set(FILES_TO_MOC
|
---|
| 76 | # add here the header files that you want to MOC
|
---|
| 77 | CPTComponent.h
|
---|
| 78 | ../driver/Win32SerialPort.h
|
---|
[99] | 79 | ${PLUGIN_HDR}
|
---|
[59] | 80 | )
|
---|
| 81 | endif(WIN32)
|
---|
| 82 |
|
---|
[99] | 83 | set(UI_FILES
|
---|
[59] | 84 | )
|
---|
| 85 |
|
---|
[99] | 86 | ################################################################################
|
---|
| 87 | # Qt: call moc, uic
|
---|
| 88 | qt_wrap_cpp(PROJECT_MOC_SRCS
|
---|
[59] | 89 | ${FILES_TO_MOC}
|
---|
| 90 | )
|
---|
| 91 |
|
---|
[99] | 92 | qt_wrap_ui(PROJECT_UI_SRCS
|
---|
[59] | 93 | ${UI_FILES}
|
---|
| 94 | )
|
---|
| 95 |
|
---|
[99] | 96 | ################################################################################
|
---|
| 97 | # BUILD and LINK
|
---|
| 98 | pacpus_add_library(${PROJECT_NAME} SHARED
|
---|
| 99 | ${PROJECT_HDRS}
|
---|
[59] | 100 | ${PROJECT_SRCS}
|
---|
| 101 | ${PROJECT_MOC_SRCS}
|
---|
| 102 | ${PROJECT_UI_SRCS}
|
---|
| 103 | )
|
---|
| 104 |
|
---|
[99] | 105 |
|
---|
[59] | 106 | # ========================================
|
---|
| 107 | # Libraries
|
---|
| 108 | # ========================================
|
---|
[99] | 109 | set(LIBS
|
---|
| 110 | optimized FileLib debug FileLib_d
|
---|
| 111 | optimized PacpusLib debug PacpusLib_d
|
---|
| 112 | optimized PacpusTools debug PacpusTools_d
|
---|
[105] | 113 | NMEA0183LIB
|
---|
[99] | 114 | )
|
---|
| 115 | if (WIN32)
|
---|
| 116 | list(APPEND LIBS
|
---|
| 117 | optimized ROAD_TIME debug ROAD_TIME_d
|
---|
[59] | 118 | )
|
---|
[99] | 119 | endif()
|
---|
| 120 | # LINK
|
---|
| 121 | target_link_libraries(${PROJECT_NAME}
|
---|
| 122 | ${PACPUS_LIBRARIES}
|
---|
| 123 | ${PACPUS_DEPENDENCIES_LIB}
|
---|
| 124 | ${LIBS}
|
---|
| 125 | ${QT_LIBRARIES}
|
---|
| 126 | )
|
---|
| 127 | qt5_use_modules(${PROJECT_NAME} Network)
|
---|
| 128 | ################################################################################
|
---|
| 129 | # FOLDERS
|
---|
[59] | 130 | pacpus_folder(${PROJECT_NAME} "components")
|
---|
[99] | 131 | ################################################################################
|
---|
| 132 | # INSTALL
|
---|
| 133 | pacpus_install(${PROJECT_NAME})
|
---|