Skip to content

Commit

Permalink
Add cpp20gpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Virv12 committed Oct 18, 2024
1 parent fbb71da commit 89b1fb5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
64 changes: 64 additions & 0 deletions cms/grading/languages/cpp20_gpp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python3

# Contest Management System - http://cms-dev.github.io/
# Copyright © 2016 Stefano Maggiolo <s.maggiolo@gmail.com>
# Copyright © 2020 Andrey Vihrov <andrey.vihrov@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""C++20 programming language definition."""

from cms.grading import CompiledLanguage


__all__ = ["Cpp20Gpp"]


class Cpp20Gpp(CompiledLanguage):
"""This defines the C++ programming language, compiled with g++ (the
version available on the system) using the C++20 standard.
"""

@property
def name(self):
"""See Language.name."""
return "C++20 / g++"

@property
def source_extensions(self):
"""See Language.source_extensions."""
return [".cpp", ".cc", ".cxx", ".c++", ".C"]

@property
def header_extensions(self):
"""See Language.header_extensions."""
return [".h"]

@property
def object_extensions(self):
"""See Language.object_extensions."""
return [".o"]

def get_compilation_commands(self,
source_filenames, executable_filename,
for_evaluation=True):
"""See Language.get_compilation_commands."""
command = ["/usr/bin/g++"]
if for_evaluation:
command += ["-DEVAL"]
command += ["-std=gnu++20", "-O2", "-pipe", "-static",
"-s", "-o", executable_filename]
command += source_filenames
return [command]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def run(self):
"C++11 / g++=cms.grading.languages.cpp11_gpp:Cpp11Gpp",
"C++14 / g++=cms.grading.languages.cpp14_gpp:Cpp14Gpp",
"C++17 / g++=cms.grading.languages.cpp17_gpp:Cpp17Gpp",
"C++20 / g++=cms.grading.languages.cpp20_gpp:Cpp20Gpp",
"C11 / gcc=cms.grading.languages.c11_gcc:C11Gcc",
"C# / Mono=cms.grading.languages.csharp_mono:CSharpMono",
"Haskell / ghc=cms.grading.languages.haskell_ghc:HaskellGhc",
Expand Down

0 comments on commit 89b1fb5

Please sign in to comment.