Skip to content

Commit 6e10629

Browse files
committedMay 21, 2024·
ignoring thirdparty random elements
1 parent 83cb271 commit 6e10629

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed
 

‎cxxbuild/cxxbuild.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,8 @@ def main():
996996
if (sys.argv[i] == "--include"):
997997
# force --include to appear
998998
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]))
9991001
if (sys.argv[i] == "--define"):
10001002
# force --define to appear
10011003
build_options_args.append("!define "+str(sys.argv[i + 1]))
@@ -1045,6 +1047,9 @@ def main():
10451047
INCLUDE_DIRS = []
10461048
DEFINITIONS = []
10471049
EXTRA_SOURCES = []
1050+
IGNORE = []
1051+
# ignore build/ folder by default
1052+
IGNORE.append("build/")
10481053
for op in build_options:
10491054
# import shlex
10501055
# oplist = shlex.split(op)
@@ -1064,6 +1069,8 @@ def main():
10641069
exit(1)
10651070
if oplist[0] == '!include':
10661071
INCLUDE_DIRS.append(oplist[1].strip("\""))
1072+
if oplist[0] == '!ignore':
1073+
IGNORE.append(op[len(oplist[0]):].strip())
10671074
if oplist[0] == '!define':
10681075
DEFINITIONS.append(op[len(oplist[0]):].strip())
10691076
if oplist[0] == '!extrasrc':
@@ -1101,9 +1108,9 @@ def main():
11011108
use_bazel = False
11021109

11031110
#
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)
11051112

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):
11071114
#
11081115
print("begin build on root_path=",root_path)
11091116
# find all source files,
@@ -1209,12 +1216,16 @@ def run_build(root_path, use_cmake, use_bazel, cppstd, search_src, search_tests,
12091216
if "include" in subdirs:
12101217
incdir = root+"/"+search_include
12111218
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:
12171227
INCLUDE_DIRS.append(incdir)
1228+
# end-for
12181229
# TODO: search in other places too... maybe inside src?
12191230
# keep unique only!
12201231
INCLUDE_DIRS = list(set(INCLUDE_DIRS))

‎demo/project6/CMakeLists.txt

-24
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ add_executable(demo6 src/demo6.cpp )
1212
add_library(my_headers0 INTERFACE)
1313
target_include_directories(my_headers0 INTERFACE inc)
1414
target_link_libraries(demo6 PRIVATE my_headers0)
15-
add_library(my_headers1 INTERFACE)
16-
target_include_directories(my_headers1 INTERFACE thirdparty/optframe-master/Examples/HFMVRP/include)
17-
target_link_libraries(demo6 PRIVATE my_headers1)
18-
add_library(my_headers2 INTERFACE)
19-
target_include_directories(my_headers2 INTERFACE thirdparty/optframe-master/Examples/EternityII/include)
20-
target_link_libraries(demo6 PRIVATE my_headers2)
21-
add_library(my_headers3 INTERFACE)
22-
target_include_directories(my_headers3 INTERFACE thirdparty/optframe-master/include)
23-
target_link_libraries(demo6 PRIVATE my_headers3)
2415
# begin dependencies from cxxdeps.txt
2516
# cxxdeps dependency absl
2617
FetchContent_Declare(absl GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git GIT_TAG 20240116.1)
@@ -30,21 +21,6 @@ target_link_libraries(my_headers0 INTERFACE absl::synchronization)
3021
target_link_libraries(my_headers0 INTERFACE absl::strings)
3122
target_link_libraries(my_headers0 INTERFACE absl::log)
3223
target_link_libraries(my_headers0 INTERFACE absl::log_initialize)
33-
target_link_libraries(my_headers1 INTERFACE absl::base)
34-
target_link_libraries(my_headers1 INTERFACE absl::synchronization)
35-
target_link_libraries(my_headers1 INTERFACE absl::strings)
36-
target_link_libraries(my_headers1 INTERFACE absl::log)
37-
target_link_libraries(my_headers1 INTERFACE absl::log_initialize)
38-
target_link_libraries(my_headers2 INTERFACE absl::base)
39-
target_link_libraries(my_headers2 INTERFACE absl::synchronization)
40-
target_link_libraries(my_headers2 INTERFACE absl::strings)
41-
target_link_libraries(my_headers2 INTERFACE absl::log)
42-
target_link_libraries(my_headers2 INTERFACE absl::log_initialize)
43-
target_link_libraries(my_headers3 INTERFACE absl::base)
44-
target_link_libraries(my_headers3 INTERFACE absl::synchronization)
45-
target_link_libraries(my_headers3 INTERFACE absl::strings)
46-
target_link_libraries(my_headers3 INTERFACE absl::log)
47-
target_link_libraries(my_headers3 INTERFACE absl::log_initialize)
4824
target_link_libraries(demo6 PRIVATE absl::base)
4925
target_link_libraries(demo6 PRIVATE absl::synchronization)
5026
target_link_libraries(demo6 PRIVATE absl::strings)

‎demo/project6/cxxdeps.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ OptFrame == * [ OptFrameAll ] local * ./thirdparty/optframe-master/cmake/
88
!define MY_HELLO="ola mundo"
99
!define IS_TEST
1010
!extrasrc src/demo6.cpp
11-
!extrasrc src/demo6.cpp
11+
!extrasrc src/demo6.cpp
12+
!ignore thirdparty

‎demo/project6/cxxdeps.windows.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ optframe == "master" [ OptFrameAll ] git * https://github.com/optframe/optframe.
88
!define MY_HELLO="ola mundo"
99
!define IS_TEST
1010
!extrasrc src/demo6.cpp
11-
!extrasrc src/demo6.cpp
11+
!extrasrc src/demo6.cpp
12+
!ignore thirdparty

0 commit comments

Comments
 (0)
Please sign in to comment.