5
5
from setuptools import find_packages , setup , Extension
6
6
from Cython .Build import cythonize
7
7
8
- os .environ ["CC" ] = "clang"
9
- os .environ ["CXX" ] = "clang++"
8
+ dir_name = os .path .dirname (os .path .realpath (__file__ ))
9
+
10
+ if not platform .system () == 'Windows' :
11
+ os .environ ["CC" ] = "clang"
12
+ os .environ ["CXX" ] = "clang++"
10
13
11
14
# Require pytest-runner only when running tests
12
15
pytest_runner = (['pytest-runner>=2.0,<3dev' ]
26
29
version = platform .python_version_tuple ()
27
30
version = '%s.%s' % (version [0 ], version [1 ])
28
31
29
- dir_name = os .path .dirname (os .path .realpath (__file__ ))
30
-
31
- root_path = os .path .join (dir_name , 'src/mixin' )
32
- def check_modification ():
33
- lib_name = os .path .join (root_path , 'libmixin.a' )
34
- if not os .path .exists (lib_name ):
35
- return True
36
- modify_time = os .path .getmtime (lib_name )
37
- for root , dirs , files in os .walk (root_path ):
38
- for f in files :
39
- if f [- 3 :] == '.go' :
40
- f = os .path .join (root , f )
41
- file_time = os .path .getmtime (f )
42
- if modify_time < file_time :
43
- return True
44
- return False
45
-
46
- r = check_modification ()
47
- if r :
48
- print ('mixin lib need to rebuild.' )
49
- os .system (f'touch { root_path } /main.go' )
50
-
51
- if platform .system () == 'Windows' :
52
- os .system ('cd ./src/mixin &&go build -o mixin.dll -buildmode=c-shared && copy mixin.dll ../../pysrc/mixin.dll && gendef mixin.dll && lib /def:mixin.def /machine:x64 /out:mixin.lib' )
53
- else :
54
- os .system ('cd ./src/mixin;go build -o libmixin.a -buildmode=c-archive' )
55
-
56
32
ext_modules = [
57
33
Extension (
58
34
'pymixin._mixin' ,
@@ -64,7 +40,8 @@ def check_modification():
64
40
],
65
41
language = 'c++' ,
66
42
extra_compile_args = ['-std=c++17' ],
67
- extra_link_args = ['-L./src/mixin' , '-lmixin' ],
43
+ library_dirs = [os .path .join (dir_name , 'src/mixin' )],
44
+ libraries = ['mixin' ]
68
45
)
69
46
]
70
47
0 commit comments