diff --git a/FindGrpc.cmake b/FindGrpc.cmake new file mode 100644 index 0000000..4e7f0ef --- /dev/null +++ b/FindGrpc.cmake @@ -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 +) diff --git a/FindOrion-Engine.cmake b/FindOrion-Engine.cmake index 724b172..0e456b7 100644 --- a/FindOrion-Engine.cmake +++ b/FindOrion-Engine.cmake @@ -12,10 +12,7 @@ include("GenericFindDependency") -option(orion-engine_ENABLE_DOCS "" false) -option(orion-engine_ENABLE_EXAMPLES "" false) option(orion-engine_ENABLE_TESTS "" false) -option(orion-engine_ENABLE_TEST_LIBS "" false) GenericFindDependency( TARGET orion_engine diff --git a/FindPrometheus-Cpp.cmake b/FindPrometheus-Cpp.cmake new file mode 100644 index 0000000..d0e9cae --- /dev/null +++ b/FindPrometheus-Cpp.cmake @@ -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() diff --git a/scripts/compile_commands_cleanup.py b/scripts/compile_commands_cleanup.py new file mode 100755 index 0000000..4c19741 --- /dev/null +++ b/scripts/compile_commands_cleanup.py @@ -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)