@@ -996,6 +996,8 @@ def main():
996
996
if (sys .argv [i ] == "--include" ):
997
997
# force --include to appear
998
998
build_options_args .append ("!include \" " + str (sys .argv [i + 1 ])+ "\" " )
999
+ if (sys .argv [i ] == "--ignore" ):
1000
+ build_options_args .append ("!ignore " + str (sys .argv [i + 1 ]))
999
1001
if (sys .argv [i ] == "--define" ):
1000
1002
# force --define to appear
1001
1003
build_options_args .append ("!define " + str (sys .argv [i + 1 ]))
@@ -1045,6 +1047,9 @@ def main():
1045
1047
INCLUDE_DIRS = []
1046
1048
DEFINITIONS = []
1047
1049
EXTRA_SOURCES = []
1050
+ IGNORE = []
1051
+ # ignore build/ folder by default
1052
+ IGNORE .append ("build/" )
1048
1053
for op in build_options :
1049
1054
# import shlex
1050
1055
# oplist = shlex.split(op)
@@ -1064,6 +1069,8 @@ def main():
1064
1069
exit (1 )
1065
1070
if oplist [0 ] == '!include' :
1066
1071
INCLUDE_DIRS .append (oplist [1 ].strip ("\" " ))
1072
+ if oplist [0 ] == '!ignore' :
1073
+ IGNORE .append (op [len (oplist [0 ]):].strip ())
1067
1074
if oplist [0 ] == '!define' :
1068
1075
DEFINITIONS .append (op [len (oplist [0 ]):].strip ())
1069
1076
if oplist [0 ] == '!extrasrc' :
@@ -1101,9 +1108,9 @@ def main():
1101
1108
use_bazel = False
1102
1109
1103
1110
#
1104
- return run_build (root_path , use_cmake , use_bazel , cppstd , search_src , search_tests , search_include , INCLUDE_DIRS , DEFINITIONS , EXTRA_SOURCES )
1111
+ return run_build (root_path , use_cmake , use_bazel , cppstd , search_src , search_tests , search_include , INCLUDE_DIRS , DEFINITIONS , EXTRA_SOURCES , IGNORE )
1105
1112
1106
- def run_build (root_path , use_cmake , use_bazel , cppstd , search_src , search_tests , search_include , INCLUDE_DIRS , DEFINITIONS , EXTRA_SOURCES ):
1113
+ def run_build (root_path , use_cmake , use_bazel , cppstd , search_src , search_tests , search_include , INCLUDE_DIRS , DEFINITIONS , EXTRA_SOURCES , IGNORE ):
1107
1114
#
1108
1115
print ("begin build on root_path=" ,root_path )
1109
1116
# find all source files,
@@ -1209,12 +1216,16 @@ def run_build(root_path, use_cmake, use_bazel, cppstd, search_src, search_tests,
1209
1216
if "include" in subdirs :
1210
1217
incdir = root + "/" + search_include
1211
1218
incdir = incdir .removeprefix (root_path ).removeprefix ("/" )
1212
- # ignore 'build' stuff
1213
- if incdir [0 :6 ] == 'build/' :
1214
- print ("WARNING: 'build/' prefixed folder ignored: " , incdir )
1215
- pass
1216
- else :
1219
+ must_ignore = False
1220
+ for ign in IGNORE :
1221
+ # ignore 'build' stuff and others in IGNORE
1222
+ if incdir .startswith (ign ):
1223
+ print ("WARNING: '" + ign + "' prefixed folder ignored: " , incdir )
1224
+ must_ignore = True
1225
+ break
1226
+ if not must_ignore :
1217
1227
INCLUDE_DIRS .append (incdir )
1228
+ # end-for
1218
1229
# TODO: search in other places too... maybe inside src?
1219
1230
# keep unique only!
1220
1231
INCLUDE_DIRS = list (set (INCLUDE_DIRS ))
0 commit comments