1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-24 20:17:39 +00:00

bds b11: Get latest changes and add bds functions in rtk module

Merge branch 'next' into bds_b1i. Also fixes multiple bugs with the
addition of bds b1i signals into code. Major changes where fixed and
code to support RINEX and RTCM is needed
This commit is contained in:
Damian Miralles
2018-11-29 09:53:40 -06:00
334 changed files with 13511 additions and 8054 deletions

View File

@@ -18,7 +18,7 @@
add_subdirectory(rtklib)
set(GNSS_SPLIBS_SOURCES
set(GNSS_SPLIBS_SOURCES
gps_l2c_signal.cc
gps_l5_signal.cc
galileo_e1_signal_processing.cc
@@ -39,7 +39,9 @@ add_subdirectory(rtklib)
conjugate_cc.cc
conjugate_sc.cc
conjugate_ic.cc
)
gnss_sdr_create_directory.cc
geofunctions.cc
)
set(GNSS_SPLIBS_HEADERS
gps_l2c_signal.h
@@ -62,36 +64,37 @@ set(GNSS_SPLIBS_HEADERS
conjugate_cc.h
conjugate_sc.h
conjugate_ic.h
gnss_sdr_create_directory.h
gnss_circular_deque.h
)
geofunctions.h
)
if(ENABLE_FPGA)
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
set(GNSS_SPLIBS_SOURCES
${GNSS_SPLIBS_SOURCES}
gnss_sdr_time_counter.cc
gnss_sdr_fpga_sample_counter.cc
)
set(GNSS_SPLIBS_HEADERS ${GNSS_SPLIBS_HEADERS}
set(GNSS_SPLIBS_HEADERS
${GNSS_SPLIBS_HEADERS}
gnss_sdr_time_counter.h
gnss_sdr_fpga_sample_counter.h
)
endif(ENABLE_FPGA)
endif()
if(OPENCL_FOUND)
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
opencl/fft_execute.cc # Needs OpenCL
opencl/fft_setup.cc # Needs OpenCL
opencl/fft_kernelstring.cc # Needs OpenCL
)
)
set(GNSS_SPLIBS_HEADERS ${GNSS_SPLIBS_HEADERS}
opencl/fft_execute.h # Needs OpenCL
opencl/fft_setup.h # Needs OpenCL
opencl/fft_kernelstring.h # Needs OpenCL
)
endif(OPENCL_FOUND)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@@ -101,6 +104,7 @@ include_directories(
${Boost_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
${VOLK_INCLUDE_DIRS}
@@ -111,10 +115,10 @@ if(OPENCL_FOUND)
include_directories( ${OPENCL_INCLUDE_DIRS} )
if(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
else(OS_IS_MACOSX)
else()
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
endif(OS_IS_MACOSX)
endif(OPENCL_FOUND)
endif()
endif()
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
@@ -124,10 +128,12 @@ list(SORT GNSS_SPLIBS_SOURCES)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS})
source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
target_link_libraries(gnss_sp_libs
${GNURADIO_RUNTIME_LIBRARIES}
${VOLK_LIBRARIES} ${ORC_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
${GFlags_LIBS}
${ARMADILLO_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
@@ -135,13 +141,16 @@ target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
gnss_rx
)
if(NOT VOLK_GNSSSDR_FOUND)
add_dependencies(gnss_sp_libs volk_gnsssdr_module)
endif(NOT VOLK_GNSSSDR_FOUND)
if(NOT VOLKGNSSSDR_FOUND)
add_dependencies(gnss_sp_libs volk_gnsssdr_module
armadillo-${armadillo_RELEASE})
else()
add_dependencies(gnss_sp_libs armadillo-${armadillo_RELEASE})
endif()
if(${GFLAGS_GREATER_20})
add_definitions(-DGFLAGS_GREATER_2_0=1)
endif(${GFLAGS_GREATER_20})
endif()
add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
source_group(Headers FILES gnss_sdr_flags.h)

View File

@@ -126,8 +126,8 @@ void galileo_e1_gen_float(float* _dest, int* _prn, char _Signal[3])
const float alpha = sqrt(10.0 / 11.0);
const float beta = sqrt(1.0 / 11.0);
int32_t sinboc_11[12 * 4092]; // _codeLength not accepted by Clang
int32_t sinboc_61[12 * 4092];
int32_t sinboc_11[12 * 4092] = {0}; // _codeLength not accepted by Clang
int32_t sinboc_61[12 * 4092] = {0};
galileo_e1_sinboc_11_gen_int(sinboc_11, _prn, _codeLength); //generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen_int(sinboc_61, _prn, _codeLength); //generate sinboc(6,1) 12 samples per chip

View File

@@ -131,12 +131,6 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
{
_dest[(i + delay) % _samplesPerCode] = _code[i];
}
if (_fs != _codeFreqBasis)
{
free(_code);
}
else
{
delete[] _code;
}
delete[] _code;
}

View File

@@ -0,0 +1,775 @@
/*!
* \file geofunctions.cc
* \brief A set of coordinate transformations functions and helpers,
* some of them migrated from MATLAB, for geographic information systems.
* \author Javier Arribas, 2018. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "geofunctions.h"
const double STRP_PI = 3.1415926535898; // Pi as defined in IS-GPS-200E
arma::mat Skew_symmetric(const arma::vec &a)
{
arma::mat A = arma::zeros(3, 3);
A << 0.0 << -a(2) << a(1) << arma::endr
<< a(2) << 0.0 << -a(0) << arma::endr
<< -a(1) << a(0) << 0 << arma::endr;
// {{0, -a(2), a(1)},
// {a(2), 0, -a(0)},
// {-a(1), a(0), 0}};
return A;
}
double WGS84_g0(double Lat_rad)
{
const double k = 0.001931853; // normal gravity constant
const double e2 = 0.00669438002290; // the square of the first numerical eccentricity
const double nge = 9.7803253359; // normal gravity value on the equator (m/sec^2)
double b = sin(Lat_rad); // Lat in degrees
b = b * b;
double g0 = nge * (1 + k * b) / (sqrt(1 - e2 * b));
return g0;
}
double WGS84_geocentric_radius(double Lat_geodetic_rad)
{
// WGS84 earth model Geocentric radius (Eq. 2.88)
const double WGS84_A = 6378137.0; // Semi-major axis of the Earth, a [m]
const double WGS84_IF = 298.257223563; // Inverse flattening of the Earth
const double WGS84_F = (1.0 / WGS84_IF); // The flattening of the Earth
// double WGS84_B=(WGS84_A*(1-WGS84_F)); // Semi-minor axis of the Earth [m]
double WGS84_E = (sqrt(2 * WGS84_F - WGS84_F * WGS84_F)); // Eccentricity of the Earth
// transverse radius of curvature
double R_E = WGS84_A / sqrt(1 - WGS84_E * WGS84_E * sin(Lat_geodetic_rad) * sin(Lat_geodetic_rad)); // (Eq. 2.66)
// geocentric radius at the Earth surface
double r_eS = R_E * sqrt(cos(Lat_geodetic_rad) * cos(Lat_geodetic_rad) +
(1 - WGS84_E * WGS84_E) * (1 - WGS84_E * WGS84_E) * sin(Lat_geodetic_rad) * sin(Lat_geodetic_rad)); // (Eq. 2.88)
return r_eS;
}
int topocent(double *Az, double *El, double *D, const arma::vec &x, const arma::vec &dx)
{
double lambda;
double phi;
double h;
const double dtr = STRP_PI / 180.0;
const double a = 6378137.0; // semi-major axis of the reference ellipsoid WGS-84
const double finv = 298.257223563; // inverse of flattening of the reference ellipsoid WGS-84
// Transform x into geodetic coordinates
togeod(&phi, &lambda, &h, a, finv, x(0), x(1), x(2));
double cl = cos(lambda * dtr);
double sl = sin(lambda * dtr);
double cb = cos(phi * dtr);
double sb = sin(phi * dtr);
arma::mat F = {{-sl, -sb * cl, cb * cl},
{cl, -sb * sl, cb * sl},
{0.0, cb, sb}};
arma::vec local_vector;
local_vector = arma::htrans(F) * dx;
double E = local_vector(0);
double N = local_vector(1);
double U = local_vector(2);
double hor_dis;
hor_dis = sqrt(E * E + N * N);
if (hor_dis < 1.0E-20)
{
*Az = 0.0;
*El = 90.0;
}
else
{
*Az = atan2(E, N) / dtr;
*El = atan2(U, hor_dis) / dtr;
}
if (*Az < 0)
{
*Az = *Az + 360.0;
}
*D = sqrt(dx(0) * dx(0) + dx(1) * dx(1) + dx(2) * dx(2));
return 0;
}
int togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z)
{
*h = 0.0;
const double tolsq = 1.e-10; // tolerance to accept convergence
const int maxit = 10; // max number of iterations
const double rtd = 180.0 / STRP_PI;
// compute square of eccentricity
double esq;
if (finv < 1.0E-20)
{
esq = 0.0;
}
else
{
esq = (2.0 - 1.0 / finv) / finv;
}
// first guess
double P = sqrt(X * X + Y * Y); // P is distance from spin axis
// direct calculation of longitude
if (P > 1.0E-20)
{
*dlambda = atan2(Y, X) * rtd;
}
else
{
*dlambda = 0.0;
}
// correct longitude bound
if (*dlambda < 0)
{
*dlambda = *dlambda + 360.0;
}
double r = sqrt(P * P + Z * Z); // r is distance from origin (0,0,0)
double sinphi;
if (r > 1.0E-20)
{
sinphi = Z / r;
}
else
{
sinphi = 0.0;
}
*dphi = asin(sinphi);
// initial value of height = distance from origin minus
// approximate distance from origin to surface of ellipsoid
if (r < 1.0E-20)
{
*h = 0.0;
return 1;
}
*h = r - a * (1 - sinphi * sinphi / finv);
// iterate
double cosphi;
double N_phi;
double dP;
double dZ;
double oneesq = 1.0 - esq;
for (int i = 0; i < maxit; i++)
{
sinphi = sin(*dphi);
cosphi = cos(*dphi);
// compute radius of curvature in prime vertical direction
N_phi = a / sqrt(1.0 - esq * sinphi * sinphi);
// compute residuals in P and Z
dP = P - (N_phi + (*h)) * cosphi;
dZ = Z - (N_phi * oneesq + (*h)) * sinphi;
// update height and latitude
*h = *h + (sinphi * dZ + cosphi * dP);
*dphi = *dphi + (cosphi * dZ - sinphi * dP) / (N_phi + (*h));
// test for convergence
if ((dP * dP + dZ * dZ) < tolsq)
{
break;
}
if (i == (maxit - 1))
{
// LOG(WARNING) << "The computation of geodetic coordinates did not converge";
}
}
*dphi = (*dphi) * rtd;
return 0;
}
arma::mat Gravity_ECEF(const arma::vec &r_eb_e)
{
// Parameters
const double R_0 = 6378137.0; // WGS84 Equatorial radius in meters
const double mu = 3.986004418E14; // WGS84 Earth gravitational constant (m^3 s^-2)
const double J_2 = 1.082627E-3; // WGS84 Earth's second gravitational constant
const double omega_ie = 7.292115E-5; // Earth rotation rate (rad/s)
// Calculate distance from center of the Earth
double mag_r = sqrt(arma::as_scalar(r_eb_e.t() * r_eb_e));
// If the input position is 0,0,0, produce a dummy output
arma::vec g = arma::zeros(3, 1);
if (mag_r != 0)
{
// Calculate gravitational acceleration using (2.142)
double z_scale = 5 * pow((r_eb_e(2) / mag_r), 2);
arma::vec tmp_vec = {(1 - z_scale) * r_eb_e(0),
(1 - z_scale) * r_eb_e(1),
(3 - z_scale) * r_eb_e(2)};
arma::vec gamma_ = (-mu / pow(mag_r, 3)) * (r_eb_e + 1.5 * J_2 * pow(R_0 / mag_r, 2) * tmp_vec);
// Add centripetal acceleration using (2.133)
g(0) = gamma_(0) + pow(omega_ie, 2) * r_eb_e(0);
g(1) = gamma_(1) + pow(omega_ie, 2) * r_eb_e(1);
g(2) = gamma_(2);
}
return g;
}
arma::vec LLH_to_deg(const arma::vec &LLH)
{
const double rtd = 180.0 / STRP_PI;
arma::vec deg = arma::zeros(3, 1);
deg(0) = LLH(0) * rtd;
deg(1) = LLH(1) * rtd;
deg(2) = LLH(2);
return deg;
}
double degtorad(double angleInDegrees)
{
double angleInRadians = (STRP_PI / 180.0) * angleInDegrees;
return angleInRadians;
}
double radtodeg(double angleInRadians)
{
double angleInDegrees = (180.0 / STRP_PI) * angleInRadians;
return angleInDegrees;
}
double mstoknotsh(double MetersPerSeconds)
{
double knots = mstokph(MetersPerSeconds) * 0.539957;
return knots;
}
double mstokph(double MetersPerSeconds)
{
double kph = 3600.0 * MetersPerSeconds / 1e3;
return kph;
}
arma::vec CTM_to_Euler(const arma::mat &C)
{
// Calculate Euler angles using (2.23)
arma::mat CTM(C);
arma::vec eul = arma::zeros(3, 1);
eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll
if (CTM(0, 2) < -1.0) CTM(0, 2) = -1.0;
if (CTM(0, 2) > 1.0) CTM(0, 2) = 1.0;
eul(1) = -asin(CTM(0, 2)); // pitch
eul(2) = atan2(CTM(0, 1), CTM(0, 0)); // yaw
return eul;
}
arma::mat Euler_to_CTM(const arma::vec &eul)
{
// Eq.2.15
// Euler angles to Attitude matrix is equivalent to rotate the body
// in the three axes:
// arma::mat Ax= {{1,0,0}, {0,cos(Att_phi),sin(Att_phi)} ,{0,-sin(Att_phi),cos(Att_phi)}};
// arma::mat Ay= {{cos(Att_theta), 0, -sin(Att_theta)}, {0,1,0} , {sin(Att_theta), 0, cos(Att_theta)}};
// arma::mat Az= {{cos(Att_psi), sin(Att_psi), 0}, {-sin(Att_psi), cos(Att_psi), 0},{0,0,1}};
// arma::mat C_b_n=Ax*Ay*Az; // Attitude expressed in the LOCAL FRAME (NED)
// C_b_n=C_b_n.t();
// Precalculate sines and cosines of the Euler angles
double sin_phi = sin(eul(0));
double cos_phi = cos(eul(0));
double sin_theta = sin(eul(1));
double cos_theta = cos(eul(1));
double sin_psi = sin(eul(2));
double cos_psi = cos(eul(2));
// Calculate coordinate transformation matrix using (2.22)
arma::mat C = {{cos_theta * cos_psi, cos_theta * sin_psi, -sin_theta},
{-cos_phi * sin_psi + sin_phi * sin_theta * cos_psi, cos_phi * cos_psi + sin_phi * sin_theta * sin_psi, sin_phi * cos_theta},
{sin_phi * sin_psi + cos_phi * sin_theta * cos_psi, -sin_phi * cos_psi + cos_phi * sin_theta * sin_psi, cos_phi * cos_theta}};
return C;
}
arma::vec cart2geo(const arma::vec &XYZ, int elipsoid_selection)
{
const double a[5] = {6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0};
const double f[5] = {1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563};
double lambda = atan2(XYZ[1], XYZ[0]);
double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection]));
double c = a[elipsoid_selection] * sqrt(1.0 + ex2);
double phi = atan(XYZ[2] / ((sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1]) * (1.0 - (2.0 - f[elipsoid_selection])) * f[elipsoid_selection])));
double h = 0.1;
double oldh = 0.0;
double N;
int iterations = 0;
do
{
oldh = h;
N = c / sqrt(1.0 + ex2 * (cos(phi) * cos(phi)));
phi = atan(XYZ[2] / ((sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1]) * (1.0 - (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] * N / (N + h)))));
h = sqrt(XYZ[0] * XYZ[0] + XYZ[1] * XYZ[1]) / cos(phi) - N;
iterations = iterations + 1;
if (iterations > 100)
{
// std::cout << "Failed to approximate h with desired precision. h-oldh= " << h - oldh;
break;
}
}
while (std::fabs(h - oldh) > 1.0e-12);
arma::vec LLH = {{phi, lambda, h}}; // radians
return LLH;
}
void ECEF_to_Geo(const arma::vec &r_eb_e, const arma::vec &v_eb_e, const arma::mat &C_b_e, arma::vec &LLH, arma::vec &v_eb_n, arma::mat &C_b_n)
{
// Compute the Latitude of the ECEF position
LLH = cart2geo(r_eb_e, 4); // ECEF -> WGS84 geographical
// Calculate ECEF to Geographical coordinate transformation matrix using (2.150)
double cos_lat = cos(LLH(0));
double sin_lat = sin(LLH(0));
double cos_long = cos(LLH(1));
double sin_long = sin(LLH(1));
// C++11 and arma >= 5.2
// arma::mat C_e_n = {{-sin_lat * cos_long, -sin_lat * sin_long, cos_lat},
// {-sin_long, cos_long, 0},
// {-cos_lat * cos_long, -cos_lat * sin_long, -sin_lat}}; //ECEF to Geo
arma::mat C_e_n = arma::zeros(3, 3);
C_e_n << -sin_lat * cos_long << -sin_lat * sin_long << cos_lat << arma::endr
<< -sin_long << cos_long << 0 << arma::endr
<< -cos_lat * cos_long << -cos_lat * sin_long << -sin_lat << arma::endr; // ECEF to Geo
// Transform velocity using (2.73)
v_eb_n = C_e_n * v_eb_e;
C_b_n = C_e_n * C_b_e; // Attitude conversion from ECEF to NED
}
void Geo_to_ECEF(const arma::vec &LLH, const arma::vec &v_eb_n, const arma::mat &C_b_n, arma::vec &r_eb_e, arma::vec &v_eb_e, arma::mat &C_b_e)
{
// Parameters
double R_0 = 6378137.0; // WGS84 Equatorial radius in meters
double e = 0.0818191908425; // WGS84 eccentricity
// Calculate transverse radius of curvature using (2.105)
double R_E = R_0 / sqrt(1.0 - (e * sin(LLH(0))) * (e * sin(LLH(0))));
// Convert position using (2.112)
double cos_lat = cos(LLH(0));
double sin_lat = sin(LLH(0));
double cos_long = cos(LLH(1));
double sin_long = sin(LLH(1));
r_eb_e = {(R_E + LLH(2)) * cos_lat * cos_long,
(R_E + LLH(2)) * cos_lat * sin_long,
((1 - e * e) * R_E + LLH(2)) * sin_lat};
// Calculate ECEF to Geo coordinate transformation matrix using (2.150)
// C++11 and arma>=5.2
// arma::mat C_e_n = {{-sin_lat * cos_long, -sin_lat * sin_long, cos_lat},
// {-sin_long, cos_long, 0},
// {-cos_lat * cos_long, -cos_lat * sin_long, -sin_lat}};
arma::mat C_e_n = arma::zeros(3, 3);
C_e_n << -sin_lat * cos_long << -sin_lat * sin_long << cos_lat << arma::endr
<< -sin_long << cos_long << 0 << arma::endr
<< -cos_lat * cos_long << -cos_lat * sin_long << -sin_lat << arma::endr;
// Transform velocity using (2.73)
v_eb_e = C_e_n.t() * v_eb_n;
// Transform attitude using (2.15)
C_b_e = C_e_n.t() * C_b_n;
}
void pv_Geo_to_ECEF(double L_b, double lambda_b, double h_b, const arma::vec &v_eb_n, arma::vec &r_eb_e, arma::vec &v_eb_e)
{
// Parameters
const double R_0 = 6378137.0; // WGS84 Equatorial radius in meters
const double e = 0.0818191908425; // WGS84 eccentricity
// Calculate transverse radius of curvature using (2.105)
double R_E = R_0 / sqrt(1 - pow(e * sin(L_b), 2));
// Convert position using (2.112)
double cos_lat = cos(L_b);
double sin_lat = sin(L_b);
double cos_long = cos(lambda_b);
double sin_long = sin(lambda_b);
r_eb_e = {(R_E + h_b) * cos_lat * cos_long,
(R_E + h_b) * cos_lat * sin_long,
((1 - pow(e, 2)) * R_E + h_b) * sin_lat};
// Calculate ECEF to Geo coordinate transformation matrix using (2.150)
arma::mat C_e_n = arma::zeros(3, 3);
C_e_n << -sin_lat * cos_long << -sin_lat * sin_long << cos_lat << arma::endr
<< -sin_long << cos_long << 0 << arma::endr
<< -cos_lat * cos_long << -cos_lat * sin_long << -sin_lat << arma::endr;
// Transform velocity using (2.73)
v_eb_e = C_e_n.t() * v_eb_n;
}
double great_circle_distance(double lat1, double lon1, double lat2, double lon2)
{
// The Haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes.
// generally used geo measurement function
double R = 6378.137; // Radius of earth in KM
double dLat = lat2 * STRP_PI / 180.0 - lat1 * STRP_PI / 180.0;
double dLon = lon2 * STRP_PI / 180.0 - lon1 * STRP_PI / 180.0;
double a = sin(dLat / 2.0) * sin(dLat / 2.0) +
cos(lat1 * STRP_PI / 180.0) * cos(lat2 * STRP_PI / 180.0) *
sin(dLon / 2) * sin(dLon / 2.0);
double c = 2.0 * atan2(sqrt(a), sqrt(1.0 - a));
double d = R * c;
return d * 1000.0; // meters
}
void cart2utm(const arma::vec &r_eb_e, int zone, arma::vec &r_enu)
{
// Transformation of (X,Y,Z) to (E,N,U) in UTM, zone 'zone'
//
// Inputs:
// r_eb_e - Cartesian coordinates. Coordinates are referenced
// with respect to the International Terrestrial Reference
// Frame 1996 (ITRF96)
// zone - UTM zone of the given position
//
// Outputs:
// r_enu - UTM coordinates (Easting, Northing, Uping)
//
// Originally written in Matlab by Kai Borre, Nov. 1994
// Implemented in C++ by J.Arribas
//
// This implementation is based upon
// O. Andersson & K. Poder (1981) Koordinattransformationer
// ved Geod\ae{}tisk Institut. Landinspekt\oe{}ren
// Vol. 30: 552--571 and Vol. 31: 76
//
// An excellent, general reference (KW) is
// R. Koenig & K.H. Weise (1951) Mathematische Grundlagen der
// h\"oheren Geod\"asie und Kartographie.
// Erster Band, Springer Verlag
//
// Explanation of variables used:
// f flattening of ellipsoid
// a semi major axis in m
// m0 1 - scale at central meridian; for UTM 0.0004
// Q_n normalized meridian quadrant
// E0 Easting of central meridian
// L0 Longitude of central meridian
// bg constants for ellipsoidal geogr. to spherical geogr.
// gb constants for spherical geogr. to ellipsoidal geogr.
// gtu constants for ellipsoidal N, E to spherical N, E
// utg constants for spherical N, E to ellipoidal N, E
// tolutm tolerance for utm, 1.2E-10*meridian quadrant
// tolgeo tolerance for geographical, 0.00040 second of arc
//
// B, L refer to latitude and longitude. Southern latitude is negative
// International ellipsoid of 1924, valid for ED50
double a = 6378388.0;
double f = 1.0 / 297.0;
double ex2 = (2.0 - f) * f / ((1.0 - f) * (1.0 - f));
double c = a * sqrt(1.0 + ex2);
arma::vec vec = r_eb_e;
vec(2) = vec(2) - 4.5;
double alpha = 0.756e-6;
arma::mat R = {{1.0, -alpha, 0.0}, {alpha, 1.0, 0.0}, {0.0, 0.0, 1.0}};
arma::vec trans = {89.5, 93.8, 127.6};
double scale = 0.9999988;
arma::vec v = scale * R * vec + trans; // coordinate vector in ED50
double L = atan2(v(1), v(0));
double N1 = 6395000.0; // preliminary value
double B = atan2(v(2) / ((1.0 - f) * (1.0 - f) * N1), arma::norm(v.subvec(0, 1)) / N1); // preliminary value
double U = 0.1;
double oldU = 0.0;
int iterations = 0;
while (fabs(U - oldU) > 1.0E-4)
{
oldU = U;
N1 = c / sqrt(1.0 + ex2 * (cos(B) * cos(B)));
B = atan2(v(2) / ((1.0 - f) * (1.0 - f) * N1 + U), arma::norm(v.subvec(0, 1)) / (N1 + U));
U = arma::norm(v.subvec(0, 1)) / cos(B) - N1;
iterations = iterations + 1;
if (iterations > 100)
{
std::cout << "Failed to approximate U with desired precision. U-oldU:" << U - oldU << std::endl;
break;
}
}
// Normalized meridian quadrant, KW p. 50 (96), p. 19 (38b), p. 5 (21)
double m0 = 0.0004;
double n = f / (2.0 - f);
double m = n * n * (1.0 / 4.0 + n * n / 64.0);
double w = (a * (-n - m0 + m * (1.0 - m0))) / (1.0 + n);
double Q_n = a + w;
// Easting and longitude of central meridian
double E0 = 500000.0;
double L0 = (zone - 30) * 6.0 - 3.0;
// Check tolerance for reverse transformation
// double tolutm = STRP_PI / 2.0 * 1.2e-10 * Q_n;
// double tolgeo = 0.000040;
// Coefficients of trigonometric series
//
// ellipsoidal to spherical geographical, KW p .186 --187, (51) - (52)
// bg[1] = n * (-2 + n * (2 / 3 + n * (4 / 3 + n * (-82 / 45))));
// bg[2] = n ^ 2 * (5 / 3 + n * (-16 / 15 + n * (-13 / 9)));
// bg[3] = n ^ 3 * (-26 / 15 + n * 34 / 21);
// bg[4] = n ^ 4 * 1237 / 630;
//
// spherical to ellipsoidal geographical, KW p.190 --191, (61) - (62) % gb[1] = n * (2 + n * (-2 / 3 + n * (-2 + n * 116 / 45)));
// gb[2] = n ^ 2 * (7 / 3 + n * (-8 / 5 + n * (-227 / 45)));
// gb[3] = n ^ 3 * (56 / 15 + n * (-136 / 35));
// gb[4] = n ^ 4 * 4279 / 630;
//
// spherical to ellipsoidal N, E, KW p.196, (69) % gtu[1] = n * (1 / 2 + n * (-2 / 3 + n * (5 / 16 + n * 41 / 180)));
// gtu[2] = n ^ 2 * (13 / 48 + n * (-3 / 5 + n * 557 / 1440));
// gtu[3] = n ^ 3 * (61 / 240 + n * (-103 / 140));
// gtu[4] = n ^ 4 * 49561 / 161280;
//
// ellipsoidal to spherical N, E, KW p.194, (65) % utg[1] = n * (-1 / 2 + n * (2 / 3 + n * (-37 / 96 + n * 1 / 360)));
// utg[2] = n ^ 2 * (-1 / 48 + n * (-1 / 15 + n * 437 / 1440));
// utg[3] = n ^ 3 * (-17 / 480 + n * 37 / 840);
// utg[4] = n ^ 4 * (-4397 / 161280);
//
// With f = 1 / 297 we get
arma::colvec bg = {-3.37077907e-3,
4.73444769e-6,
-8.29914570e-9,
1.58785330e-11};
arma::colvec gb = {3.37077588e-3,
6.62769080e-6,
1.78718601e-8,
5.49266312e-11};
arma::colvec gtu = {8.41275991e-4,
7.67306686e-7,
1.21291230e-9,
2.48508228e-12};
arma::colvec utg = {-8.41276339e-4,
-5.95619298e-8,
-1.69485209e-10,
-2.20473896e-13};
// Ellipsoidal latitude, longitude to spherical latitude, longitude
bool neg_geo = false;
if (B < 0.0) neg_geo = true;
double Bg_r = fabs(B);
double res_clensin = clsin(bg, 4, 2.0 * Bg_r);
Bg_r = Bg_r + res_clensin;
L0 = L0 * STRP_PI / 180.0;
double Lg_r = L - L0;
// Spherical latitude, longitude to complementary spherical latitude % i.e.spherical N, E
double cos_BN = cos(Bg_r);
double Np = atan2(sin(Bg_r), cos(Lg_r) * cos_BN);
double Ep = atanh(sin(Lg_r) * cos_BN);
// Spherical normalized N, E to ellipsoidal N, E
Np = 2.0 * Np;
Ep = 2.0 * Ep;
double dN;
double dE;
clksin(gtu, 4, Np, Ep, &dN, &dE);
Np = Np / 2.0;
Ep = Ep / 2.0;
Np = Np + dN;
Ep = Ep + dE;
double N = Q_n * Np;
double E = Q_n * Ep + E0;
if (neg_geo)
{
N = -N + 20000000.0;
}
r_enu(0) = E;
r_enu(1) = N;
r_enu(2) = U;
}
double clsin(const arma::colvec &ar, int degree, double argument)
{
// Clenshaw summation of sinus of argument.
//
// result = clsin(ar, degree, argument);
//
// Originally written in Matlab by Kai Borre
// Implemented in C++ by J.Arribas
double cos_arg = 2.0 * cos(argument);
double hr1 = 0.0;
double hr = 0.0;
double hr2;
for (int t = degree; t > 0; t--)
{
hr2 = hr1;
hr1 = hr;
hr = ar(t - 1) + cos_arg * hr1 - hr2;
}
return (hr * sin(argument));
}
void clksin(const arma::colvec &ar, int degree, double arg_real, double arg_imag, double *re, double *im)
{
// Clenshaw summation of sinus with complex argument
// [re, im] = clksin(ar, degree, arg_real, arg_imag);
//
// Originally written in Matlab by Kai Borre
// Implemented in C++ by J.Arribas
double sin_arg_r = sin(arg_real);
double cos_arg_r = cos(arg_real);
double sinh_arg_i = sinh(arg_imag);
double cosh_arg_i = cosh(arg_imag);
double r = 2.0 * cos_arg_r * cosh_arg_i;
double i = -2.0 * sin_arg_r * sinh_arg_i;
double hr1 = 0.0;
double hr = 0.0;
double hi1 = 0.0;
double hi = 0.0;
double hi2;
double hr2;
for (int t = degree; t > 0; t--)
{
hr2 = hr1;
hr1 = hr;
hi2 = hi1;
hi1 = hi;
double z = ar(t - 1) + r * hr1 - i * hi - hr2;
hi = i * hr1 + r * hi1 - hi2;
hr = z;
}
r = sin_arg_r * cosh_arg_i;
i = cos_arg_r * sinh_arg_i;
*re = r * hr - i * hi;
*im = r * hi + i * hr;
}
int findUtmZone(double latitude_deg, double longitude_deg)
{
// Function finds the UTM zone number for given longitude and latitude.
// The longitude value must be between -180 (180 degree West) and 180 (180
// degree East) degree. The latitude must be within -80 (80 degree South) and
// 84 (84 degree North).
//
// utmZone = findUtmZone(latitude, longitude);
//
// Latitude and longitude must be in decimal degrees (e.g. 15.5 degrees not
// 15 deg 30 min).
//
// Originally written in Matlab by Darius Plausinaitis
// Implemented in C++ by J.Arribas
// Check value bounds
if ((longitude_deg > 180.0) || (longitude_deg < -180.0))
std::cout << "Longitude value exceeds limits (-180:180).\n";
if ((latitude_deg > 84.0) || (latitude_deg < -80.0))
std::cout << "Latitude value exceeds limits (-80:84).\n";
//
// Find zone
//
// Start at 180 deg west = -180 deg
int utmZone = floor((180 + longitude_deg) / 6) + 1;
// Correct zone numbers for particular areas
if (latitude_deg > 72.0)
{
// Corrections for zones 31 33 35 37
if ((longitude_deg >= 0.0) && (longitude_deg < 9.0))
{
utmZone = 31;
}
else if ((longitude_deg >= 9.0) && (longitude_deg < 21.0))
{
utmZone = 33;
}
else if ((longitude_deg >= 21.0) && (longitude_deg < 33.0))
{
utmZone = 35;
}
else if ((longitude_deg >= 33.0) && (longitude_deg < 42.0))
{
utmZone = 37;
}
}
else if ((latitude_deg >= 56.0) && (latitude_deg < 64.0))
{
// Correction for zone 32
if ((longitude_deg >= 3.0) && (longitude_deg < 12.0))
utmZone = 32;
}
return utmZone;
}

View File

@@ -0,0 +1,184 @@
/*!
* \file geofunctions.h
* \brief A set of coordinate transformations functions and helpers,
* some of them migrated from MATLAB, for geographic information systems.
* \author Javier Arribas, 2018. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GEOFUNCTIONS_H
#define GNSS_SDR_GEOFUNCTIONS_H
#include <armadillo>
arma::mat Skew_symmetric(const arma::vec &a); //!< Calculates skew-symmetric matrix
double WGS84_g0(double Lat_rad);
double WGS84_geocentric_radius(double Lat_geodetic_rad);
/*!
* \brief Transformation of vector dx into topocentric coordinate
* system with origin at x
* Inputs:
* x - vector origin coordinates (in ECEF system [X; Y; Z;])
* dx - vector ([dX; dY; dZ;]).
*
* Outputs:
* D - vector length. Units like the input
* Az - azimuth from north positive clockwise, degrees
* El - elevation angle, degrees
*
* Based on a Matlab function by Kai Borre
*/
int topocent(double *Az, double *El, double *D, const arma::vec &x, const arma::vec &dx);
/*!
* \brief Subroutine to calculate geodetic coordinates latitude, longitude,
* height given Cartesian coordinates X,Y,Z, and reference ellipsoid
* values semi-major axis (a) and the inverse of flattening (finv).
*
* The output units of angular quantities will be in decimal degrees
* (15.5 degrees not 15 deg 30 min). The output units of h will be the
* same as the units of X,Y,Z,a.
*
* Inputs:
* a - semi-major axis of the reference ellipsoid
* finv - inverse of flattening of the reference ellipsoid
* X,Y,Z - Cartesian coordinates
*
* Outputs:
* dphi - latitude
* dlambda - longitude
* h - height above reference ellipsoid
*
* Based in a Matlab function by Kai Borre
*/
int togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z);
arma::mat Gravity_ECEF(const arma::vec &r_eb_e); //!< Calculates acceleration due to gravity resolved about ECEF-frame
/*!
* \brief Conversion of Cartesian coordinates (X,Y,Z) to geographical
* coordinates (latitude, longitude, h) on a selected reference ellipsoid.
*
* Choices of Reference Ellipsoid for Geographical Coordinates
* 0. International Ellipsoid 1924
* 1. International Ellipsoid 1967
* 2. World Geodetic System 1972
* 3. Geodetic Reference System 1980
* 4. World Geodetic System 1984
*/
arma::vec cart2geo(const arma::vec &XYZ, int elipsoid_selection);
arma::vec LLH_to_deg(const arma::vec &LLH);
double degtorad(double angleInDegrees);
double radtodeg(double angleInRadians);
double mstoknotsh(double MetersPerSeconds);
double mstokph(double Kph);
arma::vec CTM_to_Euler(const arma::mat &C);
arma::mat Euler_to_CTM(const arma::vec &eul);
void ECEF_to_Geo(const arma::vec &r_eb_e, const arma::vec &v_eb_e, const arma::mat &C_b_e, arma::vec &LLH, arma::vec &v_eb_n, arma::mat &C_b_n);
/*!
* \brief From Geographic to ECEF coordinates
*
* Inputs:
* LLH latitude (rad), longitude (rad), height (m)
* v_eb_n velocity of body frame w.r.t. ECEF frame, resolved along
* north, east, and down (m/s)
* C_b_n body-to-NED coordinate transformation matrix
*
* Outputs:
* r_eb_e Cartesian position of body frame w.r.t. ECEF frame, resolved
* along ECEF-frame axes (m)
* v_eb_e velocity of body frame w.r.t. ECEF frame, resolved along
* ECEF-frame axes (m/s)
* C_b_e body-to-ECEF-frame coordinate transformation matrix
*
*/
void Geo_to_ECEF(const arma::vec &LLH, const arma::vec &v_eb_n, const arma::mat &C_b_n, arma::vec &r_eb_e, arma::vec &v_eb_e, arma::mat &C_b_e);
/*!
* \brief Converts curvilinear to Cartesian position and velocity
* resolving axes from NED to ECEF
* This function created 11/4/2012 by Paul Groves
*
* Inputs:
* L_b latitude (rad)
* lambda_b longitude (rad)
* h_b height (m)
* v_eb_n velocity of body frame w.r.t. ECEF frame, resolved along
* north, east, and down (m/s)
*
* Outputs:
* r_eb_e Cartesian position of body frame w.r.t. ECEF frame, resolved
* along ECEF-frame axes (m)
* v_eb_e velocity of body frame w.r.t. ECEF frame, resolved along
* ECEF-frame axes (m/s)
*/
void pv_Geo_to_ECEF(double L_b, double lambda_b, double h_b, const arma::vec &v_eb_n, arma::vec &r_eb_e, arma::vec &v_eb_e);
/*!
* \brief The Haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes.
*/
double great_circle_distance(double lat1, double lon1, double lat2, double lon2);
/*!
* \brief Transformation of ECEF (X,Y,Z) to (E,N,U) in UTM, zone 'zone'.
*/
void cart2utm(const arma::vec &r_eb_e, int zone, arma::vec &r_enu);
/*!
* \brief Function finds the UTM zone number for given longitude and latitude.
*/
int findUtmZone(double latitude_deg, double longitude_deg);
/*!
* \brief Clenshaw summation of sinus of argument.
*/
double clsin(const arma::colvec &ar, int degree, double argument);
/*!
* \brief Clenshaw summation of sinus with complex argument.
*/
void clksin(const arma::colvec &ar, int degree, double arg_real, double arg_imag, double *re, double *im);
#endif

View File

@@ -0,0 +1,87 @@
/*!
* \file gnss_sdr_create_directory.cc
* \brief Create a directory
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_create_directory.h"
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <fstream>
bool gnss_sdr_create_directory(const std::string& foldername)
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(foldername))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
{
try
{
if (!boost::filesystem::create_directory(new_folder, ec))
{
return false;
}
}
catch (std::exception& e)
{
return false;
}
}
new_folder += boost::filesystem::path::preferred_separator;
}
// Check if we have writing permissions
std::string test_file = foldername + "/test_file.txt";
std::ofstream os_test_file;
os_test_file.open(test_file.c_str(), std::ios::out | std::ios::binary);
if (os_test_file.is_open())
{
boost::system::error_code ec;
os_test_file.close();
try
{
boost::filesystem::remove(test_file, ec);
}
catch (std::exception& e)
{
return false;
}
return true;
}
else
{
os_test_file.close();
return false;
}
}

View File

@@ -0,0 +1,38 @@
/*!
* \file gnss_sdr_create_directory.h
* \brief Create a directory
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GNSS_SDR_CREATE_DIRECTORY_H_
#define GNSS_SDR_GNSS_SDR_CREATE_DIRECTORY_H_
#include <string>
bool gnss_sdr_create_directory(const std::string& foldername);
#endif

View File

@@ -2,6 +2,7 @@
* \file gnss_sdr_valve.cc
* \brief Implementation of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it.
* \author Javier Arribas, 2018. jarribas(at)cttc.es
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
*
@@ -39,42 +40,70 @@
gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue) : gr::sync_block("valve",
gr::io_signature::make(1, 1, sizeof_stream_item),
gr::io_signature::make(1, 1, sizeof_stream_item)),
d_nitems(nitems),
d_ncopied_items(0),
d_queue(queue)
gr::msg_queue::sptr queue,
bool stop_flowgraph) : gr::sync_block("valve",
gr::io_signature::make(1, 1, sizeof_stream_item),
gr::io_signature::make(1, 1, sizeof_stream_item)),
d_nitems(nitems),
d_ncopied_items(0),
d_queue(queue),
d_stop_flowgraph(stop_flowgraph)
{
d_open_valve = false;
}
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
{
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
return valve_;
}
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue)
{
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue));
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, true));
return valve_;
}
void gnss_sdr_valve::open_valve()
{
d_open_valve = true;
}
int gnss_sdr_valve::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
if (d_ncopied_items >= d_nitems)
if (d_open_valve == false)
{
ControlMessageFactory *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
LOG(INFO) << "Stopping receiver, " << d_ncopied_items << " samples processed";
delete cmf;
return -1; // Done!
if (d_ncopied_items >= d_nitems)
{
ControlMessageFactory *cmf = new ControlMessageFactory();
d_queue->handle(cmf->GetQueueMessage(200, 0));
LOG(INFO) << "Stopping receiver, " << d_ncopied_items << " samples processed";
delete cmf;
if (d_stop_flowgraph)
{
return -1; // Done!
}
else
{
usleep(1000000);
return 0; // do not produce or consume
}
}
unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items));
if (n == 0) return 0;
memcpy(output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0));
d_ncopied_items += n;
return n;
}
else
{
memcpy(output_items[0], input_items[0], noutput_items * input_signature()->sizeof_stream_item(0));
return noutput_items;
}
unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items));
if (n == 0) return 0;
memcpy(output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0));
//for(long long i = 0; i++; i<n)
// {
// output_items[i] = input_items[i];
// }
d_ncopied_items += n;
return n;
}

View File

@@ -2,6 +2,7 @@
* \file gnss_sdr_valve.h
* \brief Interface of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it.
* \author Javier Arribas, 2018. jarribas(at)cttc.es
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
* -------------------------------------------------------------------------
@@ -37,10 +38,15 @@
#include <gnuradio/msg_queue.h>
#include <boost/shared_ptr.hpp>
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue);
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue,
bool stop_flowgraph);
/*!
* \brief Implementation of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it.
@@ -50,14 +56,23 @@ class gnss_sdr_valve : public gr::sync_block
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue);
gnss_sdr_valve(size_t sizeof_stream_item,
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue);
gr::msg_queue::sptr queue,
bool stop_flowgraph);
unsigned long long d_nitems;
unsigned long long d_ncopied_items;
gr::msg_queue::sptr d_queue;
bool d_stop_flowgraph;
bool d_open_valve;
public:
gnss_sdr_valve(size_t sizeof_stream_item,
unsigned long long nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph);
void open_valve();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);

View File

@@ -131,7 +131,7 @@ void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift)
{
const uint32_t _code_length = 1023;
int32_t ca_code_int[_code_length];
int32_t ca_code_int[_code_length] = {0};
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);

View File

@@ -16,60 +16,59 @@
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
#
add_definitions( -DGNSS_SDR_VERSION="${VERSION}" )
add_definitions(-DGNSS_SDR_VERSION="${VERSION}")
set(RTKLIB_LIB_SOURCES
rtklib_rtkcmn.cc
rtklib_ephemeris.cc
rtklib_preceph.cc
rtklib_sbas.cc
rtklib_ionex.cc
rtklib_pntpos.cc
rtklib_ppp.cc
rtklib_tides.cc
rtklib_lambda.cc
rtklib_rtkpos.cc
rtklib_conversions.cc
rtklib_stream.cc
rtklib_rtksvr.cc
rtklib_solution.cc
rtklib_rtcm.cc
rtklib_rtcm2.cc
rtklib_rtcm3.cc
rtklib_rtkcmn.cc
rtklib_ephemeris.cc
rtklib_preceph.cc
rtklib_sbas.cc
rtklib_ionex.cc
rtklib_pntpos.cc
rtklib_ppp.cc
rtklib_tides.cc
rtklib_lambda.cc
rtklib_rtkpos.cc
rtklib_conversions.cc
rtklib_stream.cc
rtklib_rtksvr.cc
rtklib_solution.cc
rtklib_rtcm.cc
rtklib_rtcm2.cc
rtklib_rtcm3.cc
)
set(RTKLIB_LIB_HEADERS
rtklib_rtkcmn.h
rtklib_ephemeris.h
rtklib_preceph.h
rtklib_sbas.h
rtklib_ionex.h
rtklib_pntpos.h
rtklib_ppp.h
rtklib_tides.h
rtklib_lambda.h
rtklib_rtkpos.h
rtklib_conversions.h
rtklib_stream.h
rtklib_rtksvr.h
rtklib_solution.h
rtklib_rtcm.h
rtklib_rtcm2.h
rtklib_rtcm3.h
rtklib.h
rtklib_rtkcmn.h
rtklib_ephemeris.h
rtklib_preceph.h
rtklib_sbas.h
rtklib_ionex.h
rtklib_pntpos.h
rtklib_ppp.h
rtklib_tides.h
rtklib_lambda.h
rtklib_rtkpos.h
rtklib_conversions.h
rtklib_stream.h
rtklib_rtksvr.h
rtklib_solution.h
rtklib_rtcm.h
rtklib_rtcm2.h
rtklib_rtcm3.h
rtklib.h
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${Boost_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${Boost_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
)
list(SORT RTKLIB_LIB_HEADERS)
list(SORT RTKLIB_LIB_SOURCES)
@@ -79,7 +78,7 @@ add_dependencies(rtklib_lib glog-${glog_RELEASE})
if(OS_IS_MACOSX)
set(MAC_LIBRARIES "-framework Accelerate")
endif(OS_IS_MACOSX)
endif()
target_link_libraries(
rtklib_lib

View File

@@ -119,7 +119,7 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glona
eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph)
{
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0 };
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
//Galileo is the third satellite system for RTKLIB, so, add the required offset to discriminate Galileo ephemeris
rtklib_sat.sat = gal_eph.i_satellite_PRN + NSATGPS + NSATGLO;
rtklib_sat.A = gal_eph.A_1 * gal_eph.A_1;
@@ -177,7 +177,7 @@ eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph)
eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph)
{
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0 };
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
rtklib_sat.sat = gps_eph.i_satellite_PRN;
rtklib_sat.A = gps_eph.d_sqrt_A * gps_eph.d_sqrt_A;
rtklib_sat.M0 = gps_eph.d_M_0;
@@ -234,7 +234,7 @@ eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph)
{
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0 };
rtklib_sat.sat = bei_eph.i_satellite_PRN;
rtklib_sat.sat = bei_eph.i_satellite_PRN + NSATGPS + NSATGLO + NSATGAL + NSATQZS ;
rtklib_sat.A = bei_eph.d_sqrt_A * bei_eph.d_sqrt_A;
rtklib_sat.M0 = bei_eph.d_M_0;
rtklib_sat.deln = bei_eph.d_Delta_n;
@@ -290,7 +290,7 @@ eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph)
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph)
{
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0 };
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
rtklib_sat.sat = gps_cnav_eph.i_satellite_PRN;
const double A_REF = 26559710.0; // See IS-GPS-200H, pp. 170
rtklib_sat.A = A_REF + gps_cnav_eph.d_DELTA_A;
@@ -350,3 +350,59 @@ eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph)
return rtklib_sat;
}
alm_t alm_to_rtklib(const Gps_Almanac& gps_alm)
{
alm_t rtklib_alm;
rtklib_alm = {0, 0, 0, 0, {0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
rtklib_alm.sat = gps_alm.i_satellite_PRN;
rtklib_alm.svh = gps_alm.i_SV_health;
rtklib_alm.svconf = gps_alm.i_AS_status;
rtklib_alm.week = gps_alm.i_WNa;
gtime_t toa;
toa.time = gps_alm.i_Toa;
rtklib_alm.toa = toa;
rtklib_alm.A = gps_alm.d_sqrt_A * gps_alm.d_sqrt_A;
rtklib_alm.e = gps_alm.d_e_eccentricity;
rtklib_alm.i0 = (gps_alm.d_Delta_i + 0.3) * PI;
rtklib_alm.OMG0 = gps_alm.d_OMEGA0 * PI;
rtklib_alm.OMGd = gps_alm.d_OMEGA_DOT * PI;
rtklib_alm.omg = gps_alm.d_OMEGA * PI;
rtklib_alm.M0 = gps_alm.d_M_0 * PI;
rtklib_alm.f0 = gps_alm.d_A_f0;
rtklib_alm.f1 = gps_alm.d_A_f1;
rtklib_alm.toas = gps_alm.i_Toa;
return rtklib_alm;
}
alm_t alm_to_rtklib(const Galileo_Almanac& gal_alm)
{
alm_t rtklib_alm;
rtklib_alm = {0, 0, 0, 0, {0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
rtklib_alm.sat = gal_alm.i_satellite_PRN + NSATGPS + NSATGLO;
rtklib_alm.svh = gal_alm.E1B_HS;
rtklib_alm.svconf = gal_alm.E1B_HS;
rtklib_alm.week = gal_alm.i_WNa;
gtime_t toa;
toa.time = gal_alm.i_Toa;
rtklib_alm.toa = toa;
rtklib_alm.A = 5440.588203494 + gal_alm.d_Delta_sqrt_A;
rtklib_alm.A = rtklib_alm.A * rtklib_alm.A;
rtklib_alm.e = gal_alm.d_e_eccentricity;
rtklib_alm.i0 = (gal_alm.d_Delta_i + 56.0 / 180.0) * PI;
rtklib_alm.OMG0 = gal_alm.d_OMEGA0 * PI;
rtklib_alm.OMGd = gal_alm.d_OMEGA_DOT * PI;
rtklib_alm.omg = gal_alm.d_OMEGA * PI;
rtklib_alm.M0 = gal_alm.d_M_0 * PI;
rtklib_alm.f0 = gal_alm.d_A_f0;
rtklib_alm.f1 = gal_alm.d_A_f1;
rtklib_alm.toas = gal_alm.i_Toa;
return rtklib_alm;
}

View File

@@ -31,7 +31,6 @@
#ifndef GNSS_SDR_RTKLIB_CONVERSIONS_H_
#define GNSS_SDR_RTKLIB_CONVERSIONS_H_
#include "../../../core/system_parameters/beidou_dnav_ephemeris.h"
#include "rtklib.h"
#include "gnss_synchro.h"
#include "galileo_ephemeris.h"
@@ -39,12 +38,18 @@
#include "gps_cnav_ephemeris.h"
#include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h"
#include "beidou_dnav_ephemeris.h"
#include "gps_almanac.h"
#include "galileo_almanac.h"
eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph);
eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph);
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph);
eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph);
alm_t alm_to_rtklib(const Gps_Almanac& gps_alm);
alm_t alm_to_rtklib(const Galileo_Almanac& gal_alm);
/*!
* \brief Transforms a Glonass_Gnav_Ephemeris to its RTKLIB counterpart
* \param glonass_gnav_eph GLONASS GNAV Ephemeris structure

View File

@@ -44,37 +44,37 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# retrieve the compiler's version from it
string(REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${_err})
string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_OTHER_VERSION})
else("${IS_APPLE}" STREQUAL "")
else()
set(MIN_VERSION ${GNSSSDR_APPLECLANG_MIN_VERSION})
set(APPLE_STR "Apple ")
# retrieve the compiler's version from it
string(REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${_err})
string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_APPLE_VERSION})
endif("${IS_APPLE}" STREQUAL "")
endif()
if(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}")
message(WARNING "\nThe compiler selected to build VOLK-GNSSSDR (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.")
endif(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}")
else(${_res} STREQUAL "0")
endif()
else()
message(WARNING "\nCannot determine the version of the compiler selected to build VOLK-GNSSSDR (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.")
endif(${_res} STREQUAL "0")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()
endif()
# Enable C++17 support in GCC >= 8.0.0
# Enable C++14 support in 8.0.0 > GCC >= 6.1.1
# Fallback to C++11 when using GCC < 6.1.1
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
else(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14")
else(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
else()
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++17")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
endif()
endif()
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wall -Wextra") #Add warning flags: For "-Wall" see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
endif()
# Enable C++17 support in Clang >= 6.0.0
# Enable C++14 support in 6.0.0 > Clang >= 3.5.0 or AppleClang >= 600
@@ -84,28 +84,28 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# See https://trac.macports.org/wiki/XcodeVersionInfo for Apple Clang version equivalences
if(CLANG_VERSION VERSION_LESS "600")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
else(CLANG_VERSION VERSION_LESS "600")
else()
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14")
endif(CLANG_VERSION VERSION_LESS "600")
else(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
else(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++14")
else(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0")
else()
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++17")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()
endif()
endif()
endif()
if(NOT (CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
if(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
endif(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
endif(NOT (CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
@@ -113,9 +113,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
if(CMAKE_VERSION VERSION_GREATER "3.0")
cmake_policy(SET CMP0042 NEW)
if(CMAKE_VERSION VERSION_GREATER "3.9")
cmake_policy(SET CMP0068 NEW)
endif(CMAKE_VERSION VERSION_GREATER "3.9")
endif(CMAKE_VERSION VERSION_GREATER "3.0")
cmake_policy(SET CMP0068 NEW)
endif()
endif()
option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF)
@@ -129,7 +129,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif()
VOLK_CHECK_BUILD_TYPE(${CMAKE_BUILD_TYPE})
volk_check_build_type(${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
@@ -144,14 +144,14 @@ include(VolkVersion) #setup version info
########################################################################
# Environment setup
########################################################################
IF(NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT})
SET(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
ENDIF()
if(NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT})
set(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
endif()
IF(NOT DEFINED CROSSCOMPILE_MULTILIB)
SET(CROSSCOMPILE_MULTILIB "")
ENDIF()
SET(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\" if you have and want to use multiple C development libs installed for cross compile")
if(NOT DEFINED CROSSCOMPILE_MULTILIB)
set(CROSSCOMPILE_MULTILIB "")
endif()
set(CROSSCOMPILE_MULTILIB ${CROSSCOMPILE_MULTILIB} CACHE STRING "Define \"true\" if you have and want to use multiple C development libs installed for cross compile")
if(MSVC)
add_definitions(-D_USE_MATH_DEFINES) #enables math constants on all supported versions of MSVC
@@ -160,16 +160,16 @@ if(MSVC)
add_compile_options(/wd4752)
add_compile_options(/wo4273)
add_compile_options(/wo4838)
endif(MSVC)
endif()
# allow 'large' files in 32 bit builds
if(UNIX)
add_definitions( -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
-D_FORTIFY_SOURCE=2
)
endif(UNIX)
add_definitions(-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
-D_FORTIFY_SOURCE=2
)
endif()
########################################################################
@@ -178,9 +178,9 @@ endif(UNIX)
# Python
include(VolkPython) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
VOLK_PYTHON_CHECK_MODULE("python >= 2.7" sys "sys.version.split()[0] >= '2.7'" PYTHON_MIN_VER_FOUND)
VOLK_PYTHON_CHECK_MODULE("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
VOLK_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)
volk_python_check_module("python >= 2.7" sys "sys.version.split()[0] >= '2.7'" PYTHON_MIN_VER_FOUND)
volk_python_check_module("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
volk_python_check_module("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)
if(NOT PYTHON_MIN_VER_FOUND)
@@ -199,16 +199,16 @@ endif()
# Boost
if(MSVC)
if (NOT DEFINED BOOST_ALL_DYN_LINK)
if(NOT DEFINED BOOST_ALL_DYN_LINK)
set(BOOST_ALL_DYN_LINK TRUE)
endif()
set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
if(BOOST_ALL_DYN_LINK)
add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
else(BOOST_ALL_DYN_LINK)
else()
unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
endif(BOOST_ALL_DYN_LINK)
endif(MSVC)
endif()
endif()
include(VolkBoost)
@@ -220,9 +220,9 @@ endif()
option(ENABLE_ORC "Enable Orc" True)
if(ENABLE_ORC)
find_package(ORC)
else(ENABLE_ORC)
else()
message(STATUS "Disabling use of ORC")
endif(ENABLE_ORC)
endif()
########################################################################
@@ -240,7 +240,7 @@ if(DOXYGEN_FOUND)
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
endif()
########################################################################
@@ -255,7 +255,8 @@ set(includedir "\${prefix}/include")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr.pc.in
${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.pc
@ONLY)
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/volk_gnsssdr.pc
@@ -304,17 +305,17 @@ if(APPLE)
set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE
PATH "Library Install Name Destination Directory" FORCE)
endif(NOT CMAKE_INSTALL_NAME_DIR)
endif()
if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${VOLK_LIBRARY_DIR} CACHE
PATH "Library Install RPath" FORCE)
endif(NOT CMAKE_INSTALL_RPATH)
endif()
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
BOOL "Do Build Using Library Install RPath" FORCE)
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
endif(APPLE)
endif()
endif()
########################################################################
@@ -358,7 +359,7 @@ configure_file(
if(NOT CMAKE_MODULES_DIR)
set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
endif(NOT CMAKE_MODULES_DIR)
endif()
install(
FILES
@@ -371,7 +372,7 @@ install(
########################################################################
# Option to enable QA testing, on by default
########################################################################
OPTION(ENABLE_TESTING "Enable QA testing" ON)
option(ENABLE_TESTING "Enable QA testing" ON)
if(ENABLE_TESTING)
message(STATUS "QA Testing is enabled.")
else()
@@ -383,7 +384,7 @@ message(STATUS " Modify using: -DENABLE_TESTING=ON/OFF")
########################################################################
# Option to enable post-build profiling using volk_profile, off by default
########################################################################
OPTION(ENABLE_PROFILING "Launch system profiler after build" OFF)
option(ENABLE_PROFILING "Launch system profiler after build" OFF)
if(ENABLE_PROFILING)
set(ENABLE_STATIC_LIBS ON)
if(DEFINED VOLK_CONFIGPATH)

View File

@@ -22,7 +22,7 @@
########################################################################
if(MSVC)
include_directories(${PROJECT_SOURCE_DIR}/cmake/msvc)
endif(MSVC)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@@ -37,26 +37,26 @@ include_directories(
set(Clang_required_link "")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(Clang_required_link "c++")
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(Clang_required_link "c++")
endif()
endif()
if(ORC_FOUND)
set(orc_lib ${ORC_LIBRARIES})
elseif(ORC_FOUND)
else()
set(orc_lib "")
endif(ORC_FOUND)
endif()
# allow 'large' files in 32 bit builds
if(UNIX)
add_definitions( -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
)
endif(UNIX)
add_definitions(-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
)
endif()
# MAKE volk_gnsssdr_profile
@@ -68,18 +68,18 @@ add_executable(volk_gnsssdr_profile
if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr_profile volk_gnsssdr_static ${Boost_LIBRARIES} ${Clang_required_link} ${orc_lib})
else(ENABLE_STATIC_LIBS)
else()
target_link_libraries(volk_gnsssdr_profile volk_gnsssdr ${Boost_LIBRARIES} ${Clang_required_link} ${orc_lib})
add_dependencies(volk_gnsssdr_profile volk_gnsssdr)
endif(ENABLE_STATIC_LIBS)
endif()
if(ENABLE_STRIP)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile
PROPERTIES LINK_FLAGS "-s")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
endif(ENABLE_STRIP)
PROPERTIES LINK_FLAGS "-s")
endif()
endif()
install(
@@ -92,18 +92,18 @@ install(
# MAKE volk_gnsssdr-config-info
add_executable(volk_gnsssdr-config-info volk_gnsssdr-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc)
if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${Clang_required_link} ${orc_lib})
else(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${Clang_required_link} ${orc_lib})
add_dependencies(volk_gnsssdr-config-info volk_gnsssdr)
endif(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${Clang_required_link} ${orc_lib})
else()
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${Clang_required_link} ${orc_lib})
add_dependencies(volk_gnsssdr-config-info volk_gnsssdr)
endif()
if(ENABLE_STRIP)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr-config-info
PROPERTIES LINK_FLAGS "-s")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
endif(ENABLE_STRIP)
PROPERTIES LINK_FLAGS "-s")
endif()
endif()
install(
TARGETS volk_gnsssdr-config-info
@@ -114,17 +114,14 @@ install(
# Launch volk_gnsssdr_profile if requested to do so
if(ENABLE_PROFILING)
if(DEFINED VOLK_CONFIGPATH)
if(DEFINED VOLK_CONFIGPATH)
set( VOLK_CONFIG_ARG "-p${VOLK_CONFIGPATH}" )
set( VOLK_CONFIG "${VOLK_CONFIGPATH}/volk_gnsssdr_config" )
endif()
add_custom_command(OUTPUT ${VOLK_CONFIG}
endif()
add_custom_command(OUTPUT ${VOLK_CONFIG}
COMMAND volk_gnsssdr_profile "${VOLK_CONFIG_ARG}"
DEPENDS volk_gnsssdr_profile
COMMENT "Launching profiler, this may take a few minutes..."
)
add_custom_target(volk-gnsssdr-profile-run ALL DEPENDS ${VOLK_CONFIG})
endif()

View File

@@ -16,52 +16,56 @@
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_ORC "orc-0.4 > 0.4.22")
find_package(PkgConfig)
pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22")
FIND_PROGRAM(ORCC_EXECUTABLE orcc
HINTS ${PC_ORC_TOOLSDIR}
PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin)
find_program(ORCC_EXECUTABLE orcc
HINTS ${PC_ORC_TOOLSDIR}
PATHS ${ORC_ROOT}/bin ${CMAKE_INSTALL_PREFIX}/bin
)
FIND_PATH(ORC_INCLUDE_DIR NAMES orc/orc.h
HINTS ${PC_ORC_INCLUDEDIR}
PATHS ${ORC_ROOT}/include/orc-0.4 ${CMAKE_INSTALL_PREFIX}/include/orc-0.4)
FIND_PATH(ORC_LIBRARY_DIR NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
HINTS ${PC_ORC_LIBDIR}
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib64
/usr/lib
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
FIND_LIBRARY(ORC_LIB orc-0.4
HINTS ${PC_ORC_LIBRARY_DIRS}
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
LIST(APPEND ORC_LIBRARY
${ORC_LIB}
find_path(ORC_INCLUDE_DIR NAMES orc/orc.h
HINTS ${PC_ORC_INCLUDEDIR}
PATHS ${ORC_ROOT}/include/orc-0.4 ${CMAKE_INSTALL_PREFIX}/include/orc-0.4
)
SET(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
SET(ORC_LIBRARIES ${ORC_LIBRARY})
SET(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
find_path(ORC_LIBRARY_DIR
NAMES ${CMAKE_SHARED_LIBRARY_PREFIX}orc-0.4${CMAKE_SHARED_LIBRARY_SUFFIX}
HINTS ${PC_ORC_LIBDIR}
/usr/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib64
/usr/lib
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE)
find_library(ORC_LIB orc-0.4
HINTS ${PC_ORC_LIBRARY_DIRS}
PATHS ${ORC_ROOT}/lib${LIB_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
list(APPEND ORC_LIBRARY
${ORC_LIB}
)
set(ORC_INCLUDE_DIRS ${ORC_INCLUDE_DIR})
set(ORC_LIBRARIES ${ORC_LIBRARY})
set(ORC_LIBRARY_DIRS ${ORC_LIBRARY_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ORC "orc files" ORC_LIBRARY ORC_INCLUDE_DIR ORCC_EXECUTABLE)
mark_as_advanced(ORC_INCLUDE_DIR ORC_LIBRARY ORCC_EXECUTABLE)

View File

@@ -30,7 +30,7 @@ set(__INCLUDED_VOLK_ADD_TEST TRUE)
function(VOLK_GEN_TEST executable_name)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(VOLK_TEST "" "" "SOURCES;TARGET_DEPS;EXTRA_LIB_DIRS;ENVIRONS;ARGS" ${ARGN})
cmake_parse_arguments(VOLK_TEST "" "" "SOURCES;TARGET_DEPS;EXTRA_LIB_DIRS;ENVIRONS;ARGS" ${ARGN})
add_executable(${executable_name} ${VOLK_TEST_SOURCES})
target_link_libraries(${executable_name} ${VOLK_TEST_TARGET_DEPS})
endfunction()
@@ -53,7 +53,7 @@ function(VOLK_ADD_TEST test_name executable_name)
#parse the arguments for component names
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(VOLK_TEST "" "" "TARGET_DEPS;EXTRA_LIB_DIRS;ENVIRONS;ARGS" ${ARGN})
cmake_parse_arguments(VOLK_TEST "" "" "TARGET_DEPS;EXTRA_LIB_DIRS;ENVIRONS;ARGS" ${ARGN})
#set the initial environs to use
set(environs ${VOLK_TEST_ENVIRONS})
@@ -146,7 +146,7 @@ function(VOLK_ADD_TEST test_name executable_name)
#each line sets an environment variable
foreach(environ ${environs})
file(APPEND ${sh_file} "export ${environ}\n")
endforeach(environ)
endforeach()
set(VOLK_TEST_ARGS "${test_name}")
@@ -166,7 +166,7 @@ function(VOLK_ADD_TEST test_name executable_name)
COMMAND ${SHELL} ${sh_file} ${TARGET_DIR_LIST}
)
endif(UNIX)
endif()
if(WIN32)
#In the land of windows, all libraries must be in the PATH. Since
@@ -199,7 +199,7 @@ function(VOLK_ADD_TEST test_name executable_name)
#each line sets an environment variable
foreach(environ ${environs})
file(APPEND ${bat_file} "SET ${environ}\n")
endforeach(environ)
endforeach()
set(VOLK_TEST_ARGS "${test_name}")
@@ -213,7 +213,7 @@ function(VOLK_ADD_TEST test_name executable_name)
add_test(NAME qa_${test_name}
COMMAND ${bat_file} ${TARGET_DIR_LIST}
)
endif(WIN32)
endif()
endfunction(VOLK_ADD_TEST)
endfunction()

View File

@@ -31,21 +31,21 @@ set(BOOST_REQUIRED_COMPONENTS
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
endif()
if(MSVC)
set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} chrono)
if (NOT DEFINED BOOST_ALL_DYN_LINK)
if(NOT DEFINED BOOST_ALL_DYN_LINK)
set(BOOST_ALL_DYN_LINK TRUE)
endif()
set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
if(BOOST_ALL_DYN_LINK)
add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
else(BOOST_ALL_DYN_LINK)
else()
unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
endif(BOOST_ALL_DYN_LINK)
endif(MSVC)
endif()
endif()
find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
@@ -68,10 +68,10 @@ set(Boost_ADDITIONAL_VERSIONS
# Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669
# Similar problems with Boost 1.46 and 1.47.
OPTION(ENABLE_BAD_BOOST "Enable known bad versions of Boost" OFF)
option(ENABLE_BAD_BOOST "Enable known bad versions of Boost" OFF)
if(ENABLE_BAD_BOOST)
MESSAGE(STATUS "Enabling use of known bad versions of Boost.")
endif(ENABLE_BAD_BOOST)
message(STATUS "Enabling use of known bad versions of Boost.")
endif()
# For any unsuitable Boost version, add the version number below in
# the following format: XXYYZZ
@@ -80,17 +80,17 @@ endif(ENABLE_BAD_BOOST)
# YY is the minor version number ('46' for 1.46)
# ZZ is the patcher version number (typically just '00')
set(Boost_NOGO_VERSIONS
104600 104601 104700 105200
)
104600 104601 104700 105200
)
foreach(ver ${Boost_NOGO_VERSIONS})
if("${Boost_VERSION}" STREQUAL "${ver}")
if(NOT ENABLE_BAD_BOOST)
MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Disabling.")
set(Boost_FOUND FALSE)
else(NOT ENABLE_BAD_BOOST)
MESSAGE(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Continuing anyway.")
set(Boost_FOUND TRUE)
endif(NOT ENABLE_BAD_BOOST)
endif("${Boost_VERSION}" STREQUAL "${ver}")
endforeach(ver)
if("${Boost_VERSION}" STREQUAL "${ver}")
if(NOT ENABLE_BAD_BOOST)
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Disabling.")
set(Boost_FOUND FALSE)
else()
message(STATUS "WARNING: Found a known bad version of Boost (v${Boost_VERSION}). Continuing anyway.")
set(Boost_FOUND TRUE)
endif()
endif()
endforeach()

View File

@@ -53,16 +53,16 @@ list(APPEND AVAIL_BUILDTYPES
# the avialable build types.
########################################################################
function(VOLK_CHECK_BUILD_TYPE settype)
STRING(TOUPPER ${settype} _settype)
string(TOUPPER ${settype} _settype)
foreach(btype ${AVAIL_BUILDTYPES})
STRING(TOUPPER ${btype} _btype)
string(TOUPPER ${btype} _btype)
if(${_settype} STREQUAL ${_btype})
return() # found it; exit cleanly
endif(${_settype} STREQUAL ${_btype})
endforeach(btype)
endif()
endforeach()
# Build type not found; error out
message(FATAL_ERROR "Build type '${settype}' not valid, must be one of: ${AVAIL_BUILDTYPES}")
endfunction(VOLK_CHECK_BUILD_TYPE)
endfunction()
########################################################################
# For GCC and Clang, we can set a build type:
@@ -74,23 +74,23 @@ endfunction(VOLK_CHECK_BUILD_TYPE)
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
SET(CMAKE_CXX_FLAGS_DEBUGPARANOID "-Wall -Wextra -g -O0" CACHE STRING
set(CMAKE_CXX_FLAGS_DEBUGPARANOID "-Wall -Wextra -g -O0" CACHE STRING
"Flags used by the C++ compiler during DebugParanoid builds." FORCE)
SET(CMAKE_C_FLAGS_DEBUGPARANOID "-Wall -Wextra -g -O0" CACHE STRING
set(CMAKE_C_FLAGS_DEBUGPARANOID "-Wall -Wextra -g -O0" CACHE STRING
"Flags used by the C compiler during DebugParanoid builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUGPARANOID
set(CMAKE_EXE_LINKER_FLAGS_DEBUGPARANOID
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used for linking binaries during NoOptWithASM builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUGPARANOID
set(CMAKE_SHARED_LINKER_FLAGS_DEBUGPARANOID
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used by the shared lib linker during NoOptWithASM builds." FORCE)
MARK_AS_ADVANCED(
mark_as_advanced(
CMAKE_CXX_FLAGS_DEBUGPARANOID
CMAKE_C_FLAGS_DEBUGPARANOID
CMAKE_EXE_LINKER_FLAGS_DEBUGPARANOID
CMAKE_SHARED_LINKER_DEBUGPARANOID)
endif(NOT WIN32)
endif()
########################################################################
@@ -105,23 +105,23 @@ endif(NOT WIN32)
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
SET(CMAKE_CXX_FLAGS_NOOPTWITHASM "-save-temps -g -O0" CACHE STRING
set(CMAKE_CXX_FLAGS_NOOPTWITHASM "-save-temps -g -O0" CACHE STRING
"Flags used by the C++ compiler during NoOptWithASM builds." FORCE)
SET(CMAKE_C_FLAGS_NOOPTWITHASM "-save-temps -g -O0" CACHE STRING
set(CMAKE_C_FLAGS_NOOPTWITHASM "-save-temps -g -O0" CACHE STRING
"Flags used by the C compiler during NoOptWithASM builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
set(CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used for linking binaries during NoOptWithASM builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM
set(CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used by the shared lib linker during NoOptWithASM builds." FORCE)
MARK_AS_ADVANCED(
mark_as_advanced(
CMAKE_CXX_FLAGS_NOOPTWITHASM
CMAKE_C_FLAGS_NOOPTWITHASM
CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM)
endif(NOT WIN32)
endif()
########################################################################
@@ -137,23 +137,23 @@ endif(NOT WIN32)
########################################################################
if(NOT WIN32)
SET(CMAKE_CXX_FLAGS_O2WITHASM "-save-temps -g -O2" CACHE STRING
set(CMAKE_CXX_FLAGS_O2WITHASM "-save-temps -g -O2" CACHE STRING
"Flags used by the C++ compiler during O2WithASM builds." FORCE)
SET(CMAKE_C_FLAGS_O2WITHASM "-save-temps -g -O2" CACHE STRING
set(CMAKE_C_FLAGS_O2WITHASM "-save-temps -g -O2" CACHE STRING
"Flags used by the C compiler during O2WithASM builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_O2WITHASM
set(CMAKE_EXE_LINKER_FLAGS_O2WITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used for linking binaries during O2WithASM builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_O2WITHASM
set(CMAKE_SHARED_LINKER_FLAGS_O2WITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used by the shared lib linker during O2WithASM builds." FORCE)
MARK_AS_ADVANCED(
mark_as_advanced(
CMAKE_CXX_FLAGS_O2WITHASM
CMAKE_C_FLAGS_O2WITHASM
CMAKE_EXE_LINKER_FLAGS_O2WITHASM
CMAKE_SHARED_LINKER_FLAGS_O2WITHASM)
endif(NOT WIN32)
endif()
########################################################################
@@ -169,23 +169,23 @@ endif(NOT WIN32)
########################################################################
if(NOT WIN32)
SET(CMAKE_CXX_FLAGS_O3WITHASM "-save-temps -g -O3" CACHE STRING
set(CMAKE_CXX_FLAGS_O3WITHASM "-save-temps -g -O3" CACHE STRING
"Flags used by the C++ compiler during O3WithASM builds." FORCE)
SET(CMAKE_C_FLAGS_O3WITHASM "-save-temps -g -O3" CACHE STRING
set(CMAKE_C_FLAGS_O3WITHASM "-save-temps -g -O3" CACHE STRING
"Flags used by the C compiler during O3WithASM builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_O3WITHASM
set(CMAKE_EXE_LINKER_FLAGS_O3WITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used for linking binaries during O3WithASM builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_O3WITHASM
set(CMAKE_SHARED_LINKER_FLAGS_O3WITHASM
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used by the shared lib linker during O3WithASM builds." FORCE)
MARK_AS_ADVANCED(
mark_as_advanced(
CMAKE_CXX_FLAGS_O3WITHASM
CMAKE_C_FLAGS_O3WITHASM
CMAKE_EXE_LINKER_FLAGS_O3WITHASM
CMAKE_SHARED_LINKER_FLAGS_O3WITHASM)
endif(NOT WIN32)
endif()
########################################################################
# For GCC and Clang, we can set a build type:
@@ -197,14 +197,14 @@ endif(NOT WIN32)
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
SET(CMAKE_CXX_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
set(CMAKE_CXX_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler during Address Sanitized builds." FORCE)
SET(CMAKE_C_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
set(CMAKE_C_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler during Address Sanitized builds." FORCE)
MARK_AS_ADVANCED(
mark_as_advanced(
CMAKE_CXX_FLAGS_ASAN
CMAKE_C_FLAGS_ASAN
CMAKE_EXE_LINKER_FLAGS_DEBUGPARANOID
CMAKE_SHARED_LINKER_DEBUGPARANOID)
endif(NOT WIN32)
endif()

View File

@@ -15,33 +15,33 @@
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_VOLK_GNSSSDR volk_gnsssdr)
include(FindPkgConfig)
pkg_check_modules(PC_VOLK_GNSSSDR volk_gnsssdr)
FIND_PATH(
find_path(
VOLK_GNSSSDR_INCLUDE_DIRS
NAMES volk_gnsssdr/volk_gnsssdr.h
HINTS $ENV{VOLK_DIR}/include
${PC_VOLK_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
/opt/local/include
"@CMAKE_INSTALL_PREFIX@/include"
/usr/include
/opt/local/include
"@CMAKE_INSTALL_PREFIX@/include"
)
FIND_LIBRARY(
find_library(
VOLK_GNSSSDR_LIBRARIES
NAMES volk_gnsssdr
HINTS $ENV{VOLK_DIR}/lib
${PC_VOLK_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/opt/local/lib
"@CMAKE_INSTALL_PREFIX@/lib"
/usr/local/lib64
/usr/lib
/usr/lib64
/opt/local/lib
"@CMAKE_INSTALL_PREFIX@/lib"
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(VOLK_GNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
MARK_AS_ADVANCED(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VOLKGNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
mark_as_advanced(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)

View File

@@ -27,6 +27,6 @@ if(${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${MAJOR_VERSION})
if(NOT ${PACKAGE_FIND_VERSION_PATCH} GREATER ${MAINT_VERSION})
set(PACKAGE_VERSION_EXACT 1) # exact match for API version
set(PACKAGE_VERSION_COMPATIBLE 1) # compat for minor/patch version
endif(NOT ${PACKAGE_FIND_VERSION_PATCH} GREATER ${MAINT_VERSION})
endif(${PACKAGE_FIND_VERSION_MINOR} EQUAL ${MINOR_VERSION})
endif(${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${MAJOR_VERSION})
endif()
endif()
endif()

View File

@@ -32,30 +32,30 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
if(PYTHON_EXECUTABLE)
message(STATUS "User set python executable ${PYTHON_EXECUTABLE}")
find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED)
else(PYTHON_EXECUTABLE)
else()
message(STATUS "PYTHON_EXECUTABLE not set - using default python2")
message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python3 to build for python3.")
find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION})
if(NOT PYTHONINTERP_FOUND)
message(STATUS "python2 not found - using python3")
find_package(PythonInterp ${VOLK_PYTHON3_MIN_VERSION} REQUIRED)
endif(NOT PYTHONINTERP_FOUND)
endif(PYTHON_EXECUTABLE)
endif()
endif()
find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT)
else(CMAKE_VERSION VERSION_LESS 3.12)
else()
if(PYTHON_EXECUTABLE)
message(STATUS "User set python executable ${PYTHON_EXECUTABLE}")
find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED)
else(PYTHON_EXECUTABLE)
find_package (Python COMPONENTS Interpreter)
else()
find_package(Python COMPONENTS Interpreter)
set(PYTHON_VERSION_MAJOR ${Python_VERSION_MAJOR})
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
endif(PYTHON_EXECUTABLE)
endif(CMAKE_VERSION VERSION_LESS 3.12)
endif()
endif()
if (${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3)
if(${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3)
set(PYTHON3 TRUE)
endif ()
endif()
@@ -79,7 +79,7 @@ macro(VOLK_PYTHON_CHECK_MODULE_RAW desc python_code have)
message(STATUS "Python checking for ${desc} - not found")
set(${have} FALSE)
endif()
endmacro(VOLK_PYTHON_CHECK_MODULE_RAW)
endmacro()
macro(VOLK_PYTHON_CHECK_MODULE desc mod cmd have)
VOLK_PYTHON_CHECK_MODULE_RAW(
@@ -92,7 +92,7 @@ except (ImportError, AssertionError): exit(-1)
except: pass
#########################################"
"${have}")
endmacro(VOLK_PYTHON_CHECK_MODULE)
endmacro()
########################################################################
# Sets the python installation directory VOLK_PYTHON_DIR
@@ -121,14 +121,14 @@ unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
endfunction(VOLK_UNIQUE_TARGET)
endfunction()
########################################################################
# Install python sources (also builds and installs byte-compiled python)
########################################################################
function(VOLK_PYTHON_INSTALL)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(VOLK_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
cmake_parse_arguments(VOLK_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
####################################################################
if(VOLK_PYTHON_INSTALL_FILES)
@@ -162,7 +162,7 @@ function(VOLK_PYTHON_INSTALL)
get_filename_component(pygen_path ${pygenfile} PATH)
file(MAKE_DIRECTORY ${pygen_path})
endforeach(pyfile)
endforeach()
#the command to generate the pyc files
add_custom_command(
@@ -189,8 +189,8 @@ function(VOLK_PYTHON_INSTALL)
####################################################################
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
if (CMAKE_CROSSCOMPILING)
set(pyexe_native "/usr/bin/env python")
if(CMAKE_CROSSCOMPILING)
set(pyexe_native "/usr/bin/env python")
endif()
foreach(pyfile ${VOLK_PYTHON_INSTALL_PROGRAMS})
@@ -220,13 +220,13 @@ function(VOLK_PYTHON_INSTALL)
DESTINATION ${VOLK_PYTHON_INSTALL_DESTINATION}
COMPONENT ${VOLK_PYTHON_INSTALL_COMPONENT}
)
endforeach(pyfile)
endforeach()
endif()
VOLK_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
volk_unique_target("pygen" ${python_install_gen_targets})
endfunction(VOLK_PYTHON_INSTALL)
endfunction()
########################################################################
# Write the python helper script that generates byte code files

View File

@@ -22,22 +22,22 @@
# header file detection
########################################################################
include(CheckIncludeFile)
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
check_include_file(cpuid.h HAVE_CPUID_H)
if(HAVE_CPUID_H)
add_definitions(-DHAVE_CPUID_H)
endif()
CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
check_include_file(intrin.h HAVE_INTRIN_H)
if(HAVE_INTRIN_H)
add_definitions(-DHAVE_INTRIN_H)
endif()
CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
check_include_file(fenv.h HAVE_FENV_H)
if(HAVE_FENV_H)
add_definitions(-DHAVE_FENV_H)
endif()
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
if(HAVE_DLFCN_H)
add_definitions(-DHAVE_DLFCN_H)
list(APPEND volk_gnsssdr_libraries ${CMAKE_DL_LIBS})
@@ -62,7 +62,7 @@ endif()
########################################################################
if(COMPILER_NAME MATCHES "GNU")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-Werror=unused-command-line-argument" HAVE_WERROR_UNUSED_CMD_LINE_ARG)
check_cxx_compiler_flag("-Werror=unused-command-line-argument" HAVE_WERROR_UNUSED_CMD_LINE_ARG)
if(HAVE_WERROR_UNUSED_CMD_LINE_ARG)
set(VOLK_FLAG_CHECK_FLAGS "-Werror=unused-command-line-argument")
endif()
@@ -74,20 +74,20 @@ endif()
########################################################################
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
if(HAVE_POSIX_MEMALIGN)
add_definitions(-DHAVE_POSIX_MEMALIGN)
endif(HAVE_POSIX_MEMALIGN)
endif()
if(NOT DEFINED _XOPEN_SOURCE)
add_definitions(-D_XOPEN_SOURCE=700)
endif(NOT DEFINED _XOPEN_SOURCE)
endif()
########################################################################
# detect x86 flavor of CPU
########################################################################
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(i.86|x86|x86_64|amd64|AMD64)$")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(i.86|x86|x86_64|amd64|AMD64)$")
message(STATUS "x86* CPU detected")
set(CPU_IS_x86 TRUE)
endif()
@@ -106,7 +106,7 @@ macro(check_arch arch_name)
set(flags ${ARGN})
set(have_${arch_name} TRUE)
foreach(flag ${flags})
if (MSVC AND (${flag} STREQUAL "/arch:SSE2" OR ${flag} STREQUAL "/arch:SSE" ))
if(MSVC AND (${flag} STREQUAL "/arch:SSE2" OR ${flag} STREQUAL "/arch:SSE"))
# SSE/SSE2 is supported in MSVC since VS 2005 but flag not available when compiling 64-bit so do not check
else()
include(CheckCXXCompilerFlag)
@@ -119,27 +119,27 @@ macro(check_arch arch_name)
if(VOLK_FLAG_CHECK_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${VOLK_FLAG_CHECK_FLAGS})
endif()
CHECK_CXX_COMPILER_FLAG(${flag} ${have_flag})
check_cxx_compiler_flag(${flag} ${have_flag})
unset(CMAKE_REQUIRED_FLAGS)
if (NOT ${have_flag})
if(NOT ${have_flag})
set(have_${arch_name} FALSE)
endif()
endif()
endforeach()
if (have_${arch_name})
if(have_${arch_name})
list(APPEND available_archs ${arch_name})
endif()
endmacro(check_arch)
endmacro()
foreach(line ${arch_flag_lines})
string(REGEX REPLACE "," ";" arch_flags ${line})
check_arch(${arch_flags})
endforeach(line)
endforeach()
macro(OVERRULE_ARCH arch reason)
message(STATUS "${reason}, Overruled arch ${arch}")
list(REMOVE_ITEM available_archs ${arch})
endmacro(OVERRULE_ARCH)
endmacro()
########################################################################
# eliminate AVX on if not on x86, or if the compiler does not accept
@@ -150,25 +150,25 @@ set(HAVE_XGETBV 0)
set(HAVE_AVX_CVTPI32_PS 0)
if(CPU_IS_x86)
# check to see if the compiler/linker works with xgetb instruction
if (NOT MSVC)
if(NOT MSVC)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }")
else (NOT MSVC)
else()
#MSVC defines an intrinsic
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "#include <stdio.h> \n #include <intrin.h> \n int main() { int avxSupported = 0; \n#if (_MSC_FULL_VER >= 160040219) \nint cpuInfo[4]; __cpuid(cpuInfo, 1);\nif ((cpuInfo[2] & (1 << 27) || 0) && (cpuInfo[2] & (1 << 28) || 0)) \n{\nunsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\n avxSupported = (xcrFeatureMask & 0x6) == 6;}\n#endif \n return 1- avxSupported; }")
endif(NOT MSVC)
endif()
execute_process(COMMAND ${CMAKE_C_COMPILER} -o
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_compile_result)
if(NOT ${avx_compile_result} EQUAL 0)
OVERRULE_ARCH(avx "Compiler or linker missing xgetbv instruction")
overrule_arch(avx "Compiler or linker missing xgetbv instruction")
elseif(NOT CROSSCOMPILE_MULTILIB)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_exe_result)
if(NOT ${avx_exe_result} EQUAL 0)
OVERRULE_ARCH(avx "CPU missing xgetbv")
overrule_arch(avx "CPU missing xgetbv")
else()
set(HAVE_XGETBV 1)
endif()
@@ -184,7 +184,7 @@ if(CPU_IS_x86)
#########################################################################
# check to see if the compiler/linker works with cvtpi32_ps instrinsic when using AVX
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
@@ -192,13 +192,13 @@ if(CPU_IS_x86)
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_compile_result)
if(NOT ${avx_compile_result} EQUAL 0)
OVERRULE_ARCH(avx "Compiler missing cvtpi32_ps instrinsic")
overrule_arch(avx "Compiler missing cvtpi32_ps instrinsic")
elseif(NOT CROSSCOMPILE_MULTILIB)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_exe_result)
if(NOT ${avx_exe_result} EQUAL 0)
OVERRULE_ARCH(avx "CPU missing cvtpi32_ps")
overrule_arch(avx "CPU missing cvtpi32_ps")
else()
set(HAVE_AVX_CVTPI32_PS 1)
endif()
@@ -207,13 +207,13 @@ if(CPU_IS_x86)
endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c)
else(CMAKE_SIZEOF_VOID_P EQUAL 4)
# 64-bit compilations won't need this command so don't overrule AVX
set(HAVE_AVX_CVTPI32_PS 0)
endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
else()
# 64-bit compilations won't need this command so don't overrule AVX
set(HAVE_AVX_CVTPI32_PS 0)
endif()
# Disable SSE4a if Clang is less than version 3.2
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
# Figure out the version of Clang
if(CMAKE_VERSION VERSION_LESS "2.8.10")
# Exctract the Clang version from the --version string.
@@ -222,14 +222,14 @@ if(CPU_IS_x86)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE clang_version)
string(REGEX MATCH "[0-9].[0-9]" CMAKE_C_COMPILER_VERSION ${clang_version})
endif(CMAKE_VERSION VERSION_LESS "2.8.10")
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.2")
OVERRULE_ARCH(sse4_a "Clang >= 3.2 required for SSE4a")
endif(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.2")
endif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
overrule_arch(sse4_a "Clang >= 3.2 required for SSE4a")
endif()
endif()
endif(CPU_IS_x86)
endif()
if(${HAVE_XGETBV})
add_definitions(-DHAVE_XGETBV)
@@ -244,17 +244,17 @@ endif()
########################################################################
if(NOT CPU_IS_x86)
OVERRULE_ARCH(3dnow "Architecture is not x86 or x86_64")
OVERRULE_ARCH(mmx "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse2 "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse3 "Architecture is not x86 or x86_64")
OVERRULE_ARCH(ssse3 "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse4_a "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse4_1 "Architecture is not x86 or x86_64")
OVERRULE_ARCH(sse4_2 "Architecture is not x86 or x86_64")
OVERRULE_ARCH(avx "Architecture is not x86 or x86_64")
endif(NOT CPU_IS_x86)
overrule_arch(3dnow "Architecture is not x86 or x86_64")
overrule_arch(mmx "Architecture is not x86 or x86_64")
overrule_arch(sse "Architecture is not x86 or x86_64")
overrule_arch(sse2 "Architecture is not x86 or x86_64")
overrule_arch(sse3 "Architecture is not x86 or x86_64")
overrule_arch(ssse3 "Architecture is not x86 or x86_64")
overrule_arch(sse4_a "Architecture is not x86 or x86_64")
overrule_arch(sse4_1 "Architecture is not x86 or x86_64")
overrule_arch(sse4_2 "Architecture is not x86 or x86_64")
overrule_arch(avx "Architecture is not x86 or x86_64")
endif()
########################################################################
# Select neon based on ARM ISA version
@@ -265,33 +265,33 @@ endif(NOT CPU_IS_x86)
include(CheckCSourceCompiles)
check_c_source_compiles("#include <arm_neon.h>\nint main(){ uint8_t *dest; uint8x8_t res; vst1_u8(dest, res); }"
neon_compile_result)
neon_compile_result)
if(neon_compile_result)
check_c_source_compiles("int main(){asm volatile(\"vrev32.8 q0, q0\");}"
have_neonv7_result )
have_neonv7_result)
check_c_source_compiles("int main(){asm volatile(\"sub v1.4s,v1.4s,v1.4s\");}"
have_neonv8_result )
have_neonv8_result)
if (have_neonv7_result)
OVERRULE_ARCH(neonv8 "CPU is armv7")
if(have_neonv7_result)
overrule_arch(neonv8 "CPU is armv7")
endif()
if (have_neonv8_result)
OVERRULE_ARCH(neonv7 "CPU is armv8")
if(have_neonv8_result)
overrule_arch(neonv7 "CPU is armv8")
endif()
else(neon_compile_result)
OVERRULE_ARCH(neon "Compiler doesn't support NEON")
OVERRULE_ARCH(neonv7 "Compiler doesn't support NEON")
OVERRULE_ARCH(neonv8 "Compiler doesn't support NEON")
endif(neon_compile_result)
else()
overrule_arch(neon "Compiler doesn't support NEON")
overrule_arch(neonv7 "Compiler doesn't support NEON")
overrule_arch(neonv8 "Compiler doesn't support NEON")
endif()
########################################################################
# implement overruling in the ORC case,
# since ORC always passes flag detection
########################################################################
if(NOT ORC_FOUND)
OVERRULE_ARCH(orc "ORC support not found")
overrule_arch(orc "ORC support not found")
endif()
########################################################################
@@ -301,16 +301,16 @@ endif()
if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86)
include(CheckTypeSize)
check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY)
if (${SIZEOF_CPU} EQUAL 64)
OVERRULE_ARCH(32 "CPU width is 64 bits")
if(${SIZEOF_CPU} EQUAL 64)
overrule_arch(32 "CPU width is 64 bits")
endif()
if (${SIZEOF_CPU} EQUAL 32)
OVERRULE_ARCH(64 "CPU width is 32 bits")
if(${SIZEOF_CPU} EQUAL 32)
overrule_arch(64 "CPU width is 32 bits")
endif()
#MSVC 64 bit does not have MMX, overrule it
if (${SIZEOF_CPU} EQUAL 64 AND MSVC)
OVERRULE_ARCH(mmx "No MMX for Win64")
if(${SIZEOF_CPU} EQUAL 64 AND MSVC)
overrule_arch(mmx "No MMX for Win64")
endif()
endif()
@@ -340,12 +340,12 @@ execute_process(
foreach(arch mmx orc 64 32)
foreach(machine_name ${available_machines})
string(REPLACE "_${arch}" "" machine_name_no_arch ${machine_name})
if (${machine_name} STREQUAL ${machine_name_no_arch})
if(${machine_name} STREQUAL ${machine_name_no_arch})
else()
list(REMOVE_ITEM available_machines ${machine_name_no_arch})
endif()
endforeach(machine_name)
endforeach(arch)
endforeach()
endforeach()
########################################################################
# done overrules! print the result
@@ -373,7 +373,7 @@ macro(gen_template tmpl output)
${PROJECT_SOURCE_DIR}/gen/volk_gnsssdr_tmpl_utils.py
--input ${tmpl} --output ${output} ${ARGN}
)
endmacro(gen_template)
endmacro()
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/volk_gnsssdr)
@@ -399,13 +399,13 @@ if(MSVC)
elseif(MSVC11) #Visual Studio 11
set(cmake_c_compiler_version "Microsoft Visual Studio 11.0")
elseif(MSVC12) #Visual Studio 12
SET(cmake_c_compiler_version "Microsoft Visual Studio 12.0")
set(cmake_c_compiler_version "Microsoft Visual Studio 12.0")
endif()
else()
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE cmake_c_compiler_version)
endif(MSVC)
set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FLAGS}\n${CMAKE_CXX_COMPILER}:::${CMAKE_CXX_FLAGS_${GRCBTU}} ${CMAKE_CXX_FLAGS}\n" )
endif()
set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FLAGS}\n${CMAKE_CXX_COMPILER}:::${CMAKE_CXX_FLAGS_${GRCBTU}} ${CMAKE_CXX_FLAGS}\n")
foreach(machine_name ${available_machines})
#generate machine source
@@ -419,8 +419,8 @@ foreach(machine_name ${available_machines})
--mode "machine_flags" --machine "${machine_name}" --compiler "${COMPILER_NAME}"
OUTPUT_VARIABLE ${machine_name}_flags OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "BUILD INFO ::: ${machine_name} ::: ${COMPILER_NAME} ::: ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}")
set(COMPILER_INFO "${COMPILER_INFO}${machine_name}:::${COMPILER_NAME}:::${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}\n" )
message(STATUS "BUILD INFO ::: ${machine_name} ::: ${COMPILER_NAME} ::: ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}")
set(COMPILER_INFO "${COMPILER_INFO}${machine_name}:::${COMPILER_NAME}:::${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}\n")
if(${machine_name}_flags AND NOT MSVC)
set_source_files_properties(${machine_source} PROPERTIES COMPILE_FLAGS "${${machine_name}_flags}")
endif()
@@ -428,12 +428,12 @@ foreach(machine_name ${available_machines})
#add to available machine defs
string(TOUPPER LV_MACHINE_${machine_name} machine_def)
list(APPEND machine_defs ${machine_def})
endforeach(machine_name)
endforeach()
# Convert to a C string to compile and display properly
string(STRIP "${cmake_c_compiler_version}" cmake_c_compiler_version)
string(STRIP ${COMPILER_INFO} COMPILER_INFO)
MESSAGE(STATUS "Compiler Version: ${cmake_c_compiler_version}")
message(STATUS "Compiler Version: ${cmake_c_compiler_version}")
string(REPLACE "\n" " \\n" cmake_c_compiler_version ${cmake_c_compiler_version})
string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO})
@@ -462,7 +462,7 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
# set up the assembler flags and include the source files
foreach(ARCH ${ASM_ARCHS_AVAILABLE})
string(REGEX MATCH "${ARCH}" ASM_ARCH "${available_archs}")
if( ASM_ARCH STREQUAL "neonv7" )
if(ASM_ARCH STREQUAL "neonv7")
message(STATUS "---- Adding ASM files") # we always use ATT syntax
message(STATUS "-- Detected neon architecture; enabling ASM")
# setup architecture specific assembler flags
@@ -474,23 +474,23 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
foreach(asm_file ${asm_files})
list(APPEND volk_gnsssdr_sources ${asm_file})
message(STATUS "Adding source file: ${asm_file}")
endforeach(asm_file)
endforeach()
endif()
enable_language(ASM)
set(CMAKE_ASM_FLAGS ${ARCH_ASM_FLAGS})
message(STATUS "c flags: ${FULL_C_FLAGS}")
message(STATUS "asm flags: ${CMAKE_ASM_FLAGS}")
endforeach(ARCH)
endforeach()
else(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
else()
message(STATUS "Not enabling ASM support. CMake >= 2.8.10 required.")
foreach(machine_name ${available_machines})
string(REGEX MATCH "neon" NEON_MACHINE ${machine_name})
if( NEON_MACHINE STREQUAL "neon")
if(NEON_MACHINE STREQUAL "neon")
message(FATAL_ERROR "CMake >= 2.8.10 is required for ARM NEON support")
endif()
endforeach()
endif(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
endif()
########################################################################
# Handle orc support
@@ -517,7 +517,7 @@ if(ORC_FOUND)
)
list(APPEND volk_gnsssdr_sources ${orcc_gen})
endforeach(orc_file)
endforeach()
else()
message(STATUS "Did not find liborc and orcc, disabling orc support...")
endif()
@@ -571,7 +571,7 @@ endif()
if(CMAKE_VERSION VERSION_GREATER "2.8.7")
#Create a volk_gnsssdr object library (requires cmake >= 2.8.8)
add_library(volk_gnsssdr_obj OBJECT ${volk_gnsssdr_sources})
#Add dynamic library
add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>)
target_link_libraries(volk_gnsssdr ${volk_gnsssdr_libraries} ${Boost_LIBRARIES})
@@ -597,7 +597,7 @@ if(CMAKE_VERSION VERSION_GREATER "2.8.7")
install(TARGETS volk_gnsssdr_static
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel"
)
endif(ENABLE_STATIC_LIBS)
endif()
#Older cmake versions (slower to build when building dynamic/static libs)
else()
@@ -619,14 +619,14 @@ else()
if(NOT WIN32)
set_target_properties(volk_gnsssdr_static
PROPERTIES OUTPUT_NAME volk_gnsssdr)
endif(NOT WIN32)
endif()
install(TARGETS volk_gnsssdr_static
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file
)
endif(ENABLE_STATIC_LIBS)
endif()
endif()
endif(CMAKE_VERSION VERSION_GREATER "2.8.7")
########################################################################
# Build the QA test application
########################################################################
@@ -641,7 +641,7 @@ if(ENABLE_TESTING)
)
include(VolkAddTest)
VOLK_GEN_TEST("volk_gnsssdr_test_all"
volk_gen_test("volk_gnsssdr_test_all"
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/testqa.cc
${CMAKE_CURRENT_SOURCE_DIR}/qa_utils.cc
TARGET_DEPS volk_gnsssdr
@@ -649,7 +649,7 @@ if(ENABLE_TESTING)
foreach(kernel ${h_files})
get_filename_component(kernel ${kernel} NAME)
string(REPLACE ".h" "" kernel ${kernel})
VOLK_ADD_TEST(${kernel} "volk_gnsssdr_test_all")
volk_add_test(${kernel} "volk_gnsssdr_test_all")
endforeach()
endif(ENABLE_TESTING)
endif()