Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mesa
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Erik Faye-Lund
mesa
Commits
e1bc68b0
Commit
e1bc68b0
authored
Jan 13, 2011
by
Jose 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
Show 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'):
...
@@ -118,6 +118,39 @@ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
Export
(
'env'
)
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
# Invoke SConscripts
...
...
common.py
View file @
e1bc68b0
...
@@ -19,17 +19,17 @@ _platform_map = {
...
@@ -19,17 +19,17 @@ _platform_map = {
'win32'
:
'windows'
,
'win32'
:
'windows'
,
}
}
defaul
t_platform
=
sys
.
platform
hos
t_platform
=
sys
.
platform
default_platform
=
_platform_map
.
get
(
default_platform
,
defaul
t_platform
)
host_platform
=
_platform_map
.
get
(
host_platform
,
hos
t_platform
)
# Search sys.argv[] for a "platform=foo" argument since we don't have
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
# an 'env' variable at this point.
if
'platform'
in
SCons
.
Script
.
ARGUMENTS
:
if
'platform'
in
SCons
.
Script
.
ARGUMENTS
:
selected
_platform
=
SCons
.
Script
.
ARGUMENTS
[
'platform'
]
target
_platform
=
SCons
.
Script
.
ARGUMENTS
[
'platform'
]
else
:
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
=
{
_machine_map
=
{
'x86'
:
'x86'
,
'x86'
:
'x86'
,
...
@@ -42,15 +42,17 @@ _machine_map = {
...
@@ -42,15 +42,17 @@ _machine_map = {
}
}
# find
defaul
t_machine value
# find
hos
t_machine value
if
'PROCESSOR_ARCHITECTURE'
in
os
.
environ
:
if
'PROCESSOR_ARCHITECTURE'
in
os
.
environ
:
defaul
t_machine
=
os
.
environ
[
'PROCESSOR_ARCHITECTURE'
]
hos
t_machine
=
os
.
environ
[
'PROCESSOR_ARCHITECTURE'
]
else
:
else
:
default_machine
=
_platform
.
machine
()
host_machine
=
_platform
.
machine
()
default_machine
=
_machine_map
.
get
(
default_machine
,
'generic'
)
host_machine
=
_machine_map
.
get
(
host_machine
,
'generic'
)
default_machine
=
host_machine
default_toolchain
=
'default'
default_toolchain
=
'default'
if
selected
_platform
==
'windows'
and
cross_compiling
:
if
target
_platform
==
'windows'
and
cross_compiling
:
default_machine
=
'x86'
default_machine
=
'x86'
default_toolchain
=
'crossmingw'
default_toolchain
=
'crossmingw'
...
@@ -61,7 +63,7 @@ if 'LLVM' in os.environ:
...
@@ -61,7 +63,7 @@ if 'LLVM' in os.environ:
else
:
else
:
default_llvm
=
'no'
default_llvm
=
'no'
try
:
try
:
if
selected
_platform
!=
'windows'
and
\
if
target
_platform
!=
'windows'
and
\
subprocess
.
call
([
'llvm-config'
,
'--version'
],
stdout
=
subprocess
.
PIPE
)
==
0
:
subprocess
.
call
([
'llvm-config'
,
'--version'
],
stdout
=
subprocess
.
PIPE
)
==
0
:
default_llvm
=
'yes'
default_llvm
=
'yes'
except
:
except
:
...
@@ -85,7 +87,7 @@ def AddOptions(opts):
...
@@ -85,7 +87,7 @@ def AddOptions(opts):
opts
.
Add
(
BoolOption
(
'quiet'
,
'quiet command lines'
,
'yes'
))
opts
.
Add
(
BoolOption
(
'quiet'
,
'quiet command lines'
,
'yes'
))
opts
.
Add
(
EnumOption
(
'machine'
,
'use machine-specific assembly code'
,
default_machine
,
opts
.
Add
(
EnumOption
(
'machine'
,
'use machine-specific assembly code'
,
default_machine
,
allowed_values
=
(
'generic'
,
'ppc'
,
'x86'
,
'x86_64'
)))
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'
)))
allowed_values
=
(
'linux'
,
'cell'
,
'windows'
,
'winddk'
,
'wince'
,
'darwin'
,
'embedded'
,
'cygwin'
,
'sunos5'
,
'freebsd8'
)))
opts
.
Add
(
'toolchain'
,
'compiler toolchain'
,
default_toolchain
)
opts
.
Add
(
'toolchain'
,
'compiler toolchain'
,
default_toolchain
)
opts
.
Add
(
BoolOption
(
'llvm'
,
'use LLVM'
,
default_llvm
))
opts
.
Add
(
BoolOption
(
'llvm'
,
'use LLVM'
,
default_llvm
))
...
...
src/SConscript
View file @
e1bc68b0
...
@@ -3,6 +3,9 @@ Import('*')
...
@@ -3,6 +3,9 @@ Import('*')
if
env
[
'platform'
]
==
'windows'
:
if
env
[
'platform'
]
==
'windows'
:
SConscript
(
'getopt/SConscript'
)
SConscript
(
'getopt/SConscript'
)
SConscript
(
'talloc/SConscript'
)
SConscript
(
'talloc/SConscript'
)
else
:
talloc
=
'talloc'
Export
(
'talloc'
)
SConscript
(
'glsl/SConscript'
)
SConscript
(
'glsl/SConscript'
)
SConscript
(
'mapi/glapi/SConscript'
)
SConscript
(
'mapi/glapi/SConscript'
)
...
...
src/glsl/SConscript
View file @
e1bc68b0
...
@@ -9,6 +9,7 @@ env = env.Clone()
...
@@ -9,6 +9,7 @@ env = env.Clone()
env
.
Prepend
(
CPPPATH
=
[
env
.
Prepend
(
CPPPATH
=
[
'#src/mapi'
,
'#src/mapi'
,
'#src/mesa'
,
'#src/mesa'
,
'#src/glsl'
,
])
])
if
env
[
'platform'
]
==
'windows'
:
if
env
[
'platform'
]
==
'windows'
:
...
@@ -80,34 +81,35 @@ sources = [
...
@@ -80,34 +81,35 @@ sources = [
'strtod.c'
,
'strtod.c'
,
]
]
if
env
[
'msvc'
]:
if
env
[
'platform'
]
==
common
.
host_platform
:
if
env
[
'msvc'
]:
env
.
Prepend
(
CPPPATH
=
[
'#/src/getopt'
])
env
.
Prepend
(
CPPPATH
=
[
'#/src/getopt'
])
env
.
PrependUnique
(
LIBS
=
[
getopt
])
env
.
PrependUnique
(
LIBS
=
[
getopt
])
if
env
[
'platform'
]
==
'windows'
:
if
env
[
'platform'
]
==
'windows'
:
env
.
Prepend
(
CPPPATH
=
[
'#src/talloc'
])
env
.
Prepend
(
LIBS
=
[
talloc
])
env
.
Prepend
(
LIBS
=
[
talloc
])
else
:
else
:
env
.
Prepend
(
LIBS
=
[
'talloc'
])
env
.
Prepend
(
LIBS
=
[
'talloc'
])
env
.
Append
(
CPPPATH
=
[
'#/src/glsl'
])
builtin_compiler
=
env
.
Program
(
builtin_compiler
=
env
.
Program
(
target
=
'builtin_compiler'
,
target
=
'builtin_compiler'
,
source
=
sources
+
[
'main.cpp'
,
'builtin_stubs.cpp'
,
source
=
sources
+
[
'main.cpp'
,
'builtin_stubs.cpp'
,
'#src/mesa/program/hash_table.c'
,
'#src/mesa/program/hash_table.c'
,
'#src/mesa/program/symbol_table.c'
],
'#src/mesa/program/symbol_table.c'
],
)
)
env
.
CodeGenerate
(
builtin_glsl_function
=
env
.
CodeGenerate
(
target
=
'builtin_function.cpp'
,
target
=
'builtin_function.cpp'
,
script
=
'builtins/tools/generate_builtins.py'
,
script
=
'builtins/tools/generate_builtins.py'
,
source
=
builtin_compiler
,
source
=
builtin_compiler
,
command
=
python_cmd
+
' $SCRIPT $SOURCE > $TARGET'
command
=
python_cmd
+
' $SCRIPT $SOURCE > $TARGET'
)
)
env
.
Depends
(
'builtin_function.cpp'
,
[
'builtins/tools/generate_builtins.py'
,
'builtins/tools/texture_builtins.py'
]
+
Glob
(
'builtins/ir/*'
))
env
.
Depends
(
builtin_glsl_function
,
[
'builtins/tools/generate_builtins.py'
,
'builtins/tools/texture_builtins.py'
]
+
Glob
(
'builtins/ir/*'
))
if
env
[
'msvc'
]:
if
env
[
'msvc'
]:
# There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure
# 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 is on the same dir as builtin_function.
talloc_dll_src
=
talloc
.
dir
.
File
(
'talloc.dll'
)
talloc_dll_src
=
talloc
.
dir
.
File
(
'talloc.dll'
)
...
@@ -115,9 +117,16 @@ if env['msvc']:
...
@@ -115,9 +117,16 @@ if env['msvc']:
talloc_dll
=
env
.
Command
(
talloc_dll_dst
,
talloc_dll_src
,
Copy
(
talloc_dll_dst
,
talloc_dll_src
))
talloc_dll
=
env
.
Command
(
talloc_dll_dst
,
talloc_dll_src
,
Copy
(
talloc_dll_dst
,
talloc_dll_src
))
env
.
Depends
(
'builtin_function.cpp'
,
talloc_dll
)
env
.
Depends
(
'builtin_function.cpp'
,
talloc_dll
)
Export
(
'builtin_glsl_function'
)
if
common
.
cross_compiling
:
Return
()
sources
+=
builtin_glsl_function
glsl
=
env
.
ConvenienceLibrary
(
glsl
=
env
.
ConvenienceLibrary
(
target
=
'glsl'
,
target
=
'glsl'
,
source
=
sources
+
[
'builtin_function.cpp'
]
,
source
=
sources
,
)
)
Export
(
'glsl'
)
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