[SCons] Fix msvc, linux-clang, add version check.
parent
794dea0dd7
commit
7901986dcf
|
@ -75,7 +75,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install scons
|
- name: Install scons
|
||||||
run: |
|
run: |
|
||||||
python -m pip install scons
|
python -m pip install scons==4.0.0
|
||||||
|
|
||||||
- name: Setup MinGW for Windows/MinGW build
|
- name: Setup MinGW for Windows/MinGW build
|
||||||
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
|
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
from binding_generator import scons_generate_bindings, scons_emit_files
|
from binding_generator import scons_generate_bindings, scons_emit_files
|
||||||
|
|
||||||
|
EnsureSConsVersion(4, 0)
|
||||||
|
|
||||||
|
|
||||||
def add_sources(sources, dir, extension):
|
def add_sources(sources, dir, extension):
|
||||||
for f in os.listdir(dir):
|
for f in os.listdir(dir):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from SCons.Variables import *
|
from SCons.Variables import *
|
||||||
|
from SCons.Tool import clang, clangxx
|
||||||
|
|
||||||
|
|
||||||
def options(opts):
|
def options(opts):
|
||||||
|
@ -11,8 +12,8 @@ def exists(env):
|
||||||
|
|
||||||
def generate(env):
|
def generate(env):
|
||||||
if env["use_llvm"]:
|
if env["use_llvm"]:
|
||||||
base = env.Tool("clang")
|
clang.generate(env)
|
||||||
base.generate(env)
|
clangxx.generate(env)
|
||||||
|
|
||||||
env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
|
env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
|
||||||
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
|
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import my_spawn
|
import my_spawn
|
||||||
from SCons.Tool.MSCommon import msvc_exists
|
|
||||||
|
from SCons.Tool import msvc, mingw
|
||||||
from SCons.Variables import *
|
from SCons.Variables import *
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,14 +16,13 @@ def exists(env):
|
||||||
|
|
||||||
def generate(env):
|
def generate(env):
|
||||||
base = None
|
base = None
|
||||||
if not env["use_mingw"] and msvc_exists(env):
|
if not env["use_mingw"] and msvc.exists(env):
|
||||||
base = env.Tool("msvc")
|
|
||||||
env["is_msvc"] = True
|
|
||||||
if env["arch"] == "x86_64":
|
if env["arch"] == "x86_64":
|
||||||
env["TARGET_ARCH"] = "amd64"
|
env["TARGET_ARCH"] = "amd64"
|
||||||
elif env["arch"] == "x86_32":
|
elif env["arch"] == "x86_32":
|
||||||
env["TARGET_ARCH"] = "x86"
|
env["TARGET_ARCH"] = "x86"
|
||||||
base.generate(env)
|
env["is_msvc"] = True
|
||||||
|
msvc.generate(env)
|
||||||
env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
|
env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
|
||||||
env.Append(LINKFLAGS=["/WX"])
|
env.Append(LINKFLAGS=["/WX"])
|
||||||
if env["target"] == "debug":
|
if env["target"] == "debug":
|
||||||
|
@ -32,8 +32,7 @@ def generate(env):
|
||||||
|
|
||||||
elif sys.platform == "win32" or sys.platform == "msys":
|
elif sys.platform == "win32" or sys.platform == "msys":
|
||||||
env["use_mingw"] = True
|
env["use_mingw"] = True
|
||||||
base = env.Tool("mingw")
|
mingw.generate(env)
|
||||||
base.generate(env)
|
|
||||||
# Still need to use C++17.
|
# Still need to use C++17.
|
||||||
env.Append(CCFLAGS=["-std=c++17"])
|
env.Append(CCFLAGS=["-std=c++17"])
|
||||||
# Don't want lib prefixes
|
# Don't want lib prefixes
|
||||||
|
|
Loading…
Reference in New Issue