Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnsstk: add new recipe #20890

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions recipes/gnsstk/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sources:
"14.0.0":
url: "https://github.com/SGL-UT/gnsstk/archive/refs/tags/v14.0.0.tar.gz"
sha256: "ca265361ff803ce6bed357e438dc34caa96911f75b21cb3a0eb41d1131edb809"
patches:
"14.0.0":
- patch_file: "patches/14.0-missing-includes.patch"
patch_description: "Fix missing includes"
patch_type: "portability"
- patch_file: "patches/14.0-8-cxx20-support.patch"
patch_description: "Minor fixes for C++20 support"
patch_type: "portability"
patch_source: "https://github.com/SGL-UT/gnsstk/pull/8"
valgur marked this conversation as resolved.
Show resolved Hide resolved
- patch_file: "patches/14.0-21-gcc13-include-fix.patch"
patch_description: "Fix a missing include for GCC 13"
patch_type: "portability"
patch_source: "https://github.com/SGL-UT/gnsstk/pull/21"
valgur marked this conversation as resolved.
Show resolved Hide resolved
125 changes: 125 additions & 0 deletions recipes/gnsstk/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import os

from conan import ConanFile
from conan.tools.build import check_min_cppstd, valid_min_cppstd
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
from conan.tools.files import get, copy, rmdir, save, replace_in_file, export_conandata_patches, apply_conandata_patches, mkdir, rename
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"


class GNSSTkConan(ConanFile):
name = "gnsstk"
description = (
"The GNSSTk core library provides a number of models and algorithms found in GNSS textbooks and classic papers, "
"such as solving for the user position or estimating atmospheric refraction. "
"Common data formats such as RINEX are supported as well."
)
license = "LGPL-3.0-only", "GPL-3.0-only"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/SGL-UT/gnsstk"
topics = ("gnss", "gps", "rinex")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"build_ext": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"build_ext": True,
}
options_description = {
"build_ext": "Build the ext library, in addition to the core library.",
}

@property
def _min_cppstd(self):
return 11

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.settings.compiler.cppstd:
# https://github.com/SGL-UT/gnsstk/blob/v14.0.0/BuildSetup.cmake#L54
check_min_cppstd(self, self._min_cppstd)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
# https://github.com/SGL-UT/gnsstk/blob/v14.0.0/CMakeLists.txt#L41-L51
tc.variables["BUILD_EXT"] = self.options.build_ext
tc.variables["VERSIONED_HEADER_INSTALL"] = True
tc.variables["USE_RPATH"] = False
if not valid_min_cppstd(self, self._min_cppstd):
# The C++ standard is not set correctly by the project for apple-clang
tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd
# Relocatable shared libs on macOS
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
tc.generate()

def _patch_sources(self):
apply_conandata_patches(self)
# Disable examples and tests
save(self, os.path.join(self.source_folder, "examples", "CMakeLists.txt"), "")
save(self, os.path.join(self.source_folder, "core", "tests", "CMakeLists.txt"), "")
# Disable warnings as errors
replace_in_file(self, os.path.join(self.source_folder, "BuildSetup.cmake"),
"-Werror=return-type -Werror=deprecated", "")
# Allow static library output
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
" SHARED ", " ")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
for license in ["LICENSE.md", "COPYING.LESSER.md", "COPYING.md"]:

Check warning on line 97 in recipes/gnsstk/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Redefining built-in 'license'
copy(self, license, dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "share"))
if self.settings.os == "Windows" and self.options.shared:
mkdir(self, os.path.join(self.package_folder, "bin"))
rename(self, os.path.join(self.package_folder, "lib", "gnsstk.dll"),
os.path.join(self.package_folder, "bin", "gnsstk.dll"))

def package_info(self):
# https://github.com/SGL-UT/gnsstk/blob/stable/GNSSTKConfig.cmake.in
self.cpp_info.set_property("cmake_file_name", "GNSSTk")
self.cpp_info.set_property("cmake_target_name", "gnsstk")
self.cpp_info.libs = ["gnsstk"]

versioned_dir = f"gnsstk{Version(self.version).major}"
# For compatibility with the default VERSIONED_HEADER_INSTALL=FALSE option
self.cpp_info.includedirs.append(os.path.join("include", versioned_dir))
# The examples use the headers without a directory prefix
self.cpp_info.includedirs.append(os.path.join("include", versioned_dir, "gnsstk"))

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")

if self.settings.os != "Windows":
self.cpp_info.defines.append("GNSSTK_STATIC_DEFINE")
if self.options.build_ext:
self.cpp_info.defines.append("BUILD_EXT")
22 changes: 22 additions & 0 deletions recipes/gnsstk/all/patches/14.0-21-gcc13-include-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 16c2c7e5b8dc80bb0eb46792fcb1f6e3dcbffbf4 Mon Sep 17 00:00:00 2001
From: dominformant <26122827+dominformant@users.noreply.github.com>
Date: Thu, 2 Nov 2023 10:33:46 +0100
Subject: [PATCH] Update ObsID.hpp

