default to clang++ on OS X and start reporting CXX compiler used in mapnik-config - closes #1839
This commit is contained in:
parent
d36a7323ac
commit
7518c9c2c2
3 changed files with 21 additions and 8 deletions
20
SConstruct
20
SConstruct
|
@ -35,6 +35,12 @@ except:
|
||||||
LIBDIR_SCHEMA_DEFAULT='lib'
|
LIBDIR_SCHEMA_DEFAULT='lib'
|
||||||
severities = ['debug', 'warn', 'error', 'none']
|
severities = ['debug', 'warn', 'error', 'none']
|
||||||
|
|
||||||
|
DEFAULT_CC = "gcc"
|
||||||
|
DEFAULT_CXX = "g++"
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
DEFAULT_CC = "clang"
|
||||||
|
DEFAULT_CXX = "clang++"
|
||||||
|
|
||||||
py3 = None
|
py3 = None
|
||||||
|
|
||||||
# local file to hold custom user configuration variables
|
# local file to hold custom user configuration variables
|
||||||
|
@ -168,7 +174,7 @@ def shortest_name(libs):
|
||||||
|
|
||||||
def sort_paths(items,priority):
|
def sort_paths(items,priority):
|
||||||
"""Sort paths such that compiling and linking will globally prefer custom or local libs
|
"""Sort paths such that compiling and linking will globally prefer custom or local libs
|
||||||
over system libraries by fixing up the order libs are passed to gcc and the linker.
|
over system libraries by fixing up the order libs are passed to the compiler and the linker.
|
||||||
|
|
||||||
Ideally preference could be by-target instead of global, but our SCons implementation
|
Ideally preference could be by-target instead of global, but our SCons implementation
|
||||||
is not currently utilizing different SCons build env()'s as we should.
|
is not currently utilizing different SCons build env()'s as we should.
|
||||||
|
@ -253,15 +259,15 @@ opts = Variables()
|
||||||
|
|
||||||
opts.AddVariables(
|
opts.AddVariables(
|
||||||
# Compiler options
|
# Compiler options
|
||||||
('CXX', 'The C++ compiler to use to compile mapnik (defaults to g++).', 'g++'),
|
('CXX', 'The C++ compiler to use to compile mapnik', DEFAULT_CXX),
|
||||||
('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'),
|
('CC', 'The C compiler used for configure checks of C libs.', DEFAULT_CC),
|
||||||
('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''),
|
('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>', ''),
|
||||||
('CUSTOM_DEFINES', 'Custom Compiler DEFINES, e.g. -DENABLE_THIS', ''),
|
('CUSTOM_DEFINES', 'Custom Compiler DEFINES, e.g. -DENABLE_THIS', ''),
|
||||||
('CUSTOM_CFLAGS', 'Custom C flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> (only used for configure checks)', ''),
|
('CUSTOM_CFLAGS', 'Custom C flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> (only used for configure checks)', ''),
|
||||||
('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
|
('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
|
||||||
EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
|
EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
|
||||||
EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
|
EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
|
||||||
EnumVariable('OPTIMIZATION','Set g++ optimization level','3', ['0','1','2','3','4','s']),
|
EnumVariable('OPTIMIZATION','Set compiler optimization level','3', ['0','1','2','3','4','s']),
|
||||||
# Note: setting DEBUG=True will override any custom OPTIMIZATION level
|
# Note: setting DEBUG=True will override any custom OPTIMIZATION level
|
||||||
BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
|
BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
|
||||||
BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'),
|
BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'),
|
||||||
|
@ -1588,11 +1594,11 @@ if not preconfigured:
|
||||||
|
|
||||||
if not env['SUNCC']:
|
if not env['SUNCC']:
|
||||||
# Common flags for GCC.
|
# Common flags for GCC.
|
||||||
gcc_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
|
common_cxx_flags = '-ansi -Wall %s %s -ftemplate-depth-300 ' % (env['WARNING_CXXFLAGS'], pthread)
|
||||||
if env['DEBUG']:
|
if env['DEBUG']:
|
||||||
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline')
|
env.Append(CXXFLAGS = common_cxx_flags + '-O0 -fno-inline')
|
||||||
else:
|
else:
|
||||||
env.Append(CXXFLAGS = gcc_cxx_flags + '-O%s -fvisibility-inlines-hidden -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
env.Append(CXXFLAGS = common_cxx_flags + '-O%s -fvisibility-inlines-hidden -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts' % (env['OPTIMIZATION']))
|
||||||
|
|
||||||
if env['DEBUG_UNDEFINED']:
|
if env['DEBUG_UNDEFINED']:
|
||||||
env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv')
|
env.Append(CXXFLAGS = '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv -fwrapv')
|
||||||
|
|
|
@ -32,6 +32,7 @@ CONFIG_MAPNIK_LDFLAGS='%(ldflags)s'
|
||||||
CONFIG_MAPNIK_INCLUDE="${CONFIG_PREFIX}/include -I${CONFIG_PREFIX}/include/mapnik/agg"
|
CONFIG_MAPNIK_INCLUDE="${CONFIG_PREFIX}/include -I${CONFIG_PREFIX}/include/mapnik/agg"
|
||||||
CONFIG_DEP_INCLUDES='%(dep_includes)s'
|
CONFIG_DEP_INCLUDES='%(dep_includes)s'
|
||||||
CONFIG_CXXFLAGS='%(cxxflags)s'
|
CONFIG_CXXFLAGS='%(cxxflags)s'
|
||||||
|
CONFIG_CXX='%(cxx)s'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -107,7 +108,8 @@ configuration = {
|
||||||
"fonts": fontspath,
|
"fonts": fontspath,
|
||||||
"input_plugins": inputpluginspath,
|
"input_plugins": inputpluginspath,
|
||||||
"defines":defines,
|
"defines":defines,
|
||||||
"cxxflags":cxxflags
|
"cxxflags":cxxflags,
|
||||||
|
"cxx":env['CXX']
|
||||||
}
|
}
|
||||||
|
|
||||||
## if we are statically linking depedencies
|
## if we are statically linking depedencies
|
||||||
|
|
|
@ -24,6 +24,7 @@ Known values for OPTION are:
|
||||||
--dep-includes include paths (-I) for Mapnik dependencies (new in 2.2.x)
|
--dep-includes include paths (-I) for Mapnik dependencies (new in 2.2.x)
|
||||||
--cxxflags c++ compiler flags and pre-processor defines (new in 2.2.x)
|
--cxxflags c++ compiler flags and pre-processor defines (new in 2.2.x)
|
||||||
--cflags all include paths, compiler flags, and pre-processor defines (for back-compatibility)
|
--cflags all include paths, compiler flags, and pre-processor defines (for back-compatibility)
|
||||||
|
--cxx c++ compiler used to build mapnik (new in 2.2.x)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
exit $1
|
exit $1
|
||||||
|
@ -113,6 +114,10 @@ while test $# -gt 0; do
|
||||||
echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS}
|
echo -I${CONFIG_MAPNIK_INCLUDE} ${CONFIG_DEP_INCLUDES} ${CONFIG_MAPNIK_DEFINES} ${CONFIG_CXXFLAGS}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--cxx)
|
||||||
|
echo ${CONFIG_CXX}
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
# push to stderr any invalid options
|
# push to stderr any invalid options
|
||||||
echo "unknown option $1" 1>&2;
|
echo "unknown option $1" 1>&2;
|
||||||
|
|
Loading…
Reference in a new issue