Commit 0c693538 authored by Bas Couwenberg's avatar Bas Couwenberg

Imported Upstream version 1.0.0

parents
coverage
*.gcov
out
protozero.Makefile
tests.target.mk
#Visual Studio files and folders
Release
Debug
deps
*.sdf
*.sln
*.suo
*.vcxproj*
#-----------------------------------------------------------------------------
#
# Configuration for continuous integration service at travis-ci.org
#
#-----------------------------------------------------------------------------
language: cpp
sudo: false
matrix:
include:
- os: linux
compiler: clang
env: INSTALL_CXX=clang++-3.5
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
packages: ['clang-3.5','libprotobuf-dev','protobuf-compiler']
- os: linux
compiler: clang
env: INSTALL_CXX=clang++-3.6
#env: INSTALL_CXX=clang++-3.6 COVERAGE=llvm-cov-3.6
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: ['clang-3.6','libprotobuf-dev','protobuf-compiler']
- os: linux
compiler: gcc
env: INSTALL_CXX=g++-4.8
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8','libprotobuf-dev','protobuf-compiler']
- os: linux
compiler: gcc
env: INSTALL_CXX=g++-4.9 COVERAGE=gcov-4.9
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9','libprotobuf-dev','protobuf-compiler']
- os: osx
compiler: clang
before_script:
- if [ -n "${INSTALL_CXX}" ]; then CXX=${INSTALL_CXX}; fi
- if [[ $(uname -s) == 'Darwin' ]]; then brew install protobuf; fi;
- make test
script:
- if [ -n "${COVERAGE}" ]; then
make clean;
CXXFLAGS="--coverage" LDFLAGS="--coverage" make test;
${COVERAGE} -lp test/*tests.o test/t/*/*test_cases.o;
pip install --user cpp-coveralls;
~/.local/bin/coveralls --no-gcov -i include/protozero;
fi
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
protozero copyright (c) Mapbox.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# first inherit from env
CXX := $(CXX)
CXXFLAGS := $(CXXFLAGS)
LDFLAGS := $(LDFLAGS)
WARNING_FLAGS := -Wall -Wextra -pedantic -Wsign-compare -Wsign-conversion -Wunused-parameter -Wno-float-equal
ifneq ($(findstring clang,$(CXX)),)
WARNING_FLAGS += -Wno-reserved-id-macro -Weverything -Wno-weak-vtables -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-exit-time-destructors -Wno-switch-enum -Wno-padded
endif
COMMON_FLAGS := -fvisibility-inlines-hidden -std=c++11 $(WARNING_FLAGS)
RELEASE_FLAGS := -O3 -DNDEBUG -march=native
DEBUG_FLAGS := -O0 -g -fno-inline-functions
OS:=$(shell uname -s)
ifeq ($(OS),Darwin)
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
TEST_CASES := $(wildcard test/t/*/test_cases.cpp)
TEST_CASES_O := $(subst .cpp,.o,$(TEST_CASES))
WRITER_TEST_CASES := $(wildcard test/t/*/writer_test_cases.cpp)
WRITER_TEST_CASES_O := $(subst .cpp,.o,$(WRITER_TEST_CASES))
PROTO_FILES := $(subst writer_test_cases.cpp,testcase.proto,$(WRITER_TEST_CASES))
PROTO_FILES_CC := $(subst .proto,.pb.cc,$(PROTO_FILES))
PROTO_FILES_H := $(subst .proto,.pb.h,$(PROTO_FILES))
PROTO_FILES_O := $(subst .proto,.pb.o,$(PROTO_FILES))
HPP_FILES := include/protozero/exception.hpp \
include/protozero/varint.hpp \
include/protozero/pbf_types.hpp \
include/protozero/pbf_reader.hpp \
include/protozero/pbf_writer.hpp
CFLAGS_PROTOBUF := $(shell pkg-config protobuf --cflags)
LDFLAGS_PROTOBUF := $(shell pkg-config protobuf --libs-only-L)
all: ./test/tests test/writer_tests
./test/t/%/test_cases.o: test/t/%/test_cases.cpp $(HPP_FILES)
$(CXX) -c -Iinclude -Itest/include $(CXXFLAGS) $(COMMON_FLAGS) $(DEBUG_FLAGS) $< -o $@
./test/tests.o: test/tests.cpp $(HPP_FILES)
$(CXX) -c -Iinclude -Itest/include $(CXXFLAGS) $(COMMON_FLAGS) $(DEBUG_FLAGS) $< -o $@
./test/tests: test/tests.o $(TEST_CASES_O)
$(CXX) $(LDFLAGS) $^ -o $@
./test/t/%/testcase.pb.cc: ./test/t/%/testcase.proto
protoc --cpp_out=. $^
./test/t/%/testcase.pb.o: ./test/t/%/testcase.pb.cc
$(CXX) -c -I. -Iinclude -Itest/include $(CXXFLAGS) $(CFLAGS_PROTOBUF) -std=c++11 $(DEBUG_FLAGS) $< -o $@
./test/t/%/writer_test_cases.o: ./test/t/%/writer_test_cases.cpp $(HPP_FILES)
$(CXX) -c -I. -Iinclude -Itest/include $(CXXFLAGS) $(CFLAGS_PROTOBUF) $(COMMON_FLAGS) $(DEBUG_FLAGS) $< -o $@
./test/writer_tests.o: test/writer_tests.cpp $(HPP_FILES) $(PROTO_FILES_CC)
$(CXX) -c -I. -Iinclude -Itest/include $(CXXFLAGS) $(COMMON_FLAGS) $(DEBUG_FLAGS) $< -o $@
./test/writer_tests: test/writer_tests.o $(PROTO_FILES_O) $(WRITER_TEST_CASES_O)
$(CXX) $(LDFLAGS) $(LDFLAGS_PROTOBUF) $^ -lprotobuf-lite -pthread -o $@
test: all
./test/tests
./test/writer_tests
iwyu: $(HPP_FILES) test/tests.cpp test/writer_tests.cpp
iwyu -Xiwyu -- -std=c++11 -Iinclude include/protozero/exception.hpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude include/protozero/varint.hpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude include/protozero/pbf_types.hpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude include/protozero/pbf_reader.hpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude include/protozero/pbf_writer.hpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude -Itest/include test/tests.cpp || true
iwyu -Xiwyu -- -std=c++11 -Iinclude -Itest/include test/writer_tests.cpp || true
check: $(HPP_FILES) test/tests.cpp test/include/test.hpp test/include/testcase.hpp test/t/*/testcase.cpp $(TEST_CASES)
cppcheck -Uassert --std=c++11 --enable=all --suppress=incorrectStringBooleanError $^
doc: doc/Doxyfile README.md tutorial.md $(HPP_FILES)
doxygen doc/Doxyfile
clean:
rm -f ./test/tests
rm -f ./test/tests.o
rm -f ./test/tests.gc*
rm -f ./test/writer_tests
rm -f ./test/writer_tests.o
rm -f ./test/writer_tests.gc*
rm -f ./test/t/*/testcase.pb.cc
rm -f ./test/t/*/testcase.pb.h
rm -f ./test/t/*/testcase.pb.o
rm -f ./test/t/*/testcase.pb.gc*
rm -f ./test/t/*/testcase.o
rm -f ./test/t/*/testcase
rm -f ./test/t/*/test_cases.o
rm -f ./test/t/*/test_cases.gc*
rm -f ./test/t/*/writer_test_cases.o
rm -f ./test/t/*/writer_test_cases.gc*
rm -f ./*.gcov
rm -fr doc/doxygen_sqlite3.db doc/html coverage
.PHONY: all test iwyu check doc
# protozero
Minimalistic protocol buffer decoder and encoder in C++.
Designed for high performance. Suitable for writing zero copy parsers and
encoders with minimal need for run-time allocation of memory.
Low-level: this is designed to be a building block for writing a very
customized decoder for a stable protobuf schema. If your protobuf schema
is changing frequently or lazy decoding is not critical for your application
then this approach offers no value: just use the decoding API available via the
C++ API that can be generated via the Google Protobufs `protoc` program.
[![Travis Build Status](https://travis-ci.org/mapbox/protozero.svg?branch=master)](https://travis-ci.org/mapbox/protozero)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/o354pq10y96mnr6d?svg=true)](https://ci.appveyor.com/project/Mapbox/protozero)
[![Coverage Status](https://coveralls.io/repos/mapbox/protozero/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapbox/protozero?branch=master)
## Depends
- C++11 compiler
- A working knowledge of how
[protocol buffer encoding works](https://developers.google.com/protocol-buffers/docs/encoding).
## How it works
The protozero code does **not** read `.proto` files used by the usual Protobuf
implementations. The developer using protozero has to manually "translate" the
`.proto` description into code. This means there is no way to access any of the
information from the `.proto` description. This results in a few restrictions:
* The names of the fields are not available.
* Enum names are not available, you'll have to use the values they are defined
with.
* Default values are not available.
* Field types have to be hardcoded. The library does not know which types to
expect, so the user of the library has to supply the right types. Some checks
are made using `assert()`, but mostly the user has to take care of that.
The library will make sure not to overrun the buffer it was given, but
basically all other checks have to be made in user code!
See the [tutorial](tutorial.md) for more information on how to use it.
Call `make doc` to build the Doxygen documentation. (You'll need
[Doxygen](http://www.stack.nl/~dimitri/doxygen/) installed.) Then open
`doc/html/index.html` in your browser to read it.
## Limitations
* The current implementation does not support big-endian machines. Fixed sized
integers and floats/doubles will not decode properly.
* A protobuf message has to fit into memory completely, otherwise it can not
be parsed with this library. There is no streaming support.
* The length of a string, bytes, or submessage can't be more than 2^31-1.
* The Google Protobuf spec documents that a non-repeated field can actually
appear several times in a message and the implementation is required to
return the value of the last version of that field in this case.
`pbf_reader.hpp` does not enforce this. If this feature is needed in your
case, you have to do this yourself.
* There is no specific support for maps but they can be used as described in
the "Backwards compatibility" section of
https://developers.google.com/protocol-buffers/docs/proto3#maps.
## Tests
Extensive tests are included. Call
make test
to build all tests and run them.
See `test/README.md` for more details about the test.
You can also use `gyp` to build the reader tests:
gyp --depth=. --build=Release
./out/Release/tests
This will clobber the `Makefile` from the repository! Instead of `Release` you
can use `Debug` for a debug build.
## Coverage report
To get a coverage report compile and link with `--coverage`:
CXXFLAGS="--coverage" LDFLAGS="--coverage" make test
If you are using `g++` use `gcov` to generate a report (results are in `*.gcov`
files):
gcov -lp test/*tests.o test/t/*/*test_cases.o
If you are using `clang++` use `llvm-cov` instead:
llvm-cov gcov -lp test/*tests.o test/t/*/*test_cases.o
If you are using `g++` you can use `gcovr` to generate nice HTML output:
mkdir -p coverage
gcovr -r . --html --html-details -o coverage/index.html
Open `coverage/index.html` in your browser to see the report.
## Cppcheck
For extra checks with [Cppcheck](http://cppcheck.sourceforge.net/) you can call
make check
os: Visual Studio 2015 RC
platform:
- x64
- x86
configuration:
- Debug
- Release
install:
- SET PATH=c:\python27;%PATH%
- SET PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH%
- git clone --quiet --depth 1 https://chromium.googlesource.com/external/gyp.git deps/gyp
# note windows requires --generator-output to be absolute
- python deps/gyp/gyp_main.py protozero.gyp --depth=. -f msvs -G msvs_version=2015
- set MSBUILD_PLATFORM=%platform%
- if "%MSBUILD_PLATFORM%" == "x86" set MSBUILD_PLATFORM=Win32
- msbuild protozero.sln /nologo /p:Configuration=%configuration%;Platform=%MSBUILD_PLATFORM%
- .\%configuration%\tests.exe
build: off
test: off
deploy: off
#test
{
"conditions": [
["OS=='win'", {
"target_defaults": {
"default_configuration": "Release_x64",
#"msbuild_toolset":"CTP_Nov2013",
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1, # /EHsc
"RuntimeTypeInfo": "true" # /GR
}
},
"configurations": {
"Debug_Win32": {
"msvs_configuration_platform": "Win32",
"defines": [ "DEBUG","_DEBUG"],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": "1", # static debug /MTd
"Optimization": 0, # /Od, no optimization
"MinimalRebuild": "false",
"OmitFramePointers": "false",
"BasicRuntimeChecks": 3 # /RTC1
}
}
},
"Debug_x64": {
"msvs_configuration_platform": "x64",
"defines": [ "DEBUG","_DEBUG"],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": "1", # static debug /MTd
"Optimization": 0, # /Od, no optimization
"MinimalRebuild": "false",
"OmitFramePointers": "false",
"BasicRuntimeChecks": 3 # /RTC1
}
}
},
"Release_Win32": {
"msvs_configuration_platform": "Win32",
"defines": [ "NDEBUG"],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": 0, # static release
"Optimization": 3, # /Ox, full optimization
"FavorSizeOrSpeed": 1, # /Ot, favour speed over size
"InlineFunctionExpansion": 2, # /Ob2, inline anything eligible
"WholeProgramOptimization": "true", # /GL, whole program optimization, needed for LTCG
"OmitFramePointers": "true",
"EnableFunctionLevelLinking": "true",
"EnableIntrinsicFunctions": "true",
#"AdditionalOptions": [
# "/MP", # compile across multiple CPUs
#],
"DebugInformationFormat": "0"
},
"VCLibrarianTool": {
"AdditionalOptions": [
"/LTCG" # link time code generation
],
},
"VCLinkerTool": {
"LinkTimeCodeGeneration": 1, # link-time code generation
"OptimizeReferences": 2, # /OPT:REF
"EnableCOMDATFolding": 2, # /OPT:ICF
"LinkIncremental": 1, # disable incremental linking
"GenerateDebugInformation": "false"
}
}
},
"Release_x64": {
"msvs_configuration_platform": "x64",
"defines": [ "NDEBUG"],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": 0, # static release
"Optimization": 3, # /Ox, full optimization
"FavorSizeOrSpeed": 1, # /Ot, favour speed over size
"InlineFunctionExpansion": 2, # /Ob2, inline anything eligible
"WholeProgramOptimization": "true", # /GL, whole program optimization, needed for LTCG
"OmitFramePointers": "true",
"EnableFunctionLevelLinking": "true",
"EnableIntrinsicFunctions": "true",
#"AdditionalOptions": [
# "/MP", # compile across multiple CPUs
#],
"DebugInformationFormat": "0"
},
"VCLibrarianTool": {
"AdditionalOptions": [
"/LTCG" # link time code generation
],
},
"VCLinkerTool": {
"LinkTimeCodeGeneration": 1, # link-time code generation
"OptimizeReferences": 2, # /OPT:REF
"EnableCOMDATFolding": 2, # /OPT:ICF
"LinkIncremental": 1, # disable incremental linking
"GenerateDebugInformation": "false"
}
}
}
}
}
}, {
"target_defaults": {
"default_configuration": "Release",
"xcode_settings": {
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++11",
"GCC_VERSION": "com.apple.compilers.llvm.clang.1_0",
},
"cflags_cc": ["-std=c++11"],
"configurations": {
"Debug": {
"defines": [
"DEBUG"
],
"xcode_settings": {
"GCC_OPTIMIZATION_LEVEL": "0",
"GCC_GENERATE_DEBUGGING_SYMBOLS": "YES",
"OTHER_CPLUSPLUSFLAGS": [ "-Wall", "-Wextra", "-pedantic", "-g", "-O0" ]