Commit Graph

62 Commits

Author SHA1 Message Date
Ronak Jain a31ddd2bb3 Support for Golang GRPC (Experimental) (#4082)
* support for grpc golang

* refactored grpc go generator

* added grpc-go test and refactored

* refactored idl_gen_grpc.cpp

* fixed grpc generate method name

* refactored flatc and fixed line length issue

* added codec to go lib and fixed formatting issues

* fixed spacing issues
2016-12-05 13:20:38 -08:00
Wouter van Oortmerssen 606098cac8 Fixed unused variable warnings, and made sure they are on.
Tested on Linux.

Change-Id: Ie18d6857f9ae8b1c3953a116203b4a8bb70a2ede
2016-10-17 13:06:11 -07:00
Wouter van Oortmerssen dc38f93ca8 Merge branch 'master' of https://github.com/google/flatbuffers 2016-10-12 14:39:36 -07:00
Andrew Hundt 520d68449f CMake now accepts external toolchain configuration (#4045)
Resolves #4038
Related to https://github.com/ruslo/hunter/pull/529
2016-10-05 13:20:30 -07:00
Jason Sanmiya b2e55c556e Merge "Fix Windows warnings." into ub-games-master 2016-09-15 18:42:42 +00:00
Jason Sanmiya 985de211af Fix Windows warnings.
Cmake issued a warning when the variable is in quotation marks
in an if statement.

Visual Studio upgrades constants to int and issues a truncation
warning, so inserted a cast.

Change-Id: I60cdcb5c2565cd5e97f80b9c2ff1e6abc32b1deb
Tested: Builds without warning on VS2015.
2016-09-09 14:51:33 -07:00
changnet a15659e9f8 option to build shared library,defeault off 2016-09-07 01:12:04 +08:00
Wouter van Oortmerssen ef67a58410 Merge pull request #4001 from vitalyisaev2/master
Debianization with CPack
2016-08-24 15:03:31 -07:00
Vitaly Isaev 928effd198 Debianization with CPack 2016-08-25 00:00:22 +03:00
Harsh Vardhan 2e7806ede0 Initial support to add other languages to flatbuffers 2016-08-24 23:42:59 +05:30
Jason Sanmiya 30c07f4e55 Fix Mac build.
The new line in the set(CMAKE_CXX_FLAGS...) line was getting insert
verbatim into the Makefile. Makefiles don't like new lines in their
assignment operators.

The newline escape fix works for CMake 3.0 and above, but since
we support 2.x, we need to use the legacy solution, which is to
split into two separate statements.

Tested: cmake -G"Unix Makefiles" works now on Mac.
Change-Id: I6f4655981b85087c4760c3d26ed0c97c4469ba93
2016-07-26 07:26:25 -07:00
Wouter van Oortmerssen 42e0b02149 Fixed missing \ in CMakeLists.txt that broke the build 2016-07-22 15:46:26 -07:00
Wouter van Oortmerssen 3101e327c0 Added optional object based API for C++.
Change-Id: If927f3ea3fb3723088fa287f24bdd1ad43c8d1d1
Tested: on Linux.
2016-07-20 14:58:57 -07:00
Wouter van Oortmerssen 48f37f9e0a Added GRPC code generator to flatc.
Also added simple (in-process) test.

Change-Id: I38580d554dd52f590e3396ec4846e07546dcf07d
Tested: on Linux.
2016-06-29 15:51:44 -07:00
Xiaolei Yu 3a8bc309e2 Use the build output flatc to compile test schemas by default. 2016-05-01 11:15:53 +08:00
Lakedaemon 8a64afabfd Transition 1 (with nice diffs) Go, Cpp and General code generators with class 2016-04-13 23:21:18 +02:00
Wouter van Oortmerssen 3ea5446680 Merge pull request #3789 from Chippiewill/master
Allow builds on platforms with unsigned chars by default
2016-04-08 11:32:16 -07:00
Wouter van Oortmerssen 5e3f9d5175 Merge branch 'master' of https://github.com/google/flatbuffers 2016-04-04 16:55:25 -07:00
Wouter van Oortmerssen e98b1912b3 add setloadfile and setfileexists functions to flatbuffers
to allow for custom file loaders. The targeted use case is android runtime.

(from CL 116980408)

Change-Id: I8785c0acf714fab41d8f6fc9f1c52875423b8f5b
2016-04-04 13:03:22 -07:00
Tony Kelman 4c16038e72 Fix build on Cygwin
use -std=gnu++11 instead of c++0x on cygwin to avoid
error: realpath was not declared in this scope

ref http://www.cygwin.com/ml/cygwin/2016-03/msg00005.html
2016-04-01 21:42:23 -07:00
Will Gardner ce4d3316d3 Allow builds on platforms with unsigned chars by default
Certain architectures, such as ARM, use unsigned chars by default
so require the `-fsigned-char` for certain value comparisons to
make sense and in order to compile.
2016-03-14 16:19:38 +00:00
Yuri 26f15bcd77 Fixed missing -lc++abi on FreeBSD. 2016-03-02 17:15:42 -08:00
maurice barnum 697cad7027 fix gcc-4.4 build: -Werror=unused-result is not supported 2016-02-11 00:05:04 +00:00
Rene Fichter 3de82050ce Fix build error when flatc binary is missing in PATH. 2016-01-19 13:02:25 +01:00
Wouter van Oortmerssen 40a33b1d06 Replaced exception handling in the parser with error checking.
This to allow the code to run on a greater range of build
configurations (that don't allow exceptions/RTTI).

If anyone ever doubts the usefulness of exception handling,
please show them this commit.

Change-Id: If7190babdde93c3f9cd97b8e1ab447bf0c81696d
Tested: on Linux.
2015-12-21 12:17:59 -08:00
Perry Hung d7f2488099 Link clang builds against libc++abi on Linux
Simply running clang with -stdlib=libc++ requires a manual link against
libc++abi on Linux. This is documented in the libc++ documentation:
    http://libcxx.llvm.org/

Tested on Arch Linux, using clang 3.7.0 RELEASE.

Signed-off-by: Perry Hung <iperry@gmail.com>
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen b7d8c2af1a Made generated C++ code respect gcc -Werror=shadow.
Change-Id: I17de0bcc462770124227a9967e2aab620467f6eb
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen a7b5f92f51 Merge pull request #359 from proppy/move-build-fb
flatbuffers/cmake: move build_flatbuffers to a standalone file
2015-11-18 10:10:07 -08:00
Wouter van Oortmerssen 6266b4f122 Merge pull request #308 from chobie/php
Add support for PHP code.
2015-11-18 09:31:17 -08:00
Johan Euphrosine 331d2d835c flatbuffers/cmake: move build_flatbuffers to a standalone file
So that it could be included from both flatbuffers CMakeLists.txt and
FindFlatBuffers.cmake.

Change-Id: Ie16a879beef9367cd6fd9b2d2157044841a7cdbc
2015-11-17 13:52:41 -08:00
Shuhei Taunma 5ce8682671 (PHP) add experimental support for PHP language.
* codegen for all basic features: WIP (probably implemented all basic feature)
* JSON parsing: NO
* Simple mutation: NO
* Reflection: NO
* Buffer verifier: NO (will be add later)
* Testing: basic: Yes
* Testing: fuzz: Yes
* Performance: Not bad
* Platform: Supported Linux, OS X, Windows (has 32bit integer limitation)
* Engine Unity: No

flatc --php monster_test.fbs

  <?php
  //include neccessary files.
  $fbb = new Google\FlatBuffers\FlatBufferBuilder(1);
  $str = $fbb->createString("monster");
  \MyGame\Example\Monster::startMonster($fbb);
  \MyGame\Example\Monster::addHp($fbb, 80);
  \MyGame\Example\Monster::addName($fbb, $str);
  $mon = \MyGame\Example\Monster::endMonster($fbb);
  $fbb->finish($mon);
  echo $fbb->sizedByteArray();

PHP 5.4 higher

Currently, we do not register this library to packagist as still experimental and versioning problem.
If you intended to use flatbuffers with composer. add repostiories section to composer.json like below.

  "repositories": [{
    "type": "vcs",
    "url": "https://github.com/google/flatbuffers"
  }],

 and just put google/flatbuffers.

  "require": {
    "google/flatbuffers": "*"
  }

* PHP's integer is platform dependant. we strongly recommend use 64bit machine
  and don't use uint, ulong types as prevent overflow issue.
  ref: http://php.net/manual/en/language.types.integer.php

* php don't support float type. floating point numbers are always parsed as double precision internally.
  ref: http://php.net/manual/en/language.types.float.php

* ByteBuffer is little bit slow implemnentation due to many chr/ord function calls. Especially encoding objects.
  This is expected performance as PHP5 has parsing arguments overhead. probably we'll add C-extension.

Basically, PHP implementation respects Java and C# implementation.

Note: ByteBuffer and FlatBuffersBuilder class are not intended to use other purposes.
      we may change internal API foreseeable future.

PSR-2, PSR-4 standards.

Implemented simple assertion class (respect JavaScript testcase implementation) as we prefer small code base.
this also keeps CI iteration speed.

we'll choose phpunit or something when the test cases grown.
2015-11-18 00:26:39 +09:00
Jon Simantov 65c9b355c1 Store the dirs you pass into build_flatbuffers as properties.
This allows you to query the generated target for those properties
later, so dependent modules can refer to the directories to, for example,
add them to the include_directories.

Change-Id: I7a6bd34c5c1d08e2ea69b5ad845223297cad1159
2015-11-13 18:04:41 -08:00
Jon Simantov f2949c3fb1 Added build_flatbuffers function to CMake.
This function is designed to be called by projects that use FlatBuffers.
It takes a list of FlatBuffers schemas and a list of schema include
directories, and generates build rules to create generated headers
and/or binary schemas for those files, as well as optionally copying
all of the text schemas into a directory for your use (for example if
you need to parse text schemas within your app).

See function comments for more details.

Change-Id: I181684b916e91d965e14849d8f83ec2c83e9a4a4
2015-11-13 16:24:20 -08:00
Evan Wallace 224e33ed09 Add support for JavaScript code generation
This adds a JavaScript language target. The generated JavaScript uses Google
Closure Compiler type annotations and can be compiled using the advanced
compilation mode, which performs type checking and optimizations such as
inlining and dead code elimination. The generated JavaScript also exports all
generated symbols for use with Node.js and RequireJS. This export behavior
can be turned off with the --no-js-exports flag for use with Google Closure
Compiler.
2015-10-14 21:15:57 -07:00
Wouter van Oortmerssen 7101224d86 Reworked reflection.h to be more general.
e.g. support generic reading/writing from structs/vectors etc.

Change-Id: I2eb6e24db088a72da444d5c8df7e506e53d5bc2d
Tested: on Linux.
Bug: 22660837
2015-08-03 16:42:05 -07:00
Martell Malone 79d3cb6a6c Add a libflatbuffers for other projects to use 2015-07-22 17:53:19 +01:00
Wouter van Oortmerssen 81312c2128 Initial reflection and resizing functionality.
Tested: on Linux.

Change-Id: I8f7bccf9b1ad87fea788f85e23fa69435758feca
2015-06-15 15:53:10 -07:00
Wouter van Oortmerssen 1808337adc Make generating dependent include files for C++ the default.
--gen-includes is now deprecate but still accepted.
--no-includes can be used instead when needed.

Change-Id: I2cd46d193032b9b7c31c76c6f655e9333d3a393a
Tested: on Linux.
2015-06-15 13:09:22 -07:00
Wouter van Oortmerssen 932b22f043 Added clang & OS X to .travis 2015-05-27 18:32:49 -07:00
rw 48dfc69ee6 Port FlatBuffers to Python.
Implement code generation and self-contained runtime library for Python.

The test suite verifies:
  - Correctness of generated Python code by comparing output to that of
    the other language ports.
  - The exact bytes in the Builder buffer during many scenarios.
  - Vtable deduplication correctness.
  - Edge cases for table construction, via a fuzzer derived from the Go
    implementation.
  - All code is simultaneously valid in Python 2.6, 2.7, and 3.4.

The test suite includes benchmarks for:
  - Building 'gold' data.
  - Parsing 'gold' data.
  - Deduplicating vtables.

All tests pass on this author's system for the following Python
implementations:
  - CPython 2.6.7
  - CPython 2.7.8
  - CPython 3.4.2
  - PyPy 2.5.0 (CPython 2.7.8 compatible)
2015-05-12 15:40:29 -07:00
Wouter van Oortmerssen a0bf238b09 Merge changes I2de7d14d,I56392340 into ub-games-master
* changes:
  Added accessor for file_extension in generated code.
  Added missing --gen-mutable to CMakeLists.txt
2015-05-04 21:00:43 +00:00
Wouter van Oortmerssen d4d7a84e11 Added missing --gen-mutable to CMakeLists.txt
Change-Id: I56392340de4439d05fa8f06a7336ff72c6f9346d
Tested: on Linux
2015-05-04 13:38:19 -07:00
Jason Sanmiya f47660f510 Fix bug on flathash compilation option.
Change-Id: Ib9d31d08daba7ce54b864417ae93bf479702861b
2015-04-28 15:44:10 -07:00
franchuti688 23f75f598e added .travis.yml file (build with original and biicode building);
added bii-travis.sh and readme.md files; added build status section with travis and biicode build
systems

Change-Id: I93acd1ca9497416ade6293d63b5311c4c31b880f
2015-04-15 13:43:25 -07:00
Advay Mengle 3ad853630c Generate appropriate schema doc comments from .proto files
- Add parse handling of .proto struct and field doc comments (enums and
their values were already handled)
- Add FBS generation handling of doc comments for structs, their
fields, enums, and their values (requires linking idl_gen_general in
the test binary build)
- Tested using test.proto|golden with doc comments added.  Xcode run of
flattest passes.

Change-Id: Idff64dd8064afba227174ab77d2c7be22d006628
2015-04-01 17:17:39 -07:00
Alex Ames d575321eba Added the hash attribute to ints and longs.
FlatBuffer schema files can now optionally specify a hash attribute that
will allow someone writing json files to enter a string to be hashed
rather than a specific value. The hashing algorithm to use is specified
by the schema.

Currently the only algorithms are fnv1 and fnv1a. There are 32 bit and
64 variatns for each. Additionally, a hashing command line tool was
added so that you can see what a string will hash to without needing to
inspect the flatbuffer binary blob.

Change-Id: I0cb359d0e2dc7d2dc1874b446dc19a17cc77109d
2015-02-17 14:10:18 -08:00
franramirez688 da0f096ba2 Added biicode support via biicode.conf and CMake/biicode.cmake
Change-Id: Id9750cceaa57aad3c969cf12299aa60f21c29074
2015-02-09 14:57:17 -08:00
Leander Bessa Beernaert 3ec8d7f598 Added option FLATBUFFERS_BUILD_FLATC
When FLATBUFFERS_BUILD_FLATC is set to OFF, the flatbuffer compiler
and tests will not be build.

Change-Id: I42b87b71daab4cb9c06605c813e7e4b62d6bf67a
2015-01-07 15:41:59 -08:00
Wouter van Oortmerssen 4cdf3eb19b Made CMakeLists.txt compatible with older versions of CMake.
By replacing DIRECTORY by PATH:
http://www.cmake.org/cmake/help/v3.0/command/get_filename_component.html

Change-Id: I6f5802deeda53dea443b255294235e43e7bb5389
Tested: on Linux.
2014-10-24 14:58:32 -07:00
Wouter van Oortmerssen d38b9af243 Added .proto parsing and convertion to .fbs.
Bug: 15777858
Change-Id: Iabef9b8c8044e593bb89510feebdee00d2f1840b
Tested: on Linux and Windows.
2014-10-15 17:42:31 -07:00