8000 Improve windows support by jorisv · Pull Request #457 · stack-of-tasks/eigenpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve windows support #457

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

Merged
merged 12 commits into from
Apr 9, 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
3 changes: 2 additions & 1 deletion .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Check-changelog
name: CI - Check-changelog

on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled, edited]
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/conda/environment_windows.yml

This file was deleted.

23 changes: 21 additions & 2 deletions .github/workflows/jrl-cmakemodules.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
name: JRL-cmakemodules
on: [push,pull_request]
name: CI - JRL-cmakemodules

on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: Check build on linux
name: CI - Linux via APT

on: ["push", "pull_request"]
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
32 changes: 25 additions & 7 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: Conda-CI

on: [push,pull_request]
name: CI - OSX/Linux via Conda

on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -42,7 +60,7 @@ jobs:
with:
submodules: recursive

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: .ccache
key: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.cxx_options }}-${{ matrix.python-version }}-${{ github.sha }}
Expand All @@ -53,7 +71,7 @@ jobs:
with:
activate-environment: eigenpy
auto-update-conda: true
environment-file: .github/workflows/conda/environment_macos_linux.yml
environment-file: .github/workflows/conda/environment_all.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

Expand All @@ -62,7 +80,7 @@ jobs:
with:
activate-environment: eigenpy
auto-update-conda: true
environment-file: .github/workflows/conda/environment_macos_linux.yml
environment-file: .github/workflows/conda/environment_all.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh
Expand All @@ -84,7 +102,7 @@ jobs:
-DGENERATE_PYTHON_STUBS=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_FLAGS=${{ matrix.cxx_options }}
cmake --build . -j2
cmake --build . -j4
ctest --output-on-failure
cmake --install .

Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/reloc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
name: Ensure relocatable
name: CI - Ensure relocatable

on: [push,pull_request]
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/ros_ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: ROS-CI
name: CI - Linux via ROS

# This determines when this workflow is run
on: [push, pull_request] # on all pushes and PRs
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
54 changes: 39 additions & 15 deletions .github/workflows/windows-conda.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
name: Build Eigenpy on Windows via Conda
on: [push,pull_request]
name: CI - Windows via Conda

on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -17,32 +36,34 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
compiler: ["cl", "clang-cl"]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/cache@v4
with:
path: .ccache
key: ccache-windows-conda-${{ matrix.compiler }}-${{ matrix.os }}-${{ github.sha }}
restore-keys: ccache-windows-conda-${{ matrix.compiler }}-${{ matrix.os }}-

- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: eigenpy
auto-update-conda: true
environment-file: .github/workflows/conda/environment_windows.yml
environment-file: .github/workflows/conda/environment_all.yml
python-version: "3.10"
auto-activate-base: false

- uses: actions/cache@v3
with:
path: .ccache
key: ccache-windows-conda-${{ matrix.os }}-${{ github.sha }}
restore-keys: ccache-windows-conda-${{ matrix.os }}-

- name: Build Eigenpy
shell: cmd /C CALL {0}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
run: |
:: start building
call "%programfiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
if errorlevel 1 exit 1
call conda list

mkdir build
pushd build
Expand All @@ -57,14 +78,17 @@ jobs:
..
if errorlevel 1 exit 1

:: Build and Install
cmake --build . -j3 --config Release --target install
:: Build
cmake --build . -j4
if errorlevel 1 exit 1

:: Testing
ctest --output-on-failure -C Release -V
ctest --output-on-failure
if errorlevel 1 exit 1

:: Install
cmake --install .

:: Test Python import
cd ..
python -c "import eigenpy"
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ repos:
args:
- --fix
- --exit-non-zero-on-fix
- --ignore
- UP036
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix CMake export ([#446](https://github.com/stack-of-tasks/eigenpy/pull/446)
- Fix `int` management on Windows ([#455](https://github.com/stack-of-tasks/eigenpy/pull/455))
- Fix `long long` management on Mac ([#455](https://github.com/stack-of-tasks/eigenpy/pull/455))
- Allow to run test in the build directory on Windows ([#457](https://github.com/stack-of-tasks/eigenpy/pull/457))

### Removed
- Remove casting when converting from Eigen scalar to Numpy scalar.
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ else()
endif()
endif()

function(set_standard_output_directory target)
set_target_properties(
${target}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endfunction()

# Disable -Werror on Unix for now.
set(CXX_DISABLE_WERROR True)
set(CMAKE_VERBOSE_MAKEFILE True)
Expand Down Expand Up @@ -328,6 +336,7 @@ set(${PROJECT_NAME}_SOURCES

add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
set_standard_output_directory(${PROJECT_NAME})
target_include_directories(
${PROJECT_NAME} SYSTEM
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
Expand Down
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if(GENERATE_PYTHON_STUBS)
endif(GENERATE_PYTHON_STUBS)

# --- INSTALL SCRIPTS
set(PYTHON_FILES __init__.py)
set(PYTHON_FILES __init__.py windows_dll_manager.py)

foreach(python ${PYTHON_FILES})
python_build(${PROJECT_NAME} ${python})
Expand Down
28 changes: 26 additions & 2 deletions python/eigenpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,29 @@
# Copyright (c) 2017-2021 CNRS INRIA
#

from .eigenpy_pywrap import * # noqa
from .eigenpy_pywrap import __raw_version__, __version__ # noqa
# On Windows, if eigenpy.dll is not in the same directory than
# the .pyd, it will not be loaded.
# We first try to load eigenpy, then, if it fail and we are on Windows:
# 1. We add all paths inside eigenpy_WINDOWS_DLL_PATH to DllDirectory
# 2. If EIGENPY_WINDOWS_DLL_PATH we add the relative path from the
# package directory to the bin directory to DllDirectory
# This solution is inspired from:
# - https://github.com/PixarAnimationStudios/OpenUSD/pull/1511/files
# - https://stackoverflow.com/questions/65334494/python-c-extension-packaging-dll-along-with-pyd
# More resources on https://github.com/diffpy/pyobjcryst/issues/33
try:
from .eigenpy_pywrap import * # noqa
from .eigenpy_pywrap import __raw_version__, __version__
except ImportError:
import platform

if platform.system() == "Windows":
from .windows_dll_manager import build_directory_manager, get_dll_paths

with build_directory_manager() as dll_dir_manager:
for p in get_dll_paths():
dll_dir_manager.add_dll_directory(p)
from .eigenpy_pywrap import * # noqa
from .eigenpy_pywrap import __raw_version__, __version__ # noqa
else:
raise
Loading
0