Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor windows stuff #548

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,40 @@ jobs:
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

windows:

runs-on: windows-2022

defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: false
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
glib2:p
python-pip:p

- name: Build wheel
run: pip3 wheel -v .

- name: Test wheel
run: |
pip3 install lcm*.whl --break-system-packages
python test/python/test_python_module.py

- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: windows-wheel
path: '*.whl'
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,13 @@ jobs:
lua:p

- name: Configure CMake
run: cmake -B build ${{env.CMAKE_FLAGS}} -DPython_FIND_REGISTRY=NEVER
run: cmake -B build ${{env.CMAKE_FLAGS}}

- name: Build
run: cmake --build build

# Needs to be installed for the tests to be able to find DLLs.
- name: Install
run: cmake --install build --prefix /mingw64/

- name: Test
run: |
cd build
# Copy DLLs that don't get installed into the directories of the tests that need them.
cp test/types/liblcm-test-types.dll test/c/
ctest --output-on-failure
run: ctest --output-on-failure

docs:
runs-on: ubuntu-24.04
Expand Down
26 changes: 19 additions & 7 deletions WinSpecific/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# LCM port to Windows

We currently support and test on an [MSYS2](https://www.msys2.org/) MINGW64 environment. Please
reference the GitHub actions that test on Windows in this project for packages necessary to build
LCM in an MSYS2 environment.
## Core Dependencies

We currently support and test on an [MSYS2](https://www.msys2.org/) MINGW64 environment. To install
the necessary dependencies, you can run:

```shell
pacman -S pactoys git make
pacboy -S git make toolchain cmake glib2 gtest python-pip
```

## Java

The above does not result in an environment with Java. If you need the Java-dependent components of
LCM, please see the [openjdk docs](https://openjdk.org/groups/build/doc/building.html) in order to
install a JDK.

## Other Notes

There are a few things to watch out for:

1. Before running any LCM executables locally, LCM should be installed. Otherwise Windows will not
be able to load the built DLLs.
2. When installing LCM, CMake defaults to the usual Windows directories rather than the MSYS2
1. When installing LCM, CMake defaults to the usual Windows directories rather than the MSYS2
environment. You can use CMake's `--prefix` option when installing to override this.
3. If there is an installation of Python on the system in addition to the MSYS2 version, cmake may
2. If there is an installation of Python on the system in addition to the MSYS2 version, cmake may
pick it up instead. If that is the case, it may be necessary to set
`-DPython_FIND_REGISTRY=NEVER` or [one of the other
hints](https://cmake.org/cmake/help/latest/module/FindPython.html#hints) when configuring a build
Expand Down
8 changes: 4 additions & 4 deletions test/python/test_python_module.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import lcm
from os import path, remove
from tempfile import NamedTemporaryFile
from os import path
from tempfile import TemporaryDirectory

CHANNEL = 'test/channel'
DATA = bytes(3)
Expand Down Expand Up @@ -34,8 +34,8 @@ def test_event():


def test_event_log():
with NamedTemporaryFile() as f:
filename = f.name
with TemporaryDirectory() as temp_dir:
filename = f'{temp_dir}/test.log'
# Create a log, write an event, and close it.
log = lcm.EventLog(filename, 'w', True)
assert log.mode == 'w'
Expand Down
Loading