Skip to content

Commit

Permalink
Update meta.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Oct 3, 2023
1 parent e15096b commit 4fcf698
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 65 deletions.
16 changes: 11 additions & 5 deletions recipe/bld_cxx.bat
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
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<major> 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

:: Build.
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 "basic_TEST"
if errorlevel 1 exit 1
28 changes: 28 additions & 0 deletions recipe/bld_py.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
mkdir build_py
cd build_py

:: Set CMAKE_NSTALL_PREFIX to wrong directory to ensure C++ files
:: are not included in the gz-msgs<major>-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.
ctest -C Release -E "basic_TEST"
if errorlevel 1 exit 1
20 changes: 13 additions & 7 deletions recipe/build_cxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ 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
)
Expand All @@ -35,19 +33,27 @@ mkdir build
cd build

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<major> 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 \
-DUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION:BOOL=ON \
-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"
fi
ctest -C Release -E "${CTEST_DISABLED_TESTS}"
ctest -C Release -E "${CTEST_DISABLED_TESTS}|basic_TEST"
fi
56 changes: 56 additions & 0 deletions recipe/build_py.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/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-host
pushd build-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
cd build

if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then
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

# Set Python install dir to wrong directory to ensure Python files
# are not included in the libgz-msgs<major> package
cmake ${CMAKE_ARGS} -DBUILD_TESTING:BOOL=ON -GNinja .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP:BOOL=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 \
-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
ctest -C Release -R "basic_TEST"
fi
51 changes: 0 additions & 51 deletions recipe/fixprotobuf23.patch

This file was deleted.

72 changes: 70 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% 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 }}
Expand All @@ -14,14 +15,37 @@ package:
source:
- url: https://github.com/gazebosim/{{ repo_name }}/archive/{{ repo_name }}{{ version }}.tar.gz
sha256: 81afeb973252ffabcbab1372271efac2d3dbd52679916b495000215f43d54997
patches:
- 392.patch

build:
number: 0
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


outputs:
- name: {{ cxx_name }}
script: build_cxx.sh # [unix]
script: bld_cxx.bat # [win]
script: install_cxx.sh # [unix]
script: install_cxx.bat # [win]
build:
run_exports:
- {{ pin_subpackage(cxx_name, max_pin='x') }}
Expand All @@ -45,6 +69,8 @@ outputs:
- tinyxml2
- libabseil
- libprotobuf
run:
- python
test:
commands:
- test -f ${PREFIX}/include/gz/{{ component_version }}/gz/{{ component_name }}.hh # [not win]
Expand All @@ -56,13 +82,51 @@ 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: install_python.sh # [unix]
script: install_python.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 >=3.8
run:
- python >=3.8
- protobuf
test:
commands:
- pip check
requires:
- pip
imports:
- gz.msgs10

- name: {{ name }}
build:
run_exports:
- {{ pin_subpackage(cxx_name, max_pin='x') }}
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]
Expand All @@ -73,6 +137,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 }}
Expand Down

0 comments on commit 4fcf698

Please sign in to comment.