diff --git a/.ci_support/linux_64_.yaml b/.ci_support/linux_64_.yaml index d70ec87..18066bf 100644 --- a/.ci_support/linux_64_.yaml +++ b/.ci_support/linux_64_.yaml @@ -1,7 +1,7 @@ c_compiler: - gcc c_compiler_version: -- '12' +- '13' c_stdlib: - sysroot c_stdlib_version: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '12' +- '13' docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 pin_run_as_build: @@ -28,8 +28,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython -- 3.9.* *_73_pypy - 3.9.* *_cpython target_platform: - linux-64 diff --git a/.ci_support/linux_aarch64_.yaml b/.ci_support/linux_aarch64_.yaml index 4d18f21..42eb083 100644 --- a/.ci_support/linux_aarch64_.yaml +++ b/.ci_support/linux_aarch64_.yaml @@ -3,7 +3,7 @@ BUILD: c_compiler: - gcc c_compiler_version: -- '12' +- '13' c_stdlib: - sysroot c_stdlib_version: @@ -19,7 +19,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '12' +- '13' docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 pin_run_as_build: @@ -32,8 +32,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython -- 3.9.* *_73_pypy - 3.9.* *_cpython target_platform: - linux-aarch64 diff --git a/.ci_support/linux_ppc64le_.yaml b/.ci_support/linux_ppc64le_.yaml index 9f1ac9e..928c98d 100644 --- a/.ci_support/linux_ppc64le_.yaml +++ b/.ci_support/linux_ppc64le_.yaml @@ -1,7 +1,7 @@ c_compiler: - gcc c_compiler_version: -- '12' +- '13' c_stdlib: - sysroot c_stdlib_version: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '12' +- '13' docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 pin_run_as_build: @@ -28,8 +28,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython -- 3.9.* *_73_pypy - 3.9.* *_cpython target_platform: - linux-ppc64le diff --git a/.ci_support/migrations/pypy38.yaml b/.ci_support/migrations/pypy38.yaml deleted file mode 100644 index 2dd1ff4..0000000 --- a/.ci_support/migrations/pypy38.yaml +++ /dev/null @@ -1,43 +0,0 @@ -migrator_ts: 1647123563 -__migrator: - migration_number: 1 - operation: key_add - primary_key: python - ordering: - python: - - 3.6.* *_cpython - - 3.7.* *_cpython - - 3.8.* *_cpython - - 3.9.* *_cpython - - 3.10.* *_cpython - - 3.6.* *_73_pypy - - 3.7.* *_73_pypy - - 3.8.* *_73_pypy - - 3.9.* *_73_pypy - paused: False - longterm: True - use_local: False - check_solvable: True - exclude_pinned_pkgs: False - pr_limit: 10 - bump_number: 1 - commit_message: "Rebuild for PyPy3.8 and PyPy3.9" - exclude: - # this shouldn't attempt to modify the python feedstocks - - python - - pypy3.6 - - pypy-meta - ignored_deps_per_node: - matplotlib: - - pyqt - -python: - - 3.8.* *_73_pypy # [not (osx and arm64)] - - 3.9.* *_73_pypy # [not (osx and arm64)] -numpy: - # part of a zip_keys: python, python_impl, numpy - - 1.20 # [not (osx and arm64)] - - 1.20 # [not (osx and arm64)] -python_impl: - - pypy # [not (osx and arm64)] - - pypy # [not (osx and arm64)] diff --git a/.ci_support/osx_64_.yaml b/.ci_support/osx_64_.yaml index c8ed50b..291e58b 100644 --- a/.ci_support/osx_64_.yaml +++ b/.ci_support/osx_64_.yaml @@ -5,7 +5,7 @@ MACOSX_SDK_VERSION: c_compiler: - clang c_compiler_version: -- '16' +- '17' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '16' +- '17' macos_machine: - x86_64-apple-darwin13.4.0 pin_run_as_build: @@ -30,8 +30,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython -- 3.9.* *_73_pypy - 3.9.* *_cpython target_platform: - osx-64 diff --git a/.ci_support/osx_arm64_.yaml b/.ci_support/osx_arm64_.yaml index 10954b1..121bc74 100644 --- a/.ci_support/osx_arm64_.yaml +++ b/.ci_support/osx_arm64_.yaml @@ -5,7 +5,7 @@ MACOSX_SDK_VERSION: c_compiler: - clang c_compiler_version: -- '16' +- '17' c_stdlib: - macosx_deployment_target c_stdlib_version: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '16' +- '17' macos_machine: - arm64-apple-darwin20.0.0 pin_run_as_build: @@ -30,7 +30,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython - 3.9.* *_cpython target_platform: - osx-arm64 diff --git a/.ci_support/win_64_.yaml b/.ci_support/win_64_.yaml index c3e1bc9..a6ed14c 100644 --- a/.ci_support/win_64_.yaml +++ b/.ci_support/win_64_.yaml @@ -18,8 +18,6 @@ python: - 3.10.* *_cpython - 3.11.* *_cpython - 3.12.* *_cpython -- 3.8.* *_cpython -- 3.9.* *_73_pypy - 3.9.* *_cpython target_platform: - win-64 diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index 4dc98ae..1e7a821 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -43,6 +43,8 @@ setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" source run_conda_forge_build_setup + + # make the build number clobber make_build_number "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" diff --git a/.scripts/run_win_build.bat b/.scripts/run_win_build.bat index 8ee43cd..8e7db7b 100755 --- a/.scripts/run_win_build.bat +++ b/.scripts/run_win_build.bat @@ -24,7 +24,7 @@ set "CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1" :: Provision the necessary dependencies to build the recipe later echo Installing dependencies -mamba.exe install "python=3.10" pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" -c conda-forge --strict-channel-priority --yes +mamba.exe install pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" -c conda-forge --strict-channel-priority --yes if !errorlevel! neq 0 exit /b !errorlevel! :: Set basic configuration @@ -48,7 +48,7 @@ if NOT [%HOST_PLATFORM%] == [%BUILD_PLATFORM%] ( ) if NOT [%flow_run_id%] == [] ( - set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --extra-meta flow_run_id=%flow_run_id% remote_url=%remote_url% sha=%sha%" + set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --extra-meta flow_run_id=%flow_run_id% remote_url=%remote_url% sha=%sha%" ) call :end_group diff --git a/README.md b/README.md index 96a1631..d0b272b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -About sdformat14-feedstock +About sdformat15-feedstock ========================== Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/libsdformat-feedstock/blob/main/LICENSE.txt) @@ -82,55 +82,55 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | -| [![Conda Recipe](https://img.shields.io/badge/recipe-libsdformat14-green.svg)](https://anaconda.org/conda-forge/libsdformat14) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libsdformat14.svg)](https://anaconda.org/conda-forge/libsdformat14) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libsdformat14.svg)](https://anaconda.org/conda-forge/libsdformat14) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libsdformat14.svg)](https://anaconda.org/conda-forge/libsdformat14) | -| [![Conda Recipe](https://img.shields.io/badge/recipe-sdformat14-green.svg)](https://anaconda.org/conda-forge/sdformat14) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/sdformat14.svg)](https://anaconda.org/conda-forge/sdformat14) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/sdformat14.svg)](https://anaconda.org/conda-forge/sdformat14) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/sdformat14.svg)](https://anaconda.org/conda-forge/sdformat14) | -| [![Conda Recipe](https://img.shields.io/badge/recipe-sdformat14--python-green.svg)](https://anaconda.org/conda-forge/sdformat14-python) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/sdformat14-python.svg)](https://anaconda.org/conda-forge/sdformat14-python) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/sdformat14-python.svg)](https://anaconda.org/conda-forge/sdformat14-python) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/sdformat14-python.svg)](https://anaconda.org/conda-forge/sdformat14-python) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libsdformat15-green.svg)](https://anaconda.org/conda-forge/libsdformat15) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libsdformat15.svg)](https://anaconda.org/conda-forge/libsdformat15) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libsdformat15.svg)](https://anaconda.org/conda-forge/libsdformat15) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libsdformat15.svg)](https://anaconda.org/conda-forge/libsdformat15) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-sdformat15-green.svg)](https://anaconda.org/conda-forge/sdformat15) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/sdformat15.svg)](https://anaconda.org/conda-forge/sdformat15) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/sdformat15.svg)](https://anaconda.org/conda-forge/sdformat15) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/sdformat15.svg)](https://anaconda.org/conda-forge/sdformat15) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-sdformat15--python-green.svg)](https://anaconda.org/conda-forge/sdformat15-python) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/sdformat15-python.svg)](https://anaconda.org/conda-forge/sdformat15-python) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/sdformat15-python.svg)](https://anaconda.org/conda-forge/sdformat15-python) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/sdformat15-python.svg)](https://anaconda.org/conda-forge/sdformat15-python) | -Installing sdformat14 +Installing sdformat15 ===================== -Installing `sdformat14` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with: +Installing `sdformat15` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with: ``` conda config --add channels conda-forge conda config --set channel_priority strict ``` -Once the `conda-forge` channel has been enabled, `libsdformat14, sdformat14, sdformat14-python` can be installed with `conda`: +Once the `conda-forge` channel has been enabled, `libsdformat15, sdformat15, sdformat15-python` can be installed with `conda`: ``` -conda install libsdformat14 sdformat14 sdformat14-python +conda install libsdformat15 sdformat15 sdformat15-python ``` or with `mamba`: ``` -mamba install libsdformat14 sdformat14 sdformat14-python +mamba install libsdformat15 sdformat15 sdformat15-python ``` -It is possible to list all of the versions of `libsdformat14` available on your platform with `conda`: +It is possible to list all of the versions of `libsdformat15` available on your platform with `conda`: ``` -conda search libsdformat14 --channel conda-forge +conda search libsdformat15 --channel conda-forge ``` or with `mamba`: ``` -mamba search libsdformat14 --channel conda-forge +mamba search libsdformat15 --channel conda-forge ``` Alternatively, `mamba repoquery` may provide more information: ``` # Search all versions available on your platform: -mamba repoquery search libsdformat14 --channel conda-forge +mamba repoquery search libsdformat15 --channel conda-forge -# List packages depending on `libsdformat14`: -mamba repoquery whoneeds libsdformat14 --channel conda-forge +# List packages depending on `libsdformat15`: +mamba repoquery whoneeds libsdformat15 --channel conda-forge -# List dependencies of `libsdformat14`: -mamba repoquery depends libsdformat14 --channel conda-forge +# List dependencies of `libsdformat15`: +mamba repoquery depends libsdformat15 --channel conda-forge ``` @@ -175,17 +175,17 @@ Terminology produce the finished article (built conda distributions) -Updating sdformat14-feedstock +Updating sdformat15-feedstock ============================= -If you would like to improve the sdformat14 recipe or build a new +If you would like to improve the sdformat15 recipe or build a new package version, please fork this repository and submit a PR. Upon submission, your changes will be run on the appropriate platforms to give the reviewer an opportunity to confirm that the changes result in a successful build. Once merged, the recipe will be re-built and uploaded automatically to the `conda-forge` channel, whereupon the built conda packages will be available for everybody to install and use from the `conda-forge` channel. -Note that all branches in the conda-forge/sdformat14-feedstock are +Note that all branches in the conda-forge/sdformat15-feedstock are immediately built and any created packages are uploaded, so PRs should be based on branches in forks and branches in the main repository should only be used to build distinct package versions. diff --git a/build-locally.py b/build-locally.py index d78427b..6788aea 100755 --- a/build-locally.py +++ b/build-locally.py @@ -1,8 +1,11 @@ -#!/usr/bin/env python3 +#!/bin/sh +"""exec" "python3" "$0" "$@" #""" # fmt: off # fmt: on # # This file has been generated by conda-smithy in order to build the recipe # locally. # +# The line above this comment is a bash / sh / zsh guard +# to stop people from running it with the wrong interpreter import glob import os import platform diff --git a/recipe/1414.patch b/recipe/1414.patch deleted file mode 100644 index 0291b8b..0000000 --- a/recipe/1414.patch +++ /dev/null @@ -1,366 +0,0 @@ -From 28a60f8d6db03db213265ee1dfb5a6eaf9c4f7c3 Mon Sep 17 00:00:00 2001 -From: Silvio Traversaro -Date: Mon, 13 May 2024 16:38:44 +0200 -Subject: [PATCH] Add optional binary relocatability - -Signed-off-by: Silvio Traversaro ---- - CMakeLists.txt | 7 ++ - include/sdf/InstallationDirectories.hh | 40 +++++++ - include/sdf/config.hh.in | 4 +- - src/CMakeLists.txt | 25 ++++ - src/InstallationDirectories.cc | 151 +++++++++++++++++++++++++ - src/SDF.cc | 15 ++- - test/integration/CMakeLists.txt | 1 + - test/performance/CMakeLists.txt | 5 +- - 8 files changed, 240 insertions(+), 8 deletions(-) - create mode 100644 include/sdf/InstallationDirectories.hh - create mode 100644 src/InstallationDirectories.cc - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f771a9c65..d91666603 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -49,6 +49,13 @@ if (BUILD_SDF) - # Find tinyxml2. - gz_find_package(TINYXML2 REQUIRED) - -+ ################################################# -+ # Find DL if doing relocatable installation -+ if (GZ_ENABLE_RELOCATABLE_INSTALL) -+ gz_find_package(DL REQUIRED) -+ endif() -+ -+ - ################################################ - # Find urdfdom parser. Logic: - # -diff --git a/include/sdf/InstallationDirectories.hh b/include/sdf/InstallationDirectories.hh -new file mode 100644 -index 000000000..be3b0c678 ---- /dev/null -+++ b/include/sdf/InstallationDirectories.hh -@@ -0,0 +1,40 @@ -+/* -+ * Copyright (C) 2024 Open Source Robotics Foundation -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ * -+ */ -+ -+#ifndef SDF_INSTALLATION_DIRECTORIES_HH_ -+#define SDF_INSTALLATION_DIRECTORIES_HH_ -+ -+#include -+ -+#include -+#include -+ -+namespace sdf -+{ -+ inline namespace SDF_VERSION_NAMESPACE { -+ -+ /// \brief getInstallPrefix return the install prefix of the library -+ /// i.e. CMAKE_INSTALL_PREFIX unless the library has been moved -+ SDFORMAT_VISIBLE std::string getInstallPrefix(); -+ -+ /// \brief getSharePath return the share directory used by sdformat -+ SDFORMAT_VISIBLE std::string getSharePath(); -+ -+ } -+} -+ -+#endif -diff --git a/include/sdf/config.hh.in b/include/sdf/config.hh.in -index 6a32cb8bc..456eb12cc 100644 ---- a/include/sdf/config.hh.in -+++ b/include/sdf/config.hh.in -@@ -48,11 +48,11 @@ - #cmakedefine SDFORMAT_DISABLE_CONSOLE_LOGFILE 1 - - #ifndef SDF_SHARE_PATH --#define SDF_SHARE_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/" -+#define SDF_SHARE_PATH _Pragma ("GCC warning \"'SDF_SHARE_PATH' macro is deprecated, use sdf::getSharePath() function instead. \"") "${CMAKE_INSTALL_FULL_DATAROOTDIR}/" - #endif - - #ifndef SDF_VERSION_PATH --#define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${PROJECT_VERSION_MAJOR}/${PROJECT_VERSION}" -+#define SDF_VERSION_PATH _Pragma ("GCC warning \"'SDF_VERSION_PATH' macro is deprecated and should not be used. \"") "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${PROJECT_VERSION_MAJOR}/${PROJECT_VERSION}" - #endif - - #endif // #ifndef SDF_CONFIG_HH_ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index dfd569186..57dab8757 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -23,6 +23,24 @@ gz_create_core_library(SOURCES ${sources} - CXX_STANDARD 17 - LEGACY_PROJECT_PREFIX SDFormat - ) -+gz_add_get_install_prefix_impl(GET_INSTALL_PREFIX_FUNCTION sdf::getInstallPrefix -+ GET_INSTALL_PREFIX_HEADER sdf/InstallationDirectories.hh -+ OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE SDF_INSTALL_PREFIX) -+ -+# CMAKE_INSTALL_DATAROOTDIR may be an absolute path, let's make sure to use the -+# relative version -+if(IS_ABSOLUTE "${CMAKE_INSTALL_DATAROOTDIR}") -+ file(RELATIVE_PATH CMAKE_INSTALL_RELATIVE_DATAROOTDIR "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_DATAROOTDIR}") -+else() -+ set(CMAKE_INSTALL_RELATIVE_DATAROOTDIR "${CMAKE_INSTALL_DATAROOTDIR}") -+endif() -+ -+set_property( -+ SOURCE InstallationDirectories.cc -+ PROPERTY COMPILE_DEFINITIONS -+ CMAKE_INSTALL_RELATIVE_DATAROOTDIR="${CMAKE_INSTALL_RELATIVE_DATAROOTDIR}" -+) -+ - - target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} - PUBLIC -@@ -91,6 +109,11 @@ if (BUILD_TESTING) - -DGZ_SDFORMAT_STATIC_DEFINE - ) - -+ if(WIN32) -+ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} -+ PRIVATE shlwapi) -+ endif() -+ - gz_build_tests( - TYPE UNIT - SOURCES ${gtest_sources} -@@ -99,6 +122,8 @@ if (BUILD_TESTING) - ${PROJECT_SOURCE_DIR}/test - LIB_DEPS - library_for_tests -+ ENVIRONMENT -+ SDF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - ) - - if (TARGET UNIT_gz_TEST) -diff --git a/src/InstallationDirectories.cc b/src/InstallationDirectories.cc -new file mode 100644 -index 000000000..167df10eb ---- /dev/null -+++ b/src/InstallationDirectories.cc -@@ -0,0 +1,151 @@ -+/* -+ * Copyright (C) 2024 Open Source Robotics Foundation -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ * -+*/ -+ -+#include -+ -+#include -+#include -+ -+#ifdef _WIN32 -+#include -+#endif -+ -+namespace sdf -+{ -+inline namespace SDF_VERSION_NAMESPACE { -+ -+// We locally import the gz::common::joinPaths function -+// See https://github.com/gazebosim/gz-physics/pull/507#discussion_r1186919267 -+// for more details -+ -+// Function imported from -+// https://github.com/gazebosim/gz-common/blob/ignition-common4_4.6.2/src/FilesystemBoost.cc#L507 -+#ifndef WIN32 -+static const char preferred_separator = '/'; -+#else // Windows -+static const char preferred_separator = '\\'; -+#endif -+const std::string separator(const std::string &_p) -+{ -+ return _p + preferred_separator; -+} -+ -+// Function imported from -+// https://github.com/gazebosim/gz-common/blob/ignition-common4_4.6.2/src/Filesystem.cc#L227 -+std::string checkWindowsPath(const std::string _path) -+{ -+ if (_path.empty()) -+ return _path; -+ -+ // Check if this is a http or https, if so change backslashes generated by -+ // jointPaths to '/' -+ if ((_path.size() > 7 && 0 == _path.compare(0, 7, "http://")) || -+ (_path.size() > 8 && 0 == _path.compare(0, 8, "https://"))) -+ { -+ return std::regex_replace(_path, std::regex(R"(\\)"), "/"); -+ } -+ -+ // This is a Windows path, convert all '/' into backslashes -+ std::string result = std::regex_replace(_path, std::regex(R"(/)"), "\\"); -+ std::string drive_letters; -+ -+ // only Windows contains absolute paths starting with drive letters -+ if (result.length() > 3 && 0 == result.compare(1, 2, ":\\")) -+ { -+ drive_letters = result.substr(0, 3); -+ result = result.substr(3); -+ } -+ result = drive_letters + std::regex_replace( -+ result, std::regex("[<>:\"|?*]"), ""); -+ return result; -+} -+ -+// Function imported from -+// https://github.com/gazebosim/gz-common/blob/ignition-common4_4.6.2/src/Filesystem.cc#L256 -+std::string joinPaths(const std::string &_path1, -+ const std::string &_path2) -+{ -+ -+ /// This function is used to avoid duplicated path separators at the -+ /// beginning/end of the string, and between the two paths being joined. -+ /// \param[in] _path This is the string to sanitize. -+ /// \param[in] _stripLeading True if the leading separator should be -+ /// removed. -+ auto sanitizeSlashes = [](const std::string &_path, -+ bool _stripLeading = false) -+ { -+ // Shortcut -+ if (_path.empty()) -+ return _path; -+ -+ std::string result = _path; -+ -+ // Use the appropriate character for each platform. -+#ifndef _WIN32 -+ char replacement = '/'; -+#else -+ char replacement = '\\'; -+#endif -+ -+ // Sanitize the start of the path. -+ size_t index = 0; -+ size_t leadingIndex = _stripLeading ? 0 : 1; -+ for (; index < result.length() && result[index] == replacement; ++index) -+ { -+ } -+ if (index > leadingIndex) -+ result.erase(leadingIndex, index-leadingIndex); -+ -+ // Sanitize the end of the path. -+ index = result.length()-1; -+ for (; index < result.length() && result[index] == replacement; --index) -+ { -+ } -+ index += 1; -+ if (index < result.length()-1) -+ result.erase(index+1); -+ return result; -+ }; -+ -+ std::string path; -+#ifndef _WIN32 -+ path = sanitizeSlashes(sanitizeSlashes(separator(_path1)) + -+ sanitizeSlashes(_path2, true)); -+#else // _WIN32 -+ std::string path1 = sanitizeSlashes(checkWindowsPath(_path1)); -+ std::string path2 = sanitizeSlashes(checkWindowsPath(_path2), true); -+ std::vector combined(path1.length() + path2.length() + 2); -+ if (::PathCombineA(combined.data(), path1.c_str(), path2.c_str()) != NULL) -+ { -+ path = sanitizeSlashes(checkWindowsPath(std::string(combined.data()))); -+ } -+ else -+ { -+ path = sanitizeSlashes(checkWindowsPath(separator(path1) + path2)); -+ } -+#endif // _WIN32 -+ return path; -+} -+ -+std::string getSharePath() -+{ -+ return sdf::joinPaths( -+ getInstallPrefix(), CMAKE_INSTALL_RELATIVE_DATAROOTDIR); -+} -+ -+} -+} -diff --git a/src/SDF.cc b/src/SDF.cc -index 7a43d0f9a..f3442d6c5 100644 ---- a/src/SDF.cc -+++ b/src/SDF.cc -@@ -28,6 +28,7 @@ - #include "sdf/Assert.hh" - #include "sdf/Console.hh" - #include "sdf/Filesystem.hh" -+#include "sdf/InstallationDirectories.hh" - #include "sdf/SDFImpl.hh" - #include "SDFImplPrivate.hh" - #include "sdf/sdf_config.h" -@@ -45,11 +46,15 @@ std::string SDF::version = SDF_VERSION; // NOLINT(runtime/string) - - std::string sdfSharePath() - { --#ifdef SDF_SHARE_PATH -- if (std::string(SDF_SHARE_PATH) != "/") -- return SDF_SHARE_PATH; --#endif -- return ""; -+ std::string sharePath = sdf::getSharePath(); -+ if (sharePath != "/") -+ { -+ return sharePath; -+ } -+ else -+ { -+ return ""; -+ } - } - - ///////////////////////////////////////////////// -diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt -index b7d846e95..e7e4b2c93 100644 ---- a/test/integration/CMakeLists.txt -+++ b/test/integration/CMakeLists.txt -@@ -77,6 +77,7 @@ endif() - gz_build_tests(TYPE ${TEST_TYPE} - SOURCES ${tests} - INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test -+ ENVIRONMENT SDF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - ) - - -diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt -index c809bf32e..fe3e17931 100644 ---- a/test/performance/CMakeLists.txt -+++ b/test/performance/CMakeLists.txt -@@ -4,4 +4,7 @@ set(tests - parser_urdf.cc - ) - --gz_build_tests(TYPE ${TEST_TYPE} SOURCES ${tests} INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test) -+gz_build_tests(TYPE ${TEST_TYPE} -+ SOURCES ${tests} -+ INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test -+ ENVIRONMENT SDF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 06b9079..4f55a74 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set repo_name = "sdformat" %} -{% set version = "14.5.0" %} +{% set version = "15.0.0" %} {% set major_version = version.split('.')[0] %} {% set name = repo_name + major_version %} {% set cxx_name = "lib" + name %} @@ -11,11 +11,10 @@ package: source: - url: https://github.com/osrf/sdformat/archive/sdformat{{ major_version }}_{{ version }}.tar.gz - sha256: 44ff4916be63cad987c8ff2c21b3473e1e79c85a9b4fb83029536ed0ab0403e2 + sha256: 2b21c1efe7c4bb817a5867b80974c7e35cfdd863b4024fe94a3bcb1d6a05a813 patches: - standalone_bindings.patch - standalone_bindings_tests.patch - - 1414.patch build: number: 0 @@ -39,10 +38,10 @@ outputs: - pkg-config - python host: - - libgz-cmake3 - - libgz-math7 + - libgz-cmake4 + - libgz-math8 - libgz-tools2 - - libgz-utils2 + - libgz-utils3 - urdfdom - tinyxml2 - dlfcn-win32 # [win] @@ -75,16 +74,15 @@ outputs: host: - {{ pin_subpackage(cxx_name, exact=True) }} - python - - pip - pybind11 - pybind11-abi - pytest - - libgz-math7 - - gz-math7-python + - libgz-math8 + - gz-math8-python run: - {{ pin_subpackage(cxx_name, exact=True) }} - python - - gz-math7-python + - gz-math8-python test: files: - sphere.sdf @@ -95,7 +93,7 @@ outputs: requires: - pip imports: - - sdformat14 + - sdformat15 - name: {{ name }} build: @@ -107,7 +105,7 @@ outputs: - {{ pin_subpackage(python_name, max_pin='x.x.x') }} test: imports: - - sdformat14 + - sdformat15 about: diff --git a/recipe/standalone_bindings.patch b/recipe/standalone_bindings.patch index 5eb5ed6..3272670 100644 --- a/recipe/standalone_bindings.patch +++ b/recipe/standalone_bindings.patch @@ -1,13 +1,23 @@ +From 6a0e2c8a92ae8e5766c7b180bdc974bb97848f50 Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Fri, 27 Sep 2024 13:27:06 +0200 +Subject: [PATCH] Support building bindings as standalone project + +Signed-off-by: Silvio Traversaro +--- + python/CMakeLists.txt | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index e536c749f..d5b3ef093 100644 +index 1ad2cc7a7..8e90b1e28 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,3 +1,19 @@ +# Detect if we are doing a standalone build of the bindings, using an external gz-math +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + cmake_minimum_required(VERSION 3.16) -+ set(SDF_VER 14) -+ set(GZ_UTILS_VER 2) ++ set(SDF_VER 15) ++ set(GZ_UTILS_VER 3) + project(sdformat${SDF_VER}-python VERSION ${SDF_VER}) + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + find_package(pybind11 REQUIRED) @@ -19,6 +29,6 @@ index e536c749f..d5b3ef093 100644 + endif() +endif() + - if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") - # pybind11 logic for setting up a debug build when both a debug and release - # python interpreter are present in the system seems to be pretty much broken. + if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) + if(NOT Python3_SITEARCH) + # Get variable from Python3 module diff --git a/recipe/test_sdformat.py b/recipe/test_sdformat.py index e8aa0e7..5389727 100644 --- a/recipe/test_sdformat.py +++ b/recipe/test_sdformat.py @@ -1,4 +1,4 @@ -import sdformat14 as sdf +import sdformat15 as sdf root = sdf.Root() root.load("sphere.sdf")