-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from google/v2
Merging v2 into master
- Loading branch information
Showing
43 changed files
with
5,476 additions
and
2,089 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# ignore all files in the bazel directories | ||
/bazel-* | ||
# ignore non-bazel build products | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
# Copyright 2016 Google Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
### libraries | ||
|
||
cc_library( | ||
name = "civil_time", | ||
hdrs = [ | ||
"include/civil_time.h", | ||
], | ||
includes = ["include"], | ||
textual_hdrs = ["include/civil_time_detail.h"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_library( | ||
name = "time_zone", | ||
srcs = [ | ||
"src/time_zone_format.cc", | ||
"src/time_zone_if.cc", | ||
"src/time_zone_if.h", | ||
"src/time_zone_impl.cc", | ||
"src/time_zone_impl.h", | ||
"src/time_zone_info.cc", | ||
"src/time_zone_info.h", | ||
"src/time_zone_libc.cc", | ||
"src/time_zone_libc.h", | ||
"src/time_zone_lookup.cc", | ||
"src/time_zone_posix.cc", | ||
"src/time_zone_posix.h", | ||
"src/tzfile.h", | ||
], | ||
hdrs = [ | ||
"include/time_zone.h", | ||
], | ||
includes = ["include"], | ||
linkopts = [ | ||
"-lm", | ||
"-lpthread", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = [":civil_time"], | ||
) | ||
|
||
cc_library( | ||
name = "cctz_v1", | ||
hdrs = [ | ||
"src/cctz.h", | ||
], | ||
includes = ["include"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
### tests | ||
|
||
# Builds the Google Test source that was fetched from another repository. | ||
cc_library( | ||
name = "gtest", | ||
srcs = glob( | ||
[ | ||
"google*/src/*.cc", | ||
], | ||
exclude = glob([ | ||
"google*/src/*-all.cc", | ||
"googlemock/src/gmock_main.cc", | ||
]), | ||
), | ||
hdrs = glob(["*/include/**/*.h"]), | ||
includes = [ | ||
"googlemock/", | ||
"googlemock/include", | ||
"googletest/", | ||
"googletest/include", | ||
], | ||
linkopts = ["-pthread"], | ||
textual_hdrs = ["googletest/src/gtest-internal-inl.h"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_test( | ||
name = "civil_time_test", | ||
size = "small", | ||
srcs = ["src/civil_time_test.cc"], | ||
deps = [ | ||
"@gtest//:gtest", | ||
":civil_time", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "time_zone_format_test", | ||
size = "small", | ||
srcs = ["src/time_zone_format_test.cc"], | ||
deps = [ | ||
"@gtest//:gtest", | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "time_zone_lookup_test", | ||
size = "small", | ||
srcs = ["src/time_zone_lookup_test.cc"], | ||
deps = [ | ||
"@gtest//:gtest", | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_test( | ||
name = "cctz_v1_test", | ||
size = "small", | ||
srcs = ["src/cctz_v1_test.cc"], | ||
defines = ["CCTZ_ACK_V1_DEPRECATION=1"], | ||
deps = [ | ||
"@gtest//:gtest", | ||
":cctz_v1", | ||
], | ||
) | ||
|
||
### examples | ||
|
||
cc_binary( | ||
name = "classic", | ||
srcs = ["examples/classic.cc"], | ||
) | ||
|
||
cc_binary( | ||
name = "epoch_shift", | ||
srcs = ["examples/epoch_shift.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "example1", | ||
srcs = ["examples/example1.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "example2", | ||
srcs = ["examples/example2.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "example3", | ||
srcs = ["examples/example3.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "example4", | ||
srcs = ["examples/example4.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "hello", | ||
srcs = ["examples/hello.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) | ||
|
||
### binaries | ||
|
||
cc_binary( | ||
name = "time_tool", | ||
srcs = ["src/time_tool.cc"], | ||
deps = [ | ||
":civil_time", | ||
":time_zone", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
Want to contribute? Great! First, read this page (including the small print at the end). | ||
Want to contribute? Great! First, read this page (including the small print at | ||
the end). | ||
|
||
### Before you contribute | ||
Before we can use your code, you must sign the | ||
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1) | ||
(CLA), which you can do online. The CLA is necessary mainly because you own the | ||
copyright to your changes, even after your contribution becomes part of our | ||
codebase, so we need your permission to use and distribute your code. We also | ||
need to be sure of various other things—for instance that you'll tell us if you | ||
know that your code infringes on other people's patents. You don't have to sign | ||
the CLA until after you've submitted your code for review and a member has | ||
approved it, but you must do it before we can put your code into our codebase. | ||
Before you start working on a larger contribution, you should get in touch with | ||
us first through the issue tracker with your idea so that we can help out and | ||
possibly guide you. Coordinating up front makes it much easier to avoid | ||
frustration later on. | ||
|
||
Before we can use your code, you must sign the [Google Individual Contributor | ||
License Agreement] | ||
(https://developers.google.com/open-source/cla/individual?csw=1) (CLA), which | ||
you can do online. The CLA is necessary mainly because you own the copyright to | ||
your changes, even after your contribution becomes part of our codebase, so we | ||
need your permission to use and distribute your code. We also need to be sure of | ||
various other things—for instance that you'll tell us if you know that | ||
your code infringes on other people's patents. You don't have to sign the CLA | ||
until after you've submitted your code for review and a member has approved it, | ||
but you must do it before we can put your code into our codebase. Before you | ||
start working on a larger contribution, you should get in touch with us first | ||
through the issue tracker with your idea so that we can help out and possibly | ||
guide you. Coordinating up front makes it much easier to avoid frustration later | ||
on. | ||
|
||
### Code reviews | ||
|
||
All submissions, including submissions by project members, require review. We | ||
use Github pull requests for this purpose. | ||
|
||
### The small print | ||
Contributions made by corporations are covered by a different agreement than | ||
the one above, the Software Grant and Corporate Contributor License Agreement. | ||
|
||
Contributions made by corporations are covered by a different agreement than the | ||
one above, the Software Grant and Corporate Contributor License Agreement. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright 2016 Google Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# While Bazel (http://bazel.io) is the primary build system used by cctz, | ||
# this Makefile is provided as a convenience for those who can't use Bazel | ||
# and can't compile the sources in their own build system. | ||
# | ||
# Suggested usage: | ||
# make -C build -f ../Makefile SRC=../ -j `nproc` | ||
|
||
# local configuration | ||
CXX = g++ | ||
STD = c++11 | ||
OPT = -O | ||
PREFIX = /usr/local | ||
|
||
# possible support for googletest | ||
## TESTS = civil_time_test time_zone_lookup_test time_zone_format_test | ||
## TEST_FLAGS = ... | ||
## TEST_LIBS = ... | ||
|
||
VPATH = $(SRC)include:$(SRC)src:$(SRC)examples | ||
CC = $(CXX) | ||
CPPFLAGS = -Wall -I$(SRC)include -std=$(STD) -pthread \ | ||
$(TEST_FLAGS) $(OPT) -fPIC -MMD | ||
ARFLAGS = rcs | ||
LDFLAGS = -pthread | ||
LDLIBS = $(TEST_LIBS) | ||
|
||
CCTZ_LIB = libcctz.a | ||
|
||
CCTZ_HDRS = \ | ||
civil_time.h \ | ||
civil_time_detail.h \ | ||
time_zone.h | ||
|
||
CCTZ_OBJS = \ | ||
time_zone_format.o \ | ||
time_zone_if.o \ | ||
time_zone_impl.o \ | ||
time_zone_info.o \ | ||
time_zone_libc.o \ | ||
time_zone_lookup.o \ | ||
time_zone_posix.o | ||
|
||
TOOLS = time_tool | ||
EXAMPLES = classic epoch_shift hello example1 example2 example3 example4 | ||
|
||
all: $(TESTS) $(TOOLS) $(EXAMPLES) | ||
|
||
$(TESTS) $(TOOLS) $(EXAMPLES): $(CCTZ_LIB) | ||
|
||
$(CCTZ_LIB): $(CCTZ_OBJS) | ||
$(AR) $(ARFLAGS) $@ $(CCTZ_OBJS) | ||
|
||
install: $(CCTZ_HDRS) $(CCTZ_LIB) | ||
sudo cp -p $(CCTZ_HDRS) $(PREFIX)/include | ||
sudo cp -p $(CCTZ_LIB) $(PREFIX)/lib | ||
|
||
clean: | ||
@$(RM) -r $(EXAMPLES:=.dSYM) $(EXAMPLES:=.o) $(EXAMPLES:=.d) $(EXAMPLES) | ||
@$(RM) -r $(TOOLS:=.dSYM) $(TOOLS:=.o) $(TOOLS:=.d) $(TOOLS) | ||
@$(RM) -r $(TESTS:=.dSYM) $(TESTS:=.o) $(TESTS:=.d) $(TESTS) | ||
@$(RM) $(CCTZ_OBJS) $(CCTZ_OBJS:.o=.d) $(CCTZ_LIB) | ||
|
||
-include $(CCTZ_OBJS:.o=.d) $(TESTS:=.d) $(TOOLS:=.d) $(EXAMPLES:=.d) |
Oops, something went wrong.