diff --git a/conda/meta.yaml b/conda/meta.yaml index 5b67a99..6262240 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -19,7 +19,7 @@ build: script: - readlink -f "$(which g++)" # [linux] - g++ --version # [linux] - - sip-install --verbose + - {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation script_env: - SETUPTOOLS_SCM_PRETEND_VERSION @@ -42,14 +42,12 @@ requirements: - qt-main - libqglviewer - libgl-devel # [linux] - - xorg-libxfixes # [linux] run: - python - pyqt - libqglviewer - pyopengl - - xorg-libxfixes # [linux] test: requires: diff --git a/environment-linux.yml b/environment-linux.yml index 4a190e1..6131fb3 100644 --- a/environment-linux.yml +++ b/environment-linux.yml @@ -23,7 +23,6 @@ dependencies: - qt-main - libqglviewer - libgl-devel - - xorg-libxfixes # run - pyopengl # test diff --git a/project.py b/project.py index f0eda41..6ff98a7 100644 --- a/project.py +++ b/project.py @@ -69,23 +69,16 @@ def __init__(self, project): def apply_user_defaults(self, tool): + # Libraries are declared in pyproject.toml. Qt only adds its own include + # dirs and links its libraries by full path, so the dirs of the conda env + # are needed to find libQGLViewer and GLU headers and libraries. system = platform.system() prefix = os.environ.get("PREFIX") or os.environ.get("CONDA_PREFIX") - - if system in ('Darwin','Linux') : - self.libraries.append('QGLViewer') - if prefix: - self.include_dirs.append(f'{prefix}/include') - self.library_dirs.append(f'{prefix}/lib') - - if system == 'Linux': - self.libraries.append('GLU') - - elif system == 'Windows': - self.libraries.append('QGLViewer2') - self.libraries.append('opengl32') - self.libraries.append('glu32') - + + if system in ('Darwin','Linux') and prefix: + self.include_dirs.append(f'{prefix}/include') + self.library_dirs.append(f'{prefix}/lib') + self.define_macros.append('PYQGLVIEWER_VERSION="'+PYQGLVIEWER_VERSION+'"') super().apply_user_defaults(tool) diff --git a/pyproject.toml b/pyproject.toml index cac2451..c6be824 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,9 @@ # Specify the build system. [build-system] # "setuptools", "setuptools-scm" not used -requires = ["sip<=6.10", "PyQt-builder=1.18"] +# Not installed nor checked by pip with --no-build-isolation: the versions that work +# (sip<=6.10, PyQt-builder 1.18.*) are pinned in conda/meta.yaml +requires = ["sip", "PyQt-builder"] build-backend = "sipbuild.api" @@ -27,7 +29,12 @@ sip-files-dir = "sip" [tool.sip.bindings.PyQGLViewer] qmake-QT = ['xml', 'opengl', 'gui', 'widgets'] tags = ['QGLViewer_2_9_1'] - - -# 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"'] \ No newline at end of file +# Markers must follow the name without space ('name;marker'): sip keeps spaces in the +# value. Include and library dirs of the conda env are added in project.py. +libraries = [ + 'QGLViewer;sys_platform != "win32"', + 'GLU;sys_platform == "linux"', + 'QGLViewer2;sys_platform == "win32"', + 'opengl32;sys_platform == "win32"', + 'glu32;sys_platform == "win32"', +]