Skip to content

Commit 78c50f4

Browse files
author
HowieChang
committed
as
1 parent fe6d503 commit 78c50f4

File tree

3,796 files changed

+985482
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,796 files changed

+985482
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
...
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Ignore all bazel-* symlinks.
2+
/bazel-*
3+
# Ignore Bazel verbose explanations
4+
--verbose_explanations
5+
# Ignore CMake usual build directory
6+
build
7+
# Ignore Vim files
8+
*.swp
9+
# Ignore QtCreator Project file
10+
CMakeLists.txt.user
11+
# Ignore VS Code files
12+
.vscode/*
13+
# Ignore generated python artifacts
14+
copts/copts.pyc
15+
copts/__pycache__/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Please submit a new Abseil Issue using the template below:
2+
3+
## [Short title of proposed API change(s)]
4+
5+
--------------------------------------------------------------------------------
6+
--------------------------------------------------------------------------------
7+
8+
## Background
9+
10+
[Provide the background information that is required in order to evaluate the
11+
proposed API changes. No controversial claims should be made here. If there are
12+
design constraints that need to be considered, they should be presented here
13+
**along with justification for those constraints**. Linking to other docs is
14+
good, but please keep the **pertinent information as self contained** as
15+
possible in this section.]
16+
17+
## Proposed API Change (s)
18+
19+
[Please clearly describe the API change(s) being proposed. If multiple changes,
20+
please keep them clearly distinguished. When possible, **use example code
21+
snippets to illustrate before-after API usages**. List pros-n-cons. Highlight
22+
the main questions that you want to be answered. Given the Abseil project compatibility requirements, describe why the API change is safe.]

downloads/downloads/absl/AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is the list of Abseil authors for copyright purposes.
2+
#
3+
# This does not necessarily list everyone who has contributed code, since in
4+
# some cases, their employer may be the copyright holder. To see the full list
5+
# of contributors, see the revision history in source control.
6+
Google Inc.
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
#
2+
# Copyright 2017 The Abseil Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
include(CMakeParseArguments)
18+
include(AbseilConfigureCopts)
19+
20+
# The IDE folder for Abseil that will be used if Abseil is included in a CMake
21+
# project that sets
22+
# set_property(GLOBAL PROPERTY USE_FOLDERS ON)
23+
# For example, Visual Studio supports folders.
24+
set(ABSL_IDE_FOLDER Abseil)
25+
26+
# absl_cc_library()
27+
#
28+
# CMake function to imitate Bazel's cc_library rule.
29+
#
30+
# Parameters:
31+
# NAME: name of target (see Note)
32+
# HDRS: List of public header files for the library
33+
# SRCS: List of source files for the library
34+
# DEPS: List of other libraries to be linked in to the binary targets
35+
# COPTS: List of private compile options
36+
# DEFINES: List of public defines
37+
# LINKOPTS: List of link options
38+
# PUBLIC: Add this so that this library will be exported under absl:: (see Note).
39+
# Also in IDE, target will appear in Abseil folder while non PUBLIC will be in Abseil/internal.
40+
# TESTONLY: When added, this target will only be built if user passes -DABSL_RUN_TESTS=ON to CMake.
41+
#
42+
# Note:
43+
# By default, absl_cc_library will always create a library named absl_internal_${NAME},
44+
# and alias target absl::${NAME}.
45+
# This is to reduce namespace pollution.
46+
#
47+
# absl_cc_library(
48+
# NAME
49+
# awesome
50+
# HDRS
51+
# "a.h"
52+
# SRCS
53+
# "a.cc"
54+
# )
55+
# absl_cc_library(
56+
# NAME
57+
# fantastic_lib
58+
# SRCS
59+
# "b.cc"
60+
# DEPS
61+
# absl_internal_awesome # not "awesome"!
62+
# )
63+
#
64+
# If PUBLIC is set, absl_cc_library will instead create a target named
65+
# absl_${NAME} and still an alias absl::${NAME}.
66+
#
67+
# absl_cc_library(
68+
# NAME
69+
# main_lib
70+
# ...
71+
# PUBLIC
72+
# )
73+
#
74+
# User can then use the library as absl::main_lib (although absl_main_lib is defined too).
75+
#
76+
# TODO: Implement "ALWAYSLINK"
77+
function(absl_cc_library)
78+
cmake_parse_arguments(ABSL_CC_LIB
79+
"DISABLE_INSTALL;PUBLIC;TESTONLY"
80+
"NAME"
81+
"HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS"
82+
${ARGN}
83+
)
84+
85+
if (NOT ABSL_CC_LIB_TESTONLY OR ABSL_RUN_TESTS)
86+
if (ABSL_CC_LIB_PUBLIC)
87+
set(_NAME "absl_${ABSL_CC_LIB_NAME}")
88+
else()
89+
set(_NAME "absl_internal_${ABSL_CC_LIB_NAME}")
90+
endif()
91+
92+
# Check if this is a header-only library
93+
# Note that as of February 2019, many popular OS's (for example, Ubuntu
94+
# 16.04 LTS) only come with cmake 3.5 by default. For this reason, we can't
95+
# use list(FILTER...)
96+
set(ABSL_CC_SRCS "${ABSL_CC_LIB_SRCS}")
97+
foreach(src_file IN LISTS ABSL_CC_SRCS)
98+
if(${src_file} MATCHES ".*\\.(h|inc)")
99+
list(REMOVE_ITEM ABSL_CC_SRCS "${src_file}")
100+
endif()
101+
endforeach()
102+
if ("${ABSL_CC_SRCS}" STREQUAL "")
103+
set(ABSL_CC_LIB_IS_INTERFACE 1)
104+
else()
105+
set(ABSL_CC_LIB_IS_INTERFACE 0)
106+
endif()
107+
108+
if(NOT ABSL_CC_LIB_IS_INTERFACE)
109+
add_library(${_NAME} STATIC "")
110+
target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS})
111+
target_include_directories(${_NAME}
112+
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS})
113+
target_compile_options(${_NAME}
114+
PRIVATE ${ABSL_CC_LIB_COPTS})
115+
target_link_libraries(${_NAME}
116+
PUBLIC ${ABSL_CC_LIB_DEPS}
117+
PRIVATE ${ABSL_CC_LIB_LINKOPTS}
118+
)
119+
target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES})
120+
121+
# Add all Abseil targets to a a folder in the IDE for organization.
122+
if(ABSL_CC_LIB_PUBLIC)
123+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
124+
elseif(ABSL_CC_LIB_TESTONLY)
125+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER}/test)
126+
else()
127+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER}/internal)
128+
endif()
129+
130+
# INTERFACE libraries can't have the CXX_STANDARD property set
131+
set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD})
132+
set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
133+
else()
134+
# Generating header-only library
135+
add_library(${_NAME} INTERFACE)
136+
target_include_directories(${_NAME}
137+
INTERFACE ${ABSL_COMMON_INCLUDE_DIRS})
138+
target_link_libraries(${_NAME}
139+
INTERFACE ${ABSL_CC_LIB_DEPS} ${ABSL_CC_LIB_LINKOPTS}
140+
)
141+
target_compile_definitions(${_NAME} INTERFACE ${ABSL_CC_LIB_DEFINES})
142+
endif()
143+
144+
add_library(absl::${ABSL_CC_LIB_NAME} ALIAS ${_NAME})
145+
endif()
146+
endfunction()
147+
148+
# absl_cc_test()
149+
#
150+
# CMake function to imitate Bazel's cc_test rule.
151+
#
152+
# Parameters:
153+
# NAME: name of target (see Usage below)
154+
# SRCS: List of source files for the binary
155+
# DEPS: List of other libraries to be linked in to the binary targets
156+
# COPTS: List of private compile options
157+
# DEFINES: List of public defines
158+
# LINKOPTS: List of link options
159+
#
160+
# Note:
161+
# By default, absl_cc_test will always create a binary named absl_${NAME}.
162+
# This will also add it to ctest list as absl_${NAME}.
163+
#
164+
# Usage:
165+
# absl_cc_library(
166+
# NAME
167+
# awesome
168+
# HDRS
169+
# "a.h"
170+
# SRCS
171+
# "a.cc"
172+
# PUBLIC
173+
# )
174+
#
175+
# absl_cc_test(
176+
# NAME
177+
# awesome_test
178+
# SRCS
179+
# "awesome_test.cc"
180+
# DEPS
181+
# absl::awesome
182+
# gmock
183+
# gtest_main
184+
# )
185+
function(absl_cc_test)
186+
if(NOT ABSL_RUN_TESTS)
187+
return()
188+
endif()
189+
190+
cmake_parse_arguments(ABSL_CC_TEST
191+
""
192+
"NAME"
193+
"SRCS;COPTS;DEFINES;LINKOPTS;DEPS"
194+
${ARGN}
195+
)
196+
197+
set(_NAME "absl_${ABSL_CC_TEST_NAME}")
198+
add_executable(${_NAME} "")
199+
target_sources(${_NAME} PRIVATE ${ABSL_CC_TEST_SRCS})
200+
target_include_directories(${_NAME}
201+
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS}
202+
PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
203+
)
204+
target_compile_definitions(${_NAME}
205+
PUBLIC ${ABSL_CC_TEST_DEFINES}
206+
)
207+
target_compile_options(${_NAME}
208+
PRIVATE ${ABSL_CC_TEST_COPTS}
209+
)
210+
target_link_libraries(${_NAME}
211+
PUBLIC ${ABSL_CC_TEST_DEPS}
212+
PRIVATE ${ABSL_CC_TEST_LINKOPTS}
213+
)
214+
# Add all Abseil targets to a a folder in the IDE for organization.
215+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER}/test)
216+
217+
set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD})
218+
set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
219+
220+
add_test(NAME ${_NAME} COMMAND ${_NAME})
221+
endfunction()
222+
223+
224+
function(check_target my_target)
225+
if(NOT TARGET ${my_target})
226+
message(FATAL_ERROR " ABSL: compiling absl requires a ${my_target} CMake target in your project,
227+
see CMake/README.md for more details")
228+
endif(NOT TARGET ${my_target})
229+
endfunction()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 2.8.2)
2+
3+
project(googletest-download NONE)
4+
5+
include(ExternalProject)
6+
ExternalProject_Add(googletest
7+
GIT_REPOSITORY https://github.com/google/googletest.git
8+
GIT_TAG master
9+
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
10+
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
11+
CONFIGURE_COMMAND ""
12+
BUILD_COMMAND ""
13+
INSTALL_COMMAND ""
14+
TEST_COMMAND ""
15+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Downloads and unpacks googletest at configure time. Based on the instructions
2+
# at https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project
3+
4+
# Download the latest googletest from Github master
5+
configure_file(
6+
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in
7+
${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt
8+
)
9+
10+
# Configure and build the downloaded googletest source
11+
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
12+
RESULT_VARIABLE result
13+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
14+
if(result)
15+
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
16+
endif()
17+
18+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
19+
RESULT_VARIABLE result
20+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
21+
if(result)
22+
message(FATAL_ERROR "Build step for googletest failed: ${result}")
23+
endif()
24+
25+
# Prevent overriding the parent project's compiler/linker settings on Windows
26+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
27+
28+
# Add googletest directly to our build. This defines the gtest and gtest_main
29+
# targets.
30+
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
31+
${CMAKE_BINARY_DIR}/googletest-build
32+
EXCLUDE_FROM_ALL)

0 commit comments

Comments
 (0)