Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Sep 18, 2015
1 parent 80a1ef8 commit 269a2d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
8 changes: 2 additions & 6 deletions colibricore_classes.pxd → colibricore_classes.in.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,8 @@ cdef extern from "patternmodel.h":
unsigned int tokens()


@includegcc relationmap.gcc.pxi
@includeclang relationmap.clang.pxi
ctypedef PatternMap[unsigned int,BaseValueHandler[uint],unsigned long] t_relationmap
ctypedef PatternMap[double,BaseValueHandler[double],unsigned long] t_relationmap_double
ctypedef PatternMap[unsigned int,BaseValueHandler[uint],unsigned long].iterator t_relationmap_iterator
ctypedef PatternMap[double,BaseValueHandler[double],unsigned long].iterator t_relationmap_double_iterator
@includegcc colibricore_relationmap.gcc.pxi
@includeclang colibricore_relationmap.clang.pxi


cdef cppclass PatternSetModel:
Expand Down
30 changes: 18 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,30 @@
# cython's include is sucky unfortunately :(
# And we need some conditional includes based on gcc vs clang
# We'll have our own:
for filename in glob.glob(os.path.join(ROOTDIR ,"*.in.pyx")):
for filename in glob.glob(os.path.join(ROOTDIR ,"*.in.p??")):
extension = filename[-3:]
print("(Writing " + filename[:-6]+extension + ")" ,file=sys.stderr)
with open(filename,'r') as f_in:
with open(filename[:-6]+'pyx','w') as f_out:
with open(filename[:-6]+extension,'w') as f_out:
for line in f_in:
found = line.find('@include') #generic include'
foundlen = 8

foundgcc = line.find('@includegcc') #gcc-only include
if foundgcc != -1:
if compilerversion.find('clang') == -1: #anything that is not clang is gcc for our purposes
found = foundgcc
foundlen = 11
else:
continue

foundclang = line.find('@includeclang') #clang-only include
if foundgcc != -1 and compilerversion.find('clang') == -1: #anything that is not clang is gcc for our purposes
found = foundgcc
foundlen = 1
else:
continue
if foundclang != -1 and compilerversion.find('clang') != -1:
found = foundclang
foundlen = 13
else:
continue
if foundclang != -1:
if compilerversion.find('clang') != -1:
found = foundclang
foundlen = 13
else:
continue

if found != -1:
includefilename = line[found+foundlen+1:].strip()
Expand Down

0 comments on commit 269a2d9

Please sign in to comment.