[99] | 1 | #########################quick start############################################
|
---|
| 2 | #cmake ../ -G "CodeBlocks - Unix Makefiles"
|
---|
| 3 | #make
|
---|
| 4 | #make install
|
---|
| 5 | #make clean
|
---|
| 6 | ################################################################################
|
---|
| 7 | project(Gps)
|
---|
| 8 | set(${PROJECT_NAME}_VERSION_MAJOR 0)
|
---|
| 9 | set(${PROJECT_NAME}_VERSION_MINOR 1)
|
---|
| 10 | add_definitions( -DGPS_EXPORTS )
|
---|
| 11 | ################################################################################
|
---|
| 12 | create_export(EXPORT_HDR ${PROJECT_NAME})
|
---|
| 13 | pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
|
---|
| 14 | add_definitions (${QT_DEFINITIONS})
|
---|
| 15 |
|
---|
| 16 | find_package(Qt5Network REQUIRED)
|
---|
| 17 | find_package(Qt5Widgets REQUIRED)
|
---|
| 18 | ################################################################################
|
---|
| 19 | # DIRECTORIES
|
---|
| 20 | include_directories(
|
---|
| 21 | ${PROJECT_BINARY_DIR}
|
---|
| 22 | ${QT_INCLUDE_DIR}
|
---|
| 23 | ${PACPUS_INCLUDE_DIR}
|
---|
| 24 | ${PACPUS_INCLUDE_DIR}/Pacpus/
|
---|
| 25 | )
|
---|
| 26 |
|
---|
| 27 | # ========================================
|
---|
| 28 | # Link directories
|
---|
| 29 | # ========================================
|
---|
| 30 | link_directories(
|
---|
| 31 | ${PACPUS_LIB_DIR}
|
---|
| 32 | )
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | ################################################################################
|
---|
| 36 | # FILES
|
---|
| 37 | set(PROJECT_HDRS
|
---|
| 38 | ${EXPORT_HDR}
|
---|
| 39 | gpsComponent.h
|
---|
| 40 | GpsFrames.h
|
---|
| 41 | structure_gps.h
|
---|
| 42 | )
|
---|
| 43 | set(PROJECT_SRCS
|
---|
| 44 | ${PLUGIN_CPP}
|
---|
| 45 | gpsComponent.cpp
|
---|
[105] | 46 |
|
---|
[99] | 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 | gpsComponent.h
|
---|
| 69 | GpsFrames.h
|
---|
| 70 | ../driver/PosixSerialPort.h
|
---|
| 71 | ${PLUGIN_HDR}
|
---|
| 72 | )
|
---|
| 73 | endif(UNIX)
|
---|
| 74 |
|
---|
| 75 | if(WIN32)
|
---|
| 76 | set(FILES_TO_MOC
|
---|
| 77 | # add here the header files that you want to MOC
|
---|
| 78 | gpsComponent.h
|
---|
| 79 | ../driver/Win32SerialPort.h
|
---|
| 80 | ${PLUGIN_HDR}
|
---|
| 81 | )
|
---|
| 82 | endif(WIN32)
|
---|
| 83 |
|
---|
| 84 | set(UI_FILES
|
---|
| 85 | )
|
---|
| 86 |
|
---|
| 87 | ################################################################################
|
---|
| 88 | # Qt: call moc, uic
|
---|
| 89 | qt_wrap_cpp(PROJECT_MOC_SRCS
|
---|
| 90 | ${FILES_TO_MOC}
|
---|
| 91 | )
|
---|
| 92 |
|
---|
| 93 | qt_wrap_ui(PROJECT_UI_SRCS
|
---|
| 94 | ${UI_FILES}
|
---|
| 95 | )
|
---|
| 96 |
|
---|
| 97 | ################################################################################
|
---|
| 98 | # BUILD and LINK
|
---|
| 99 | pacpus_add_library(${PROJECT_NAME} SHARED
|
---|
| 100 | ${PROJECT_HDRS}
|
---|
| 101 | ${PROJECT_SRCS}
|
---|
| 102 | ${PROJECT_MOC_SRCS}
|
---|
| 103 | ${PROJECT_UI_SRCS}
|
---|
| 104 | )
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | # ========================================
|
---|
| 108 | # Libraries
|
---|
| 109 | # ========================================
|
---|
| 110 | set(LIBS
|
---|
| 111 | optimized FileLib debug FileLib_d
|
---|
| 112 | optimized PacpusLib debug PacpusLib_d
|
---|
| 113 | optimized PacpusTools debug PacpusTools_d
|
---|
[109] | 114 | optimized NMEA0183LIB debug NMEA0183LIB_d
|
---|
[99] | 115 | )
|
---|
| 116 | if (WIN32)
|
---|
| 117 | list(APPEND LIBS
|
---|
| 118 | optimized ROAD_TIME debug ROAD_TIME_d
|
---|
| 119 | )
|
---|
| 120 | endif()
|
---|
| 121 | # LINK
|
---|
| 122 | target_link_libraries(${PROJECT_NAME}
|
---|
| 123 | ${PACPUS_LIBRARIES}
|
---|
| 124 | ${PACPUS_DEPENDENCIES_LIB}
|
---|
| 125 | ${LIBS}
|
---|
| 126 | ${QT_LIBRARIES}
|
---|
| 127 | )
|
---|
| 128 | qt5_use_modules(${PROJECT_NAME} Network)
|
---|
| 129 | ################################################################################
|
---|
| 130 | # FOLDERS
|
---|
| 131 | pacpus_folder(${PROJECT_NAME} "components")
|
---|
| 132 | ################################################################################
|
---|
| 133 | # INSTALL
|
---|
| 134 | pacpus_install(${PROJECT_NAME})
|
---|
[109] | 135 |
|
---|
| 136 | # install headers
|
---|
| 137 | install(
|
---|
| 138 | DIRECTORY
|
---|
| 139 | ${Gps_SOURCE_DIR}
|
---|
| 140 | DESTINATION
|
---|
| 141 | ${PACPUS_INSTALL_DIR}/include
|
---|
| 142 | FILES_MATCHING PATTERN "*.h"
|
---|
| 143 | )
|
---|
| 144 | # if WIN32 install driver dependencies
|
---|