|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
| 3 | +# Contest Management System - http://cms-dev.github.io/ |
| 4 | +# Copyright © 2024 Filippo Casarin <[email protected]> |
| 5 | +# |
| 6 | +# This program is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Affero General Public License as |
| 8 | +# published by the Free Software Foundation, either version 3 of the |
| 9 | +# License, or (at your option) any later version. |
| 10 | +# |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Affero General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Affero General Public License |
| 17 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +"""C++20 programming language definition.""" |
| 20 | + |
| 21 | +from cms.grading import CompiledLanguage |
| 22 | + |
| 23 | + |
| 24 | +__all__ = ["Cpp20Gpp"] |
| 25 | + |
| 26 | + |
| 27 | +class Cpp20Gpp(CompiledLanguage): |
| 28 | + """This defines the C++ programming language, compiled with g++ (the |
| 29 | + version available on the system) using the C++20 standard. |
| 30 | +
|
| 31 | + """ |
| 32 | + |
| 33 | + @property |
| 34 | + def name(self): |
| 35 | + """See Language.name.""" |
| 36 | + return "C++20 / g++" |
| 37 | + |
| 38 | + @property |
| 39 | + def source_extensions(self): |
| 40 | + """See Language.source_extensions.""" |
| 41 | + return [".cpp", ".cc", ".cxx", ".c++", ".C"] |
| 42 | + |
| 43 | + @property |
| 44 | + def header_extensions(self): |
| 45 | + """See Language.header_extensions.""" |
| 46 | + return [".h"] |
| 47 | + |
| 48 | + @property |
| 49 | + def object_extensions(self): |
| 50 | + """See Language.object_extensions.""" |
| 51 | + return [".o"] |
| 52 | + |
| 53 | + def get_compilation_commands(self, |
| 54 | + source_filenames, executable_filename, |
| 55 | + for_evaluation=True): |
| 56 | + """See Language.get_compilation_commands.""" |
| 57 | + command = ["/usr/bin/g++"] |
| 58 | + if for_evaluation: |
| 59 | + command += ["-DEVAL"] |
| 60 | + command += ["-std=gnu++20", "-O2", "-pipe", "-static", |
| 61 | + "-s", "-o", executable_filename] |
| 62 | + command += source_filenames |
| 63 | + return [command] |
0 commit comments