summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel <dmoody256@gmail.com>2019-02-20 06:16:11 (GMT)
committerDaniel <dmoody256@gmail.com>2019-02-20 06:16:11 (GMT)
commit16d8a62b17ae8a3e026d192574a05bdb87140c59 (patch)
tree8cc90faccdd193123b59cb7ce83db789be2c5b30 /src
parent77560936fe38dccf1c4c46a2b41e3c5d4e3a0462 (diff)
downloadSCons-16d8a62b17ae8a3e026d192574a05bdb87140c59.zip
SCons-16d8a62b17ae8a3e026d192574a05bdb87140c59.tar.gz
SCons-16d8a62b17ae8a3e026d192574a05bdb87140c59.tar.bz2
add win_flex as option for windows, add choco default path, and add flag for nounistd on windows. also more testing
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Platform/win32.py4
-rw-r--r--src/engine/SCons/Tool/lex.py26
-rw-r--r--src/engine/SCons/Tool/lex.xml9
3 files changed, 29 insertions, 10 deletions
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 2d40fb8..be30546 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -43,6 +43,10 @@ from SCons.Platform.virtualenv import ImportVirtualenv
from SCons.Platform.virtualenv import ignore_virtualenv, enable_virtualenv
import SCons.Util
+CHOCO_DEFAULT_PATH = [
+ r'C:\ProgramData\chocolatey\bin'
+]
+
try:
import msvcrt
import win32api
diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py
index 70c0c5f..3506f7c 100644
--- a/src/engine/SCons/Tool/lex.py
+++ b/src/engine/SCons/Tool/lex.py
@@ -41,6 +41,7 @@ import SCons.Tool
import SCons.Util
from SCons.Platform.mingw import MINGW_DEFAULT_PATHS
from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS
+from SCons.Platform.win32 import CHOCO_DEFAULT_PATH
LexAction = SCons.Action.Action("$LEXCOM", "$LEXCOMSTR")
@@ -74,17 +75,19 @@ def get_lex_path(env, append_paths=False):
"""
# save existing path to reset if we don't want to append any paths
envPath = env['ENV']['PATH']
- bins = ['lex', 'flex']
+ bins = ['win_flex', 'lex', 'flex']
for prog in bins:
- bin_path = SCons.Tool.find_program_path(env, prog, default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS )
+ bin_path = SCons.Tool.find_program_path(
+ env,
+ prog,
+ default_paths=CHOCO_DEFAULT_PATH + MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS )
if bin_path:
if not append_paths:
env['ENV']['PATH'] = envPath
else:
env.AppendENVPath('PATH', os.path.dirname(bin_path))
return bin_path
-
SCons.Warnings.Warning('lex tool requested, but lex or flex binary not found in ENV PATH')
@@ -92,9 +95,6 @@ def generate(env):
"""Add Builders and construction variables for lex to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
- if sys.platform == 'win32':
- get_lex_path(env, append_paths=True)
-
# C
c_file.add_action(".l", LexAction)
c_file.add_emitter(".l", lexEmitter)
@@ -109,10 +109,16 @@ def generate(env):
# C++
cxx_file.add_action(".ll", LexAction)
cxx_file.add_emitter(".ll", lexEmitter)
-
- env["LEX"] = env.Detect("flex") or "lex"
- env["LEXFLAGS"] = SCons.Util.CLVar("")
- env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET"
+
+ if sys.platform == 'win32':
+ get_lex_path(env, append_paths=True)
+ env["LEX"] = env.Detect(['win_flex', 'lex', 'flex'])
+ env["LEXUNISTD"] = SCons.Util.CLVar("--nounistd")
+ env["LEXCOM"] = "$LEX $LEXUNISTD $LEXFLAGS -t $SOURCES > $TARGET"
+ else:
+ env["LEX"] = env.Detect(["flex", "lex"])
+ env["LEXFLAGS"] = SCons.Util.CLVar("")
+ env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET"
def exists(env):
if sys.platform == 'win32':
diff --git a/src/engine/SCons/Tool/lex.xml b/src/engine/SCons/Tool/lex.xml
index 0388ee3..f933451 100644
--- a/src/engine/SCons/Tool/lex.xml
+++ b/src/engine/SCons/Tool/lex.xml
@@ -33,6 +33,7 @@ Sets construction variables for the &lex; lexical analyser.
<item>LEX</item>
<item>LEXFLAGS</item>
<item>LEXCOM</item>
+<item>LEXUNISTD</item>
</sets>
<uses>
<item>LEXCOMSTR</item>
@@ -78,4 +79,12 @@ General options passed to the lexical analyzer generator.
</summary>
</cvar>
+<cvar name="LEXUNISTD">
+<summary>
+<para>
+Used only on windows environments to set a lex flag to prevent 'unistd.h' from being included. The default value is '--nounistd'.
+</para>
+</summary>
+</cvar>
+
</sconsdoc>