summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJosh Blum2012-12-01 23:31:13 -0800
committerJohnathan Corgan2012-12-04 09:15:56 -0800
commit32e9190a47109d51639b897c11a75bfd6f30f3f7 (patch)
tree964fe926c88e60a40873d6ff900b2063558b6b10 /cmake
parent7b58aac684e3b0f698e26c623f9bf002b735d8df (diff)
downloadgnuradio-32e9190a47109d51639b897c11a75bfd6f30f3f7.tar.gz
gnuradio-32e9190a47109d51639b897c11a75bfd6f30f3f7.tar.bz2
gnuradio-32e9190a47109d51639b897c11a75bfd6f30f3f7.zip
swig: tweaks for swig makedepend
* only search %include/import in .i files * when in regular headers use #include * stop adding all inc paths when file found
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/GrSwig.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 3d1c5d47f..b9bf0bb0b 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -205,21 +205,25 @@ file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
import os, sys, re
-include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]')
+i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
+h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
include_dirs = sys.argv[2].split(';')
def get_swig_incs(file_path):
+ if file_path.endswith('.i'): matcher = i_include_matcher
+ else: matcher = h_include_matcher
file_contents = open(file_path, 'r').read()
- return include_matcher.findall(file_contents, re.MULTILINE)
+ return matcher.findall(file_contents, re.MULTILINE)
def get_swig_deps(file_path, level):
deps = [file_path]
if level == 0: return deps
- for inc_file in get_swig_incs(file_path):
+ for keyword, inc_file in get_swig_incs(file_path):
for inc_dir in include_dirs:
inc_path = os.path.join(inc_dir, inc_file)
if not os.path.exists(inc_path): continue
deps.extend(get_swig_deps(inc_path, level-1))
+ break #found, we dont search in lower prio inc dirs
return deps
if __name__ == '__main__':