Skip to content

Commit

Permalink
first attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
enetheru committed Jan 12, 2025
1 parent 94a1f4f commit 11ac8e1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import common_compiler_flags
import my_spawn
from SCons.Tool import mingw, msvc
from SCons.Tool import mingw, msvc, clangxx, clang
from SCons.Variables import BoolVariable


Expand Down Expand Up @@ -73,14 +73,17 @@ def spawn_capture(sh, escape, cmd, args, env):


def options(opts):
mingw = os.getenv("MINGW_PREFIX", "")
msystem = os.getenv("MSYSTEM", "")
mingw_prefix=""
if not msystem:
mingw_prefix = os.getenv("MINGW_PREFIX", "")

opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
opts.Add(BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True))
opts.Add(BoolVariable("silence_msvc", "Silence MSVC's cl/link stdout bloat, redirecting errors to stderr.", True))
opts.Add(BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False))
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler (MVSC or MinGW depending on the use_mingw flag)", False))
opts.Add("mingw_prefix", "MinGW prefix", mingw)
opts.Add("mingw_prefix", "MinGW prefix", mingw_prefix)


def exists(env):
Expand Down Expand Up @@ -132,7 +135,12 @@ def generate(env):

elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
env["use_mingw"] = True
mingw.generate(env)
if env["use_llvm"]:
clang.generate(env)
clangxx.generate(env)
else:
mingw.generate(env)

# Don't want lib prefixes
env["IMPLIBPREFIX"] = ""
env["SHLIBPREFIX"] = ""
Expand Down

0 comments on commit 11ac8e1

Please sign in to comment.