Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TPF
jack2
Commits
65e3c278
Unverified
Commit
65e3c278
authored
Mar 31, 2016
by
Karl Linden
Browse files
Make platform detection less hardcoded. Rename --dist-target=mingw option to --platform=win32.
parent
7bdad496
Changes
1
Hide whitespace changes
Inline
Side-by-side
wscript
View file @
65e3c278
...
...
@@ -400,7 +400,7 @@ def options(opt):
opt
.
add_option
(
'--mandir'
,
type
=
'string'
,
help
=
"Manpage directory [Default: <prefix>/share/man/man1]"
)
# options affecting binaries
opt
.
add_option
(
'--
dist-target
'
,
type
=
'string'
,
default
=
'auto'
,
help
=
'Specify the target for cross-compiling [auto,mingw]
'
)
opt
.
add_option
(
'--
platform
'
,
type
=
'string'
,
default
=
sys
.
platform
,
help
=
'Target platform for cross-compiling, e.g. cygwin or win32
'
)
opt
.
add_option
(
'--mixed'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Build with 32/64 bits mixed mode'
)
opt
.
add_option
(
'--debug'
,
action
=
'store_true'
,
default
=
False
,
dest
=
'debug'
,
help
=
'Build debuggable binaries'
)
...
...
@@ -449,31 +449,33 @@ def options(opt):
# this must be called before the configure phase
auto_options_argv_hack
()
def
detect_platform
(
conf
):
# GNU/kFreeBSD and GNU/Hurd are treated as Linux
platforms
=
[
# ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
(
'IS_LINUX'
,
'Linux'
,
[
'gnu0'
,
'gnukfreebsd'
,
'linux'
,
'posix'
]),
(
'IS_MACOSX'
,
'MacOS X'
,
[
'darwin'
]),
(
'IS_SUN'
,
'SunOS'
,
[
'sunos'
]),
(
'IS_WINDOWS'
,
'Windows'
,
[
'cygwin'
,
'win32'
])
]
for
key
,
name
,
strings
in
platforms
:
conf
.
env
[
key
]
=
False
conf
.
start_msg
(
'Checking platform'
)
platform
=
Options
.
options
.
platform
for
key
,
name
,
strings
in
platforms
:
for
s
in
strings
:
if
platform
.
startswith
(
s
):
conf
.
env
[
key
]
=
True
conf
.
end_msg
(
name
,
color
=
'CYAN'
)
break
def
configure
(
conf
):
conf
.
load
(
'compiler_cxx'
)
conf
.
load
(
'compiler_c'
)
if
Options
.
options
.
dist_target
==
'auto'
:
platform
=
sys
.
platform
conf
.
env
[
'IS_MACOSX'
]
=
platform
==
'darwin'
conf
.
env
[
'IS_LINUX'
]
=
platform
==
'linux'
or
platform
==
'linux2'
or
platform
==
'linux3'
or
platform
==
'posix'
conf
.
env
[
'IS_SUN'
]
=
platform
==
'sunos'
# GNU/kFreeBSD and GNU/Hurd are treated as Linux
if
platform
.
startswith
(
'gnu0'
)
or
platform
.
startswith
(
'gnukfreebsd'
):
conf
.
env
[
'IS_LINUX'
]
=
True
elif
Options
.
options
.
dist_target
==
'mingw'
:
conf
.
env
[
'IS_WINDOWS'
]
=
True
if
conf
.
env
[
'IS_LINUX'
]:
Logs
.
pprint
(
'CYAN'
,
"Linux detected"
)
if
conf
.
env
[
'IS_MACOSX'
]:
Logs
.
pprint
(
'CYAN'
,
"MacOS X detected"
)
if
conf
.
env
[
'IS_SUN'
]:
Logs
.
pprint
(
'CYAN'
,
"SunOS detected"
)
if
conf
.
env
[
'IS_WINDOWS'
]:
Logs
.
pprint
(
'CYAN'
,
"Windows detected"
)
detect_platform
(
conf
)
if
conf
.
env
[
'IS_WINDOWS'
]:
conf
.
env
.
append_unique
(
'CCDEFINES'
,
'_POSIX'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment