-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
79 lines (66 loc) · 2.17 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import sys
import platform
from setuptools import setup, Extension
##adapted from https://github.com/CUITzhaoqi/awtk-python/blob/master/setup.py
sys.path.insert(0, '../awtk/')
sys.path.insert(0, '../awtk/scripts')
sys.path.insert(0, 'build/awtk/')
import compile_config
complie_helper = compile_config.complie_helper()
compile_config.set_curr_config(complie_helper)
import awtk_config as awtk
include_dirs = awtk.CPPPATH
extra_compile_args = awtk.CCFLAGS
print (extra_compile_args.split( ))
extra_compile_args_list = extra_compile_args.split( )
extra_compile_args_list.append('-D__'+platform.machine()+'__=1');
print(extra_compile_args_list)
extra_define_macros = []
for i in extra_compile_args_list:
if i.find("-D", 0, len(i) - 1) >= 0:
equal_index = i.find("=", 0, len(i) - 1)
if equal_index > 0 :
macros = (i[2:equal_index], i[equal_index + 1:len(i)])
extra_define_macros.append(macros)
pass
else:
macros = (i[2:len(i)], None)
extra_define_macros.append(macros)
print(extra_define_macros)
extra_lib = []
library_dirs=awtk.LIBPATH
extra_libraries=awtk.LIBS
for i in extra_libraries:
print(i)
lib_index = i.find(".lib", 0, len(i))
if lib_index > 0:
print(lib_index)
extra_lib.append(i[0:lib_index])
else :
extra_lib.append(i)
print(extra_lib)
NAME = 'awtk'
VERSION = '0.1.0'
AUTHOR = 'Li XianJing'
EMAIL = '[email protected]'
DESCRIPTION = 'awtk python binding.'
URL = 'https://github.com/zlgopen/awtk-python'
LICENSE="LGPL-2.0"
PLATFORM=platform.machine()
setup(name="awtk",
url=URL,
version=VERSION,
author=AUTHOR,
author_email=EMAIL,
description=DESCRIPTION,
license=LICENSE,
platforms=['any'],
long_description=DESCRIPTION,
ext_modules=[Extension("awtk_native",
["src/c/awtk_module.c",
"src/assets.c"],
include_dirs=include_dirs,
define_macros=extra_define_macros,
library_dirs=library_dirs,
libraries=extra_lib,
)])