13
13
mod_dir = './randomstate'
14
14
configs = []
15
15
16
- rngs = ['RNG_MLFG_1279_861' , 'RNG_PCG32' , 'RNG_PCG64' , 'RNG_DSFMT ' ,
17
- 'RNG_MT19937' , ' RNG_XORSHIFT128' , 'RNG_XORSHIFT1024' , 'RNG_MRG32K3A' ]
16
+ rngs = ['RNG_DSFMT' , ' RNG_MLFG_1279_861' , 'RNG_PCG32' , 'RNG_PCG64' , 'RNG_MT19937 ' ,
17
+ 'RNG_XORSHIFT128' , 'RNG_XORSHIFT1024' , 'RNG_MRG32K3A' ]
18
18
19
- compile_rngs = rngs [:]
19
+ compile_rngs = rngs [:] # ['RNG_DSFMT'] # rngs[:]
20
20
21
21
extra_defs = []
22
22
extra_link_args = ['Advapi32.lib' , 'Kernel32.lib' ] if os .name == 'nt' else []
23
- extra_compile_args = [] if os .name == 'nt' else ['-std=c99' ]
23
+ base_extra_compile_args = [] if os .name == 'nt' else ['-std=c99' ]
24
24
25
25
26
26
def write_config (file_name , config ):
@@ -48,6 +48,7 @@ def write_config(file_name, config):
48
48
join (mod_dir , 'src' , 'common' , 'entropy.c' ),
49
49
join (mod_dir , 'distributions.c' )]
50
50
include_dirs = base_include_dirs [:]
51
+ extra_compile_args = base_extra_compile_args [:]
51
52
52
53
if rng == 'RNG_PCG32' :
53
54
sources += [join (mod_dir , 'src' , 'pcg' , 'pcg32.c' )]
@@ -117,15 +118,19 @@ def write_config(file_name, config):
117
118
sources += [join (mod_dir , 'shims' , 'dSFMT' , 'dSFMT-shim.c' )]
118
119
# TODO: HAVE_SSE2 should only be for platforms that have SSE2
119
120
# TODO: But how to reliable detect?
120
- defs = [('DSFMT_RNG' , '1' ),('DSFMT_MEXP' ,'19937' )] # ('HAVE_SSE2', '1'),
121
+ defs = [('DSFMT_RNG' , '1' ),('DSFMT_MEXP' ,'19937' )]
122
+ defs += [('HAVE_SSE2' , '1' )]
123
+ if os .name == 'nt' :
124
+ extra_compile_args = base_extra_compile_args + ['/arch:SSE2' ]
121
125
122
126
include_dirs += [join (mod_dir , 'src' , 'dSFMT' )]
123
127
124
128
config = {'file_name' : file_name ,
125
129
'sources' : sources ,
126
130
'include_dirs' : include_dirs ,
127
131
'defs' : defs ,
128
- 'flags' : dict ([(k , v ) for k , v in flags .items ()])
132
+ 'flags' : dict ([(k , v ) for k , v in flags .items ()]),
133
+ 'compile_args' : extra_compile_args
129
134
}
130
135
131
136
configs .append (config )
@@ -136,7 +141,7 @@ def write_config(file_name, config):
136
141
join (mod_dir , 'src' , 'common' , 'entropy.c' )],
137
142
include_dirs = base_include_dirs ,
138
143
define_macros = extra_defs ,
139
- extra_compile_args = extra_compile_args ,
144
+ extra_compile_args = base_extra_compile_args ,
140
145
extra_link_args = extra_link_args )]
141
146
142
147
for config in configs :
@@ -157,7 +162,7 @@ def write_config(file_name, config):
157
162
sources = config ['sources' ],
158
163
include_dirs = config ['include_dirs' ],
159
164
define_macros = config ['defs' ] + extra_defs ,
160
- extra_compile_args = extra_compile_args ,
165
+ extra_compile_args = config [ 'compile_args' ] ,
161
166
extra_link_args = extra_link_args )
162
167
extensions .append (ext )
163
168
0 commit comments