[Positioner] Allow building with clang++
This patch is to have clang++ (>= 3.2) happily build OwlPS Positioner. For some reason it doesn't work on NetBSD, but it is fine on GNU/Linux and (a couple of warnings apart) on DragonFly BSD.
This commit is contained in:
parent
d32813376b
commit
9701a2d393
|
@ -177,26 +177,38 @@ endif()
|
||||||
|
|
||||||
## Positioner ##
|
## Positioner ##
|
||||||
|
|
||||||
# OwlPS Positioner can be built only with GCC, and with a minimal
|
# OwlPS Positioner can be built only with a minimal version of GCC, or
|
||||||
# version. CMAKE_CXX_COMPILER_VERSION is not guaranteed to be set,
|
# Clang++. CMAKE_CXX_COMPILER_VERSION is not guaranteed to be set, so we
|
||||||
# so we will test GCC's version number only if possible.
|
# will test the version number only if possible.
|
||||||
set(POSITIONER_MIN_GCC_VERSION 4.7)
|
set(POSITIONER_MIN_GCC_VERSION 4.7)
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
set(POSITIONER_MIN_CLANG_VERSION 3.2)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU) # Are we using GCC?
|
||||||
# Test the compiler version if we can
|
# Test the compiler version if we can
|
||||||
if (${CMAKE_CXX_COMPILER_VERSION})
|
if (${CMAKE_CXX_COMPILER_VERSION} AND
|
||||||
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_EQUAL ${POSITIONER_MIN_GCC_VERSION} OR
|
${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${POSITIONER_MIN_GCC_VERSION})
|
||||||
${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER ${POSITIONER_MIN_GCC_VERSION})
|
# GCC's version is too low
|
||||||
add_subdirectory(owlps-positioner)
|
message(WARNING
|
||||||
else() # GCC's version is too low
|
"OwlPS Positioner requires GCC >= ${POSITIONER_MIN_GCC_VERSION}")
|
||||||
message(WARNING
|
else()
|
||||||
"OwlPS Positioner requires GCC >= ${POSITIONER_MIN_GCC_VERSION}")
|
# GCC's version is OK or we couldn'd get it
|
||||||
endif()
|
|
||||||
else() # we couldn't get GCC's version, let's try to build anyway
|
|
||||||
add_subdirectory(owlps-positioner)
|
add_subdirectory(owlps-positioner)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL Clang) # Are we using Clang?
|
||||||
|
if (${CMAKE_CXX_COMPILER_VERSION} AND
|
||||||
|
${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${POSITIONER_MIN_CLANG_VERSION})
|
||||||
|
# Clang's version is too low
|
||||||
|
message(WARNING
|
||||||
|
"OwlPS Positioner requires GCC >= ${POSITIONER_MIN_GCC_VERSION}")
|
||||||
|
else()
|
||||||
|
# Clang's version is OK or we couldn'd get it
|
||||||
|
add_subdirectory(owlps-positioner)
|
||||||
|
endif()
|
||||||
|
|
||||||
else() # we're not using GCC
|
else() # we're not using GCC
|
||||||
message(WARNING
|
message(WARNING
|
||||||
"OwlPS Positioner requires GCC (>= ${POSITIONER_MIN_GCC_VERSION})")
|
"OwlPS Positioner requires GCC (>= ${POSITIONER_MIN_GCC_VERSION}) or Clang (>= ${POSITIONER_MIN_CLANG_VERSION})")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## UDP-to-HTTP ##
|
## UDP-to-HTTP ##
|
||||||
|
|
|
@ -17,7 +17,8 @@ systems” below) with the following development libraries installed:
|
||||||
|
|
||||||
You also need support for POSIX threads, which should be provided by
|
You also need support for POSIX threads, which should be provided by
|
||||||
default by your system in most cases, and the GCC C++ compiler (g++)
|
default by your system in most cases, and the GCC C++ compiler (g++)
|
||||||
version 4.7 or above.
|
version 4.7 or above; the Clang C++ compiler (clang++) version 3.2 or
|
||||||
|
above should also work in most cases.
|
||||||
|
|
||||||
If you miss one or more of the requirements, the concerned modules will
|
If you miss one or more of the requirements, the concerned modules will
|
||||||
not be built, but the others can still be.
|
not be built, but the others can still be.
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
CalibrationRequest::
|
CalibrationRequest::
|
||||||
CalibrationRequest(uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION):
|
CalibrationRequest(uint_fast8_t _type):
|
||||||
reference_point(NULL), direction(Direction())
|
reference_point(NULL), direction(Direction())
|
||||||
{
|
{
|
||||||
type = _type ;
|
type = _type ;
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
Direction direction ;
|
Direction direction ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CalibrationRequest(uint_fast8_t _type) ;
|
CalibrationRequest(uint_fast8_t _type = OWL_REQUEST_AUTOCALIBRATION) ;
|
||||||
|
|
||||||
CalibrationRequest(const CalibrationRequest &source):
|
CalibrationRequest(const CalibrationRequest &source):
|
||||||
Request(source), reference_point(source.reference_point),
|
Request(source), reference_point(source.reference_point),
|
||||||
|
|
|
@ -54,20 +54,29 @@ protected:
|
||||||
void clear_real_position(void) ;
|
void clear_real_position(void) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/// Measurements' list type
|
||||||
|
/**
|
||||||
|
* This really is just an alias to work-around clang++ that doesn't
|
||||||
|
* handle the following syntax:
|
||||||
|
*
|
||||||
|
* Request(..., const std::unordered_map<std::string, Measurement>
|
||||||
|
* &_measurements = std::unordered_map<std::string,
|
||||||
|
* Measurement>()) ;
|
||||||
|
*/
|
||||||
|
typedef std::unordered_map<std::string, Measurement> measurements_list ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Request(const Mobile *_mobile = NULL,
|
Request(const Mobile *_mobile = NULL,
|
||||||
const Timestamp &_time_sent = Timestamp(),
|
const Timestamp &_time_sent = Timestamp(),
|
||||||
const std::unordered_map<std::string, Measurement>
|
const std::unordered_map<std::string, Measurement>
|
||||||
&_measurements =
|
&_measurements = measurements_list()) ;
|
||||||
std::unordered_map<std::string, Measurement>()) ;
|
|
||||||
|
|
||||||
Request(const std::unordered_map<std::string, Measurement>
|
Request(const std::unordered_map<std::string, Measurement>
|
||||||
&_measurements) ;
|
&_measurements) ;
|
||||||
|
|
||||||
Request(const Timestamp &_time_sent,
|
Request(const Timestamp &_time_sent,
|
||||||
const std::unordered_map<std::string, Measurement>
|
const std::unordered_map<std::string, Measurement>
|
||||||
&_measurements =
|
&_measurements = measurements_list()) ;
|
||||||
std::unordered_map<std::string, Measurement>()) ;
|
|
||||||
|
|
||||||
Request(const Request &source) ;
|
Request(const Request &source) ;
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,10 @@ protected:
|
||||||
float trx_power ; ///< Transmit power in dBm
|
float trx_power ; ///< Transmit power in dBm
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WifiDevice(const std::string &_ip_addr,
|
WifiDevice(const std::string &_ip_addr = "",
|
||||||
const std::string &_mac_addr,
|
const std::string &_mac_addr = "",
|
||||||
const float _antenna_gain,
|
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
||||||
const float _trx_power) ;
|
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER) ;
|
||||||
|
|
||||||
WifiDevice(const WifiDevice &source):
|
WifiDevice(const WifiDevice &source):
|
||||||
ip_addr(source.ip_addr), mac_addr(source.mac_addr),
|
ip_addr(source.ip_addr), mac_addr(source.mac_addr),
|
||||||
|
@ -81,10 +81,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
inline WifiDevice::
|
inline WifiDevice::
|
||||||
WifiDevice(const std::string &_ip_addr = "",
|
WifiDevice(const std::string &_ip_addr,
|
||||||
const std::string &_mac_addr = "",
|
const std::string &_mac_addr,
|
||||||
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
const float _antenna_gain,
|
||||||
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
const float _trx_power):
|
||||||
ip_addr(_ip_addr), mac_addr(_mac_addr),
|
ip_addr(_ip_addr), mac_addr(_mac_addr),
|
||||||
antenna_gain(_antenna_gain), trx_power(_trx_power)
|
antenna_gain(_antenna_gain), trx_power(_trx_power)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue