1. Jakub Wilk
  2. python-djvulibre

Commits

Jakub Wilk  committed 01ccf8f

setup: when compiling natively on Windows, pass -I and -L to the compiler, as guessed by djvu.dllpath.

  • Participants
  • Parent commits 925f622
  • Branches default

Comments (0)

Files changed (1)

File setup.py

View file
 else:
     mingw32cross = None
 
+if os.name == 'nt':
+    import djvu.dllpath
+
 # Just to make sure setuptools won't try to be clever:
 fake_module = type(sys)('fake_module')
 fake_module.build_ext = None
 PKG_CONFIG_FLAG_MAP = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
 
 def pkg_config(*packages, **kwargs):
-    libdjvulibre = 'djvulibre'
+    fallback = dict(
+        libraries=['djvulibre'],
+    )
     if os.name == 'nt':
-        libdjvulibre = 'libdjvulibre'
-    fallback = dict(
-        libraries=[libdjvulibre],
-    )
+        dll_path = djvu.dllpath.guess_dll_path()
+        if dll_path is not None:
+            fallback.update(
+                extra_compile_args=['-I' + os.path.join(dll_path, 'include')],
+                extra_link_args=['-L' + os.path.join(dll_path)],
+            )
     try:
         pkgconfig = ipc.Popen(
             ['pkg-config', '--libs', '--cflags'] + list(packages),