88
99#!/usr/bin/env python3
1010
11- from os.path import join, abspath, realpath, dirname
12- import shutil
11+ from os.path import join, abspath
1312Import("env")
1413
1514profile = ARGUMENTS.get("profile", "release")
@@ -28,25 +27,18 @@ env["COMPILERSUFFIX"] = "-12"
2827%% endif
2928%% endif
3029
30+ %% if toolpaths
3131# SCons tools
3232env.Append(toolpath=[
3333%% for toolpath in toolpaths | sort
3434 abspath("{{ toolpath | modm.windowsify(escape_level=1) }}"),
3535%% endfor
3636])
37+ %% endif
3738%% for tool in tools | sort
3839env.Tool("{{tool}}")
3940%% endfor
4041
41- c_compiler_name = env["CC"]
42- c_compiler_path = shutil.which(c_compiler_name)
43-
44- if c_compiler_path is None:
45- print(f'Selected compiler "{c_compiler_name}" not found on PATH. Please add its installation directory to the PATH environment variable.')
46- exit(1)
47-
48- env["GCC_PATH"] = dirname(dirname(realpath(c_compiler_path)))
49-
5042%% macro generate_flags_for_profile(name, profile, append=False)
5143env{% if append %}.Append({{name | upper}}{% else %}["{{name | upper}}"]{% endif %} = [
5244%% for flag in flags[name][profile] | sort
@@ -205,6 +197,7 @@ env.AppendUnique(LIBPATH=[
205197env.ParseConfig("pkg-config --cflags --libs {{ packages | sort | join(" ") }}")
206198%% endif
207199
200+ %% if is_modm
208201for flags in ["CCFLAGS", "CFLAGS", "CXXFLAGS", "ASFLAGS", "ARCHFLAGS", "LINKFLAGS"]:
209202 flags_str = ARGUMENTS.get(flags)
210203 if flags_str is not None:
@@ -220,5 +213,6 @@ for flags in ["CCFLAGS", "CFLAGS", "CXXFLAGS", "ASFLAGS", "ARCHFLAGS", "LINKFLAG
220213 exit(1)
221214 else:
222215 env[flags].append(flag)
216+ %% endif
223217
224218Return("library")
0 commit comments