diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml index d66c7d1..82c5318 100755 --- a/.azure-pipelines/azure-pipelines-win.yml +++ b/.azure-pipelines/azure-pipelines-win.yml @@ -17,6 +17,7 @@ jobs: UPLOAD_TEMP: D:\\tmp steps: + - task: PythonScript@0 displayName: 'Download Miniforge' inputs: @@ -35,55 +36,14 @@ jobs: displayName: Add conda to PATH - script: | - call activate base - mamba.exe install "python=3.10" conda-build conda pip boa conda-forge-ci-setup=3 -c conda-forge --strict-channel-priority --yes - displayName: Install conda-build - - - script: set PYTHONUNBUFFERED=1 - displayName: Set PYTHONUNBUFFERED - - # Configure the VM - - script: | - call activate base - setup_conda_rc .\ ".\recipe" .\.ci_support\%CONFIG%.yaml - displayName: conda-forge CI setup - - # Configure the VM. - - script: | - set "CI=azure" - call activate base - run_conda_forge_build_setup - displayName: conda-forge build setup - - - script: | - call activate base - if EXIST LICENSE.txt ( - copy LICENSE.txt "recipe\\recipe-scripts-license.txt" - ) - if NOT [%HOST_PLATFORM%] == [%BUILD_PLATFORM%] ( - set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --no-test" - ) - conda.exe mambabuild "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% - displayName: Build recipe + call ".scripts\run_win_build.bat" + displayName: Run Windows build env: PYTHONUNBUFFERED: 1 - - script: | - set "FEEDSTOCK_NAME=%BUILD_REPOSITORY_NAME:*/=%" - call activate base - validate_recipe_outputs "%FEEDSTOCK_NAME%" - displayName: Validate Recipe Outputs - - - script: | - set "GIT_BRANCH=%BUILD_SOURCEBRANCHNAME%" - set "FEEDSTOCK_NAME=%BUILD_REPOSITORY_NAME:*/=%" - set "TEMP=$(UPLOAD_TEMP)" - if not exist "%TEMP%\" md "%TEMP%" - set "TMP=%TEMP%" - call activate base - upload_package --validate --feedstock-name="%FEEDSTOCK_NAME%" .\ ".\recipe" .ci_support\%CONFIG%.yaml - displayName: Upload package - env: + CONFIG: $(CONFIG) + CI: azure + UPLOAD_PACKAGES: $(UPLOAD_PACKAGES) + UPLOAD_TEMP: $(UPLOAD_TEMP) BINSTAR_TOKEN: $(BINSTAR_TOKEN) FEEDSTOCK_TOKEN: $(FEEDSTOCK_TOKEN) - STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) - condition: and(succeeded(), not(eq(variables['UPLOAD_PACKAGES'], 'False')), not(eq(variables['Build.Reason'], 'PullRequest'))) \ No newline at end of file + STAGING_BINSTAR_TOKEN: $(STAGING_BINSTAR_TOKEN) \ No newline at end of file diff --git a/.ci_support/linux_64_.yaml b/.ci_support/linux_64_.yaml index 6059ea1..5bcc1a1 100644 --- a/.ci_support/linux_64_.yaml +++ b/.ci_support/linux_64_.yaml @@ -18,6 +18,12 @@ libabseil: - '20230802' libprotobuf: - 4.23.4 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - linux-64 tinyxml2: diff --git a/.ci_support/linux_aarch64_.yaml b/.ci_support/linux_aarch64_.yaml index bcdd836..000855b 100644 --- a/.ci_support/linux_aarch64_.yaml +++ b/.ci_support/linux_aarch64_.yaml @@ -22,6 +22,12 @@ libabseil: - '20230802' libprotobuf: - 4.23.4 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - linux-aarch64 tinyxml2: diff --git a/.ci_support/linux_ppc64le_.yaml b/.ci_support/linux_ppc64le_.yaml index 7c8bb72..ccbc2ef 100644 --- a/.ci_support/linux_ppc64le_.yaml +++ b/.ci_support/linux_ppc64le_.yaml @@ -18,6 +18,12 @@ libabseil: - '20230802' libprotobuf: - 4.23.4 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - linux-ppc64le tinyxml2: diff --git a/.ci_support/osx_64_.yaml b/.ci_support/osx_64_.yaml index 0162597..057d1e2 100644 --- a/.ci_support/osx_64_.yaml +++ b/.ci_support/osx_64_.yaml @@ -3,7 +3,7 @@ MACOSX_DEPLOYMENT_TARGET: c_compiler: - clang c_compiler_version: -- '15' +- '16' channel_sources: - conda-forge channel_targets: @@ -11,13 +11,19 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '15' +- '16' libabseil: - '20230802' libprotobuf: - 4.23.4 macos_machine: - x86_64-apple-darwin13.4.0 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - osx-64 tinyxml2: diff --git a/.ci_support/osx_arm64_.yaml b/.ci_support/osx_arm64_.yaml index 00607f4..bd0177f 100644 --- a/.ci_support/osx_arm64_.yaml +++ b/.ci_support/osx_arm64_.yaml @@ -3,7 +3,7 @@ MACOSX_DEPLOYMENT_TARGET: c_compiler: - clang c_compiler_version: -- '15' +- '16' channel_sources: - conda-forge channel_targets: @@ -11,13 +11,19 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '15' +- '16' libabseil: - '20230802' libprotobuf: - 4.23.4 macos_machine: - arm64-apple-darwin20.0.0 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - osx-arm64 tinyxml2: diff --git a/.ci_support/win_64_.yaml b/.ci_support/win_64_.yaml index 5885789..68469c3 100644 --- a/.ci_support/win_64_.yaml +++ b/.ci_support/win_64_.yaml @@ -10,6 +10,12 @@ libabseil: - '20230802' libprotobuf: - 4.23.4 +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +python: +- 3.11.* *_cpython target_platform: - win-64 tinyxml2: diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index a6b09f6..bd9e671 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -31,11 +31,10 @@ pkgs_dirs: CONDARC - -mamba install --update-specs --yes --quiet --channel conda-forge \ - conda-build pip boa conda-forge-ci-setup=3 -mamba update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip boa conda-forge-ci-setup=3 +mamba install --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ + pip mamba conda-build boa conda-forge-ci-setup=3 +mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ + pip mamba conda-build boa conda-forge-ci-setup=3 # set up the condarc setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" diff --git a/.scripts/logging_utils.sh b/.scripts/logging_utils.sh index 57bc95c..aff009f 100644 --- a/.scripts/logging_utils.sh +++ b/.scripts/logging_utils.sh @@ -12,7 +12,7 @@ function startgroup { echo "##[group]$1";; travis ) echo "$1" - echo -en 'travis_fold:start:'"${1// /}"'\\r';; + echo -en 'travis_fold:start:'"${1// /}"'\r';; github_actions ) echo "::group::$1";; * ) @@ -28,7 +28,7 @@ function endgroup { azure ) echo "##[endgroup]";; travis ) - echo -en 'travis_fold:end:'"${1// /}"'\\r';; + echo -en 'travis_fold:end:'"${1// /}"'\r';; github_actions ) echo "::endgroup::";; esac diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 3969edf..870c49a 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -23,10 +23,10 @@ bash $MINIFORGE_FILE -b -p ${MINIFORGE_HOME} source ${MINIFORGE_HOME}/etc/profile.d/conda.sh conda activate base -mamba install --update-specs --quiet --yes --channel conda-forge \ - conda-build pip boa conda-forge-ci-setup=3 -mamba update --update-specs --yes --quiet --channel conda-forge \ - conda-build pip boa conda-forge-ci-setup=3 +mamba install --update-specs --quiet --yes --channel conda-forge --strict-channel-priority \ + pip mamba conda-build boa conda-forge-ci-setup=3 +mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ + pip mamba conda-build boa conda-forge-ci-setup=3 diff --git a/.scripts/run_win_build.bat b/.scripts/run_win_build.bat new file mode 100755 index 0000000..07d3445 --- /dev/null +++ b/.scripts/run_win_build.bat @@ -0,0 +1,115 @@ +:: PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here +:: will be lost next time ``conda smithy rerender`` is run. If you would like to make permanent +:: changes to this script, consider a proposal to conda-smithy so that other feedstocks can also +:: benefit from the improvement. + +:: Note: we assume a Miniforge installation is available + +:: INPUTS (required environment variables) +:: CONFIG: name of the .ci_support/*.yaml file for this job +:: CI: azure, github_actions, or unset +:: UPLOAD_PACKAGES: true or false +:: UPLOAD_ON_BRANCH: true or false + +setlocal enableextensions enabledelayedexpansion + +call :start_group "Configuring conda" + +:: Activate the base conda environment +call activate base + +:: Provision the necessary dependencies to build the recipe later +echo Installing dependencies +mamba.exe install "python=3.10" pip mamba conda-build boa conda-forge-ci-setup=3 -c conda-forge --strict-channel-priority --yes +if !errorlevel! neq 0 exit /b !errorlevel! + +:: Set basic configuration +echo Setting up configuration +setup_conda_rc .\ ".\recipe" .\.ci_support\%CONFIG%.yaml +if !errorlevel! neq 0 exit /b !errorlevel! +echo Running build setup +CALL run_conda_forge_build_setup + + +if !errorlevel! neq 0 exit /b !errorlevel! + +if EXIST LICENSE.txt ( + echo Copying feedstock license + copy LICENSE.txt "recipe\\recipe-scripts-license.txt" +) +if NOT [%HOST_PLATFORM%] == [%BUILD_PLATFORM%] ( + set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --no-test" +) + +call :end_group + +:: Build the recipe +echo Building recipe +conda.exe mambabuild "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% +if !errorlevel! neq 0 exit /b !errorlevel! + +:: Prepare some environment variables for the upload step +if /i "%CI%" == "github_actions" ( + set "FEEDSTOCK_NAME=%GITHUB_REPOSITORY:*/=%" + set "GIT_BRANCH=%GITHUB_REF:refs/heads/=%" + if /i "%GITHUB_EVENT_NAME%" == "pull_request" ( + set "IS_PR_BUILD=True" + ) else ( + set "IS_PR_BUILD=False" + ) + set "TEMP=%RUNNER_TEMP%" +) +if /i "%CI%" == "azure" ( + set "FEEDSTOCK_NAME=%BUILD_REPOSITORY_NAME:*/=%" + set "GIT_BRANCH=%BUILD_SOURCEBRANCHNAME%" + if /i "%BUILD_REASON%" == "PullRequest" ( + set "IS_PR_BUILD=True" + ) else ( + set "IS_PR_BUILD=False" + ) + set "TEMP=%UPLOAD_TEMP%" +) + +:: Validate +call :start_group "Validating outputs" +validate_recipe_outputs "%FEEDSTOCK_NAME%" +if !errorlevel! neq 0 exit /b !errorlevel! +call :end_group + +if /i "%UPLOAD_PACKAGES%" == "true" ( + if /i "%IS_PR_BUILD%" == "false" ( + call :start_group "Uploading packages" + if not exist "%TEMP%\" md "%TEMP%" + set "TMP=%TEMP%" + upload_package --validate --feedstock-name="%FEEDSTOCK_NAME%" .\ ".\recipe" .ci_support\%CONFIG%.yaml + if !errorlevel! neq 0 exit /b !errorlevel! + call :end_group + ) +) + +exit + +:: Logging subroutines + +:start_group +if /i "%CI%" == "github_actions" ( + echo ::group::%~1 + exit /b +) +if /i "%CI%" == "azure" ( + echo ##[group]%~1 + exit /b +) +echo %~1 +exit /b + +:end_group +if /i "%CI%" == "github_actions" ( + echo ::endgroup:: + exit /b +) +if /i "%CI%" == "azure" ( + echo ##[endgroup] + exit /b +) +exit /b \ No newline at end of file diff --git a/README.md b/README.md index d54ddd8..33a306d 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,9 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | -| [![Conda Recipe](https://img.shields.io/badge/recipe-gz--msgs9-green.svg)](https://anaconda.org/conda-forge/gz-msgs9) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/gz-msgs9.svg)](https://anaconda.org/conda-forge/gz-msgs9) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/gz-msgs9.svg)](https://anaconda.org/conda-forge/gz-msgs9) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/gz-msgs9.svg)](https://anaconda.org/conda-forge/gz-msgs9) | -| [![Conda Recipe](https://img.shields.io/badge/recipe-libgz--msgs9-green.svg)](https://anaconda.org/conda-forge/libgz-msgs9) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libgz-msgs9.svg)](https://anaconda.org/conda-forge/libgz-msgs9) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libgz-msgs9.svg)](https://anaconda.org/conda-forge/libgz-msgs9) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libgz-msgs9.svg)](https://anaconda.org/conda-forge/libgz-msgs9) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-gz--msgs10-green.svg)](https://anaconda.org/conda-forge/gz-msgs10) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/gz-msgs10.svg)](https://anaconda.org/conda-forge/gz-msgs10) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/gz-msgs10.svg)](https://anaconda.org/conda-forge/gz-msgs10) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/gz-msgs10.svg)](https://anaconda.org/conda-forge/gz-msgs10) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-gz--msgs10--python-green.svg)](https://anaconda.org/conda-forge/gz-msgs10-python) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/gz-msgs10-python.svg)](https://anaconda.org/conda-forge/gz-msgs10-python) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/gz-msgs10-python.svg)](https://anaconda.org/conda-forge/gz-msgs10-python) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/gz-msgs10-python.svg)](https://anaconda.org/conda-forge/gz-msgs10-python) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-libgz--msgs10-green.svg)](https://anaconda.org/conda-forge/libgz-msgs10) | [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/libgz-msgs10.svg)](https://anaconda.org/conda-forge/libgz-msgs10) | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/libgz-msgs10.svg)](https://anaconda.org/conda-forge/libgz-msgs10) | [![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/libgz-msgs10.svg)](https://anaconda.org/conda-forge/libgz-msgs10) | Installing gz-msgs ================== @@ -94,41 +95,41 @@ conda config --add channels conda-forge conda config --set channel_priority strict ``` -Once the `conda-forge` channel has been enabled, `gz-msgs9, libgz-msgs9` can be installed with `conda`: +Once the `conda-forge` channel has been enabled, `gz-msgs10, gz-msgs10-python, libgz-msgs10` can be installed with `conda`: ``` -conda install gz-msgs9 libgz-msgs9 +conda install gz-msgs10 gz-msgs10-python libgz-msgs10 ``` or with `mamba`: ``` -mamba install gz-msgs9 libgz-msgs9 +mamba install gz-msgs10 gz-msgs10-python libgz-msgs10 ``` -It is possible to list all of the versions of `gz-msgs9` available on your platform with `conda`: +It is possible to list all of the versions of `gz-msgs10` available on your platform with `conda`: ``` -conda search gz-msgs9 --channel conda-forge +conda search gz-msgs10 --channel conda-forge ``` or with `mamba`: ``` -mamba search gz-msgs9 --channel conda-forge +mamba search gz-msgs10 --channel conda-forge ``` Alternatively, `mamba repoquery` may provide more information: ``` # Search all versions available on your platform: -mamba repoquery search gz-msgs9 --channel conda-forge +mamba repoquery search gz-msgs10 --channel conda-forge -# List packages depending on `gz-msgs9`: -mamba repoquery whoneeds gz-msgs9 --channel conda-forge +# List packages depending on `gz-msgs10`: +mamba repoquery whoneeds gz-msgs10 --channel conda-forge -# List dependencies of `gz-msgs9`: -mamba repoquery depends gz-msgs9 --channel conda-forge +# List dependencies of `gz-msgs10`: +mamba repoquery depends gz-msgs10 --channel conda-forge ``` diff --git a/conda-forge.yml b/conda-forge.yml index 3f62c99..0241978 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -1,4 +1,6 @@ bot: + abi_migration_branches: + - 'v9' automerge: true build_platform: linux_aarch64: linux_aarch64 diff --git a/recipe/391.patch b/recipe/391.patch new file mode 100644 index 0000000..55cbb8f --- /dev/null +++ b/recipe/391.patch @@ -0,0 +1,24 @@ +From 690d2a65eae3c968e82d47f62aee1234548163a6 Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Mon, 2 Oct 2023 11:29:01 +0200 +Subject: [PATCH] Set GZ_TOOLS_VER to 2 for consistency with rest of Garden and + Harmonic libraries + +Signed-off-by: Silvio Traversaro +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2a9e8ed0..7a4a6699 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -97,7 +97,7 @@ set(GZ_MATH_VER ${gz-math7_VERSION_MAJOR}) + # Note that CLI files are installed regardless of whether the dependency is + # available during build time + find_program(HAVE_GZ_TOOLS gz) +-set(GZ_TOOLS_VER 1) ++set(GZ_TOOLS_VER 2) + + #-------------------------------------- + # Find Tinyxml2 diff --git a/recipe/392.patch b/recipe/392.patch new file mode 100644 index 0000000..c5cc2ed --- /dev/null +++ b/recipe/392.patch @@ -0,0 +1,406 @@ +From b9302c375d63829ff2630a284990472da71dcbf0 Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Mon, 2 Oct 2023 12:21:10 +0200 +Subject: [PATCH] Fix cross-compilation support for gz-msg10 + +Signed-off-by: Silvio Traversaro +--- + CMakeLists.txt | 55 +++++++++++++++++++++++------------- + cmake/gz_msgs_factory.cmake | 10 +++++-- + cmake/gz_msgs_generate.cmake | 41 +++++++++++++++++++++++++-- + cmake/gz_msgs_protoc.cmake | 19 +++++++++++-- + core/CMakeLists.txt | 13 ++++++++- + gz-msgs-extras.cmake.in | 15 +++++++++- + 6 files changed, 124 insertions(+), 29 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b3133776..e1af90f8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,34 +25,49 @@ gz_configure_project(VERSION_SUFFIX + #============================================================================ + + # Cross-compilation related options +-# In a cross-compilation scenario, it is possible that the gz_msgs_gen ++# In a cross-compilation scenario, it is possible that the ++# ${PROJECT_NAME}_protoc_plugin + # generator compiled for the target machine cannot be used to generate +-# the C++ code corresponding to the .proto definition. For this scenario, +-# the following two options can be used as follows. ++# the C++ code corresponding to the .proto definition. ++# Similarly, it is possible that Python3::Interpreter and protobuf::protoc ++# found via find_package are not executable that can be run during the build. ++# To avoid, that the following options can be used as follows. + # First of all, gz-msgs is compiled targeting the host machine, and in the +-# build targeting the host, the INSTALL_GZ_MSGS_GEN_EXECUTABLE option is +-# enabled: +-# > cmake -DINSTALL_GZ_MSGS_GEN_EXECUTABLE:BOOL=ON .. +-# ensuring that the gz_msgs_gen is installed in +-# /bin/gz_msgs_gen . Then, the same version of gz-msgs ++# build targeting the host, ensuring that the ${PROJECT_NAME}_protoc_plugin ++# is installed in /bin/${PROJECT_NAME}_protoc_plugin . ++# Then, the same version of gz-msgs + # can be cross-compiled, and in the cross-compilation build the location of the +-# host gz_msgs_gen is specified via the GZ_MSGS_GEN_EXECUTABLE +-# CMake cache variable: +-# > cmake -GZ_MSGS_GEN_EXECUTABLE=/bin/gz_msgs_gen .. ++# host gz_msgs_gen is specified via the GZ_MSGS_GEN_EXECUTABLE CMake option. ++# Similarly to gz-msgs, also a copy of protoc and of the Python interpreter need ++# to be installed in the host at /bin, and they can be passed ++# to the build appropriate CMake options: ++# > cmake -Dgz-msgs_PROTO_GENERATOR_PLUGIN=gz-msgs_protoc_plugin ++# > -Dgz-msgs_PROTOC_EXECUTABLE=/bin/protoc ++# > -Dgz-msgs_PYTHON_INTERPRETER=/bin/python ++# > .. ++# In case the gz-msgs CMake functions are used also in downstream projects, ++# the same variables can be passed when configuring the downsream projects. + +-option( +- INSTALL_GZ_MSGS_GEN_EXECUTABLE +- "Install the gz_msgs_gen executable." +- OFF) ++set( ++ ${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN ++ "${PROJECT_NAME}_protoc_plugin" ++ CACHE STRING ++ "gz_msgs_gen executable used in the gz-msgs CMake functions.") ++mark_as_advanced(${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN) + +-mark_as_advanced(INSTALL_GZ_MSGS_GEN_EXECUTABLE) ++set( ++ ${PROJECT_NAME}_PROTOC_EXECUTABLE ++ protobuf::protoc ++ CACHE STRING ++ "protoc target or executable used in the gz-msgs CMake functions.") ++mark_as_advanced(${PROJECT_NAME}_PROTOC_EXECUTABLE) + + set( +- GZ_MSGS_GEN_EXECUTABLE +- "$" ++ ${PROJECT_NAME}_PYTHON_INTERPRETER ++ Python3::Interpreter + CACHE STRING +- "gz_msgs_gen executable used in the gz_msgs_protoc CMake function.") +-mark_as_advanced(GZ_MSGS_GEN_EXECUTABLE) ++ "python target or executable used in the gz-msgs CMake functions.") ++mark_as_advanced(${PROJECT_NAME}_PYTHON_INTERPRETER) + + # Python interfaces vars + option(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION +diff --git a/cmake/gz_msgs_factory.cmake b/cmake/gz_msgs_factory.cmake +index b86b1b4f..2af59ffa 100644 +--- a/cmake/gz_msgs_factory.cmake ++++ b/cmake/gz_msgs_factory.cmake +@@ -6,7 +6,7 @@ + # One value arguments: + # FACTORY_GEN_SCRIPT - Location of the factory generator script + # PROTO_PACKAGE - Protobuf package the file belongs to (e.g. "gz.msgs") +-# PROTOC_EXEC - Path to protoc ++# PYTHON_INTERPRETER - Target or path to the Python interpreter to use to execute the generator script + # OUTPUT_CPP_DIR - Path where C++ files are saved + # OUTPUT_CPP_HH_VAR - A CMake variable name containing a list that the C++ headers should be appended to + # OUTPUT_CPP_CC_VAR - A Cmake variable name containing a list that the C++ sources should be appended to +@@ -18,6 +18,7 @@ function(gz_msgs_factory) + set(oneValueArgs + FACTORY_GEN_SCRIPT + PROTO_PACKAGE ++ PYTHON_INTERPRETER + OUTPUT_CPP_DIR + OUTPUT_CPP_HH_VAR + OUTPUT_CPP_CC_VAR) +@@ -25,6 +26,11 @@ function(gz_msgs_factory) + + cmake_parse_arguments(gz_msgs_factory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + ++ # Default values for optional parameters ++ if (NOT DEFINED gz_msgs_factory_PYTHON_INTERPRETER) ++ set(gz_msgs_factory_PYTHON_INTERPRETER Python3::Interpreter) ++ endif() ++ + _gz_msgs_proto_pkg_to_path(${gz_msgs_factory_PROTO_PACKAGE} proto_package_dir) + + set(output_header "${gz_msgs_factory_OUTPUT_CPP_DIR}/${proto_package_dir}/MessageTypes.hh") +@@ -57,7 +63,7 @@ function(gz_msgs_factory) + + add_custom_command( + OUTPUT ${output_files} +- COMMAND Python3::Interpreter ++ COMMAND ${gz_msgs_factory_PYTHON_INTERPRETER} + ARGS ${gz_msgs_factory_FACTORY_GEN_SCRIPT} ${GENERATE_ARGS} + DEPENDS + ${depends_index} +diff --git a/cmake/gz_msgs_generate.cmake b/cmake/gz_msgs_generate.cmake +index 679b9cae..5fc0cf3d 100644 +--- a/cmake/gz_msgs_generate.cmake ++++ b/cmake/gz_msgs_generate.cmake +@@ -2,6 +2,7 @@ + # The implementation of gz_msgs_generate_messages + # Options: + # One value arguments: ++# PYTHON_INTERPRETER - Target or path to the python interpreter used + # PROTO_PACKAGE - Protobuf package the file belongs to (e.g. "gz.msgs") + # MSGS_GEN_SCRIPT - Location of the messge generator script + # GZ_PROTOC_PLUGIN - Location of the gazebo generator plugin +@@ -20,6 +21,8 @@ function(gz_msgs_generate_messages_impl) + set(options "") + set(oneValueArgs + # Inputs ++ PYTHON_INTERPRETER ++ PROTOC_EXEC + PROTO_PACKAGE MSGS_GEN_SCRIPT GZ_PROTOC_PLUGIN FACTORY_GEN_SCRIPT PROTO_PATH + DEPENDENCY_DESCRIPTIONS + DLLEXPORT_DECL +@@ -33,6 +36,15 @@ function(gz_msgs_generate_messages_impl) + set(multiValueArgs INPUT_PROTOS) + + cmake_parse_arguments(generate_messages "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) ++ ++ # Default values for optional parameters ++ if (NOT DEFINED generate_messages_PYTHON_INTERPRETER) ++ set(generate_messages_PYTHON_INTERPRETER Python3::Interpreter) ++ endif() ++ if (NOT DEFINED generate_messages_PROTOC_EXEC) ++ set(generate_messages_PROTOC_EXEC protobuf::protoc) ++ endif() ++ + _gz_msgs_proto_pkg_to_string(${generate_messages_PROTO_PACKAGE} gen_dir) + _gz_msgs_proto_pkg_to_path(${generate_messages_PROTO_PACKAGE} proto_package_dir) + set(output_directory ${generate_messages_OUTPUT_DIRECTORY}) +@@ -42,6 +54,8 @@ function(gz_msgs_generate_messages_impl) + + foreach(proto_file ${generate_messages_INPUT_PROTOS}) + gz_msgs_protoc( ++ PYTHON_INTERPRETER ++ ${generate_messages_PYTHON_INTERPRETER} + MSGS_GEN_SCRIPT + ${generate_messages_MSGS_GEN_SCRIPT} + PROTO_PACKAGE +@@ -49,7 +63,7 @@ function(gz_msgs_generate_messages_impl) + INPUT_PROTO + ${proto_file} + PROTOC_EXEC +- protobuf::protoc ++ ${generate_messages_PROTOC_EXEC} + GZ_PROTOC_PLUGIN + ${generate_messages_GZ_PROTOC_PLUGIN} + PROTO_PATH +@@ -81,6 +95,8 @@ function(gz_msgs_generate_messages_impl) + endforeach() + + gz_msgs_factory( ++ PYTHON_INTERPRETER ++ ${generate_messages_PYTHON_INTERPRETER} + FACTORY_GEN_SCRIPT + ${generate_messages_FACTORY_GEN_SCRIPT} + PROTO_PACKAGE +@@ -130,6 +146,7 @@ endfunction() + ################################################## + # Options: + # One value arguments: ++# PROTOC_EXEC - protoc target or executable to use + # PROTO_PATH - Base directory of the proto files + # DEPENDENCY_DESCRIPTIONS - Variable containing all depedency description files + # OUTPUT_DIRECTORY - Directory of output gz_desc file +@@ -140,6 +157,7 @@ function(gz_msgs_generate_desc_impl) + set(options "") + set(oneValueArgs + # Inputs ++ PROTOC_EXEC + PROTO_PATH + DEPENDENCY_DESCRIPTIONS + OUTPUT_DIRECTORY +@@ -148,6 +166,10 @@ function(gz_msgs_generate_desc_impl) + + cmake_parse_arguments(generate_messages "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + ++ if (NOT DEFINED generate_messages_PROTOC_EXEC) ++ set(generate_messages_PROTOC_EXEC protobuf::protoc) ++ endif() ++ + set(ARGS) + list(APPEND ARGS -I${generate_messages_PROTO_PATH}) + list(APPEND ARGS --descriptor_set_out=${generate_messages_OUTPUT_FILENAME}) +@@ -161,7 +183,7 @@ function(gz_msgs_generate_desc_impl) + + add_custom_command( + OUTPUT ${generate_messages_OUTPUT_FILENAME} +- COMMAND protobuf::protoc ++ COMMAND ${generate_messages_PROTOC_EXEC} + ARGS ${ARGS} + DEPENDS ${generate_messages_INPUT_PROTOS} + COMMENT "Generating descriptor set" +@@ -175,6 +197,8 @@ endfunction() + # TARGET - Target (static library) to create + # PROTO_PACKAGE - Protobuf package the file belongs to (e.g. "gz.msgs") + # MSGS_GEN_SCRIPT - Location of the messge generator script ++# PYTHON_INTERPRETER - Target or path to the python interpreter used ++# PROTOC_EXEC - Protoc target or executable to use + # GZ_PROTOC_PLUGIN - Location of the gazebo generator plugin + # FACTORY_GEN_SCRIPT - Location of the factory generator script + # MSGS_LIB - gz-msgs library to link to +@@ -186,7 +210,7 @@ endfunction() + # that depend on gz-msgs + function(gz_msgs_generate_messages_lib) + set(options "") +- set(oneValueArgs TARGET PROTO_PACKAGE MSGS_GEN_SCRIPT GZ_PROTOC_PLUGIN FACTORY_GEN_SCRIPT MSGS_LIB PROTO_PATH) ++ set(oneValueArgs TARGET PROTO_PACKAGE MSGS_GEN_SCRIPT PYTHON_INTERPRETER PROTOC_EXEC GZ_PROTOC_PLUGIN FACTORY_GEN_SCRIPT MSGS_LIB PROTO_PATH) + set(multiValueArgs INPUT_PROTOS DEPENDENCIES) + + cmake_parse_arguments(generate_messages "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) +@@ -205,9 +229,19 @@ function(gz_msgs_generate_messages_lib) + list(APPEND depends_msgs_desc ${msgs_desc_file}) + endforeach() + ++ # Default values for optional parameters ++ if (NOT DEFINED generate_messages_PYTHON_INTERPRETER) ++ set(generate_messages_PYTHON_INTERPRETER Python3::Interpreter) ++ endif() ++ if (NOT DEFINED generate_messages_PROTOC_EXEC) ++ set(generate_messages_PROTOC_EXEC protobuf::protoc) ++ endif() ++ + gz_msgs_generate_messages_impl( + PROTO_PACKAGE ${generate_messages_PROTO_PACKAGE} + MSGS_GEN_SCRIPT ${generate_messages_MSGS_GEN_SCRIPT} ++ PYTHON_INTERPRETER ${generate_messages_PYTHON_INTERPRETER} ++ PROTOC_EXEC ${generate_messages_PROTOC_EXEC} + GZ_PROTOC_PLUGIN ${generate_messages_GZ_PROTOC_PLUGIN} + FACTORY_GEN_SCRIPT ${generate_messages_FACTORY_GEN_SCRIPT} + PROTO_PATH ${generate_messages_PROTO_PATH} +@@ -221,6 +255,7 @@ function(gz_msgs_generate_messages_lib) + ) + + gz_msgs_generate_desc_impl( ++ PROTOC_EXEC ${generate_messages_PROTOC_EXEC} + INPUT_PROTOS ${generate_messages_INPUT_PROTOS} + PROTO_PATH ${generate_messages_PROTO_PATH} + DEPENDENCY_DESCRIPTIONS ${depends_msgs_desc} +diff --git a/cmake/gz_msgs_protoc.cmake b/cmake/gz_msgs_protoc.cmake +index 077e266c..863d6b64 100644 +--- a/cmake/gz_msgs_protoc.cmake ++++ b/cmake/gz_msgs_protoc.cmake +@@ -4,6 +4,7 @@ + # GENERATE_CPP - generates c++ code for the message if specified + # GENERATE_PYTHON - generates python code for the message if specified + # One value arguments: ++# PYTHON_INTERPRETER - Target or path to the Python interpreter to use to run generation scripts + # MSGS_GEN_SCRIPT - Path to the message generation python script + # PROTO_PACKAGE - Protobuf package the file belongs to (e.g. "gz.msgs") + # PROTOC_EXEC - Path to protoc +@@ -22,6 +23,7 @@ + function(gz_msgs_protoc) + set(options GENERATE_CPP GENERATE_PYTHON) + set(oneValueArgs ++ PYTHON_INTERPRETER + MSGS_GEN_SCRIPT + PROTO_PACKAGE + PROTOC_EXEC +@@ -38,6 +40,13 @@ function(gz_msgs_protoc) + + cmake_parse_arguments(gz_msgs_protoc "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + ++ if (NOT DEFINED gz_msgs_protoc_PYTHON_INTERPRETER) ++ set(gz_msgs_protoc_PYTHON_INTERPRETER Python3::Interpreter) ++ endif() ++ if (NOT DEFINED gz_msgs_protoc_PROTOC_EXEC) ++ set(gz_msgs_protoc_PROTOC_EXEC protobuf::protoc) ++ endif() ++ + get_filename_component(ABS_FIL ${gz_msgs_protoc_INPUT_PROTO} ABSOLUTE) + get_filename_component(FIL_WE ${gz_msgs_protoc_INPUT_PROTO} NAME_WE) + +@@ -85,8 +94,14 @@ function(gz_msgs_protoc) + set(${gz_msgs_protoc_OUTPUT_PYTHON_VAR} ${${gz_msgs_protoc_OUTPUT_PYTHON_VAR}} PARENT_SCOPE) + endif() + ++ if(TARGET ${gz_msgs_protoc_PROTOC_EXEC}) ++ set(gz_msgs_protoc_PROTOC_EXEC_FILE_ABS_PATH "$") ++ else() ++ set(gz_msgs_protoc_PROTOC_EXEC_FILE_ABS_PATH ${gz_msgs_protoc_PROTOC_EXEC}) ++ endif() ++ + set(GENERATE_ARGS +- --protoc-exec "$" ++ --protoc-exec "${gz_msgs_protoc_PROTOC_EXEC_FILE_ABS_PATH}" + --gz-generator-bin "${gz_msgs_protoc_GZ_PROTOC_PLUGIN}" + --proto-path "${gz_msgs_protoc_PROTO_PATH}" + --input-path "${ABS_FIL}" +@@ -118,7 +133,7 @@ function(gz_msgs_protoc) + + add_custom_command( + OUTPUT ${output_files} +- COMMAND Python3::Interpreter ++ COMMAND ${gz_msgs_protoc_PYTHON_INTERPRETER} + ARGS ${gz_msgs_protoc_MSGS_GEN_SCRIPT} ${GENERATE_ARGS} + DEPENDS + ${ABS_FIL} +diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt +index 2bbe9114..3cc7fad8 100644 +--- a/core/CMakeLists.txt ++++ b/core/CMakeLists.txt +@@ -26,13 +26,23 @@ include(${PROJECT_SOURCE_DIR}/cmake/gz_msgs_generate.cmake) + include(${PROJECT_SOURCE_DIR}/cmake/gz_msgs_protoc.cmake) + include(${PROJECT_SOURCE_DIR}/cmake/gz_msgs_string_utils.cmake) + ++if(TARGET ${${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN}) ++ set(${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN_FILE $) ++else() ++ set(${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN_FILE ${${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN}) ++endif() ++ + gz_msgs_generate_messages_impl( + MSGS_GEN_SCRIPT + ${PROJECT_SOURCE_DIR}/tools/gz_msgs_generate.py + FACTORY_GEN_SCRIPT + ${PROJECT_SOURCE_DIR}/tools/gz_msgs_generate_factory.py ++ PYTHON_INTERPRETER ++ ${${PROJECT_NAME}_PYTHON_INTERPRETER} ++ PROTOC_EXEC ++ ${${PROJECT_NAME}_PROTOC_EXECUTABLE} + GZ_PROTOC_PLUGIN +- $ ++ ${${PROJECT_NAME}_PROTO_GENERATOR_PLUGIN_FILE} + INPUT_PROTOS + ${proto_files} + DLLEXPORT_DECL +@@ -54,6 +64,7 @@ gz_msgs_generate_messages_impl( + ) + + gz_msgs_generate_desc_impl( ++ PROTOC_EXEC ${${PROJECT_NAME}_PROTOC_EXECUTABLE} + INPUT_PROTOS ${proto_files} + PROTO_PATH ${PROJECT_SOURCE_DIR}/proto + DEPENDENCY_DESCRIPTIONS ${depends_msgs_desc} +diff --git a/gz-msgs-extras.cmake.in b/gz-msgs-extras.cmake.in +index 914f779a..40d6c913 100644 +--- a/gz-msgs-extras.cmake.in ++++ b/gz-msgs-extras.cmake.in +@@ -28,7 +28,16 @@ set(PROTO_SCRIPT_NAME "@PROJECT_NAME@_generate.py") + set(FACTORY_SCRIPT_NAME "@PROJECT_NAME@_generate_factory.py") + + set(@PROJECT_NAME@_PROTO_PATH ${@PROJECT_NAME@_INSTALL_PATH}/share/protos) +-set(@PROJECT_NAME@_PROTO_GENERATOR_PLUGIN ${@PROJECT_NAME@_INSTALL_PATH}/bin/${PROTOC_NAME}) ++# Provide support to override generator executable used during cross-compilation ++if(NOT DEFINED @PROJECT_NAME@_PROTO_GENERATOR_PLUGIN) ++ set(@PROJECT_NAME@_PROTO_GENERATOR_PLUGIN ${@PROJECT_NAME@_INSTALL_PATH}/bin/${PROTOC_NAME}) ++endif() ++if(NOT DEFINED @PROJECT_NAME@_PROTOC_EXECUTABLE) ++ set(@PROJECT_NAME@_PROTOC_EXECUTABLE protobuf::protoc) ++endif() ++if(NOT DEFINED @PROJECT_NAME@_PYTHON_INTERPRETER) ++ set(@PROJECT_NAME@_PYTHON_INTERPRETER Python3::Interpreter) ++endif() + set(@PROJECT_NAME@_PROTO_GENERATOR_SCRIPT ${@PROJECT_NAME@_INSTALL_PATH}/bin/${PROTO_SCRIPT_NAME}) + set(@PROJECT_NAME@_FACTORY_GENERATOR_SCRIPT ${@PROJECT_NAME@_INSTALL_PATH}/bin/${FACTORY_SCRIPT_NAME}) + +@@ -64,6 +73,10 @@ function(gz_msgs_generate_messages) + + cmake_parse_arguments(generate_messages "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + gz_msgs_generate_messages_lib( ++ PYTHON_INTERPRETER ++ ${@PROJECT_NAME@_PYTHON_INTERPRETER} ++ PROTOC_EXEC ++ ${@PROJECT_NAME@_PROTOC_EXECUTABLE} + MSGS_GEN_SCRIPT + ${@PROJECT_NAME@_PROTO_GENERATOR_SCRIPT} + FACTORY_GEN_SCRIPT diff --git a/recipe/393.patch b/recipe/393.patch new file mode 100644 index 0000000..e53e738 --- /dev/null +++ b/recipe/393.patch @@ -0,0 +1,42 @@ +From e2cc2ab7deb53a9f7e151bad1bd4bb32d4cb18cf Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Wed, 4 Oct 2023 13:32:49 +0200 +Subject: [PATCH] Do not redefine GZ_PYTHON_INSTALL_PATH if it is already + defined + +Signed-off-by: Silvio Traversaro +--- + CMakeLists.txt | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b3133776..a6c5c418 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,16 +108,18 @@ endif() + # Find Python + find_package(Python3 REQUIRED COMPONENTS Interpreter) + +-if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) +- if(USE_DIST_PACKAGES_FOR_PYTHON) +- string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) ++if(NOT GZ_PYTHON_INSTALL_PATH) ++ if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) ++ if(USE_DIST_PACKAGES_FOR_PYTHON) ++ string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) ++ else() ++ # Python3_SITELIB might use dist-packages in some platforms ++ string(REPLACE "dist-packages" "site-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) ++ endif() + else() +- # Python3_SITELIB might use dist-packages in some platforms +- string(REPLACE "dist-packages" "site-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITELIB}) ++ # If not a system installation, respect local paths ++ set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) + endif() +-else() +- # If not a system installation, respect local paths +- set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) + endif() + #============================================================================ + # Configure the build diff --git a/recipe/bld_cxx.bat b/recipe/bld_cxx.bat index 712cead..e3706d6 100644 --- a/recipe/bld_cxx.bat +++ b/recipe/bld_cxx.bat @@ -1,11 +1,17 @@ -mkdir build -cd build +mkdir build_cxx +cd build_cxx +:: Set Python install dir to wrong directory to ensure Python files +:: are not included in the libgz-msgs package cmake ^ -G "Ninja" ^ -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON ^ + -DGZ_PYTHON_INSTALL_PATH=%SRC_DIR%\wrong_py_install ^ + -DUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION:BOOL=ON ^ + -DPython3_EXECUTABLE:PATH=%PYTHON% ^ + -DPYTHON_EXECUTABLE:PATH=%PYTHON% ^ %SRC_DIR% if errorlevel 1 exit 1 @@ -13,10 +19,10 @@ if errorlevel 1 exit 1 cmake --build . --config Release if errorlevel 1 exit 1 -:: Install. +:: Install cmake --build . --config Release --target install if errorlevel 1 exit 1 :: Test. -ctest -C Release +ctest -C Release -E "INTEGRATION_gz_TEST|basic_TEST" if errorlevel 1 exit 1 diff --git a/recipe/bld_py.bat b/recipe/bld_py.bat new file mode 100644 index 0000000..d6c83f2 --- /dev/null +++ b/recipe/bld_py.bat @@ -0,0 +1,29 @@ +mkdir build_py +cd build_py + +:: Set CMAKE_NSTALL_PREFIX to wrong directory to ensure C++ files +:: are not included in the gz-msgs-python package +cmake ^ + -G "Ninja" ^ + -DCMAKE_INSTALL_PREFIX=%SRC_DIR%\wrong_cxx_install ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON ^ + -DGZ_PYTHON_INSTALL_PATH=%SP_DIR% ^ + -DUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION:BOOL=ON ^ + -DPython3_EXECUTABLE:PATH=%PYTHON% ^ + -DPYTHON_EXECUTABLE:PATH=%PYTHON% ^ + %SRC_DIR% +if errorlevel 1 exit 1 + +:: Build. +cmake --build . --config Release +if errorlevel 1 exit 1 + +:: Install +cmake --build . --config Release --target install +if errorlevel 1 exit 1 + +:: Test using pytest +cd %SRC_DIR%\python\test +pytest .\basic_TEST.py +if errorlevel 1 exit 1 diff --git a/recipe/build_cxx.sh b/recipe/build_cxx.sh index c524b53..05970bc 100644 --- a/recipe/build_cxx.sh +++ b/recipe/build_cxx.sh @@ -7,8 +7,8 @@ fi if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then ( - mkdir -p build-host - pushd build-host + mkdir -p build_cxx_host + pushd build_cxx_host export CC=$CC_FOR_BUILD export CXX=$CXX_FOR_BUILD @@ -23,31 +23,36 @@ if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$BUILD_PREFIX -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \ -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True \ - -DINSTALL_GZ_MSGS_GEN_EXECUTABLE:BOOL=ON - + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True cmake --build . --parallel ${CPU_COUNT} --config Release cmake --build . --parallel ${CPU_COUNT} --config Release --target install ) fi -mkdir build -cd build +mkdir build_cxx +cd build_cxx if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then - export CMAKE_ARGS="${CMAKE_ARGS} -DGZ_MSGS_PROTOC_EXECUTABLE=$BUILD_PREFIX/bin/protoc -DGZ_MSGS_GEN_EXECUTABLE:BOOL=$BUILD_PREFIX/bin/gz_msgs_gen" + export CMAKE_ARGS="${CMAKE_ARGS} -Dgz-msgs10_PYTHON_INTERPRETER=$BUILD_PREFIX/bin/python -Dgz-msgs10_PROTOC_EXECUTABLE=$BUILD_PREFIX/bin/protoc -Dgz-msgs10_PROTO_GENERATOR_PLUGIN=$BUILD_PREFIX/bin/gz-msgs10_protoc_plugin" fi -cmake ${CMAKE_ARGS} -GNinja .. \ +# Set Python install dir to wrong directory to ensure Python files +# are not included in the libgz-msgs package +cmake ${CMAKE_ARGS} -DBUILD_TESTING:BOOL=ON -GNinja .. \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP:BOOL=ON \ + -DGZ_PYTHON_INSTALL_PATH=$SRC_DIR/wrong_py_install \ + -DPython3_EXECUTABLE:PATH=$PYTHON \ + -DPYTHON_EXECUTABLE:PATH=$PYTHON \ + -DPython3_INCLUDE_DIR:PATH=$PREFIX/include/`ls $PREFIX/include | grep "python\|pypy"` cmake --build . --config Release cmake --build . --config Release --target install + export CTEST_OUTPUT_ON_FAILURE=1 if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then if [[ "${CONDA_BUILD_CROSS_COMPILATION}" != "" ]]; then - export CTEST_DISABLED_TESTS="UNIT_ign_TEST" + export CTEST_DISABLED_TESTS="INTEGRATION_gz_TEST" fi - ctest -C Release -E "${CTEST_DISABLED_TESTS}" + ctest -C Release -E "${CTEST_DISABLED_TESTS}|basic_TEST" fi diff --git a/recipe/build_py.sh b/recipe/build_py.sh new file mode 100644 index 0000000..c19476b --- /dev/null +++ b/recipe/build_py.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +if [[ "${target_platform}" == osx-* ]]; then + # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" +fi + +if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then + ( + mkdir -p build_py_host + pushd build_py_host + + export CC=$CC_FOR_BUILD + export CXX=$CXX_FOR_BUILD + export LDFLAGS=${LDFLAGS//$PREFIX/$BUILD_PREFIX} + export PKG_CONFIG_PATH=${PKG_CONFIG_PATH//$PREFIX/$BUILD_PREFIX} + + # Unset them as we're ok with builds that are either slow or non-portable + unset CFLAGS + unset CXXFLAGS + + cmake -GNinja .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$BUILD_PREFIX -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True + cmake --build . --parallel ${CPU_COUNT} --config Release + cmake --build . --parallel ${CPU_COUNT} --config Release --target install + ) +fi + +mkdir build_py +cd build_py + +if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then + export CMAKE_ARGS_FOR_PY_BUILD="-Dgz-msgs10_PYTHON_INTERPRETER=$BUILD_PREFIX/bin/python -Dgz-msgs10_PROTOC_EXECUTABLE=$BUILD_PREFIX/bin/protoc -Dgz-msgs10_PROTO_GENERATOR_PLUGIN=$BUILD_PREFIX/bin/gz-msgs10_protoc_plugin -DPython3_EXECUTABLE:PATH=$BUILD_PREFIX/bin/python -DPYTHON_EXECUTABLE:PATH=$BUILD_PREFIX/bin/python" +else + export CMAKE_ARGS_FOR_PY_BUILD="-DPython3_EXECUTABLE:PATH=$PYTHON -DPYTHON_EXECUTABLE:PATH=$PYTHON" +fi + +echo "Printing env value ====>" +env + +# Set CMAKE_INSTALL_PREFIX install dir to wrong directory to ensure C++ files +# are not included in the gz-msgs-python package +cmake ${CMAKE_ARGS_FOR_PY_BUILD} -DCMAKE_INSTALL_PREFIX=$SRC_DIR/wrong_cxx_install -DBUILD_TESTING:BOOL=ON -GNinja .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP:BOOL=ON \ + -DGZ_PYTHON_INSTALL_PATH=$SP_DIR \ + -DUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION:BOOL=ON + +cmake --build . --config Release +cmake --build . --config Release --target install + +export CTEST_OUTPUT_ON_FAILURE=1 +if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then + cd $SRC_DIR/python/test + pytest ./basic_TEST.py +fi diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml new file mode 100644 index 0000000..97558aa --- /dev/null +++ b/recipe/conda_build_config.yaml @@ -0,0 +1,16 @@ +# Hardcode python version to avoid have one build job +# for python version as in the end the generated +# artifacts do not depend on Python version +zip_keys: + - + - python + - numpy + - python_impl +python: + # part of a zip_keys: python, python_impl, numpy + - 3.11.* *_cpython +python_impl: + # part of a zip_keys: python, python_impl, numpy + - cpython +numpy: + - 1.23 diff --git a/recipe/fixprotobuf23.patch b/recipe/fixprotobuf23.patch deleted file mode 100644 index f5d4697..0000000 --- a/recipe/fixprotobuf23.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ec1dababa779a262d08b445c904dba5784c56833 Mon Sep 17 00:00:00 2001 -From: Silvio Traversaro -Date: Wed, 31 May 2023 01:30:07 +0200 -Subject: [PATCH] Fix protobuf 23 - ---- - CMakeLists.txt | 9 +++++++-- - src/CMakeLists.txt | 4 ++-- - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d3376fa8..82cf4b50 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -67,6 +67,13 @@ set( - "gz_msgs_gen executable used in the gz_msgs_protoc CMake function.") - mark_as_advanced(GZ_MSGS_GEN_EXECUTABLE) - -+set( -+ GZ_MSGS_PROTOC_EXECUTABLE -+ "$" -+ CACHE STRING -+ "protoc executable used in the gz_msgs_protoc CMake function.") -+mark_as_advanced(GZ_MSGS_PROTOC_EXECUTABLE) -+ - # TODO(CH3): Deprecated. Remove IGN_MSGS CMake variables on tick-tock. - set( - IGN_MSGS_GEN_EXECUTABLE -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 236f12f1..d9221c5e 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -110,7 +110,7 @@ function(gz_msgs_protoc) - - - set(GENERATE_ARGS -- --protoc-exec "$" -+ --protoc-exec "${gz_msgs_protoc_PROTOC_EXEC}" - --gz-generator-bin "${GZ_MSGS_GEN_EXECUTABLE}" - --proto-path "${gz_msgs_protoc_PROTO_PATH}" - --input-path "${ABS_FIL}" -@@ -158,7 +158,7 @@ foreach(proto_file ${proto_files}) - INPUT_PROTO - ${proto_file} - PROTOC_EXEC -- protobuf::protoc -+ ${GZ_MSGS_PROTOC_EXECUTABLE} - OUTPUT_CPP_DIR - "${PROJECT_BINARY_DIR}/include" - OUTPUT_RUBY_DIR - diff --git a/recipe/meta.yaml b/recipe/meta.yaml index f645d13..3ffdfd0 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,11 +1,13 @@ {% set component_name = "msgs" %} {% set repo_name = "gz-" + component_name %} -{% set version = "9_9.5.0" %} +{% set version = "10_10.0.0" %} {% set major_version = version.split('_')[0] %} {% set version_package = version.split('_')[1] %} {% set name = repo_name + major_version %} {% set component_version = component_name + major_version %} {% set cxx_name = "lib" + name %} +{% set python_name = name + "-python" %} + package: name: {{ name }} @@ -13,12 +15,16 @@ package: source: - url: https://github.com/gazebosim/{{ repo_name }}/archive/{{ repo_name }}{{ version }}.tar.gz - sha256: b0ee93979a1aaf035b193006052fb6339a52511a3db04ec995f79e39ef798b14 + sha256: 81afeb973252ffabcbab1372271efac2d3dbd52679916b495000215f43d54997 patches: - - fixprotobuf23.patch - + - 391.patch + - 392.patch + - 393.patch + - win_enable_cmd_install.patch + - win_enable_py_tests.patch + build: - number: 1 + number: 0 outputs: - name: {{ cxx_name }} @@ -47,6 +53,8 @@ outputs: - tinyxml2 - libabseil - libprotobuf + run: + - python test: commands: - test -f ${PREFIX}/include/gz/{{ component_version }}/gz/{{ component_name }}.hh # [not win] @@ -58,6 +66,45 @@ outputs: - if not exist %PREFIX%\\Library\\bin\\{{ name }}.dll exit 1 # [win] - if not exist %PREFIX%\\Library\\lib\\cmake\\{{ name }}\\{{ name }}-config.cmake exit 1 # [win] + - name: {{ python_name }} + build: + noarch: python + script: build_py.sh # [unix] + script: bld_py.bat # [win] + requirements: + build: + - {{ compiler('cxx') }} + - {{ compiler('c') }} + - ninja + - cmake + - pkg-config + - python + # We need all host deps also in build for cross-compiling + - libgz-math7 # [build_platform != target_platform] + - libgz-tools2 # [build_platform != target_platform] + - tinyxml2 # [build_platform != target_platform] + - libabseil # [build_platform != target_platform] + - libprotobuf # [build_platform != target_platform] + host: + - libgz-math7 + - libgz-tools2 + - tinyxml2 + - libabseil + - libprotobuf + - python + - protobuf + - pytest + run: + - python >=3.8 + - protobuf + test: + commands: + - pip check + requires: + - pip + imports: + - gz.msgs10 + - name: {{ name }} build: run_exports: @@ -65,6 +112,7 @@ outputs: requirements: run: - {{ pin_subpackage(cxx_name, exact=True) }} + - {{ pin_subpackage(python_name, max_pin='x.x.x') }} test: commands: - test -f ${PREFIX}/include/gz/{{ component_version }}/gz/{{ component_name }}.hh # [not win] @@ -75,6 +123,10 @@ outputs: - if not exist %PREFIX%\\Library\\lib\\{{ name }}.lib exit 1 # [win] - if not exist %PREFIX%\\Library\\bin\\{{ name }}.dll exit 1 # [win] - if not exist %PREFIX%\\Library\\lib\\cmake\\{{ name }}\\{{ name }}-config.cmake exit 1 # [win] + requires: + - pip + imports: + - gz.msgs10 about: home: https://github.com/gazebosim/{{ repo_name }} diff --git a/recipe/win_enable_cmd_install.patch b/recipe/win_enable_cmd_install.patch new file mode 100644 index 0000000..2c3118f --- /dev/null +++ b/recipe/win_enable_cmd_install.patch @@ -0,0 +1,22 @@ +From a956bc89ee8a48f04e46c380b7d2dfb1557b698f Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Wed, 4 Oct 2023 10:34:45 +0200 +Subject: [PATCH] Install gz-tools commands on Windows + +Signed-off-by: Silvio Traversaro +--- + core/CMakeLists.txt | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt +index 2bbe9114..b2859c58 100644 +--- a/core/CMakeLists.txt ++++ b/core/CMakeLists.txt +@@ -132,6 +132,4 @@ gz_build_tests(TYPE UNIT + ) + + add_subdirectory(include/gz/msgs) +-if(NOT WIN32) +- add_subdirectory(src/cmd) +-endif() ++add_subdirectory(src/cmd) diff --git a/recipe/win_enable_py_tests.patch b/recipe/win_enable_py_tests.patch new file mode 100644 index 0000000..2ffc834 --- /dev/null +++ b/recipe/win_enable_py_tests.patch @@ -0,0 +1,22 @@ +From e83ea0a14b69e59b9fc8cf240f2b8bf3b6b743ba Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Wed, 4 Oct 2023 10:14:52 +0200 +Subject: [PATCH] Enable Python tests on Windows + +--- + python/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index fad895f1..ea22f1cb 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -7,7 +7,7 @@ configure_file(${PROJECT_SOURCE_DIR}/python/src/__init__.py.in ${python_init_fil + + install(FILES ${python_init_file} DESTINATION ${GZ_PYTHON_INSTALL_PATH}/gz/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR} RENAME __init__.py) + +-if (BUILD_TESTING AND NOT WIN32) ++if (BUILD_TESTING) + set(python_tests + basic_TEST + )