From eba2ff04f47b49df90bd4f194a7501761a16df1b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 12:34:43 +0200 Subject: [PATCH 01/16] gnsstk: new recipe --- recipes/gnsstk/all/conandata.yml | 4 + recipes/gnsstk/all/conanfile.py | 99 +++++++++++++++++++ .../gnsstk/all/test_package/CMakeLists.txt | 7 ++ recipes/gnsstk/all/test_package/bahr1620.04o | 32 ++++++ recipes/gnsstk/all/test_package/conanfile.py | 29 ++++++ .../gnsstk/all/test_package/test_package.cpp | 78 +++++++++++++++ recipes/gnsstk/config.yml | 3 + 7 files changed, 252 insertions(+) create mode 100644 recipes/gnsstk/all/conandata.yml create mode 100644 recipes/gnsstk/all/conanfile.py create mode 100644 recipes/gnsstk/all/test_package/CMakeLists.txt create mode 100644 recipes/gnsstk/all/test_package/bahr1620.04o create mode 100644 recipes/gnsstk/all/test_package/conanfile.py create mode 100644 recipes/gnsstk/all/test_package/test_package.cpp create mode 100644 recipes/gnsstk/config.yml diff --git a/recipes/gnsstk/all/conandata.yml b/recipes/gnsstk/all/conandata.yml new file mode 100644 index 0000000000000..6d338f223823c --- /dev/null +++ b/recipes/gnsstk/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "14.0.0": + url: "https://github.com/SGL-UT/gnsstk/archive/refs/tags/v14.0.0.tar.gz" + sha256: "ca265361ff803ce6bed357e438dc34caa96911f75b21cb3a0eb41d1131edb809" diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py new file mode 100644 index 0000000000000..0d27d3ea86432 --- /dev/null +++ b/recipes/gnsstk/all/conanfile.py @@ -0,0 +1,99 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.files import get, copy, rmdir, save +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], + "versioned_header": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_ext": True, + "versioned_header": False, + } + options_description = { + "build_ext": "Build the ext library, in addition to the core library.", + "versioned_header": "Install header files into maj/min versioned directory.", + } + + + 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 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.cache_variables["BUILD_EXT"] = self.options.build_ext + tc.cache_variables["VERSIONED_HEADER_INSTALL"] = self.options.versioned_header + tc.cache_variables["USE_RPATH"] = False + tc.generate() + + def _patch_sources(self): + # Disable examples + save(self, os.path.join(self.source_folder, "examples", "CMakeLists.txt"), "") + # Disable tests + save(self, os.path.join(self.source_folder, "core", "tests", "CMakeLists.txt"), "") + + 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"]: + 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")) + + 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"] + + if self.options.versioned_header: + versioned_dir = f"gnsstk{Version(self.version).major}" + self.cpp_info.includedirs.append(os.path.join("include", versioned_dir)) + self.cpp_info.includedirs.append(os.path.join("include", versioned_dir, "gnsstk")) + else: + self.cpp_info.includedirs.append(os.path.join("include", "gnsstk")) + + 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") diff --git a/recipes/gnsstk/all/test_package/CMakeLists.txt b/recipes/gnsstk/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..13cf11e598ba0 --- /dev/null +++ b/recipes/gnsstk/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +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) diff --git a/recipes/gnsstk/all/test_package/bahr1620.04o b/recipes/gnsstk/all/test_package/bahr1620.04o new file mode 100644 index 0000000000000..bb4477daac4b5 --- /dev/null +++ b/recipes/gnsstk/all/test_package/bahr1620.04o @@ -0,0 +1,32 @@ + 2.10 Observation GPS RINEX VERSION / TYPE +GFW - ROW NIMA 06/09/2004 23:59:50 PGM / RUN BY / DATE +Data are thinned (not smoothed) 30s. observations COMMENT +BAHR MARKER NAME +24901M002 MARKER NUMBER +NIMA NATIONAL IMAGERY AND MAPPING AGENCY OBSERVER / AGENCY +03215 ASHTECH Z-XII3 1Y07-1DY4 REC # / TYPE / VERS +11942 ASH700936B_M SNOW ANT # / TYPE + 3633909.1016 4425275.5033 2799861.2736 APPROX POSITION XYZ + 3.122 .0000 .0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 9 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + 30 INTERVAL + 2004 6 10 0 0 0.0000000 TIME OF FIRST OBS + END OF HEADER + 04 6 10 0 0 0.0000000 0 8G 4G 5G 6G 9G10G17G24G30 .000000000 + -4163185.462 7 -3221253.335 7 24236698.057 24236698.474 24236701.852 + -3468.113 -2702.427 39.020 36.240 + -24427464.594 9 -19023455.680 8 20576567.763 20576567.469 20576570.973 + 1063.071 828.369 51.180 48.050 + -9865068.837 8 -7679434.221 7 23523582.258 23523582.877 23523586.029 + 1614.770 1258.271 41.100 37.980 + -13714338.112 8 -10674627.667 8 22141230.525 22141230.616 22141233.839 + -2753.216 -2145.357 47.700 44.230 + -10408234.922 8 -8095254.721 8 23044359.240 23044357.397 23044361.846 + 2504.879 1951.866 41.800 40.060 + -23488911.056 8 -18291343.413 8 20813497.339 20813496.926 20813501.340 + 478.914 373.188 49.440 49.440 + -17641408.437 8 -13706556.260 8 21415744.099 21415744.065 21415748.245 + -2041.643 -1590.884 48.750 45.620 + -14855795.469 8 -11555992.528 8 22341902.327 22341902.993 22341906.794 + 2784.951 2170.104 43.880 41.800 diff --git a/recipes/gnsstk/all/test_package/conanfile.py b/recipes/gnsstk/all/test_package/conanfile.py new file mode 100644 index 0000000000000..9fcaadbdf9e83 --- /dev/null +++ b/recipes/gnsstk/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +from conan.tools.files import copy + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + copy(self, "bahr1620.04o", self.source_folder, self.cpp.build.bindir) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gnsstk/all/test_package/test_package.cpp b/recipes/gnsstk/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4570b05fadae4 --- /dev/null +++ b/recipes/gnsstk/all/test_package/test_package.cpp @@ -0,0 +1,78 @@ +// https://github.com/SGL-UT/gnsstk/blob/v14.0.0/examples/Rinex3ObsStream_example_1.cpp + +//============================================================================== +// +// This file is part of GNSSTk, the ARL:UT GNSS Toolkit. +// +// The GNSSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GNSSTk 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GNSSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// This software was developed by Applied Research Laboratories at the +// University of Texas at Austin. +// Copyright 2004-2022, The Board of Regents of The University of Texas System +// +//============================================================================== + +//============================================================================== +// +// This software was developed by Applied Research Laboratories at the +// University of Texas at Austin, under contract to an agency or agencies +// within the U.S. Department of Defense. The U.S. Government retains all +// rights to use, duplicate, distribute, disclose, or release this software. +// +// Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================== + +/** @file Rinex3ObsStream_example_1.cpp implements an extremely basic + * example of using Rinex3ObsStream for input and output where the + * input data is copied to the output with unnecessary processing. */ + +#include +#include + +#include "Rinex3ObsBase.hpp" +#include "Rinex3ObsHeader.hpp" +#include "Rinex3ObsData.hpp" +#include "Rinex3ObsStream.hpp" + +using namespace std; +using namespace gnsstk; + +int main() +{ + // Create the input file stream + Rinex3ObsStream rin("bahr1620.04o"); + + // Create the output file stream + Rinex3ObsStream rout("bahr1620.04o.new", ios::out|ios::trunc); + + // Read the RINEX header + Rinex3ObsHeader head; //RINEX header object + rin >> head; + rout.header = rin.header; + rout << rout.header; + + // Loop over all data epochs + Rinex3ObsData data; //RINEX data object + while (rin >> data) + { + rout << data; + } + + return 0; +} diff --git a/recipes/gnsstk/config.yml b/recipes/gnsstk/config.yml new file mode 100644 index 0000000000000..d95bd4e9ba8f1 --- /dev/null +++ b/recipes/gnsstk/config.yml @@ -0,0 +1,3 @@ +versions: + "14.0.0": + folder: all From b0ca05b49a868571f4d8164e9b3973b0ca16d55a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 14:00:01 +0200 Subject: [PATCH 02/16] gnsstk: disable -Werror, add cppstd check --- recipes/gnsstk/all/conanfile.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index 0d27d3ea86432..2642cfcb0c75b 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -1,8 +1,9 @@ import os from conan import ConanFile +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.files import get, copy, rmdir, save +from conan.tools.files import get, copy, rmdir, save, replace_in_file from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -50,6 +51,11 @@ def configure(self): 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, 11) + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -66,6 +72,9 @@ def _patch_sources(self): save(self, os.path.join(self.source_folder, "examples", "CMakeLists.txt"), "") # Disable tests 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", "") def build(self): self._patch_sources() From 1929d43ca65a60f21be7794adeb3dd9d5945b59c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 14:31:59 +0200 Subject: [PATCH 03/16] gnsstk: allow static builds --- recipes/gnsstk/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index 2642cfcb0c75b..bd8b6fe6dab5b 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -75,6 +75,9 @@ def _patch_sources(self): # Disable warnings as errors replace_in_file(self, os.path.join(self.source_folder, "BuildSetup.cmake"), "-Werror=return-type -Werror=deprecated", "") + # Do not force shared library + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " SHARED ", " ") def build(self): self._patch_sources() From 3a42b4cd79ed813994983a66ab50720c1579d0d4 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 14:55:13 +0200 Subject: [PATCH 04/16] gnsstk: add cxx_std_11 to test_package --- recipes/gnsstk/all/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/gnsstk/all/test_package/CMakeLists.txt b/recipes/gnsstk/all/test_package/CMakeLists.txt index 13cf11e598ba0..cd7fd1402f62d 100644 --- a/recipes/gnsstk/all/test_package/CMakeLists.txt +++ b/recipes/gnsstk/all/test_package/CMakeLists.txt @@ -5,3 +5,4 @@ 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) From d9d13b8c82db4625cc1201e1ede1102f809c2788 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 15:21:49 +0200 Subject: [PATCH 05/16] gnsstk: enable VERSIONED_HEADER_INSTALL --- recipes/gnsstk/all/conanfile.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index bd8b6fe6dab5b..b9091844ce4aa 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -26,17 +26,14 @@ class GNSSTkConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "build_ext": [True, False], - "versioned_header": [True, False], } default_options = { "shared": False, "fPIC": True, "build_ext": True, - "versioned_header": False, } options_description = { "build_ext": "Build the ext library, in addition to the core library.", - "versioned_header": "Install header files into maj/min versioned directory.", } @@ -63,7 +60,7 @@ def generate(self): tc = CMakeToolchain(self) # https://github.com/SGL-UT/gnsstk/blob/v14.0.0/CMakeLists.txt#L41-L51 tc.cache_variables["BUILD_EXT"] = self.options.build_ext - tc.cache_variables["VERSIONED_HEADER_INSTALL"] = self.options.versioned_header + tc.cache_variables["VERSIONED_HEADER_INSTALL"] = True tc.cache_variables["USE_RPATH"] = False tc.generate() @@ -98,12 +95,11 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "gnsstk") self.cpp_info.libs = ["gnsstk"] - if self.options.versioned_header: - versioned_dir = f"gnsstk{Version(self.version).major}" - self.cpp_info.includedirs.append(os.path.join("include", versioned_dir)) - self.cpp_info.includedirs.append(os.path.join("include", versioned_dir, "gnsstk")) - else: - self.cpp_info.includedirs.append(os.path.join("include", "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 != "Windows": self.cpp_info.defines.append("GNSSTK_STATIC_DEFINE") From bce0b75081a18dc1bdd23f17f2536caf58799a47 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 17:09:39 +0200 Subject: [PATCH 06/16] gnsstk: make sure CMAKE_CXX_STANDARD is set --- recipes/gnsstk/all/conanfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index b9091844ce4aa..c8bc00cd94e3c 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -36,6 +36,9 @@ class GNSSTkConan(ConanFile): "build_ext": "Build the ext library, in addition to the core library.", } + @property + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -51,7 +54,7 @@ def layout(self): 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, 11) + check_min_cppstd(self, self._min_cppstd) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -62,6 +65,9 @@ def generate(self): tc.cache_variables["BUILD_EXT"] = self.options.build_ext tc.cache_variables["VERSIONED_HEADER_INSTALL"] = True tc.cache_variables["USE_RPATH"] = False + if not self.settings.compiler.cppstd: + # The C++ standard is not set correctly by the project for apple-clang + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.generate() def _patch_sources(self): From 03d79ba582f5a5b02455c33d48d7dafa6c1e9305 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 1 Jan 2024 15:21:05 +0200 Subject: [PATCH 07/16] gnsstk: fix missing includes --- recipes/gnsstk/all/conandata.yml | 5 + recipes/gnsstk/all/conanfile.py | 13 +- .../all/patches/14.0-missing-includes.patch | 122 ++++++++++++++++++ 3 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 recipes/gnsstk/all/patches/14.0-missing-includes.patch diff --git a/recipes/gnsstk/all/conandata.yml b/recipes/gnsstk/all/conandata.yml index 6d338f223823c..8c70384a36085 100644 --- a/recipes/gnsstk/all/conandata.yml +++ b/recipes/gnsstk/all/conandata.yml @@ -2,3 +2,8 @@ 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" diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index c8bc00cd94e3c..088659c7b1182 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -1,9 +1,9 @@ import os from conan import ConanFile -from conan.tools.build import check_min_cppstd +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 +from conan.tools.files import get, copy, rmdir, save, replace_in_file, export_conandata_patches, apply_conandata_patches from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -40,6 +40,9 @@ class GNSSTkConan(ConanFile): 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 @@ -65,15 +68,15 @@ def generate(self): tc.cache_variables["BUILD_EXT"] = self.options.build_ext tc.cache_variables["VERSIONED_HEADER_INSTALL"] = True tc.cache_variables["USE_RPATH"] = False - if not self.settings.compiler.cppstd: + 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 tc.generate() def _patch_sources(self): - # Disable examples + apply_conandata_patches(self) + # Disable examples and tests save(self, os.path.join(self.source_folder, "examples", "CMakeLists.txt"), "") - # Disable tests 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"), diff --git a/recipes/gnsstk/all/patches/14.0-missing-includes.patch b/recipes/gnsstk/all/patches/14.0-missing-includes.patch new file mode 100644 index 0000000000000..d3e4f21cf3135 --- /dev/null +++ b/recipes/gnsstk/all/patches/14.0-missing-includes.patch @@ -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 ++#include + + 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 + #include + + #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 + #include + + 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 + #include ++#include + + 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 + #include + #include ++#include + + #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 + #include ++#include + + #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 ++#include + #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 + #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 ++#include + #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 + #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 + #include "NavFilterMgr.hpp" + #include "NavFilter.hpp" + #include "NavFilterKey.hpp" From 1864fa963c8ec2fc3e95bd38085cc64f307b178a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 1 Jan 2024 15:36:14 +0200 Subject: [PATCH 08/16] gnsstk: fix DLL location --- recipes/gnsstk/all/conanfile.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index 088659c7b1182..dbffc6049ca49 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -3,7 +3,7 @@ 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 +from conan.tools.files import get, copy, rmdir, save, replace_in_file, export_conandata_patches, apply_conandata_patches, mkdir from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -65,9 +65,9 @@ def source(self): def generate(self): tc = CMakeToolchain(self) # https://github.com/SGL-UT/gnsstk/blob/v14.0.0/CMakeLists.txt#L41-L51 - tc.cache_variables["BUILD_EXT"] = self.options.build_ext - tc.cache_variables["VERSIONED_HEADER_INSTALL"] = True - tc.cache_variables["USE_RPATH"] = False + 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 @@ -81,7 +81,7 @@ def _patch_sources(self): # Disable warnings as errors replace_in_file(self, os.path.join(self.source_folder, "BuildSetup.cmake"), "-Werror=return-type -Werror=deprecated", "") - # Do not force shared library + # Allow static library output replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), " SHARED ", " ") @@ -97,6 +97,10 @@ def package(self): 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")) + os.rename(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 From be588c8e79dd6bad008b85dddc18e47446d679fc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 1 Jan 2024 15:42:52 +0200 Subject: [PATCH 09/16] gnsstk: add compatibility patches from PRs --- recipes/gnsstk/all/conandata.yml | 8 +++ .../patches/14.0-21-gcc13-include-fix.patch | 22 ++++++ .../all/patches/14.0-8-cxx20-support.patch | 70 +++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 recipes/gnsstk/all/patches/14.0-21-gcc13-include-fix.patch create mode 100644 recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch diff --git a/recipes/gnsstk/all/conandata.yml b/recipes/gnsstk/all/conandata.yml index 8c70384a36085..29929504acd3e 100644 --- a/recipes/gnsstk/all/conandata.yml +++ b/recipes/gnsstk/all/conandata.yml @@ -7,3 +7,11 @@ patches: - 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" + - 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" diff --git a/recipes/gnsstk/all/patches/14.0-21-gcc13-include-fix.patch b/recipes/gnsstk/all/patches/14.0-21-gcc13-include-fix.patch new file mode 100644 index 0000000000000..e647785d7a4f5 --- /dev/null +++ b/recipes/gnsstk/all/patches/14.0-21-gcc13-include-fix.patch @@ -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 + #include + #include + #include diff --git a/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch b/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch new file mode 100644 index 0000000000000..cbe0555d2c59b --- /dev/null +++ b/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch @@ -0,0 +1,70 @@ +From 86ff5697f4e16cfb3dda2399c552cf47d41e3447 Mon Sep 17 00:00:00 2001 +From: Antoine +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; From 7314bedbb01031126c1f318b927f473030f089cd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 1 Jan 2024 15:45:59 +0200 Subject: [PATCH 10/16] gnsstk: fix linter warnings --- recipes/gnsstk/all/conanfile.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index dbffc6049ca49..ba4d681f5f923 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -3,7 +3,7 @@ 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 +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" @@ -99,8 +99,8 @@ def package(self): 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")) - os.rename(os.path.join(self.package_folder, "lib", "gnsstk.dll"), - os.path.join(self.package_folder, "bin", "gnsstk.dll")) + 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 @@ -114,6 +114,9 @@ def package_info(self): # 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: From aa71ff5362d76d927467f871a750c23cad06f74a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 2 Jan 2024 02:19:26 +0200 Subject: [PATCH 11/16] gnsstk: make macOS shared libs relocatable --- recipes/gnsstk/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index ba4d681f5f923..8b6fabd40f555 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -71,6 +71,8 @@ def generate(self): 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): From 2cfda8d256e71fca49d40d7a96e36d0dc854b6a7 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 31 Mar 2024 11:42:27 +0300 Subject: [PATCH 12/16] gnsstk: bump to v14.3.0 --- recipes/gnsstk/all/conandata.yml | 8 ++++---- recipes/gnsstk/config.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/gnsstk/all/conandata.yml b/recipes/gnsstk/all/conandata.yml index 29929504acd3e..4a57fc4f8b2cd 100644 --- a/recipes/gnsstk/all/conandata.yml +++ b/recipes/gnsstk/all/conandata.yml @@ -1,9 +1,9 @@ sources: - "14.0.0": - url: "https://github.com/SGL-UT/gnsstk/archive/refs/tags/v14.0.0.tar.gz" - sha256: "ca265361ff803ce6bed357e438dc34caa96911f75b21cb3a0eb41d1131edb809" + "14.3.0": + url: "https://github.com/SGL-UT/gnsstk/archive/refs/tags/v14.3.0.tar.gz" + sha256: "4e72f1464ee4ab5ca6250d6e348c67b6437294637008029dc7161be14c285c63" patches: - "14.0.0": + "14.3.0": - patch_file: "patches/14.0-missing-includes.patch" patch_description: "Fix missing includes" patch_type: "portability" diff --git a/recipes/gnsstk/config.yml b/recipes/gnsstk/config.yml index d95bd4e9ba8f1..1114745fd3287 100644 --- a/recipes/gnsstk/config.yml +++ b/recipes/gnsstk/config.yml @@ -1,3 +1,3 @@ versions: - "14.0.0": + "14.3.0": folder: all From 0fa2d26624cbd174f6cd0880696ff09fd15f36a5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 19 May 2024 14:35:52 +0300 Subject: [PATCH 13/16] gnsstk: simplify test_package --- recipes/gnsstk/all/test_package/bahr1620.04o | 32 --------- .../gnsstk/all/test_package/test_package.cpp | 71 +------------------ 2 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 recipes/gnsstk/all/test_package/bahr1620.04o diff --git a/recipes/gnsstk/all/test_package/bahr1620.04o b/recipes/gnsstk/all/test_package/bahr1620.04o deleted file mode 100644 index bb4477daac4b5..0000000000000 --- a/recipes/gnsstk/all/test_package/bahr1620.04o +++ /dev/null @@ -1,32 +0,0 @@ - 2.10 Observation GPS RINEX VERSION / TYPE -GFW - ROW NIMA 06/09/2004 23:59:50 PGM / RUN BY / DATE -Data are thinned (not smoothed) 30s. observations COMMENT -BAHR MARKER NAME -24901M002 MARKER NUMBER -NIMA NATIONAL IMAGERY AND MAPPING AGENCY OBSERVER / AGENCY -03215 ASHTECH Z-XII3 1Y07-1DY4 REC # / TYPE / VERS -11942 ASH700936B_M SNOW ANT # / TYPE - 3633909.1016 4425275.5033 2799861.2736 APPROX POSITION XYZ - 3.122 .0000 .0000 ANTENNA: DELTA H/E/N - 1 1 WAVELENGTH FACT L1/2 - 9 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV - 30 INTERVAL - 2004 6 10 0 0 0.0000000 TIME OF FIRST OBS - END OF HEADER - 04 6 10 0 0 0.0000000 0 8G 4G 5G 6G 9G10G17G24G30 .000000000 - -4163185.462 7 -3221253.335 7 24236698.057 24236698.474 24236701.852 - -3468.113 -2702.427 39.020 36.240 - -24427464.594 9 -19023455.680 8 20576567.763 20576567.469 20576570.973 - 1063.071 828.369 51.180 48.050 - -9865068.837 8 -7679434.221 7 23523582.258 23523582.877 23523586.029 - 1614.770 1258.271 41.100 37.980 - -13714338.112 8 -10674627.667 8 22141230.525 22141230.616 22141233.839 - -2753.216 -2145.357 47.700 44.230 - -10408234.922 8 -8095254.721 8 23044359.240 23044357.397 23044361.846 - 2504.879 1951.866 41.800 40.060 - -23488911.056 8 -18291343.413 8 20813497.339 20813496.926 20813501.340 - 478.914 373.188 49.440 49.440 - -17641408.437 8 -13706556.260 8 21415744.099 21415744.065 21415748.245 - -2041.643 -1590.884 48.750 45.620 - -14855795.469 8 -11555992.528 8 22341902.327 22341902.993 22341906.794 - 2784.951 2170.104 43.880 41.800 diff --git a/recipes/gnsstk/all/test_package/test_package.cpp b/recipes/gnsstk/all/test_package/test_package.cpp index 4570b05fadae4..37d762c9eb160 100644 --- a/recipes/gnsstk/all/test_package/test_package.cpp +++ b/recipes/gnsstk/all/test_package/test_package.cpp @@ -1,78 +1,9 @@ -// https://github.com/SGL-UT/gnsstk/blob/v14.0.0/examples/Rinex3ObsStream_example_1.cpp +#include -//============================================================================== -// -// This file is part of GNSSTk, the ARL:UT GNSS Toolkit. -// -// The GNSSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GNSSTk 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GNSSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// This software was developed by Applied Research Laboratories at the -// University of Texas at Austin. -// Copyright 2004-2022, The Board of Regents of The University of Texas System -// -//============================================================================== - -//============================================================================== -// -// This software was developed by Applied Research Laboratories at the -// University of Texas at Austin, under contract to an agency or agencies -// within the U.S. Department of Defense. The U.S. Government retains all -// rights to use, duplicate, distribute, disclose, or release this software. -// -// Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================== - -/** @file Rinex3ObsStream_example_1.cpp implements an extremely basic - * example of using Rinex3ObsStream for input and output where the - * input data is copied to the output with unnecessary processing. */ - -#include -#include - -#include "Rinex3ObsBase.hpp" -#include "Rinex3ObsHeader.hpp" -#include "Rinex3ObsData.hpp" -#include "Rinex3ObsStream.hpp" - -using namespace std; using namespace gnsstk; int main() { - // Create the input file stream Rinex3ObsStream rin("bahr1620.04o"); - - // Create the output file stream - Rinex3ObsStream rout("bahr1620.04o.new", ios::out|ios::trunc); - - // Read the RINEX header - Rinex3ObsHeader head; //RINEX header object - rin >> head; - rout.header = rin.header; - rout << rout.header; - - // Loop over all data epochs - Rinex3ObsData data; //RINEX data object - while (rin >> data) - { - rout << data; - } - return 0; } From 542d2b2a030d49bf3d587fe836b2ba8160dc7fbd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 19 May 2024 15:54:57 +0300 Subject: [PATCH 14/16] gnsstk: fix_apple_shared_install_name() --- recipes/gnsstk/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index 8b6fabd40f555..61e2689c6177d 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -1,6 +1,7 @@ import os from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name 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 @@ -67,7 +68,7 @@ def generate(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 + tc.variables["USE_RPATH"] = False # Adds install directory to RPATH otherwise 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 @@ -103,6 +104,7 @@ def package(self): 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")) + fix_apple_shared_install_name(self) def package_info(self): # https://github.com/SGL-UT/gnsstk/blob/stable/GNSSTKConfig.cmake.in From 969aeeda1c7f90c1e67a8af81c5457f9b36bd407 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Dec 2024 11:38:00 +0200 Subject: [PATCH 15/16] gnsstk: modernize for Conan v2 --- recipes/gnsstk/all/conanfile.py | 51 +++++++++++---------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/recipes/gnsstk/all/conanfile.py b/recipes/gnsstk/all/conanfile.py index 61e2689c6177d..45e2c7ac99199 100644 --- a/recipes/gnsstk/all/conanfile.py +++ b/recipes/gnsstk/all/conanfile.py @@ -1,13 +1,12 @@ import os from conan import ConanFile -from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.build import check_min_cppstd, check_max_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" +required_conan_version = ">=2.0.9" class GNSSTkConan(ConanFile): @@ -36,47 +35,23 @@ class GNSSTkConan(ConanFile): options_description = { "build_ext": "Build the ext library, in addition to the core library.", } - - @property - def _min_cppstd(self): - return 11 + implements = ["auto_shared_fpic"] 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) + # https://github.com/SGL-UT/gnsstk/blob/v14.0.0/BuildSetup.cmake#L54 + check_min_cppstd(self, 11) + # https://github.com/SGL-UT/gnsstk/pull/8 + check_max_cppstd(self, 17) 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 # Adds install directory to RPATH otherwise - 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"), "") @@ -88,8 +63,17 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), " SHARED ", " ") + 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 # Adds install directory to RPATH otherwise + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + def build(self): - self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -104,7 +88,6 @@ def package(self): 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")) - fix_apple_shared_install_name(self) def package_info(self): # https://github.com/SGL-UT/gnsstk/blob/stable/GNSSTKConfig.cmake.in From cca27673e6e0c70f7ed3dcd55797b2ecea0d447b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Dec 2024 11:39:17 +0200 Subject: [PATCH 16/16] gnsstk: drop 14.0-8-cxx20-support.patch --- recipes/gnsstk/all/conandata.yml | 4 -- .../all/patches/14.0-8-cxx20-support.patch | 70 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch diff --git a/recipes/gnsstk/all/conandata.yml b/recipes/gnsstk/all/conandata.yml index 4a57fc4f8b2cd..dca0d977137f4 100644 --- a/recipes/gnsstk/all/conandata.yml +++ b/recipes/gnsstk/all/conandata.yml @@ -7,10 +7,6 @@ patches: - 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" - patch_file: "patches/14.0-21-gcc13-include-fix.patch" patch_description: "Fix a missing include for GCC 13" patch_type: "portability" diff --git a/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch b/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch deleted file mode 100644 index cbe0555d2c59b..0000000000000 --- a/recipes/gnsstk/all/patches/14.0-8-cxx20-support.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 86ff5697f4e16cfb3dda2399c552cf47d41e3447 Mon Sep 17 00:00:00 2001 -From: Antoine -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;