Skip to content
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ if __name__ == '__main__':

The sources are hosted on [GitHub](https://github.com/fredboudon/PyQGLViewer).

To create a conda environment with all dependencies:
To create and activate a conda environment with all dependencies, using `environment-linux.yml`, `environment-macos.yml` or `environment-windows.yml` for your platform:

```
conda env create -f environment.yml
conda env create -f environment-linux.yml
conda activate qglviewer
```

macOS also requires the Xcode Command Line Tools, and Windows Visual Studio 2022 with the C++ tools.

To build and install the project:

```
Expand Down
1 change: 0 additions & 1 deletion conda/bld.bat

This file was deleted.

61 changes: 0 additions & 61 deletions conda/build.sh

This file was deleted.

44 changes: 18 additions & 26 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,50 @@ about:

build:
number: 2
string: py{{ PY_VER }}
script:
- readlink -f "$(which g++)" # [linux]
- g++ --version # [linux]
- sip-install --verbose
script_env:
- SETUPTOOLS_SCM_PRETEND_VERSION
# script:
# - sip-install --verbose
# - {{ PYTHON }} -m pip install . -v --no-build-isolation --no-deps --ignore-installed

requirements:
build:
- {{ compiler('cxx') }}
- {{ stdlib('c') }} # [osx and win]
- {{ stdlib('c') }}
# on linux qmake calls g++ by its plain name, that compiler('cxx') does not provide
- gxx # [linux]
- make # [unix]
- pkg-config # [unix]
# - libgl-devel # [linux] # match libqglviewer CDT GL strategy
# # from https://conda-forge.org/docs/maintainer/knowledge_base.html#libgl
# - python
# - sip
# - pyqt
# - pyqt-builder
- pkg-config # [unix]
host:
- python
- pip
- sip<=6.10
- pyqt
- pyqt5-sip
- pyqt-builder=1.18
- pyqt-builder 1.18.*
- packaging
- qt-main
- libqglviewer
- libgl-devel # [linux]
- libxcb # [linux]
- pthread-stubs # [linux]
- sysroot_linux-64 # [linux]
- xorg-libxfixes # [linux]


run:
- python
- sip<=6.10
- pyqt
- libqglviewer
- pyopengl
- xorg-libxfixes # [linux]

test:
requires: # [unix]
- pytest # [unix]
- pytest-qt # [unix]
- pytest-xvfb # [unix]
requires:
- pytest
- pytest-qt
- pytest-xvfb # [linux]
imports:
- PyQGLViewer
source_files: # [unix]
- test/*.py # [unix]
commands: # [unix]
- pytest -v # [unix]
source_files:
- test/*.py
commands:
- set QT_QPA_PLATFORM=offscreen # [win]
- pytest -v
32 changes: 32 additions & 0 deletions environment-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Linux developer environment, mirroring conda/meta.yaml.
# Versions follow conda-forge. Only sip and pyqt-builder are pinned as in the
# recipe, and sysroot as in conda-forge-pinning.
name: qglviewer
channels:
- conda-forge
dependencies:
# compiler('cxx') and stdlib('c') from the recipe. cxx-compiler provides g++
# without target prefix, as called by qmake (gxx in the recipe does the same).
# g++ finds this sysroot by itself.
- cxx-compiler
- sysroot_linux-64=2.17
- make
- pkg-config
# host
- python
- pip
- sip<=6.10
- pyqt
- pyqt5-sip
- pyqt-builder=1.18.*
- packaging
- qt-main
- libqglviewer
- libgl-devel
- xorg-libxfixes
# run
- pyopengl
# test
- pytest
- pytest-qt
- pytest-xvfb
30 changes: 30 additions & 0 deletions environment-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# macOS developer environment (Intel and Apple Silicon), mirroring conda/meta.yaml.
# Versions follow conda-forge. Only sip and pyqt-builder are pinned as in the
# recipe.
#
# Xcode Command Line Tools are required: qmake gets the SDK path from xcrun.
name: qglviewer
channels:
- conda-forge
dependencies:
# clang++ as called by qmake. The clangxx_osx-* wrappers of compiler('cxx')
# are arch specific and only set env flags, that qmake does not read.
- cxx-compiler
- make
- pkg-config
# host
- python
- pip
- sip<=6.10
- pyqt
- pyqt5-sip
- pyqt-builder=1.18.*
- packaging
- qt-main
- libqglviewer
# run
- pyopengl
# test
- pytest
- pytest-qt
- pytest-xvfb
27 changes: 27 additions & 0 deletions environment-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Windows developer environment, mirroring conda/meta.yaml.
# Versions follow conda-forge. Only sip and pyqt-builder are pinned as in the
# recipe.
#
# Visual Studio 2022 with the C++ tools is required: activation of the env sets
# up its compiler and nmake.
name: qglviewer
channels:
- conda-forge
dependencies:
# compiler('cxx') from the recipe
- cxx-compiler
# host
- python
- pip
- sip<=6.10
- pyqt
- pyqt5-sip
- pyqt-builder=1.18.*
- packaging
- qt-main
- libqglviewer
# run
- pyopengl
# test
- pytest
- pytest-qt
13 changes: 0 additions & 13 deletions environment.yml

This file was deleted.

32 changes: 12 additions & 20 deletions project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@


import os
import platform
import subprocess

from pyqtbuild import PyQtBindings, PyQtProject


def determine_pyqglviewer_version():
import os, subprocess

version = os.environ.get("SETUPTOOLS_SCM_PRETEND_VERSION",None)
if version is None:
try:
Expand Down Expand Up @@ -68,28 +68,20 @@ def __init__(self, project):
print("Instanciation of the PyQGLViewerBindings ")

def apply_user_defaults(self, tool):
import platform, os


CONDA_PREFIX = os.environ.get('CONDA_PREFIX',None)
PREFIX = os.environ.get('PREFIX',None)
CONDA_BUILD_SYSROOT = os.environ.get('CONDA_BUILD_SYSROOT',None)

if platform.system() in ['Darwin','Linux'] :
system = platform.system()
prefix = os.environ.get("PREFIX") or os.environ.get("CONDA_PREFIX")

if system in ('Darwin','Linux') :
self.libraries.append('QGLViewer')
if not CONDA_PREFIX is None:
self.include_dirs.append(f'{CONDA_PREFIX}/include')
self.library_dirs.append(f'{CONDA_PREFIX}/lib')
if not PREFIX is None:
self.include_dirs.append(f'{PREFIX}/include')
self.library_dirs.append(f'{PREFIX}/lib')

if platform.system() == 'Linux':
if prefix:
self.include_dirs.append(f'{prefix}/include')
self.library_dirs.append(f'{prefix}/lib')

if system == 'Linux':
self.libraries.append('GLU')
if not CONDA_BUILD_SYSROOT is None :
self.include_dirs.append(f'{CONDA_BUILD_SYSROOT}/usr/include')

elif platform.system() == 'Windows':
elif system == 'Windows':
self.libraries.append('QGLViewer2')
self.libraries.append('opengl32')
self.libraries.append('glu32')
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specify the build system.
[build-system]
# "setuptools", "setuptools-scm" not used
requires = ["sip<=6.10", "PyQt-builder"]
requires = ["sip<=6.10", "PyQt-builder=1.18"]
build-backend = "sipbuild.api"


Expand All @@ -16,7 +16,6 @@ authors = [
{ name = "Frederic Boudon", email = "frederic.boudon@cirad.fr" }
]
dependencies = [
"sip<=6.10",
"PyQt5",
"PyQt5-sip"
]
Expand All @@ -28,8 +27,7 @@ sip-files-dir = "sip"
[tool.sip.bindings.PyQGLViewer]
qmake-QT = ['xml', 'opengl', 'gui', 'widgets']
tags = ['QGLViewer_2_9_1']
# include-dirs=['${CONDA_PREFIX}/include']
# library-dirs=['${CONDA_PREFIX}/lib']


# Could specified directly with new construct but currently only working on MacOS. Instead options set in project.py
# libraries = ['QGLViewer ; system_platform == "Linux"','GLU ; system_platform == "Linux"']
Loading