Commit Graph
23 Commits
Author SHA1 Message Date
Rich Gowman 189313e8b1 Minor refactoring 2018-02-06 10:02:30 -05:00
Rich Gowman fd0b332f46 Downgrade nanopb from 0.4.0-dev to 0.3.8.
Also regenerate the protos
2018-02-06 10:02:30 -05:00
Rich Gowman 3fcdf510ce Hook up nanopb to firestorep project
Use remote/serializer placeholder class as a hook for the test to ensure
nanopb headers can be found, and test can be linked.
2018-02-06 10:02:30 -05:00
Rich Gowman ace2ed15fe Add ability to build nanopb and protobuf 2018-02-06 10:02:30 -05:00
Rich Gowman 15206e8df2 Skip 'update' step for external dependencies
We check them out from a git tag, so this *should* be a noop. However,
cmake seems to want to rebuild these dependencies every time you run
make as it assumes the dependency *might* have been updated. (In
practice, this isn't completely awful, as make notices the files haven't
changed, so files don't actually get recompiled. But the configure step
is still re-run and all the files still need to be rescanned.)

Skipping the update step speeds up the build considerably.

On my linux box, running:
  cmake .. && make -j && time make -j
takes ~8.5s prior to this CL and ~6.5 afterwards. (6s is used by the
test suite.) The upcoming protobuf addition would otherwise have made
this much worse. (It takes a long time to ./configure.)
2018-02-06 10:02:30 -05:00
Rich Gowman f12406716c Eliminate sequencing dependencies
We originally had this as it was thought that cmake would spawn n*m jobs
(where n is the number of jobs it was instructed to create, ie. make
-j8, and m is the number of external projects.) However, it isn't
supposed to do that, and doesn't appear to be doing that right now. So
we'll remove this.

