conda-forge / qhull-feedstock

A conda-smithy repository for qhull.
BSD 3-Clause "New" or "Revised" License
3 stars 10 forks source link

pyhull #2

Closed jan-janssen closed 2 months ago

jan-janssen commented 5 years ago

I try to bind pyhull to qhull and while it works for Mac and Linux - https://github.com/conda-forge/staged-recipes/pull/7094 , I am not able to get it to work for windows:

src\_pyhull.c(32) : fatal error C1083: Cannot open include file: 'libqhull.h': No such file or directory 1813 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\amd64\\cl.exe' failed with exit status 2

Is there any difference between the qhull version for Unix and the qhull version for Windows?

Sirokujira commented 5 years ago

Because you are building from source code If you use the conda module, you need to set the Include / Library path in setup.py.

The source code also needs some modification.


diff --git a/src/_pyhull.c b/src/_pyhull.c
index 4aab0ae..5a57a63 100644
--- a/src/_pyhull.c
+++ b/src/_pyhull.c
@@ -29,9 +29,9 @@ Date: Nov 23 2012
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "libqhull.h"
-#include "mem.h"
-#include "qset.h"
+#include "libqhull/libqhull.h"
+#include "libqhull/mem.h"
+#include "libqhull/qset.h"

 #if __MWERKS__ && __POWERPC__
 #include <SIOUX.h>

diff --git a/setup.py b/setup.py
index 0cd6173..0386d74 100644
--- a/setup.py
+++ b/setup.py
@@ -5,13 +5,20 @@ import sys
 from setuptools import setup, Extension, find_packages

 src_dir = "src"
-include_dirs = glob.glob(os.path.join("src", "libqhull"))
-sources = glob.glob(os.path.join("src", "libqhull", "*.c"))
+# include_dirs = glob.glob(os.path.join("src", "libqhull"))
+# sources = glob.glob(os.path.join("src", "libqhull", "*.c"))
+include_dirs = [ os.path.join(os.environ["LIBRARY_INC"]) ]
+sources = []
+library_dirs = [ os.path.join(os.environ["LIBRARY_LIB"]) ]
+# libraries = ['qhull', 'qhull_p', 'qhull_r', 'qhullcpp']
+libraries = ['qhullstatic']
 if sys.platform.strip() == "darwin":
     include_dirs += glob.glob(os.path.join("src", "fmemopen"))
     sources += glob.glob(os.path.join("src", "fmemopen", "*.c"))
 extension = Extension('pyhull._pyhull',
                       include_dirs=include_dirs,
+                      library_dirs=library_dirs,
+                      libraries=libraries,
                       sources=[os.path.join(src_dir, '_pyhull.c')] + sources)

 long_description = """
Tobias-Fischer commented 3 years ago

I think this can be closed @Sirokujira

jakirkham commented 2 months ago

Looks like pyhull has since been packaged: https://github.com/conda-forge/pyhull-feedstock

It uses an appropriate patch

Also resolving this has been discussed with upstream ( https://github.com/materialsvirtuallab/pyhull/issues/11 ). Though there is no clear resolution there atm

Closing this out as there doesn't appear to be anything left to do here. Though please let us know if we missed something