Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mesa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
virgl-es
mesa
Commits
e1bc68b0
Commit
e1bc68b0
authored
Jan 13, 2011
by
José Fonseca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scons: Fix cross-compilation.
Hairy stuff. Don't know how to do it better though.
parent
0448f73f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
42 deletions
+89
-42
SConstruct
SConstruct
+33
-0
common.py
common.py
+14
-12
src/SConscript
src/SConscript
+3
-0
src/glsl/SConscript
src/glsl/SConscript
+39
-30
No files found.
SConstruct
View file @
e1bc68b0
...
...
@@ -118,6 +118,39 @@ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
Export
(
'env'
)
#######################################################################
# Invoke host SConscripts
#
# For things that are meant to be run on the native host build machine, instead
# of the target machine.
#
# Create host environent
if
env
[
'platform'
]
!=
common
.
host_platform
:
host_env
=
Environment
(
options
=
opts
,
# no tool used
tools
=
[],
toolpath
=
[
'#scons'
],
ENV
=
os
.
environ
,
)
# Override options
host_env
[
'platform'
]
=
common
.
host_platform
host_env
[
'machine'
]
=
common
.
host_machine
host_env
[
'toolchain'
]
=
'default'
host_env
[
'llvm'
]
=
False
host_env
.
Tool
(
'gallium'
)
SConscript
(
'src/glsl/SConscript'
,
variant_dir
=
host_env
[
'build_dir'
],
duplicate
=
0
,
# http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
exports
=
{
'env'
:
host_env
},
)
#######################################################################
# Invoke SConscripts
...
...
common.py
View file @
e1bc68b0
...
...
@@ -19,17 +19,17 @@ _platform_map = {
'win32'
:
'windows'
,
}
defaul
t_platform
=
sys
.
platform
default_platform
=
_platform_map
.
get
(
default_platform
,
defaul
t_platform
)
hos
t_platform
=
sys
.
platform
host_platform
=
_platform_map
.
get
(
host_platform
,
hos
t_platform
)
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
if
'platform'
in
SCons
.
Script
.
ARGUMENTS
:
selected
_platform
=
SCons
.
Script
.
ARGUMENTS
[
'platform'
]
target
_platform
=
SCons
.
Script
.
ARGUMENTS
[
'platform'
]
else
:
selected_platform
=
defaul
t_platform
target_platform
=
hos
t_platform
cross_compiling
=
selected_platform
!=
defaul
t_platform
cross_compiling
=
target_platform
!=
hos
t_platform
_machine_map
=
{
'x86'
:
'x86'
,
...
...
@@ -42,15 +42,17 @@ _machine_map = {
}
# find
defaul
t_machine value
# find
hos
t_machine value
if
'PROCESSOR_ARCHITECTURE'
in
os
.
environ
:
defaul
t_machine
=
os
.
environ
[
'PROCESSOR_ARCHITECTURE'
]
hos
t_machine
=
os
.
environ
[
'PROCESSOR_ARCHITECTURE'
]
else
:
default_machine
=
_platform
.
machine
()
default_machine
=
_machine_map
.
get
(
default_machine
,
'generic'
)
host_machine
=
_platform
.
machine
()
host_machine
=
_machine_map
.
get
(
host_machine
,
'generic'
)
default_machine
=
host_machine
default_toolchain
=
'default'
if
selected
_platform
==
'windows'
and
cross_compiling
:
if
target
_platform
==
'windows'
and
cross_compiling
:
default_machine
=
'x86'
default_toolchain
=
'crossmingw'
...
...
@@ -61,7 +63,7 @@ if 'LLVM' in os.environ:
else
:
default_llvm
=
'no'
try
:
if
selected
_platform
!=
'windows'
and
\
if
target
_platform
!=
'windows'
and
\
subprocess
.
call
([
'llvm-config'
,
'--version'
],
stdout
=
subprocess
.
PIPE
)
==
0
:
default_llvm
=
'yes'
except
:
...
...
@@ -85,7 +87,7 @@ def AddOptions(opts):
opts
.
Add
(
BoolOption
(
'quiet'
,
'quiet command lines'
,
'yes'
))
opts
.
Add
(
EnumOption
(
'machine'
,
'use machine-specific assembly code'
,
default_machine
,
allowed_values
=
(
'generic'
,
'ppc'
,
'x86'
,
'x86_64'
)))
opts
.
Add
(
EnumOption
(
'platform'
,
'target platform'
,
defaul
t_platform
,
opts
.
Add
(
EnumOption
(
'platform'
,
'target platform'
,
hos
t_platform
,
allowed_values
=
(
'linux'
,
'cell'
,
'windows'
,
'winddk'
,
'wince'
,
'darwin'
,
'embedded'
,
'cygwin'
,
'sunos5'
,
'freebsd8'
)))
opts
.
Add
(
'toolchain'
,
'compiler toolchain'
,
default_toolchain
)
opts
.
Add
(
BoolOption
(
'llvm'
,
'use LLVM'
,
default_llvm
))
...
...
src/SConscript
View file @
e1bc68b0
...
...
@@ -3,6 +3,9 @@ Import('*')
if
env
[
'platform'
]
==
'windows'
:
SConscript
(
'getopt/SConscript'
)
SConscript
(
'talloc/SConscript'
)
else
:
talloc
=
'talloc'
Export
(
'talloc'
)
SConscript
(
'glsl/SConscript'
)
SConscript
(
'mapi/glapi/SConscript'
)
...
...
src/glsl/SConscript
View file @
e1bc68b0
...
...
@@ -9,6 +9,7 @@ env = env.Clone()
env
.
Prepend
(
CPPPATH
=
[
'#src/mapi'
,
'#src/mesa'
,
'#src/glsl'
,
])
if
env
[
'platform'
]
==
'windows'
:
...
...
@@ -78,46 +79,54 @@ sources = [
'opt_tree_grafting.cpp'
,
's_expression.cpp'
,
'strtod.c'
,
]
]
if
env
[
'msvc'
]:
env
.
Prepend
(
CPPPATH
=
[
'#/src/getopt'
])
env
.
PrependUnique
(
LIBS
=
[
getopt
])
if
env
[
'platform'
]
==
'windows'
:
env
.
Prepend
(
LIBS
=
[
talloc
])
else
:
env
.
Prepend
(
LIBS
=
[
'talloc'
])
if
env
[
'platform'
]
==
common
.
host_platform
:
if
env
[
'msvc'
]:
env
.
Prepend
(
CPPPATH
=
[
'#/src/getopt'
])
env
.
PrependUnique
(
LIBS
=
[
getopt
])
env
.
Append
(
CPPPATH
=
[
'#/src/glsl'
])
if
env
[
'platform'
]
==
'windows'
:
env
.
Prepend
(
CPPPATH
=
[
'#src/talloc'
])
env
.
Prepend
(
LIBS
=
[
talloc
])
else
:
env
.
Prepend
(
LIBS
=
[
'talloc'
])
builtin_compiler
=
env
.
Program
(
target
=
'builtin_compiler'
,
source
=
sources
+
[
'main.cpp'
,
'builtin_stubs.cpp'
,
'#src/mesa/program/hash_table.c'
,
'#src/mesa/program/symbol_table.c'
],
)
builtin_compiler
=
env
.
Program
(
target
=
'builtin_compiler'
,
source
=
sources
+
[
'main.cpp'
,
'builtin_stubs.cpp'
,
'#src/mesa/program/hash_table.c'
,
'#src/mesa/program/symbol_table.c'
],
)
env
.
CodeGenerate
(
target
=
'builtin_function.cpp'
,
script
=
'builtins/tools/generate_builtins.py'
,
source
=
builtin_compiler
,
command
=
python_cmd
+
' $SCRIPT $SOURCE > $TARGET'
)
builtin_glsl_function
=
env
.
CodeGenerate
(
target
=
'builtin_function.cpp'
,
script
=
'builtins/tools/generate_builtins.py'
,
source
=
builtin_compiler
,
command
=
python_cmd
+
' $SCRIPT $SOURCE > $TARGET'
)
env
.
Depends
(
builtin_glsl_function
,
[
'builtins/tools/generate_builtins.py'
,
'builtins/tools/texture_builtins.py'
]
+
Glob
(
'builtins/ir/*'
))
if
env
[
'msvc'
]:
# There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure
# talloc.dll is on the same dir as builtin_function.
talloc_dll_src
=
talloc
.
dir
.
File
(
'talloc.dll'
)
talloc_dll_dst
=
builtin_compiler
[
0
].
dir
.
File
(
'talloc.dll'
)
talloc_dll
=
env
.
Command
(
talloc_dll_dst
,
talloc_dll_src
,
Copy
(
talloc_dll_dst
,
talloc_dll_src
))
env
.
Depends
(
'builtin_function.cpp'
,
talloc_dll
)
Export
(
'builtin_glsl_function'
)
env
.
Depends
(
'builtin_function.cpp'
,
[
'builtins/tools/generate_builtins.py'
,
'builtins/tools/texture_builtins.py'
]
+
Glob
(
'builtins/ir/*'
))
if
common
.
cross_compiling
:
Return
()
if
env
[
'msvc'
]:
# There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure
# talloc.dll is on the same dir as builtin_function.
talloc_dll_src
=
talloc
.
dir
.
File
(
'talloc.dll'
)
talloc_dll_dst
=
builtin_compiler
[
0
].
dir
.
File
(
'talloc.dll'
)
talloc_dll
=
env
.
Command
(
talloc_dll_dst
,
talloc_dll_src
,
Copy
(
talloc_dll_dst
,
talloc_dll_src
))
env
.
Depends
(
'builtin_function.cpp'
,
talloc_dll
)
sources
+=
builtin_glsl_function
glsl
=
env
.
ConvenienceLibrary
(
target
=
'glsl'
,
source
=
sources
+
[
'builtin_function.cpp'
]
,
source
=
sources
,
)
Export
(
'glsl'
)
...
...
Write
Preview
Markdown
is supported
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