1
0
forked from GitHub/gf-core

on Windows link the C runtime statically into the Python binding

This commit is contained in:
Krasimir Angelov
2023-01-25 20:50:32 +01:00
parent 82683bd1a5
commit 1ca1828fef

View File

@@ -2,6 +2,8 @@ from setuptools import setup, Extension
import os import os
import platform import platform
on_windows = platform.system() == 'Windows'
includes = os.getenv('EXTRA_INCLUDE_DIRS','').split(':') includes = os.getenv('EXTRA_INCLUDE_DIRS','').split(':')
if includes==['']: if includes==['']:
includes=[] includes=[]
@@ -9,6 +11,11 @@ libraries = os.getenv('EXTRA_LIB_DIRS','').split(':')
if libraries==['']: if libraries==['']:
libraries=[] libraries=[]
if on_windows:
extra_sources = [f for f in os.listdir('../c/pgf') if f.endswith('.cxx')]
else:
extra_sources = []
pgf_module = Extension( pgf_module = Extension(
'pgf', 'pgf',
sources = [ sources = [
@@ -16,11 +23,11 @@ pgf_module = Extension(
'expr.c', 'expr.c',
'ffi.c', 'ffi.c',
'transactions.c' 'transactions.c'
], ]+extra_sources,
extra_compile_args = [] if platform.system() == 'Windows' else ['-std=c99', '-Werror', '-Wno-error=unused-variable', '-Wno-comment'], extra_compile_args = [] if on_windows else ['-std=c99', '-Werror', '-Wno-error=unused-variable', '-Wno-comment'],
include_dirs = includes, include_dirs = includes,
library_dirs = libraries, library_dirs = libraries,
libraries = ['pgf']) libraries = [] if on_windows else ['pgf'])
setup( setup(
name = 'pgf', name = 'pgf',