@@ -31,7 +31,9 @@ def is_pure(self):
3131
3232CXXFLAGS = []
3333
34- print (f"building for platform: { os .name } " )
34+ print ("building for platform: %s" % os .name )
35+ print ("available CPU flags: %s" % CPU_FLAGS )
36+
3537if os .name == "nt" :
3638 CXXFLAGS .extend (["/O2" ])
3739else :
@@ -42,58 +44,58 @@ def is_pure(self):
4244 ])
4345
4446
47+ if 'ssse3' in CPU_FLAGS :
48+ print ("Compiling with SSSE3 enabled" )
49+ CXXFLAGS .append ('-mssse3' )
50+ else :
51+ print ("compiling without SSE3 support" )
52+
53+
4554if 'sse4_2' in CPU_FLAGS :
4655 print ("Compiling with SSE4.2 enabled" )
4756 CXXFLAGS .append ('-msse4.2' )
4857else :
4958 print ("compiling without SSE4.2 support" )
5059
5160
52- INCLUDE_DIRS = ['include ' ]
61+ INCLUDE_DIRS = ['src ' ]
5362CXXHEADERS = [
54- "include /metro.h" ,
55- "include /metrohash.h" ,
56- "include /metrohash128.h" ,
57- "include /metrohash128crc.h" ,
58- "include /metrohash64.h" ,
59- "include /platform.h" ,
63+ "src /metro.h" ,
64+ "src /metrohash.h" ,
65+ "src /metrohash128.h" ,
66+ "src /metrohash128crc.h" ,
67+ "src /metrohash64.h" ,
68+ "src /platform.h" ,
6069]
6170CXXSOURCES = [
6271 "src/metrohash64.cc" ,
6372 "src/metrohash128.cc" ,
6473]
6574
66- CMDCLASS = {}
6775EXT_MODULES = []
6876
6977if USE_CYTHON :
7078 print ("building extension using Cython" )
71- CMDCLASS ['build_ext' ] = build_ext
72- EXT_MODULES .append (
73- Extension (
74- "metrohash" ,
75- CXXSOURCES + ["src/metrohash.pyx" ],
76- depends = CXXHEADERS ,
77- language = "c++" ,
78- extra_compile_args = CXXFLAGS ,
79- include_dirs = INCLUDE_DIRS ,
80- )
81- )
79+ CMDCLASS = {'build_ext' : build_ext }
80+ SRC_EXT = ".pyx"
8281else :
8382 print ("building extension w/o Cython" )
84- EXT_MODULES .append (
85- Extension (
86- "metrohash" ,
87- CXXSOURCES + ["src/metrohash.cpp" ],
88- depends = CXXHEADERS ,
89- language = "c++" ,
90- extra_compile_args = CXXFLAGS ,
91- include_dirs = INCLUDE_DIRS ,
92- )
93- )
94-
95-
96- VERSION = '0.1.1.post2'
83+ CMDCLASS = {}
84+ SRC_EXT = ".cpp"
85+
86+
87+ EXT_MODULES = [
88+ Extension (
89+ "metrohash" ,
90+ CXXSOURCES + ["src/metrohash" + SRC_EXT ],
91+ depends = CXXHEADERS ,
92+ language = "c++" ,
93+ extra_compile_args = CXXFLAGS ,
94+ include_dirs = INCLUDE_DIRS ,
95+ ),
96+ ]
97+
98+ VERSION = '0.1.1.post3'
9799URL = "https://github.com/escherba/python-metrohash"
98100
99101
0 commit comments