1 cmake_minimum_required(VERSION 3.2)
3 option(ENABLE_STATIC "Enable static library" ON)
8 set(LIBRARY_TYPE "STATIC")
10 set(LIBRARY_TYPE "SHARED")
12 message(STATUS "Build library type: ${LIBRARY_TYPE}")
14 message(STATUS "Build AIS support : ${ENABLE_AIS}")
15 message(STATUS "Build SeaTalk support: ${ENABLE_SEATALK}")
16 message(STATUS "Build IO support : ${ENABLE_IO}")
19 ${CMAKE_CURRENT_SOURCE_DIR}/marnav/version.hpp.in
20 ${CMAKE_CURRENT_BINARY_DIR}/marnav/version.hpp
24 # intentionally left blank
28 set(SOURCES ${SOURCES}
29 marnav/seatalk/seatalk.cpp
30 marnav/seatalk/message.cpp
31 marnav/seatalk/message_00.cpp
32 marnav/seatalk/message_01.cpp
33 marnav/seatalk/message_05.cpp
34 marnav/seatalk/message_10.cpp
35 marnav/seatalk/message_11.cpp
36 marnav/seatalk/message_20.cpp
37 marnav/seatalk/message_21.cpp
38 marnav/seatalk/message_22.cpp
39 marnav/seatalk/message_23.cpp
40 marnav/seatalk/message_24.cpp
41 marnav/seatalk/message_25.cpp
42 marnav/seatalk/message_26.cpp
43 marnav/seatalk/message_27.cpp
44 marnav/seatalk/message_30.cpp
45 marnav/seatalk/message_36.cpp
46 marnav/seatalk/message_38.cpp
47 marnav/seatalk/message_50.cpp
48 marnav/seatalk/message_51.cpp
49 marnav/seatalk/message_52.cpp
50 marnav/seatalk/message_53.cpp
51 marnav/seatalk/message_54.cpp
52 marnav/seatalk/message_56.cpp
53 marnav/seatalk/message_58.cpp
54 marnav/seatalk/message_59.cpp
55 marnav/seatalk/message_65.cpp
56 marnav/seatalk/message_66.cpp
57 marnav/seatalk/message_6c.cpp
58 marnav/seatalk/message_86.cpp
59 marnav/seatalk/message_87.cpp
60 marnav/seatalk/message_89.cpp
65 set(SOURCES ${SOURCES}
69 marnav/ais/message.cpp
70 marnav/ais/message_01.cpp
71 marnav/ais/message_02.cpp
72 marnav/ais/message_03.cpp
73 marnav/ais/message_04.cpp
74 marnav/ais/message_05.cpp
75 marnav/ais/message_09.cpp
76 marnav/ais/message_10.cpp
77 marnav/ais/message_11.cpp
78 marnav/ais/message_18.cpp
79 marnav/ais/message_19.cpp
80 marnav/ais/message_21.cpp
81 marnav/ais/message_22.cpp
82 marnav/ais/message_23.cpp
83 marnav/ais/message_24.cpp
88 set(SOURCES ${SOURCES}
90 marnav/io/nmea_reader.cpp
91 marnav/io/default_nmea_reader.cpp
95 set(SOURCES ${SOURCES}
96 marnav/io/seatalk_reader.cpp
97 marnav/io/default_seatalk_reader.cpp
102 add_library(marnav ${LIBRARY_TYPE}
103 marnav/math/floatingpoint.hpp
104 marnav/math/vector.hpp
105 marnav/math/matrix.hpp
106 marnav/math/quaternion.hpp
107 marnav/utils/mmsi.cpp
108 marnav/utils/mmsi_country.cpp
110 marnav/geo/position.cpp
111 marnav/geo/region.cpp
113 marnav/geo/geodesic.cpp
114 marnav/nmea/waypoint.cpp
115 marnav/nmea/talker_id.cpp
116 marnav/nmea/convert.cpp
117 marnav/nmea/manufacturer.cpp
118 marnav/nmea/checks.cpp
119 marnav/nmea/split.cpp
120 marnav/nmea/angle.cpp
121 marnav/nmea/string.cpp
126 marnav/nmea/checksum.cpp
127 marnav/nmea/sentence.cpp
128 marnav/nmea/detail.cpp
129 marnav/nmea/ais_helper.cpp
206 marnav/nmea/pgrme.cpp
207 marnav/nmea/pgrmm.cpp
208 marnav/nmea/pgrmz.cpp
212 target_include_directories(marnav
214 ${CMAKE_CURRENT_SOURCE_DIR}
215 ${CMAKE_CURRENT_BINARY_DIR}
218 target_compile_options(marnav
228 target_compile_options(marnav
234 target_compile_options(marnav
236 -fno-omit-frame-pointer
239 if(ENABLE_WARNING_HELL)
240 message(STATUS "Behold: entering the hell of extended warnings")
241 target_compile_options(marnav
243 # some are not enabled on purpose
247 -Wdisabled-optimization
255 -Wmissing-field-initializers
256 -Wmissing-format-attribute
257 -Wmissing-include-dirs
270 # explicitly disabled on purpose:
279 -Wno-format-nonliteral
287 message(STATUS "Sanitizer: enabled")
288 target_compile_options(marnav
294 target_link_libraries(marnav
300 if(build_type_lower MATCHES coverage)
301 message(STATUS "Coverage: enabled")
302 target_compile_options(marnav
308 -fno-inline-small-functions
313 set_target_properties(marnav
314 PROPERTIES VERSION "${PROJECT_VERSION}"
315 SOVERSION "${PROJECT_VERSION}"
320 LIBRARY DESTINATION lib
321 ARCHIVE DESTINATION lib
322 RUNTIME DESTINATION bin
327 ${CMAKE_CURRENT_BINARY_DIR}/marnav/version.hpp
328 DESTINATION include/marnav
333 marnav/nmea/constants.hpp
334 marnav/nmea/talker_id.hpp
335 marnav/nmea/sentence_id.hpp
336 marnav/nmea/convert.hpp
337 marnav/nmea/waypoint.hpp
338 marnav/nmea/manufacturer.hpp
339 marnav/nmea/angle.hpp
340 marnav/nmea/string.hpp
345 marnav/nmea/checksum.hpp
346 marnav/nmea/sentence.hpp
347 marnav/nmea/detail.hpp
348 marnav/nmea/ais_helper.hpp
425 marnav/nmea/pgrme.hpp
426 DESTINATION include/marnav/nmea
435 marnav/ais/message.hpp
436 marnav/ais/message_01.hpp
437 marnav/ais/message_02.hpp
438 marnav/ais/message_03.hpp
439 marnav/ais/message_04.hpp
440 marnav/ais/message_05.hpp
441 marnav/ais/message_09.hpp
442 marnav/ais/message_10.hpp
443 marnav/ais/message_11.hpp
444 marnav/ais/message_18.hpp
445 marnav/ais/message_19.hpp
446 marnav/ais/message_21.hpp
447 marnav/ais/message_22.hpp
448 marnav/ais/message_23.hpp
449 marnav/ais/message_24.hpp
450 DESTINATION include/marnav/ais
457 marnav/seatalk/key.hpp
458 marnav/seatalk/equipment.hpp
459 marnav/seatalk/seatalk.hpp
460 marnav/seatalk/message.hpp
461 marnav/seatalk/message_00.hpp
462 marnav/seatalk/message_01.hpp
463 marnav/seatalk/message_05.hpp
464 marnav/seatalk/message_10.hpp
465 marnav/seatalk/message_11.hpp
466 marnav/seatalk/message_20.hpp
467 marnav/seatalk/message_21.hpp
468 marnav/seatalk/message_22.hpp
469 marnav/seatalk/message_23.hpp
470 marnav/seatalk/message_24.hpp
471 marnav/seatalk/message_25.hpp
472 marnav/seatalk/message_26.hpp
473 marnav/seatalk/message_27.hpp
474 marnav/seatalk/message_30.hpp
475 marnav/seatalk/message_36.hpp
476 marnav/seatalk/message_38.hpp
477 marnav/seatalk/message_50.hpp
478 marnav/seatalk/message_51.hpp
479 marnav/seatalk/message_52.hpp
480 marnav/seatalk/message_53.hpp
481 marnav/seatalk/message_54.hpp
482 marnav/seatalk/message_56.hpp
483 marnav/seatalk/message_58.hpp
484 marnav/seatalk/message_59.hpp
485 marnav/seatalk/message_65.hpp
486 marnav/seatalk/message_66.hpp
487 marnav/seatalk/message_6c.hpp
488 marnav/seatalk/message_86.hpp
489 marnav/seatalk/message_87.hpp
490 marnav/seatalk/message_89.hpp
491 DESTINATION include/marnav/seatalk
497 marnav/utils/unused.hpp
498 marnav/utils/unique.hpp
499 marnav/utils/bitset.hpp
500 marnav/utils/bitset_string.hpp
501 marnav/utils/optional.hpp
502 marnav/utils/mmsi.hpp
503 marnav/utils/mmsi_country.hpp
504 DESTINATION include/marnav/utils
509 marnav/math/floatingpoint.hpp
510 marnav/math/vector.hpp
511 marnav/math/matrix.hpp
512 marnav/math/quaternion.hpp
513 DESTINATION include/marnav/math
519 marnav/geo/position.hpp
520 marnav/geo/region.hpp
522 marnav/geo/geodesic.hpp
523 DESTINATION include/marnav/geo
531 marnav/io/nmea_reader.hpp
532 marnav/io/default_nmea_reader.hpp
533 marnav/io/default_nmea_serial.hpp
534 DESTINATION include/marnav/io
539 marnav/io/seatalk_reader.hpp
540 marnav/io/default_seatalk_reader.hpp
541 marnav/io/default_seatalk_serial.hpp
542 DESTINATION include/marnav/io
547 # stuff for the config and config-version files
548 set(INCLUDE_INSTALL_DIR include)
549 set(LIB_INSTALL_DIR lib)
550 include(CMakePackageConfigHelpers)
551 configure_package_config_file(
553 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
554 INSTALL_DESTINATION "${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake"
555 PATH_VARS INCLUDE_INSTALL_DIR
557 write_basic_package_version_file(
558 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
559 VERSION "${PROJECT_VERSION}"
560 COMPATIBILITY SameMajorVersion)
563 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
564 "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
566 "${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake"
571 add_executable(nmeasum
575 target_include_directories(nmeasum PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
577 target_compile_options(nmeasum
588 if(ENABLE_AIS AND ENABLE_IO)
589 add_executable(nmeadump
593 target_include_directories(nmeadump
595 ${CMAKE_CURRENT_SOURCE_DIR}
596 ${CMAKE_CURRENT_SOURCE_DIR}/../extern
599 target_compile_options(nmeadump
608 target_link_libraries(nmeadump