import platform as PLATFORM
from waflib.Tools import winres
+from waflib.Build import BuildContext
+class i18n(BuildContext):
+ cmd = 'i18n'
+ fun = 'i18n'
+
+class i18n_pot(BuildContext):
+ cmd = 'i18n_pot'
+ fun = 'i18n_pot'
+
+class i18n_po(BuildContext):
+ cmd = 'i18n_po'
+ fun = 'i18n_po'
+
+class i18n_mo(BuildContext):
+ cmd = 'i18n_mo'
+ fun = 'i18n_mo'
+
+
+compiler_flags_dictionaries= {
+ 'gcc' : {
+ # Flags required when building a debug build
+ 'debuggable' : [ '-O0', '-g' ],
+ # Flags required for the linker (if any) when building a debug build
+ 'linker-debuggable' : '',
+ # Flags required when building a non-debug optimized build
+ 'nondebuggable' : '-DNDEBUG',
+ # Flags required to enable profiling at runtime
+ 'profile' : '-pg',
+ # Flags required to disable warnings about unused arguments to function calls
+ 'silence-unused-arguments' : '',
+ # Flags required to use SSE unit for general math
+ 'sse' : '-msse',
+ # Flags required to use SSE unit for floating point math
+ 'fpmath-sse' : '-mfpmath=sse',
+ # Flags required to use XMM Intrinsics
+ 'xmmintrinsics' : '-DUSE_XMMINTRIN',
+ # Flags to use posix pipes between compiler stages
+ 'pipe' : '-pipe',
+ # Flags for maximally optimized build
+ 'full-optimization' : [ '-O3', '-fomit-frame-pointer', '-ffast-math', '-fstrength-reduce', ],
+ # Flag to ensure that compiler error output includes column/line numbers
+ 'show-column' : '-fshow-column',
+ # Flags required to build for x86 only (OS X feature)
+ 'generic-x86' : '',
+ # Flags required to build for PowerPC only (OS X feature)
+ 'generic-ppc' : '',
+ # All flags required to get basic warnings to be generated by the compiler
+ 'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ],
+ # Any additional flags for warnings that are specific to C (not C++)
+ 'extra-c-warnings' : [ '-Wstrict-prototypes', '-Wmissing-prototypes' ],
+ # Any additional flags for warnings that are specific to C++ (not C)
+ 'extra-cxx-warnings' : [ '-Woverloaded-virtual', '-Wno-unused-local-typedefs' ],
+ # Flags used for "strict" compilation, C and C++ (i.e. compiler will warn about language issues)
+ 'strict' : ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings', '-Wunsafe-loop-optimizations', '-Wlogical-op' ],
+ # Flags used for "strict" compilation, C only (i.e. compiler will warn about language issues)
+ 'c-strict' : ['-std=c99', '-pedantic', '-Wshadow'],
+ # Flags used for "strict" compilation, C++ only (i.e. compiler will warn about language issues)
+ 'cxx-strict' : [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ],
+ # Flags required for whatever consider the strictest possible compilation
+ 'ultra-strict' : ['-Wredundant-decls', '-Wstrict-prototypes', '-Wmissing-prototypes'],
+ # Flag to turn on C99 compliance by itself
+ 'c99': '-std=c99',
+ },
+ 'msvc' : {
+ 'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'],
+ 'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ],
+ 'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'],
+ 'profile' : '',
+ 'sse' : '/arch:SSE',
+ 'silence-unused-arguments' : '',
+ 'sse' : '',
+ 'fpmath-sse' : '',
+ 'xmmintrinsics' : '',
+ 'pipe' : '',
+ 'full-optimization' : '/O2',
+ 'no-frame-pointer' : '',
+ 'fast-math' : '',
+ 'strength-reduce' : '',
+ 'show-column' : '',
+ 'generic-x86' : '',
+ 'generic-ppc' : '',
+ 'basic-warnings' : '',
+ 'extra-c-warnings' : '',
+ 'extra-cxx-warnings' : '',
+ 'ultra-strict' : '',
+ 'c-strict' : '',
+ 'cxx-strict' : '',
+ 'strict' : '',
+ 'c99': '/TP',
+ },
+}
+
+# Copy, edit and insert variants on gcc dict for gcc-darwin and clang
+
+gcc_darwin_dict = compiler_flags_dictionaries['gcc'].copy()
+gcc_darwin_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual' ]
+gcc_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ]
+gcc_darwin_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
+gcc_darwin_dict['generic-x86'] = [ '-arch', 'i386' ]
+gcc_darwin_dict['generic-ppc'] = [ '-arch', 'ppc' ]
+compiler_flags_dictionaries['gcc-darwin'] = gcc_darwin_dict;
+
+clang_dict = compiler_flags_dictionaries['gcc'].copy();
+clang_dict['sse'] = ''
+clang_dict['fpmath-sse'] = ''
+clang_dict['xmmintrinsics'] = ''
+clang_dict['silence-unused-arguments'] = '-Qunused-arguments'
+clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-tags' ]
+clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ]
+clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
+clang_dict['generic-x86'] = [ '-arch', 'i386' ]
+compiler_flags_dictionaries['clang'] = clang_dict;
+
+clang_darwin_dict = compiler_flags_dictionaries['clang'].copy();
+clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', ]
+compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict;
+
def fetch_git_revision ():
cmd = "git describe HEAD"
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
rev = fetch_tarball_revision ()
#
-# rev is now of the form MAJOR.MINOR-rev-commit
-# or, if right at the same rev as a release, MAJOR.MINOR
+# rev is now of the form MAJOR.MINOR[-rcX]-rev-commit
+# or, if right at the same rev as a release, MAJOR.MINOR[-rcX]
#
-parts = rev.split ('.')
+parts = rev.split ('.', 1)
MAJOR = parts[0]
-other = parts[1].split ('-')
+other = parts[1].split('-', 1)
MINOR = other[0]
if len(other) > 1:
- MICRO = other[1]
+ MICRO = other[1].rsplit('-',1)[0].replace('-','.')
else:
MICRO = '0'
#
# Compiler flags and other system-dependent stuff
#
-
build_host_supports_sse = False
# Flags necessary for building
execute = False,
msg = 'Checking for clang')
+ if is_clang:
+ if platform == 'darwin':
+ compiler_name = 'clang-darwin'
+ else:
+ compiler_name = 'clang'
+ elif conf.env['MSVC_COMPILER']:
+ compiler_name = 'msvc'
+ else:
+ if platform == 'darwin':
+ compiler_name = 'gcc-darwin'
+ else:
+ compiler_name = 'gcc'
+
+ flags_dict = compiler_flags_dictionaries[compiler_name]
+
+ autowaf.set_basic_compiler_flags (conf,flags_dict)
+
if conf.options.asan:
conf.check_cxx(cxxflags=["-fsanitize=address", "-fno-omit-frame-pointer"], linkflags=["-fsanitize=address"])
cxx_flags.append('-fsanitize=address')
linker_flags.append('-fsanitize=address')
if opt.gprofile:
- debug_flags = [ '-pg' ]
+ debug_flags = [ flags_dict['profile'] ]
# OSX
if platform == 'darwin':
elif cpu == "i686":
compiler_flags.append ("-march=i686")
- if not is_clang and ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
- compiler_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
+ if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
+ compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'] ])
# end of processor-specific section
# prepend boiler plate optimization flags that work on all architectures
#
- optimization_flags[:0] = ["-pipe"]
+ optimization_flags[:0] = [flags_dict['pipe']]
# don't prepend optimization flags if "-O<something>" is present
prepend_opt_flags = True
break
if prepend_opt_flags:
- optimization_flags[:0] = [
- "-O3",
- "-fomit-frame-pointer",
- "-ffast-math",
- "-fstrength-reduce"
- ]
+ optimization_flags[:0] = flags_dict['full-optimization']
if opt.debug_symbols:
- optimization_flags += [ '-g' ]
+ optimization_flags += flags_dict['debuggable']
if opt.stl_debug:
cxx_flags.append("-D_GLIBCXX_DEBUG")
compiler_flags.append('-DDEBUG_DENORMAL_EXCEPTION')
if opt.generic:
- compiler_flags.extend(('-arch', 'i386'))
- linker_flags.extend(('-arch', 'i386'))
+ compiler_flags.extend(flags_dict['generic-x86'])
+ linker_flags.extend(flags_dict['generic-x86'])
if opt.ppc:
- compiler_flags.extend(('-arch', 'ppc'))
- linker_flags.extend(('-arch', 'ppc'))
+ compiler_flags.extend(flags_dict['generic-ppc'])
+ linker_flags.extend(flags_dict['generic-ppc'])
#
# warnings flags
#
- compiler_flags.extend(
- ('-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter'))
+ compiler_flags.extend(flags_dict['basic-warnings'])
- c_flags.extend(('-Wstrict-prototypes', '-Wmissing-prototypes'))
- cxx_flags.append('-Woverloaded-virtual')
- if (not is_clang and not platform == "darwin"):
- cxx_flags.append('-Wno-unused-local-typedefs')
- if is_clang:
- cxx_flags.append('-Wno-mismatched-tags')
+ c_flags.extend(flags_dict['extra-c-warnings'])
+ cxx_flags.extend (flags_dict['extra-cxx-warnings'])
#
# more boilerplate
opt.add_option('--depstack-root', type='string', default='~', dest='depstack_root',
help='Directory/folder where dependency stack trees (gtk, a3) can be found (defaults to ~)')
opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
- help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw]')
+ help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw,msvc]')
opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
help='Build runtime checked assembler code (default)')
opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
help='Compile with support for linuxVST plugins')
opt.add_option('--no-lxvst', action='store_false', dest='lxvst',
help='Compile without support for linuxVST plugins')
+ opt.add_option('--no-lrdf', action='store_true', dest='no_lrdf',
+ help='Compile without support for LRDF LADSPA data even if present')
opt.add_option('--nls', action='store_true', default=True, dest='nls',
help='Enable i18n (native language support) (default)')
opt.add_option('--no-nls', action='store_false', dest='nls')
if Options.options.dist_target == 'mingw':
conf.load('winres')
+ if Options.options.dist_target == 'msvc':
+ conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', ]
+ conf.env['MSVC_TARGETS'] = ['x64']
+ conf.load('msvc')
+
+ if Options.options.debug:
+ # Nuke user CFLAGS/CXXFLAGS if debug is set (they likely contain -O3, NDEBUG, etc)
+ conf.env['CFLAGS'] = []
+ conf.env['CXXFLAGS'] = []
+
conf.env['VERSION'] = VERSION
conf.env['MAJOR'] = MAJOR
conf.env['MINOR'] = MINOR
if Options.options.lv2dir:
conf.env['LV2DIR'] = Options.options.lv2dir
else:
- conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'lv2')
+ conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'ardour' + str(conf.env['MAJOR']), 'lv2')
conf.env['LV2DIR'] = os.path.normpath(conf.env['LV2DIR'])
# executing a test program is n/a when cross-compiling
if Options.options.dist_target != 'mingw':
- conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
+ if Options.options.dist_target != 'msvc':
+ conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
conf.check_cxx(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
execute = "1",
mandatory = True,
if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw':
autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
- autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=True)
+ autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.28', mandatory=True)
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2', mandatory=True)
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True)
autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=True)
# needed for at least libsmf
conf.check_cc(function_name='htonl', header_name='winsock2.h', lib='ws2_32')
conf.env.append_value('LIB', 'ws2_32')
+ conf.env.append_value('LIB', 'winmm')
# needed for mingw64 packages, not harmful on normal mingw build
conf.env.append_value('LIB', 'intl')
conf.check_cc(function_name='regcomp', header_name='regex.h',
conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
+ if Options.options.dist_target == 'msvc':
+ conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
+ conf.env.append_value('CFLAGS', '-DCOMPILER_MSVC')
+ conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
+ conf.env.append_value('CXXFLAGS', '-DCOMPILER_MSVC')
+ # work around GdkDrawable BitBlt performance issue on windows
+ # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo
+ conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
+ conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
+ # MORE STUFF PROBABLY NEEDED HERE
+
# Tell everyone that this is a waf build
conf.env.append_value('CFLAGS', '-DWAF_BUILD')
bld.path.find_dir ('libs/pbd/pbd')
# set up target directories
- lwrcase_dirname = 'ardour3'
+ lwrcase_dirname = 'ardour' + bld.env['MAJOR']
if bld.is_defined ('TRX_BUILD'):
lwrcase_dirname = 'trx'
bld.env['DLLDIR'] = os.path.join(bld.env['LIBDIR'], lwrcase_dirname)
bld.env['LIBDIR'] = bld.env['DLLDIR']
bld.env['LOCALEDIR'] = os.path.join(bld.env['DATADIR'], 'locale')
+ bld.env['lwrcase_dirname'] = lwrcase_dirname;
autowaf.set_recursive()
bld.add_post_fun(test)
def i18n(bld):
+ print(bld.env)
bld.recurse (i18n_children)
def i18n_pot(bld):