Skip to content

Commit

Permalink
#5 attempting visual studio compatiblewheel build(6)
Browse files Browse the repository at this point in the history
  • Loading branch information
myselfhimself committed Nov 13, 2020
1 parent 89ec548 commit a2c0a69
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
gmic_src_path = path.abspath("src/gmic/src")
WIN_DLL_DIR = path.abspath("win_dll")

debug_enabled = "--debug" in sys.argv


# List of non-standard '-l*' compiler parameters
extra_link_args = []

# Extra C flags
extra_compile_args = []

# Macros to toggle (gmic or CImg will do C/C++ #ifdef checks on them, testing mostly only their existence)
# cimg_date and cimg_date are true variables, the value of which is checked in the C/C++ source
define_macros = [
Expand All @@ -40,6 +45,15 @@

# UNIX build flags pregeneration
if not IS_WINDOWS:

extra_compile_args.extend(["-std=c++11"])
if debug_enabled:
extra_compile_args += ["-O0"]
extra_compile_args += ["-g"]
else:
extra_compile_args += ["-Ofast", "-flto"]
extra_link_args += ["-flto"]

# List of libs to get include directories and linkable libraries paths from for compiling
pkgconfig_list = ["zlib"]

Expand Down Expand Up @@ -113,17 +127,7 @@
define_macros += [("cimg_use_tiff", None)]
define_macros += [("cimg_use_png", None)]
define_macros += [("cimg_display", None)]


debug_enabled = "--debug" in sys.argv

extra_compile_args = ["-std=c++11"]
if debug_enabled:
extra_compile_args += ["-O0"]
extra_compile_args += ["-g"]
else:
extra_compile_args += ["-Ofast", "-flto"]
extra_link_args += ["-flto"]
extra_compile_args.extend(["/std:c++11", "/OpenMP"])

if sys.platform == "darwin":
extra_compile_args += ["-fopenmp", "-stdlib=libc++"]
Expand All @@ -132,12 +136,8 @@
"-nodefaultlibs",
"-lc++",
] # options inspired by https://github.com/explosion/spaCy/blob/master/setup.py
elif sys.platform in (
"linux",
"win32",
"msys",
"cygwin",
): # Enable openmp for 32bit & 64bit linuxes and posix'ed windows
elif not IS_WINDOWS:
# Enable openmp for 32bit & 64bit linuxes and posix'ed windows
extra_compile_args += ["-fopenmp"]
extra_link_args += ["-lgomp"]

Expand All @@ -155,6 +155,7 @@

print("Define macros:")
print(define_macros)

extension_kwargs = dict(
name="gmic",
include_dirs=include_dirs,
Expand All @@ -172,11 +173,12 @@
)


print("Extension options:", extension_kwargs)
print("Extension options:")
print(extension_kwargs)


# Static CPython gmic.so embedding libgmic.so / .dll
gmic_module = Extension(extension_kwargs)
gmic_module = Extension(**extension_kwargs)

# Get the long description from the README file
with open(path.join(here, "README.md"), encoding="utf-8") as f:
Expand Down

0 comments on commit a2c0a69

Please sign in to comment.