Add explicit import of cstdint
---
core/lib/GNSSCore/ObsID.hpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/core/lib/GNSSCore/ObsID.hpp b/core/lib/GNSSCore/ObsID.hpp
index d0251fe4c..612e4d2fa 100755
--- a/core/lib/GNSSCore/ObsID.hpp
+++ b/core/lib/GNSSCore/ObsID.hpp
@@ -47,6 +47,7 @@
#ifndef OBSID_HPP
#define OBSID_HPP

+#include <cstdint>
#include <iostream>
#include <iomanip>
#include <sstream>
70 changes: 70 additions & 0 deletions recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
From 86ff5697f4e16cfb3dda2399c552cf47d41e3447 Mon Sep 17 00:00:00 2001
From: Antoine <antoine.gagniere@orolia2s.com>
Date: Fri, 3 Mar 2023 23:10:13 +0100
Subject: [PATCH] support C++20

---
core/lib/CommandLine/getopt.h | 3 ++-
core/lib/FileHandling/RINEX/RinexClockBase.cpp | 3 +--
core/lib/Geomatics/SatPass.cpp | 2 +-
core/lib/Geomatics/SatPassUtilities.cpp | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/lib/CommandLine/getopt.h b/core/lib/CommandLine/getopt.h
index b7d1a13a5..43919d840 100644
--- a/core/lib/CommandLine/getopt.h
+++ b/core/lib/CommandLine/getopt.h
@@ -142,7 +142,8 @@ struct option
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
-extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
+extern int getopt (int __argc, char *const *__argv, const char *__shortopts)
+ __THROW __nonnull ((2,3));
# endif /* __GNU_LIBRARY__ */

# ifndef __need_getopt
diff --git a/core/lib/FileHandling/RINEX/RinexClockBase.cpp b/core/lib/FileHandling/RINEX/RinexClockBase.cpp
index 0c44ac809..cd0d48e26 100644
--- a/core/lib/FileHandling/RINEX/RinexClockBase.cpp
+++ b/core/lib/FileHandling/RINEX/RinexClockBase.cpp
@@ -58,7 +58,7 @@ namespace gnsstk

string RinexClockBase::writeTime(const CivilTime& dt) const
{
- if (dt == CommonTime::BEGINNING_OF_TIME)
+ if (dt == CivilTime(CommonTime::BEGINNING_OF_TIME))
{
return std::string(26, ' ');
}
@@ -111,4 +111,3 @@ namespace gnsstk


} // namespace
-
diff --git a/core/lib/Geomatics/SatPass.cpp b/core/lib/Geomatics/SatPass.cpp
index 2bc86c276..7a7df652c 100644
--- a/core/lib/Geomatics/SatPass.cpp
+++ b/core/lib/Geomatics/SatPass.cpp
@@ -1194,7 +1194,7 @@ namespace gnsstk
dt = N * dt;
return;
}
- if (refTime == CommonTime::BEGINNING_OF_TIME)
+ if (refTime == Epoch(CommonTime::BEGINNING_OF_TIME))
{
refTime = firstTime;
}
diff --git a/core/lib/Geomatics/SatPassUtilities.cpp b/core/lib/Geomatics/SatPassUtilities.cpp
index b5cf588b2..242a30fbe 100644
--- a/core/lib/Geomatics/SatPassUtilities.cpp
+++ b/core/lib/Geomatics/SatPassUtilities.cpp
@@ -396,7 +396,7 @@ namespace gnsstk
continue;
}

