# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

EXPORTS.google.protobuf += [
    'src/google/protobuf/descriptor.h',
    'src/google/protobuf/descriptor.pb.h',
    'src/google/protobuf/descriptor_database.h',
    'src/google/protobuf/dynamic_message.h',
    'src/google/protobuf/extension_set.h',
    'src/google/protobuf/generated_enum_reflection.h',
    'src/google/protobuf/generated_message_reflection.h',
    'src/google/protobuf/generated_message_util.h',
    'src/google/protobuf/message.h',
    'src/google/protobuf/message_lite.h',
    'src/google/protobuf/package_info.h',
    'src/google/protobuf/reflection_ops.h',
    'src/google/protobuf/repeated_field.h',
    'src/google/protobuf/service.h',
    'src/google/protobuf/text_format.h',
    'src/google/protobuf/unknown_field_set.h',
    'src/google/protobuf/wire_format.h',
    'src/google/protobuf/wire_format_lite.h',
    'src/google/protobuf/wire_format_lite_inl.h',
]

EXPORTS.google.protobuf.io += [
    'src/google/protobuf/io/coded_stream.h',
    'src/google/protobuf/io/coded_stream_inl.h',
    'src/google/protobuf/io/gzip_stream.h',
    'src/google/protobuf/io/package_info.h',
    'src/google/protobuf/io/printer.h',
    'src/google/protobuf/io/strtod.h',
    'src/google/protobuf/io/tokenizer.h',
    'src/google/protobuf/io/zero_copy_stream.h',
    'src/google/protobuf/io/zero_copy_stream_impl.h',
    'src/google/protobuf/io/zero_copy_stream_impl_lite.h',
]

EXPORTS.google.protobuf.stubs += [
    'src/google/protobuf/stubs/atomicops.h',
    'src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h',
    'src/google/protobuf/stubs/atomicops_internals_arm_gcc.h',
    'src/google/protobuf/stubs/atomicops_internals_arm_qnx.h',
    'src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h',
    'src/google/protobuf/stubs/atomicops_internals_generic_gcc.h',
    'src/google/protobuf/stubs/atomicops_internals_macosx.h',
    'src/google/protobuf/stubs/atomicops_internals_mips_gcc.h',
    'src/google/protobuf/stubs/atomicops_internals_pnacl.h',
    'src/google/protobuf/stubs/atomicops_internals_solaris.h',
    'src/google/protobuf/stubs/atomicops_internals_tsan.h',
    'src/google/protobuf/stubs/atomicops_internals_x86_gcc.h',
    'src/google/protobuf/stubs/atomicops_internals_x86_msvc.h',
    'src/google/protobuf/stubs/common.h',
    'src/google/protobuf/stubs/hash.h',
    'src/google/protobuf/stubs/map_util.h',
    'src/google/protobuf/stubs/once.h',
    'src/google/protobuf/stubs/platform_macros.h',
    'src/google/protobuf/stubs/shared_ptr.h',
    'src/google/protobuf/stubs/stl_util.h',
    'src/google/protobuf/stubs/stringprintf.h',
    'src/google/protobuf/stubs/strutil.h',
    'src/google/protobuf/stubs/substitute.h',
    'src/google/protobuf/stubs/template_util.h',
    'src/google/protobuf/stubs/type_traits.h',
]

UNIFIED_SOURCES += [
    'src/google/protobuf/descriptor.cc',
    'src/google/protobuf/descriptor.pb.cc',
    'src/google/protobuf/descriptor_database.cc',
    'src/google/protobuf/dynamic_message.cc',
    'src/google/protobuf/extension_set.cc',
    'src/google/protobuf/generated_message_reflection.cc',
    'src/google/protobuf/generated_message_util.cc',
    'src/google/protobuf/io/coded_stream.cc',
    'src/google/protobuf/io/gzip_stream.cc',
    'src/google/protobuf/io/printer.cc',
    'src/google/protobuf/io/strtod.cc',
    'src/google/protobuf/io/tokenizer.cc',
    'src/google/protobuf/io/zero_copy_stream.cc',
    'src/google/protobuf/io/zero_copy_stream_impl.cc',
    'src/google/protobuf/io/zero_copy_stream_impl_lite.cc',
    'src/google/protobuf/message.cc',
    'src/google/protobuf/message_lite.cc',
    'src/google/protobuf/reflection_ops.cc',
    'src/google/protobuf/repeated_field.cc',
    'src/google/protobuf/service.cc',
    'src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc',
    'src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc',
    'src/google/protobuf/stubs/common.cc',
    'src/google/protobuf/stubs/once.cc',
    'src/google/protobuf/stubs/stringprintf.cc',
    'src/google/protobuf/stubs/structurally_valid.cc',
    'src/google/protobuf/stubs/strutil.cc',
    'src/google/protobuf/stubs/substitute.cc',
    'src/google/protobuf/unknown_field_set.cc',
    'src/google/protobuf/wire_format_lite.cc',
]

SOURCES += [
    'src/google/protobuf/extension_set_heavy.cc',
    'src/google/protobuf/text_format.cc',
    'src/google/protobuf/wire_format.cc',
]

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

FINAL_LIBRARY = 'xul'

DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True

# Suppress warnings in third-party code.
if CONFIG['GNU_CXX']:
    CXXFLAGS += [
        '-Wno-return-type',
        '-Wno-sign-compare',
    ]
    if CONFIG['CLANG_CXX']:
        CXXFLAGS += [
            '-Wno-null-conversion',
        ]
elif CONFIG['_MSC_VER']:
    CXXFLAGS += [
        '-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
        '-wd4018', # '<' : signed/unsigned mismatch
        '-wd4099', # mismatched class/struct tags
    ]

if CONFIG['MOZ_USE_PTHREADS']:
    DEFINES['HAVE_PTHREAD'] = True

# Needed for the gzip streams.
DEFINES['HAVE_ZLIB'] = True

CXXFLAGS += CONFIG['TK_CFLAGS']