Skip to content

Commit

Permalink
Force "compiler.cppstd" to gnu17/17
Browse files Browse the repository at this point in the history
  • Loading branch information
vollous committed May 6, 2024
1 parent 777d99a commit 2e640a9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import shutil
from enum import Enum
import fileinput
from argparse import ArgumentParser, ArgumentTypeError
import platform

Expand Down Expand Up @@ -60,6 +61,11 @@ def get_profile(os: str, arch: str, build_type: BuildMode):

return profile

def set_setting(file, setting, value):
for line in fileinput.input([file], inplace=True):
if line.strip().startswith(setting):
line = setting + "=" + value + "\n"
sys.stdout.write(line)

def check_profile(profile):
path = os.path.join("profiles", "BSMPT", profile)
Expand All @@ -71,9 +77,14 @@ def check_profile(profile):
subprocess.check_output(cmd)
if (sys.platform != "win32"):
cmd = "cp " + conan_home + "/profiles/default profiles/BSMPT/" + str(profile)
subprocess.check_call(cmd, shell=True)
set_setting(path, "compiler.cppstd", "gnu17")

else:
cmd = "copy " + conan_home + "\\profiles\\default profiles\\BSMPT\\" + str(profile)
subprocess.check_call(cmd, shell=True)
subprocess.check_call(cmd, shell=True)
set_setting(path, "compiler.cppstd", "17")

setup_profiles()
check_profile(profile)

Expand Down

0 comments on commit 2e640a9

Please sign in to comment.