- if (prevtime != CommonTime::BEGINNING_OF_TIME)
+ if (prevtime != Epoch(CommonTime::BEGINNING_OF_TIME))
{
// compute time since the last epoch
dt = obsdata.time - prevtime;
122 changes: 122 additions & 0 deletions recipes/gnsstk/all/patches/14.0-missing-includes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
diff --git a/core/lib/FileHandling/Binex/BinexFilterOperators.hpp b/core/lib/FileHandling/Binex/BinexFilterOperators.hpp
--- a/core/lib/FileHandling/Binex/BinexFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/Binex/BinexFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -47,7 +47,7 @@
#include "FileFilter.hpp"
#include "BinexData.hpp"

-#include <set>
+#include <functional>

namespace gnsstk
{
diff --git a/core/lib/FileHandling/RINEX/RinexMetFilterOperators.hpp b/core/lib/FileHandling/RINEX/RinexMetFilterOperators.hpp
--- a/core/lib/FileHandling/RINEX/RinexMetFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/RINEX/RinexMetFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -44,6 +44,7 @@
#ifndef GNSSTK_RINEXMETFILTEROPERATORS_HPP
#define GNSSTK_RINEXMETFILTEROPERATORS_HPP

+#include <functional>
#include <set>

#include "CivilTime.hpp"
diff --git a/core/lib/FileHandling/RINEX/RinexNavFilterOperators.hpp b/core/lib/FileHandling/RINEX/RinexNavFilterOperators.hpp
--- a/core/lib/FileHandling/RINEX/RinexNavFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/RINEX/RinexNavFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -51,6 +51,7 @@
#include "RinexNavHeader.hpp"
#include "GPSWeekSecond.hpp"

+#include <functional>
#include <set>

namespace gnsstk
diff --git a/core/lib/FileHandling/RINEX/RinexObsFilterOperators.hpp b/core/lib/FileHandling/RINEX/RinexObsFilterOperators.hpp
--- a/core/lib/FileHandling/RINEX/RinexObsFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/RINEX/RinexObsFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -50,6 +50,7 @@

#include <set>
#include <algorithm>
+#include <functional>

namespace gnsstk
{
diff --git a/core/lib/FileHandling/RINEX3/Rinex3NavFilterOperators.hpp b/core/lib/FileHandling/RINEX3/Rinex3NavFilterOperators.hpp
--- a/core/lib/FileHandling/RINEX3/Rinex3NavFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/RINEX3/Rinex3NavFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -47,6 +47,7 @@
#include <set>
#include <list>
#include <string>
+#include <functional>

#include "FileFilter.hpp"
#include "Rinex3NavData.hpp"
diff --git a/core/lib/FileHandling/RINEX3/Rinex3ObsFilterOperators.hpp b/core/lib/FileHandling/RINEX3/Rinex3ObsFilterOperators.hpp
--- a/core/lib/FileHandling/RINEX3/Rinex3ObsFilterOperators.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/FileHandling/RINEX3/Rinex3ObsFilterOperators.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -46,6 +46,7 @@

#include <set>
#include <algorithm>
+#include <functional>

#include "FileFilter.hpp"
#include "Rinex3ObsData.hpp"
diff --git a/core/lib/NavFilter/CNavFilterData.hpp b/core/lib/NavFilter/CNavFilterData.hpp
--- a/core/lib/NavFilter/CNavFilterData.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/NavFilter/CNavFilterData.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -40,6 +40,7 @@
#define CNAVFILTERDATA_HPP

#include <stdint.h>
+#include <functional>
#include "NavFilterKey.hpp"
#include "PackedNavBits.hpp"

diff --git a/core/lib/NavFilter/LNavEphMaker.hpp b/core/lib/NavFilter/LNavEphMaker.hpp
--- a/core/lib/NavFilter/LNavEphMaker.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/NavFilter/LNavEphMaker.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -39,6 +39,7 @@
#ifndef LNAVEPHMAKER_HPP
#define LNAVEPHMAKER_HPP

+#include <functional>
#include "NavFilter.hpp"
#include "LNavFilterData.hpp"

diff --git a/core/lib/NavFilter/LNavFilterData.hpp b/core/lib/NavFilter/LNavFilterData.hpp
--- a/core/lib/NavFilter/LNavFilterData.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/NavFilter/LNavFilterData.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -40,6 +40,7 @@
#define LNAVFILTERDATA_HPP

#include <stdint.h>
+#include <functional>
#include "NavFilterKey.hpp"

namespace gnsstk
diff --git a/core/lib/NavFilter/LNavOrderFilter.hpp b/core/lib/NavFilter/LNavOrderFilter.hpp
--- a/core/lib/NavFilter/LNavOrderFilter.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/NavFilter/LNavOrderFilter.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -39,6 +39,7 @@
#ifndef LNAVORDERFILTER_HPP
#define LNAVORDERFILTER_HPP

+#include <functional>
#include "NavFilterMgr.hpp"
#include "NavFilter.hpp"
#include "LNavFilterData.hpp"
diff --git a/core/lib/NavFilter/NavOrderFilter.hpp b/core/lib/NavFilter/NavOrderFilter.hpp
--- a/core/lib/NavFilter/NavOrderFilter.hpp (revision c4b1b21124a093a1ee8f19c09b9d258d4a6d12aa)
+++ b/core/lib/NavFilter/NavOrderFilter.hpp (revision 4d5109c4b0be93be0ca906e25e9a0275d308f73e)
@@ -39,6 +39,7 @@
#ifndef NAVORDERFILTER_HPP
#define NAVORDERFILTER_HPP

+#include <functional>
#include "NavFilterMgr.hpp"
#include "NavFilter.hpp"
#include "NavFilterKey.hpp"
8 changes: 8 additions & 0 deletions recipes/gnsstk/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(GNSSTk REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE gnsstk)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
Loading