Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit cd7aba3

Browse files
authored
Merge pull request #371 from ahartikainen/feature/issue-364-windows-support
Add Windows gcc support
2 parents f82e934 + dfa5bb8 commit cd7aba3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pystan/model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
274274
('BOOST_NO_DECLTYPE', None),
275275
('BOOST_DISABLE_ASSERTS', None),
276276
]
277+
278+
build_extension = _get_build_extension()
277279
# compile stan models with optimization (-O2)
278280
# (stanc is compiled without optimization (-O0) currently, see #33)
279281
if extra_compile_args is None:
@@ -283,7 +285,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
283285
'-Wno-unused-function',
284286
'-Wno-uninitialized',
285287
]
286-
if platform.platform().startswith('Win'):
288+
if platform.platform().startswith('Win') and build_extension.compiler in (None, 'msvc'):
287289
extra_compile_args = ['/EHsc', '-DBOOST_DATE_TIME_NO_LIB']
288290

289291
distutils.log.set_verbosity(verbose)
@@ -295,7 +297,7 @@ def __init__(self, file=None, charset='utf-8', model_name="anon_model",
295297
extra_compile_args=extra_compile_args)
296298

297299
cython_include_dirs = ['.', pystan_dir]
298-
build_extension = _get_build_extension()
300+
299301
build_extension.extensions = cythonize([extension],
300302
include_path=cython_include_dirs,
301303
quiet=not verbose)

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ def find_version(*parts):
117117
]
118118

119119
if platform.platform().startswith('Win'):
120-
extra_compile_args = [
121-
'/EHsc',
122-
'-DBOOST_DATE_TIME_NO_LIB',
123-
]
120+
from Cython.Build.Inline import _get_build_extension
121+
if _get_build_extension().compiler in (None, 'msvc'):
122+
extra_compile_args = [
123+
'/EHsc',
124+
'-DBOOST_DATE_TIME_NO_LIB',
125+
]
124126

125127

126128
stanc_sources = [

0 commit comments

Comments
 (0)