direwolf/cmake/modules/FindGPSD.cmake

89 lines
2.0 KiB
CMake
Raw Permalink Normal View History

cmake: new build tool this step unify the builing system for all platforms (windows, linux, osx and *BSD) * Requirements: - gcc/clang (C/C++ compiler) (in debian build-essential) - cmake (in debian cmake) - git if you build from source (in debian git) - posix threads ** Requirements on *BSD/macOS: - portaudio ** Optional Requirements: - gpsd (in debian libgps-dev) - libhamlib (in debian libhamlib-dev) ** Optional Requirements in Linux - udev (in debian libudev-dev) - alsa (in debian libasound2-dev) * Main changes: - version is now set only on CMakeLists.txt and automatically used on the code - cpu flags are auto-discovered in the default build and it works on gcc/clang/msvc on x86/x86_64/arm; you can force cpu flags with -DFORCE_SSE=1 for example (see CMakeLists.txt on root) - use a more "complex" tag on generic.conf to facilitate parsing by cmake (not more platform dependent). Now it is %C% or %R% for example - target `tocalls-symbols` is now called `data-update` - created debian/ directory to contains files to use debuild * Example to build: mkdir build && cd build cmake .. make make install make install-conf then you have the binary files on src/ and in the system directory * CMake options (see the head of CMakeLists.txt) - FORCE_SSE force sse instruction - FORCE_SSSE3 force ssse3 instruction - FORCE_SSE41 force ssse4.1 instruction - OPTIONAL_TEST compile optional test (might be broken) - BUILD_TESTING enable tests (ctest framework) - CMAKE_INSTALL_PREFIX if you want to change your install path prefix for example: cmake .. -DOPTIONAL_TEST=ON
2019-08-15 06:30:42 +00:00
# - Try to find GPSD
# Once done this will define
#
# GPSD_FOUND - system has GPSD
# GPSD_INCLUDE_DIRS - the GPSD include directory
# GPSD_LIBRARIES - Link these to use GPSD
# GPSD_DEFINITIONS - Compiler switches required for using GPSD
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
set(GPSD_ROOT_DIR
"${GPSD_ROOT_DIR}"
CACHE
PATH
"Directory to search for gpsd")
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_GPSD libgps)
endif()
if (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
# in cache already
set(GPSD_FOUND TRUE)
else (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
find_path(GPSD_INCLUDE_DIRS
NAMES
gps.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
/usr/include/gps
/usr/local/include/gps
/opt/local/include/gps
/sw/include/gps
HINTS
${PC_GPSD_INCLUDEDIR}
${GPSD_ROOT_DIR}
)
# debian uses version suffixes
# add suffix evey new release
find_library(GPSD_LIBRARIES
NAMES
gps
PATHS
/usr/lib64
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
HINTS
${PC_GPSD_LIBDIR}
${GPSD_ROOT_DIR}
)
if (GPSD_INCLUDE_DIRS AND GPSD_LIBRARIES)
set(GPSD_FOUND TRUE)
endif (GPSD_INCLUDE_DIRS AND GPSD_LIBRARIES)
if (GPSD_FOUND)
if (NOT GPSD_FIND_QUIETLY)
message(STATUS "Found GPSD: ${GPSD_LIBRARIES}")
endif (NOT GPSD_FIND_QUIETLY)
else (GPSD_FOUND)
if (GPSD_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GPSD")
endif (GPSD_FIND_REQUIRED)
endif (GPSD_FOUND)
# show the GPSD_INCLUDE_DIRS and GPSD_LIBRARIES variables only in the advanced view
mark_as_advanced(GPSD_INCLUDE_DIRS GPSD_LIBRARIES)
endif (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
# maybe on CYGWIN gpsd works
cmake: new build tool this step unify the builing system for all platforms (windows, linux, osx and *BSD) * Requirements: - gcc/clang (C/C++ compiler) (in debian build-essential) - cmake (in debian cmake) - git if you build from source (in debian git) - posix threads ** Requirements on *BSD/macOS: - portaudio ** Optional Requirements: - gpsd (in debian libgps-dev) - libhamlib (in debian libhamlib-dev) ** Optional Requirements in Linux - udev (in debian libudev-dev) - alsa (in debian libasound2-dev) * Main changes: - version is now set only on CMakeLists.txt and automatically used on the code - cpu flags are auto-discovered in the default build and it works on gcc/clang/msvc on x86/x86_64/arm; you can force cpu flags with -DFORCE_SSE=1 for example (see CMakeLists.txt on root) - use a more "complex" tag on generic.conf to facilitate parsing by cmake (not more platform dependent). Now it is %C% or %R% for example - target `tocalls-symbols` is now called `data-update` - created debian/ directory to contains files to use debuild * Example to build: mkdir build && cd build cmake .. make make install make install-conf then you have the binary files on src/ and in the system directory * CMake options (see the head of CMakeLists.txt) - FORCE_SSE force sse instruction - FORCE_SSSE3 force ssse3 instruction - FORCE_SSE41 force ssse4.1 instruction - OPTIONAL_TEST compile optional test (might be broken) - BUILD_TESTING enable tests (ctest framework) - CMAKE_INSTALL_PREFIX if you want to change your install path prefix for example: cmake .. -DOPTIONAL_TEST=ON
2019-08-15 06:30:42 +00:00
if (WIN32)
set(GPSD_FOUND FALSE)
set(GPSD_LIBRARIES "")
set(GPSD_INCLUDE_DIRS "")
endif (WIN32)