File indexing completed on 2024-05-19 05:41:59

0001 // ct_lvtclp_compilerutil.h                                           -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_CT_LVTCLP_COMPILERUTIL
0021 #define INCLUDED_CT_LVTCLP_COMPILERUTIL
0022 
0023 //@PURPOSE: Query information about installed compilers
0024 //
0025 //@CLASSES:
0026 //  lvtclp::CompilerUtil Query information about installed compilers
0027 
0028 #include <optional>
0029 #include <string>
0030 #include <vector>
0031 
0032 #include <lvtclp_export.h>
0033 
0034 namespace Codethink::lvtclp {
0035 
0036 // =======================
0037 // class CompilerUtil
0038 // =======================
0039 
0040 class LVTCLP_EXPORT CompilerUtil {
0041   public:
0042     // CLASS METHODS
0043     static std::optional<std::string> findBundledHeaders(bool silent);
0044     // Look to see if there were any clang headers bundled with this binary
0045     // If the headers are found, return a path to the directory containing
0046     // these headers. If we don't find any headers *and that is correct*,
0047     // return {""}. If we don't find any headers *and that is a problem*,
0048     // return {}
0049     // arguments:
0050     // silent: supress output
0051 
0052     static bool weNeedSystemHeaders();
0053     // Figure out if we need to use findSystemIncludes() to compile with
0054     // these flags
0055 
0056     static std::vector<std::string> findSystemIncludes();
0057     // Attempts to locate appropriate include directories to find standard
0058     // headers etc
0059 
0060 #ifdef __linux__
0061     static std::optional<std::string> runCompiler(const std::string& compiler);
0062 #endif
0063 };
0064 
0065 } // namespace Codethink::lvtclp
0066 
0067 #endif // INCLUDED_CT_LVTCLP_COMPILERUTIL