diff --git a/CMakeLists.txt b/CMakeLists.txt index d8e2cc3056..49b9a5f546 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,12 @@ enable_testing() add_subdirectory(app/metashell) add_subdirectory(app/reference_gen) +add_subdirectory(app/stub/clang) +add_subdirectory(app/stub/cl_de) +add_subdirectory(app/stub/cl_en) +add_subdirectory(app/stub/gcc) +add_subdirectory(test/system/auto_engine) add_subdirectory(test/system/core) add_subdirectory(test/system/mdb) add_subdirectory(test/system/pdb) @@ -124,9 +129,11 @@ add_subdirectory(test/unit/pragma) add_subdirectory(test/unit/replace_part) add_subdirectory(test/unit/system_test) +add_subdirectory(lib/compiler_stub) add_subdirectory(lib/core) add_subdirectory(lib/data) add_subdirectory(lib/defaults) +add_subdirectory(lib/engine/auto) add_subdirectory(lib/engine/clang) add_subdirectory(lib/engine/constant) add_subdirectory(lib/engine/gcc) diff --git a/app/metashell/main.cpp b/app/metashell/main.cpp index acc91aad8a..17f858543f 100644 --- a/app/metashell/main.cpp +++ b/app/metashell/main.cpp @@ -135,8 +135,8 @@ int main(int argc_, const char* argv_[]) else { return eentry->second.build(config_, shell_dir, temp_dir, - env_filename, det, ccfg.displayer(), - &logger); + env_filename, engines, det, + ccfg.displayer(), &logger); } }, metashell::defaults::pragma_map( diff --git a/app/stub/cl_de/CMakeLists.txt b/app/stub/cl_de/CMakeLists.txt new file mode 100644 index 0000000000..f4990ad3fc --- /dev/null +++ b/app/stub/cl_de/CMakeLists.txt @@ -0,0 +1,28 @@ +# Metashell - Interactive C++ template metaprogramming shell +# Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +project(app_stub_cl_de) + +aux_source_directory(. SOURCES) +add_executable(${PROJECT_NAME} ${SOURCES}) + +enable_warnings(${PROJECT_NAME}) + +target_link_libraries( + ${PROJECT_NAME} + + metashell::compiler_stub +) diff --git a/app/stub/cl_de/main.cpp b/app/stub/cl_de/main.cpp new file mode 100644 index 0000000000..63ee6a998e --- /dev/null +++ b/app/stub/cl_de/main.cpp @@ -0,0 +1,39 @@ +// Metashell - Interactive C++ template metaprogramming shell +// Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +using namespace metashell; + +int main(int argc_, const char* argv_[]) +{ + compiler_stub::cl_stub compiler( + "Microsoft (R) C/C++-Optimierungscompiler Version 19.16.27025.1 " + "f\xc3\xbcr x86\n" + "Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.\n" + "\n", + + "Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ]\n\n", + + [](const std::string& option_) { + return "cl : Befehlszeile warning D9002 : Unbekannte Option \"" + + option_ + + "\" wird ignoriert.\n" + "cl : Befehlszeile error D8003 : Name der Quelldatei fehlt.\n"; + }); + + return compiler.run(argc_, argv_).value(); +} diff --git a/app/stub/cl_en/CMakeLists.txt b/app/stub/cl_en/CMakeLists.txt new file mode 100644 index 0000000000..3876eb01f3 --- /dev/null +++ b/app/stub/cl_en/CMakeLists.txt @@ -0,0 +1,28 @@ +# Metashell - Interactive C++ template metaprogramming shell +# Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +project(app_stub_cl_en) + +aux_source_directory(. SOURCES) +add_executable(${PROJECT_NAME} ${SOURCES}) + +enable_warnings(${PROJECT_NAME}) + +target_link_libraries( + ${PROJECT_NAME} + + metashell::compiler_stub +) diff --git a/app/stub/cl_en/main.cpp b/app/stub/cl_en/main.cpp new file mode 100644 index 0000000000..dc6d96557f --- /dev/null +++ b/app/stub/cl_en/main.cpp @@ -0,0 +1,38 @@ +// Metashell - Interactive C++ template metaprogramming shell +// Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +using namespace metashell; + +int main(int argc_, const char* argv_[]) +{ + compiler_stub::cl_stub compiler( + "Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27025.1 for x86\n" + "Copyright (C) Microsoft Corporation. All rights reserved.\n" + "\n", + + "usage: cl [ option... ] filename... [ /link linkoption... ]\n", + + [](const std::string& option_) { + return "cl : Command line warning D9002 : ignoring unknown option '" + + option_ + + "'\n" + "cl : Command line error D8003 : missing source filename\n"; + }); + + return compiler.run(argc_, argv_).value(); +} diff --git a/app/stub/clang/CMakeLists.txt b/app/stub/clang/CMakeLists.txt new file mode 100644 index 0000000000..816a53e1e1 --- /dev/null +++ b/app/stub/clang/CMakeLists.txt @@ -0,0 +1,28 @@ +# Metashell - Interactive C++ template metaprogramming shell +# Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +project(app_stub_clang) + +aux_source_directory(. SOURCES) +add_executable(${PROJECT_NAME} ${SOURCES}) + +enable_warnings(${PROJECT_NAME}) + +target_link_libraries( + ${PROJECT_NAME} + + metashell::compiler_stub +) diff --git a/app/stub/clang/main.cpp b/app/stub/clang/main.cpp new file mode 100644 index 0000000000..2d79899b1c --- /dev/null +++ b/app/stub/clang/main.cpp @@ -0,0 +1,479 @@ +// Metashell - Interactive C++ template metaprogramming shell +// Copyright (C) 2019, Abel Sinkovics (abel@sinkovics.hu) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +using namespace metashell; + +int main(int argc_, const char* argv_[]) +{ + compiler_stub::stub compiler; + + compiler.on_args( + {}, {data::exit_code_t(1), "", "clang: error: no input files\n"}); + + compiler.on_args( + {"-v"}, {data::exit_code_t(0), "", + R"EOS(clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) +Target: x86_64-pc-linux-gnu +Thread model: posix +InstalledDir: /usr/bin +Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 +Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0 +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0 +Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0 +Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 +Candidate multilib: .;@m64 +Selected multilib: .;@m64 +)EOS"}); + + compiler.on_args( + {"--help"}, {data::exit_code_t(0), R"EOS(OVERVIEW: clang LLVM compiler + +USAGE: clang [options] + +OPTIONS: + -### Print (but do not run) the commands to run for this compilation + --analyze Run the static analyzer + -arcmt-migrate-emit-errors + Emit ARC errors even if the migrator can fix them + -arcmt-migrate-report-output + Output path for the plist report + --cuda-device-only Do device-side CUDA compilation only + --cuda-host-only Do host-side CUDA compilation only + --cuda-path= CUDA installation path + -cxx-isystem + Add directory to the C++ SYSTEM include search path + -c Only run preprocess, compile, and assemble steps + -dD Print macro definitions in -E mode in addition to normal output + -dependency-dot Filename to write DOT-formatted header dependencies to + -dependency-file + Filename (or -) to write dependency output to + -dM Print macro definitions in -E mode instead of normal output + -emit-ast Emit Clang AST files for source inputs + -emit-llvm Use the LLVM representation for assembler and object files + -E Only run the preprocessor + -faltivec Enable AltiVec vector initializer syntax + -fansi-escape-codes Use ANSI escape codes for diagnostics + -fapple-kext Use Apple's kernel extensions ABI + -fapple-pragma-pack Enable Apple gcc-compatible #pragma pack handling + -fapplication-extension Restrict code to those available for App Extensions + -fblocks Enable the 'blocks' language feature + -fborland-extensions Accept non-standard constructs supported by the Borland compiler + -fbuild-session-file= + Use the last modification time of as the build session timestamp + -fbuild-session-timestamp=