If the problem re-appears, we'll add these back in. (Symptom was being
unable to spawn /bin/sh.)
2018-02-06 10:02:30 -05:00
Gil 5a280ca1d6 Import iterator_adaptors from google3 (#718)
* Import iterator_adapters from google3

* Remove -Wconversion which is annoyingly hard to satisfy

* Strip dependency on absl_container from iterator_adapters_test

* Format and lint iterator_adaptors

* More flexible copyright checking in Travis
2018-01-29 08:38:32 -08:00
rsgowman a74d39f02b Fix a number of c++ build errors (#715)
* Move -fvisibility-inlines-hidden from common_flags to cxx_flags

This option isn't supported by C (and causes the build to fail under
at least rodete).

Manifested error was:

```
-- Looking for include file openssl/rand.h
-- Looking for include file openssl/rand.h - not found
CMake Error at core/src/firebase/firestore/util/CMakeLists.txt:94 (message):
  No implementation for SecureRandom available.

-- Configuring incomplete, errors occurred!
```

which is completely misleading. :(

* Fix exception include for std::logic_error

Was causing compiler error on (at least) rodete.

(http://en.cppreference.com/w/cpp/error/logic_error suggests that
stdexcept is the correct header.)

* Remove 'const' from vector contents.

vectors cannot contain const objects as the contained objects are
required to be assignable and copy constructable. (Not *quite* strictly
true; since c++11, this requirement now depends on the operations
performed on the container. But my compiler objects at any rate.)

http://en.cppreference.com/w/cpp/container/vector

https://stackoverflow.com/questions/8685257/why-cant-you-put-a-const-object-into-a-stl-container

* Add brackets as suggested (required) by my compiler.

* Add missing include

For LLONG_MIN, etc.

* Enable gnu extension to c++11 for firestore/util *test*.

We disable them by default (in cmake/CompilerSetup.cmake) but our tests
requires hexidecimal floating point, which is not supported in c++11
(though is supported in C++17, gnu++11, and others).

http://en.cppreference.com/w/cpp/language/floating_literal
https://bugzilla.redhat.com/show_bug.cgi?id=1321986

* Fix printf format for uint64_t

http://en.cppreference.com/w/cpp/types/integer
https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c

* Allow 0 length printf template strings in tests.

* Get rid of a multi line comment.

The backslash is apparently interpreted by the compiler cause the next
line to be ignored too. In this case, the next line is (currently) a
comment, and would be ignored anyways. (But that doesn't stop the
compiler from yelling.)

* Run ./scripts/style.sh
2018-01-27 16:16:41 -08:00
Gil 6a3379db62 Add a cc_library to the CMake build (#670)
* Rewrite cc_test to take named arguments

Cut down on build file verbosity by having cc_test take SOURCES and
DEPENDS. The separate invocation of target_link_libraries is no longer
necessary.

* Add a cc_library rule to parallel cc_test

This cuts down on build file verbosity.

* Automatically add OBJC_FLAGS to cc_libraries if applicable

* Exclude platform-specific libraries from 'all'

This is makes it possible to declare this kind of library
unconditionally. Usage within a test or as a dependency will actually
trigger building.

* Restore secure_random_test.cc; clean-up comments
2018-01-17 10:24:27 -08:00
Gil c3664973a9 Simplify integration with googletest (#672)
This makes it possible to build the Firestore subproject with CLion
because it no longer needs to be told where googletest is.
2018-01-17 10:22:57 -08:00
Gil df71c9ad8c Enable warnings in the CMake build (#669)
* Enable warnings when building with GCC or clang

* Fix warnings
2018-01-16 13:17:27 -05:00
Gil b15283bd27 Build gRPC for Firestore C++ (#652)
* Clean up quoting and other minor issues

* Reorganize CMake build output

Make it clearer which parts of the output pertain to external projects.

* Use a consistent ordering of ExternalProject arguments

* Prevent the top-level build from running in parallel

This prevents spurious failures when running make -j.

* Actually parse arguments in the xcodebuild function

* Use ExternalProject features when available

  * submodule limits from CMake 3.0
  * shallow clones from CMake 3.6
  * git progress output from CMake 3.8

* Only build the parts of leveldb we need

Skip building the tools and other libraries

* Avoid installing ExternalProjects

Consume build output directly so that we can build just the targets we
need. Installing causes all targets to be built.

This doesn't matter as much for these targets but the gRPC build
includes a ton of stuff we don't need so it's worth adopting this as a
general strategy.

* Define an external build for grpc

* Test that grpc can link successfully.

* Add a FindGRPC CMake module

* Actually comment ExternalProjext_GitSource
2018-01-13 15:21:01 -08:00
Gil ad97695519 Actually exclude leveldb on Windows (#630) 2018-01-08 17:49:59 -08:00
Gil 0f6103e404 Port StringPrintf from //base (#624)
* Port StringPrintf from //base.

  Prefer this to approaches based on variadic templates. While the variadic
  template mechanisms are strictly safer, they result in binary bloat we
  can't afford.

  This is essentially the same StringPrintf previously open sourced as a
  part of protobuf, though updated for C++11 which saves a copy and a
  temporary buffer on the heap.

* Add abseil as a subdirectory of Firestore

  This saves having to redefine all the libraries that abseil defines as
  imported libraries.

* Rename firebase_firesture_util_log_* targets

  Cut the log out of the name to reflect that these will get more
  components besides just logging.
2018-01-08 08:57:36 -08:00
Gil 5a6155f6a3 Build and test both C++ loggers where possible (#595)
* Rename FIREBASE_BINARY_DIR to FIREBASE_INSTALL_DIR

  Make this consistent with the outer superbuild and also make the
  association with CMAKE_INSTALL_PREFIX more obvious.

* Build and test log_stdio separate from the rest of util

  This is in preparation for adding a test for log_apple

* Build and test log_apple under CMake

  Also add notes about how FIRLogger's debug mode can break this test

* Refactor log_apple to cut down duplicate switch statements

  There's also a slight reduction in final binary size.
2018-01-03 07:00:54 -08:00
Ryan Wilson 7ab9c3c498 Remove FIRAppEnvironmentUtil's sharedApplication (#603)
* Deprecate FIRAppEnvironmentUtil sharedApplication

* Remove sharedApplication private API.

This also allows us to remove an AppKit dependency.

* Disable autolink when building FirebaseCore (#606)

This prevents the dependencies of FirebaseCore's dependencies from
bleeding into its interface.

The proximate benefit of avoiding this is that FirebaseCore no longer
ends up depending on ColorSync.framework which became a top-level system
framework in 10.13. This makes it possible to build against the
resulting FirebaseCore.framework on macOS 10.12 using Xcode 9 (with the
macOS 10.13 SDK).
2018-01-02 18:43:04 -05:00
Gil 13da48d8a4 Build FirebaseCore from CMake (#594)
* Don't bother specifying a download directory to CMake ExternalProject
* Teach CMake to build pure Xcode projects as dependencies

  This allows downstream code (like log_apple.mm) to consume this for
  testing within the CMake build without requiring a CMake-native build
  for these components.

  This makes integrating these components into the cmake build essentially
  free from the point of view of the consumed component.

* Get the CMake build semi-working on Linux again

  Many prebuilt versions of cmake on Linux lack the ability to download
  over https so use git to get googletest.

  Don't attempt to build FirebaseCore on Linux; there's no xcodebuild.

  Note the build is still ultimately broken because we don't yet have an
  alternative to arc4random on Linux but at least this is no more broken
  than it was before.
2018-01-01 21:00:32 -08:00
Gil 87d88ebbe2 Add leveldb to the Firestore cmake build (#559)
* Use Debug as the default build type if unspecified

* Add a leveldb ExternalProject, FindLevelDB module, and use it in Firestore

* Accept an externally built leveldb via LEVELDB_ROOT

* Clone leveldb via https: instead of git:

* Remove extra DOWNLOAD_DIR which doesn't work with GIT sources
2017-12-12 11:13:02 -08:00
Marek Gilbert 56c8c06594 Fix whitespace 2017-12-08 09:43:13 -08:00
Marek Gilbert 82810a84ff Add abseil-cpp to the superbuild 2017-12-07 13:02:53 -08:00
Gil 32bdc38400 Rework the top-level cmake build to be a superproject (#538)
All projects are now ExternalProjects

This makes it much easier to build them all in a single pass.
2017-12-06 16:10:59 -08:00
Gil 5e49692058 Add SecureRandom (#473)
* Add SecureRandom
* Add CMake support for building src/support
2017-11-20 20:53:08 -08:00
Gil 1670f1c5dd Initial CMake-based build (#472)
Initial CMake-based build

This knows how to download and build googletest.
2017-11-20 14:38:44 -08:00