-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compile compile command cleanup (#130)
- Loading branch information
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include("GenericFindDependency") | ||
|
||
option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil" true) | ||
|
||
GenericFindDependency( | ||
TARGET grpc++ | ||
SOURCE_DIR grpc | ||
SYSTEM_INCLUDES | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
include("GenericFindDependency") | ||
option(ENABLE_TESTING "Build tests" OFF) | ||
option(ENABLE_PUSH "Build prometheus-cpp push library" OFF) | ||
option(ENABLE_COMPRESSION "Enable gzip compression" ON) | ||
GenericFindDependency( | ||
TARGET prometheus-cpp::core | ||
SOURCE_DIR "prometheus-cpp" | ||
) | ||
|
||
# Change all of Prometheus's include directories to be system includes, to avoid | ||
# compiler errors. The generalised version of this in GenericFindDependency won't | ||
# work here because we are dealing with an aliased target | ||
get_target_property(_aliased prometheus-cpp::core ALIASED_TARGET) | ||
if(_aliased) | ||
get_target_property(prometheus_include_directories ${_aliased} INTERFACE_INCLUDE_DIRECTORIES) | ||
if(prometheus_include_directories) | ||
set_target_properties(${_aliased} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") | ||
target_include_directories(${_aliased} SYSTEM INTERFACE ${prometheus_include_directories}) | ||
endif() | ||
endif() | ||
|
||
# Change all of Prometheus's include directories to be system includes, to avoid | ||
# compiler errors. The generalised version of this in GenericFindDependency won't | ||
# work here because we are dealing with an aliased target | ||
get_target_property(_aliased prometheus-cpp::pull ALIASED_TARGET) | ||
if(_aliased) | ||
get_target_property(prometheus_include_directories ${_aliased} INTERFACE_INCLUDE_DIRECTORIES) | ||
if(prometheus_include_directories) | ||
set_target_properties(${_aliased} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "") | ||
target_include_directories(${_aliased} SYSTEM INTERFACE ${prometheus_include_directories}) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Application will allow users to strip away source files from the compile_commands.json file. | ||
# | ||
|
||
import argparse | ||
import json | ||
import sys | ||
|
||
parser = argparse.ArgumentParser(description="Modifies a compile_commands.json file", allow_abbrev=False) | ||
parser.add_argument("file", type=str, help="path to the compile_commands.json file") | ||
parser.add_argument("--remove-third-party", action="store_true", help="removes all third party files") | ||
arguments = parser.parse_args() | ||
|
||
try: | ||
with open(arguments.file, "r") as file: | ||
data = json.load(file) | ||
|
||
if arguments.remove_third_party: | ||
data = [x for x in data if "third_party" not in x["file"]] | ||
|
||
with open(arguments.file, "w") as file: | ||
json.dump(data, file, indent=4) | ||
except BaseException as e: | ||
print(e, file=sys.stderr) | ||
exit(1) |