From 4b2a41fb67ddfd0523ff6128dfc1cf24204a302b Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Wed, 31 Jul 2024 16:55:45 +0200 Subject: [PATCH 01/11] First attempt at building a wheel. See issue #176 --- README.md | 13 +++++++++++++ pyproject.toml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 pyproject.toml diff --git a/README.md b/README.md index 4cf06f71..3e41cc42 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,19 @@ colcon build Please, refer to [colcon documentation](https://colcon.readthedocs.io/en/released/reference/verb/build.html) for more information, such as building only one of the packages. +### Building a python wheel + +First build fast DDS as per usual. Setup CMAKE_PREFIX_PATH to point to this installation. + +Then build the python wheel using the [build frontend](https://build.pypa.io/en/stable/) and the [py-cmake-build](https://tttapa.github.io/py-build-cmake/) backend: + +```bash +export CMAKE_PREFIX_PATH=~/fastdds/install +pip install build +python -m build . + +``` + ## Python example Fast DDS documentation includes a first publisher-subscriber application using Python. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..7aad2c5f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[project] +name = "fastdds" +readme = "README.md" +version = "2.0.0" +requires-python = ">=3.8" +license = { "file" = "LICENSE" } +authors = [{ "name" = "Pieter P", "email" = "pieter.p.dev@outlook.com" }] +keywords = ["dds"] +classifiers = [ + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", +] +urls = { "Documentation" = "https://fast-dds.docs.eprosima.com" } +dependencies = [] + +[build-system] +# Use a pre release, see this issue: https://github.com/tttapa/py-build-cmake/issues/22 +# This allows usage of generated = "package" below. +requires = ["py-build-cmake==0.2.0a14", "setuptools"] +build-backend = "py_build_cmake.build" + +[tool.py-build-cmake.module] +generated = "package" + +[tool.py-build-cmake.sdist] +include = ["fastdds_python"] + +[tool.py-build-cmake.cmake] +minimum_version = "3.22" +source_path = "fastdds_python" +build_type = "Release" + From b50e741c9f9a84899250a5be059e66657aed0a1b Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Thu, 1 Aug 2024 22:16:24 +0200 Subject: [PATCH 02/11] Add cibuildwheel workflow file. --- .github/workflows/cibuildwheel.yml | 21 +++++++++++++++++++++ fastdds_python/src/swig/CMakeLists.txt | 1 + fastdds_python/src/swig/fastdds.i | 4 ++-- pyproject.toml | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cibuildwheel.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml new file mode 100644 index 00000000..371487a0 --- /dev/null +++ b/.github/workflows/cibuildwheel.yml @@ -0,0 +1,21 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] # TODO:, macos-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.19.2 + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl diff --git a/fastdds_python/src/swig/CMakeLists.txt b/fastdds_python/src/swig/CMakeLists.txt index c30d7820..09a1fb82 100644 --- a/fastdds_python/src/swig/CMakeLists.txt +++ b/fastdds_python/src/swig/CMakeLists.txt @@ -52,6 +52,7 @@ endif() if(MSVC OR MSVC_IDE) target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) endif() +target_compile_options(${PROJECT_NAME} PRIVATE -DPy_LIMITED_API=0x030A0000) target_link_libraries(${PROJECT_NAME} Python3::Module diff --git a/fastdds_python/src/swig/fastdds.i b/fastdds_python/src/swig/fastdds.i index 9e5275f2..c4f0a515 100644 --- a/fastdds_python/src/swig/fastdds.i +++ b/fastdds_python/src/swig/fastdds.i @@ -24,14 +24,14 @@ std::string err_msg("In method '$symname': "); PyObject* exc_str = PyObject_GetAttrString(exc, "__name__"); - err_msg += PyUnicode_AsUTF8(exc_str); + err_msg += "Oi";// PyUnicode_AsUTF8(exc_str); Py_XDECREF(exc_str); if (val != NULL) { PyObject* val_str = PyObject_Str(val); err_msg += ": "; - err_msg += PyUnicode_AsUTF8(val_str); + err_msg += "Oi"; // PyUnicode_AsUTF8(val_str); Py_XDECREF(val_str); } diff --git a/pyproject.toml b/pyproject.toml index 7aad2c5f..249872e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,3 +38,8 @@ minimum_version = "3.22" source_path = "fastdds_python" build_type = "Release" +[tool.cibuildwheel] +# use podman instead of docker +container-engine = "podman" + +build = ["cp39-manylinux_x86_64"] From 2d06beeb2be77abb8ed58dfe9f9b068e1719c8dc Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Thu, 1 Aug 2024 23:12:24 +0200 Subject: [PATCH 03/11] Add bash script to install and compile dependencies. --- .github/workflows/cibuildwheel.yml | 2 ++ fastdds_python/CMakeLists.txt | 2 +- fastdds_python/src/swig/CMakeLists.txt | 2 +- pyproject.toml | 2 +- scripts/build_deps.sh | 32 ++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100755 scripts/build_deps.sh diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 371487a0..143d8284 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -14,6 +14,8 @@ jobs: - uses: actions/checkout@v2 - name: Build wheels + env: + CIBW_BEFORE_BUILD: "scripts/build_deps.sh" uses: pypa/cibuildwheel@v2.19.2 - uses: actions/upload-artifact@v4 diff --git a/fastdds_python/CMakeLists.txt b/fastdds_python/CMakeLists.txt index 3eedf30c..ccadb180 100644 --- a/fastdds_python/CMakeLists.txt +++ b/fastdds_python/CMakeLists.txt @@ -40,7 +40,7 @@ find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) set(CMAKE_SWIG_FLAGS "") -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED) find_package(fastcdr REQUIRED) find_package(fastrtps 2.12 REQUIRED) diff --git a/fastdds_python/src/swig/CMakeLists.txt b/fastdds_python/src/swig/CMakeLists.txt index 09a1fb82..8830010e 100644 --- a/fastdds_python/src/swig/CMakeLists.txt +++ b/fastdds_python/src/swig/CMakeLists.txt @@ -52,7 +52,7 @@ endif() if(MSVC OR MSVC_IDE) target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) endif() -target_compile_options(${PROJECT_NAME} PRIVATE -DPy_LIMITED_API=0x030A0000) +target_compile_options(${PROJECT_NAME} PRIVATE -DPy_LIMITED_API=0x03090000) target_link_libraries(${PROJECT_NAME} Python3::Module diff --git a/pyproject.toml b/pyproject.toml index 249872e9..8a26b513 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,5 +41,5 @@ build_type = "Release" [tool.cibuildwheel] # use podman instead of docker container-engine = "podman" - build = ["cp39-manylinux_x86_64"] +build-frontend = "build" diff --git a/scripts/build_deps.sh b/scripts/build_deps.sh new file mode 100755 index 00000000..cd2ef531 --- /dev/null +++ b/scripts/build_deps.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Script to install required software in manylinux2014 container + +set -eu + +# Install tinyxml2 and asio +yum install -y tinyxml2-devel asio-devel + +# Foo nathan +git clone --branch v0.7-3 https://github.com/foonathan/memory.git +mkdir memory/build +pushd memory/build +cmake .. -DCMAKE_BUILD_TYPE=Release -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF +make install +popd + +# Fast CDR: +git clone --branch 2.2.3 https://github.com/eProsima/Fast-CDR.git +mkdir Fast-CDR/build +pushd Fast-CDR/build +cmake .. -DCMAKE_BUILD_TYPE=Release +make install +popd + +# Fast RTPS: +git clone --branch v2.14.3 https://github.com/eProsima/Fast-DDS.git +mkdir Fast-DDS/build +pushd Fast-DDS/build +cmake .. -DCMAKE_BUILD_TYPE=Release +make install +popd From 8b34b6ee2fb3fcc2af8c37dcd1364995a5a076e1 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 13:46:59 +0200 Subject: [PATCH 04/11] Add bat file to build dependencies on windows. --- .github/workflows/cibuildwheel.yml | 6 ++++-- .gitignore | 3 +++ pyproject.toml | 2 +- scripts/build_deps.bat | 24 ++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100755 scripts/build_deps.bat diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 143d8284..388630fe 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -7,15 +7,17 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] # TODO:, macos-latest] + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - name: Build wheels env: - CIBW_BEFORE_BUILD: "scripts/build_deps.sh" + CIBW_BEFORE_BUILD_LINUX: "scripts/build_deps.sh" + CIBW_BEFORE_BUILD_WINDOWS: "scripts/build_deps.bat" uses: pypa/cibuildwheel@v2.19.2 - uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index d858b73c..a67de63b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ __pycache__ # ignore vscode folder .vscode + +# py-build-cmake cache folder +.py-build-cmake_cache diff --git a/pyproject.toml b/pyproject.toml index 8a26b513..9187f9a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,5 +41,5 @@ build_type = "Release" [tool.cibuildwheel] # use podman instead of docker container-engine = "podman" -build = ["cp39-manylinux_x86_64"] +build = ["cp39-manylinux_x86_64", "cp39-win_amd64"] build-frontend = "build" diff --git a/scripts/build_deps.bat b/scripts/build_deps.bat new file mode 100755 index 00000000..ca4ea38e --- /dev/null +++ b/scripts/build_deps.bat @@ -0,0 +1,24 @@ + +@REM Foo nathan +git clone --branch v0.7-3 https://github.com/foonathan/memory.git +mkdir memory\build +pushd memory\build +cmake .. -DCMAKE_BUILD_TYPE=Release -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF -G Ninja +ninja install +popd + +@REM Fast CDR +git clone --branch 2.2.3 https://github.com/eProsima/Fast-CDR.git +mkdir Fast-CDR\build +pushd Fast-CDR\build +cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja +ninja install +popd + +@REM Fast RTPS +git clone --branch v2.14.3 https://github.com/eProsima/Fast-DDS.git +mkdir Fast-DDS\build +pushd Fast-DDS\build +cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja +ninja install +popd From 33f7a3e1080718f483719d33291245e7ce6556df Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 15:44:02 +0200 Subject: [PATCH 05/11] Split build steps into separate jobs. --- .github/workflows/cibuildwheel.yml | 25 ------ .github/workflows/wheels.yml | 125 +++++++++++++++++++++++++++++ scripts/build_deps.sh | 2 +- 3 files changed, 126 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/cibuildwheel.yml create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml deleted file mode 100644 index 388630fe..00000000 --- a/.github/workflows/cibuildwheel.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - - steps: - - uses: actions/checkout@v2 - - - name: Build wheels - env: - CIBW_BEFORE_BUILD_LINUX: "scripts/build_deps.sh" - CIBW_BEFORE_BUILD_WINDOWS: "scripts/build_deps.bat" - uses: pypa/cibuildwheel@v2.19.2 - - - uses: actions/upload-artifact@v4 - with: - path: ./wheelhouse/*.whl diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 00000000..123e0c41 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,125 @@ +name: Build + +on: [push, pull_request] + +jobs: + build-fastdds-ubuntu: + name: Build fast DDS library for ubuntu + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Cache build + id: cache-build + uses: actions/cache@v4 + with: + path: install + key: fastdds-ubuntu-${{ hashFiles('scripts/build_deps.sh') }} + + - name: Build fast DDS library + if: steps.cache-build.outputs.cache-hit != 'true' + run: scripts/build_deps.sh + + - uses: actions/upload-artifact@v4 + with: + name: fastdds-ubuntu + path: ./install + + build-fastdds-linux: + name: Build fast DDS library for manylinux2014 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Cache build + id: cache-build + uses: actions/cache@v4 + with: + path: install + key: fastdds-linux-${{ hashFiles('scripts/build_deps.sh') }} + + - name: Build fast DDS library + if: steps.cache-build.outputs.cache-hit != 'true' + run: | + yum install -y tinyxml2-devel asio-devel + scripts/build_deps.sh + + - uses: actions/upload-artifact@v4 + with: + name: fastdds-linux + path: ./install + + build-fastdds-windows: + name: Build fast DDS library for windows + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build fast DDS library + if: false + run: scripts\build_deps.bat + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + + build-ubuntu-wheels: + name: Build wheels for ubuntu + runs-on: ubuntu-latest + needs: build-fastdds-ubuntu + + steps: + - uses: actions/checkout@v4 + + - name: Download Library Build + uses: actions/download-artifact@v4 + with: + name: fastdds-ubuntu + + - name: Build wheels + run: python -m build . + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + + build-ubuntu-wheels: + name: Build wheels for linux + runs-on: ubuntu-latest + needs: build-fastdds-linux + + steps: + - uses: actions/checkout@v4 + + - name: Download Library Build + uses: actions/download-artifact@v4 + with: + name: fastdds-linux + path: HelloLibrary/install + + - name: Build wheels + env: + CIBW_BEFORE_BUILD_LINUX: "scripts/build_deps.sh" + uses: pypa/cibuildwheel@v2.19.2 + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + + build-windows-wheels: + name: Build wheels for windows + runs-on: windows-latest + needs: build-fastdds-windows + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.19.2 + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl diff --git a/scripts/build_deps.sh b/scripts/build_deps.sh index cd2ef531..39cb84fd 100755 --- a/scripts/build_deps.sh +++ b/scripts/build_deps.sh @@ -5,7 +5,7 @@ set -eu # Install tinyxml2 and asio -yum install -y tinyxml2-devel asio-devel +# yum install -y tinyxml2-devel asio-devel # Foo nathan git clone --branch v0.7-3 https://github.com/foonathan/memory.git From a8980ddcf7416e2ea9256103aa3bce1a740dfd31 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 15:48:11 +0200 Subject: [PATCH 06/11] Split build steps into separate jobs. --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 123e0c41..52896124 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -86,7 +86,7 @@ jobs: with: path: ./wheelhouse/*.whl - build-ubuntu-wheels: + build-linux-wheels: name: Build wheels for linux runs-on: ubuntu-latest needs: build-fastdds-linux From ba65470280d001be7c58fa506eb348412da6ae34 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 16:03:34 +0200 Subject: [PATCH 07/11] Use manylinux container image during build. --- .github/workflows/wheels.yml | 1 + scripts/build_deps.sh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 52896124..0e99a3b3 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -29,6 +29,7 @@ jobs: build-fastdds-linux: name: Build fast DDS library for manylinux2014 runs-on: ubuntu-latest + image: quay.io/pypa/manylinux_2014_x86_64 steps: - uses: actions/checkout@v4 diff --git a/scripts/build_deps.sh b/scripts/build_deps.sh index 39cb84fd..78c6315a 100755 --- a/scripts/build_deps.sh +++ b/scripts/build_deps.sh @@ -6,12 +6,14 @@ set -eu # Install tinyxml2 and asio # yum install -y tinyxml2-devel asio-devel +INSTALL_FOLDER=`pwd`/install +echo "Installing to ${INSTALL_FOLDER}" # Foo nathan git clone --branch v0.7-3 https://github.com/foonathan/memory.git mkdir memory/build pushd memory/build -cmake .. -DCMAKE_BUILD_TYPE=Release -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF +cmake .. --install-prefix ${INSTALL_FOLDER} -DCMAKE_BUILD_TYPE=Release -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF make install popd @@ -19,7 +21,7 @@ popd git clone --branch 2.2.3 https://github.com/eProsima/Fast-CDR.git mkdir Fast-CDR/build pushd Fast-CDR/build -cmake .. -DCMAKE_BUILD_TYPE=Release +cmake .. --install-prefix ${INSTALL_FOLDER} -DCMAKE_BUILD_TYPE=Release make install popd @@ -27,6 +29,6 @@ popd git clone --branch v2.14.3 https://github.com/eProsima/Fast-DDS.git mkdir Fast-DDS/build pushd Fast-DDS/build -cmake .. -DCMAKE_BUILD_TYPE=Release +cmake .. --install-prefix ${INSTALL_FOLDER} -DCMAKE_BUILD_TYPE=Release make install popd From 0059c3efade15db58dbfd63581278779ea9628f6 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 16:04:19 +0200 Subject: [PATCH 08/11] Use manylinux container image during build. --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 0e99a3b3..b314ad78 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -29,7 +29,7 @@ jobs: build-fastdds-linux: name: Build fast DDS library for manylinux2014 runs-on: ubuntu-latest - image: quay.io/pypa/manylinux_2014_x86_64 + container: quay.io/pypa/manylinux_2014_x86_64 steps: - uses: actions/checkout@v4 From 69fa9264e9718ee5b78d7ac459b282b7a66a01ad Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 16:14:39 +0200 Subject: [PATCH 09/11] Use manylinux container image during build. --- .github/workflows/wheels.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b314ad78..27b10ff8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -19,7 +19,9 @@ jobs: - name: Build fast DDS library if: steps.cache-build.outputs.cache-hit != 'true' - run: scripts/build_deps.sh + run: | + sudo apt install -y libasio-dev libtinyxml2-dev libssl-dev + scripts/build_deps.sh - uses: actions/upload-artifact@v4 with: @@ -29,7 +31,7 @@ jobs: build-fastdds-linux: name: Build fast DDS library for manylinux2014 runs-on: ubuntu-latest - container: quay.io/pypa/manylinux_2014_x86_64 + container: quay.io/pypa/manylinux2014_x86_64 steps: - uses: actions/checkout@v4 From a21b6b9136ff98af93b7c45c2d549e532f45fc2f Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 16:35:40 +0200 Subject: [PATCH 10/11] Use makefile for windows build. --- .github/workflows/wheels.yml | 21 +++++++++++++++++---- scripts/Makefile.win32 | 29 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 scripts/Makefile.win32 diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 27b10ff8..bec8aa8e 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -60,14 +60,23 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Cache build + id: cache-build + uses: actions/cache@v4 + with: + path: install + key: fastdds-windows-${{ hashFiles('scripts/Makefile.win32') }} - name: Build fast DDS library - if: false - run: scripts\build_deps.bat + if: steps.cache-build.outputs.cache-hit != 'true' + run: nmake /F scripts\Makefile.win32 - uses: actions/upload-artifact@v4 with: - path: ./wheelhouse/*.whl + name: fastdds-windows + path: ./install build-ubuntu-wheels: name: Build wheels for ubuntu @@ -101,7 +110,6 @@ jobs: uses: actions/download-artifact@v4 with: name: fastdds-linux - path: HelloLibrary/install - name: Build wheels env: @@ -120,6 +128,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Download windows fastdds Build + uses: actions/download-artifact@v4 + with: + name: fastdds-windows + - name: Build wheels uses: pypa/cibuildwheel@v2.19.2 diff --git a/scripts/Makefile.win32 b/scripts/Makefile.win32 new file mode 100644 index 00000000..fbfcf2db --- /dev/null +++ b/scripts/Makefile.win32 @@ -0,0 +1,29 @@ + +all: fastdds + +foonathan: + @echo Foo nathan + git clone --branch v0.7-3 https://github.com/foonathan/memory.git + mkdir memory\build + pushd memory\build + cmake .. -DCMAKE_BUILD_TYPE=Release -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF -G Ninja + ninja install + popd + +fastcdr: + @echo Fast CDR + git clone --branch 2.2.3 https://github.com/eProsima/Fast-CDR.git + mkdir Fast-CDR\build + pushd Fast-CDR\build + cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja + ninja install + popd + +fastdds: fastcdr foonathan + @echo Fast RTPS + git clone --branch v2.14.3 https://github.com/eProsima/Fast-DDS.git + mkdir Fast-DDS\build + pushd Fast-DDS\build + cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja + ninja install + popd From 9335177922fc77a60dfc8919294598e341c91e93 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Sat, 3 Aug 2024 16:44:09 +0200 Subject: [PATCH 11/11] Add build python package to wheel building. --- .github/workflows/wheels.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index bec8aa8e..83e444ad 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -85,12 +85,16 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 - name: Download Library Build uses: actions/download-artifact@v4 with: name: fastdds-ubuntu + - name: Install build python package + run: pip install build + - name: Build wheels run: python -m build .