From d5134a7f11e32d11caa67e75ae2ae2e506fb54ba Mon Sep 17 00:00:00 2001 From: Adrien Devresse Date: Tue, 26 Sep 2017 20:37:27 -0700 Subject: CMake support - initial cmake support - downgrade cmake requirement to 2.8.12 - factorize cmake test flags / libs options - refactor test / library under helpers functions, follow bazel's style - Add fix for MSVC and Windows support ( thx @patrikfors ) - Switch to default "add_subdirectory()" usage mode - add CMake/README.md for instructions - add header-only cmake target generator - map absl target to absl:: namespace --- CMake/AbseilHelpers.cmake | 157 +++++++++++++++++++ CMake/README.md | 41 +++++ CMakeLists.txt | 81 ++++++++++ README.md | 6 + absl/CMakeLists.txt | 30 ++++ absl/algorithm/CMakeLists.txt | 63 ++++++++ absl/base/CMakeLists.txt | 296 +++++++++++++++++++++++++++++++++++ absl/container/CMakeLists.txt | 126 +++++++++++++++ absl/debugging/CMakeLists.txt | 58 +++++++ absl/memory/CMakeLists.txt | 52 +++++++ absl/meta/CMakeLists.txt | 49 ++++++ absl/numeric/CMakeLists.txt | 62 ++++++++ absl/strings/CMakeLists.txt | 300 ++++++++++++++++++++++++++++++++++++ absl/synchronization/CMakeLists.txt | 154 ++++++++++++++++++ absl/time/CMakeLists.txt | 78 ++++++++++ absl/types/CMakeLists.txt | 153 ++++++++++++++++++ absl/utility/CMakeLists.txt | 60 ++++++++ 17 files changed, 1766 insertions(+) create mode 100644 CMake/AbseilHelpers.cmake create mode 100644 CMake/README.md create mode 100644 CMakeLists.txt create mode 100644 absl/CMakeLists.txt create mode 100644 absl/algorithm/CMakeLists.txt create mode 100644 absl/base/CMakeLists.txt create mode 100644 absl/container/CMakeLists.txt create mode 100644 absl/debugging/CMakeLists.txt create mode 100644 absl/memory/CMakeLists.txt create mode 100644 absl/meta/CMakeLists.txt create mode 100644 absl/numeric/CMakeLists.txt create mode 100644 absl/strings/CMakeLists.txt create mode 100644 absl/synchronization/CMakeLists.txt create mode 100644 absl/time/CMakeLists.txt create mode 100644 absl/types/CMakeLists.txt create mode 100644 absl/utility/CMakeLists.txt diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake new file mode 100644 index 00000000..f6243c3b --- /dev/null +++ b/CMake/AbseilHelpers.cmake @@ -0,0 +1,157 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +include(CMakeParseArguments) + +set(_ABSL_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}") + +# +# create a static library absl_based on the following variable +# +# parameters +# SOURCES : sources files for the library +# PUBLIC_LIBRARIES: targets and flags for linking phase +# PRIVATE_COMPILE_FLAGS: compile flags for the library. Will not be exported. +# EXPORT_NAME: export name for the absl:: target export +# TARGET: target name +# +# create a target associated to +# libraries are installed under CMAKE_INSTALL_FULL_LIBDIR by default +# +function(absl_library) + cmake_parse_arguments(ABSL_LIB + "DISABLE_INSTALL" # keep that in case we want to support installation one day + "TARGET;EXPORT_NAME" + "SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS" + ${ARGN} + ) + + set(_NAME ${ABSL_LIB_TARGET}) + string(TOUPPER ${_NAME} _UPPER_NAME) + + add_library(${_NAME} STATIC ${ABSL_LIB_SOURCES}) + + target_compile_options(${_NAME} PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_LIB_PRIVATE_COMPILE_FLAGS}) + target_link_libraries(${_NAME} PUBLIC ${ABSL_LIB_PUBLIC_LIBRARIES}) + target_include_directories(${_NAME} + PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_LIB_PUBLIC_INCLUDE_DIRS} + PRIVATE ${ABSL_LIB_PRIVATE_INCLUDE_DIRS} + ) + + if(ABSL_LIB_EXPORT_NAME) + add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME}) + endif() +endfunction() + + + +# +# header only virtual target creation +# +function(absl_header_library) + cmake_parse_arguments(ABSL_HO_LIB + "DISABLE_INSTALL" + "EXPORT_NAME;TARGET" + "PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS" + ${ARGN} + ) + + set(_NAME ${ABSL_HO_LIB_TARGET}) + + set(__dummy_header_only_lib_file "${CMAKE_CURRENT_BINARY_DIR}/${_NAME}_header_only_dummy.cc") + + if(NOT EXISTS ${__dummy_header_only_lib_file}) + file(WRITE ${__dummy_header_only_lib_file} + "\ + /* generated file for header-only cmake target */ \ + \ + // single meaningless symbol \ + void __${_NAME}__header_fakesym() {} \ + \ + " + ) + endif() + + + add_library(${_NAME} ${__dummy_header_only_lib_file}) + target_link_libraries(${_NAME} PUBLIC ${ABSL_HO_LIB_PUBLIC_LIBRARIES}) + target_include_directories(${_NAME} + PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_HO_LIB_PUBLIC_INCLUDE_DIRS} + PRIVATE ${ABSL_HO_LIB_PRIVATE_INCLUDE_DIRS} + ) + + if(ABSL_HO_LIB_EXPORT_NAME) + add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME}) + endif() + +endfunction() + + +# +# create an abseil unit_test and add it to the executed test list +# +# parameters +# TARGET: target name prefix +# SOURCES: sources files for the tests +# PUBLIC_LIBRARIES: targets and flags for linking phase. +# PRIVATE_COMPILE_FLAGS: compile flags for the test. Will not be exported. +# +# create a target associated to _bin +# +# all tests will be register for execution with add_test() +# +# test compilation and execution is disable when BUILD_TESTING=OFF +# +function(absl_test) + + cmake_parse_arguments(ABSL_TEST + "" + "TARGET" + "SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS" + ${ARGN} + ) + + + if(BUILD_TESTING) + + set(_NAME ${ABSL_TEST_TARGET}) + string(TOUPPER ${_NAME} _UPPER_NAME) + + add_executable(${_NAME}_bin ${ABSL_TEST_SOURCES}) + + target_compile_options(${_NAME}_bin PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_TEST_PRIVATE_COMPILE_FLAGS}) + target_link_libraries(${_NAME}_bin PUBLIC ${ABSL_TEST_PUBLIC_LIBRARIES} ${ABSL_TEST_COMMON_LIBRARIES}) + target_include_directories(${_NAME}_bin + PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_TEST_PUBLIC_INCLUDE_DIRS} + PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} + ) + + add_test(${_NAME}_test ${_NAME}_bin) + endif(BUILD_TESTING) + +endfunction() + + + + +function(check_target my_target) + + if(NOT TARGET ${my_target}) + message(FATAL_ERROR " ABSL: compiling absl requires a ${my_target} CMake target in your project, + see CMake/README.md for more details") + endif(NOT TARGET ${my_target}) + +endfunction() diff --git a/CMake/README.md b/CMake/README.md new file mode 100644 index 00000000..53d3d335 --- /dev/null +++ b/CMake/README.md @@ -0,0 +1,41 @@ + +## Abseil CMake build instructions + + +### Recommended usage : incorporate Abseil into an CMake project + + We recommended to build and use abseil in the same way than googletest + ( https://github.com/google/googletest/blob/master/googletest/README.md ) + + * Download abseil and copy it in a sub-directory in your project. + + * Or add abseil as a git-submodule in your project + + You can then use the cmake `add_subdirectory()` command to include + abseil directly and use the abseil targets in your project. + + Abseil requires CCTZ and the googletest framework. Consequently, + the targets `gtest`, `gtest_main`, `gmock` and `cctz` need + to be declared in your project before including abseil with `add_subdirectory`. + You can find instructions on how to get and build these projects at these + URL : + * cctz https://github.com/google/cctz + * googletest https://github.com/google/googletest + + + + Here is a short CMakeLists.txt example of a possible project file + using abseil + + project(my_project) + + add_subdirectory(googletest) + add_subdirectory(cctz) + add_subdirectory(abseil-cpp) + + add_executable(my_exe source.cpp) + target_link_libraries(my_exe base synchronization strings) + + + + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8f4cd5af --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,81 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# +cmake_minimum_required(VERSION 2.8.12) +project(absl) + +# enable ctest +include(CTest) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake) + +include(GNUInstallDirs) +include(AbseilHelpers) + + +# config options +set(ABSL_STD_CXX_FLAG "-std=c++11" CACHE STRING "c++ std flag (default: c++11)") + + + +## +## Using absl targets +## +## all public absl targets are +## exported with the absl:: prefix +## +## e.g absl::base absl::synchronization absl::strings .... +## +## DO NOT rely on the internal targets outside of the prefix + + +# include current path +list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) + +# -std=X +set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_WARNING_VLA} ${CMAKE_CXX_FLAGS} ") + + +# find dependencies +## pthread +find_package(Threads REQUIRED) + +# commented: used only for standalone test +#add_subdirectory(cctz) +#add_subdirectory(googletest) + +## check targets +check_target(cctz) +check_target(gtest) +check_target(gtest_main) +check_target(gmock) + +# -fexceptions +set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}") + +# fix stuff +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FIX_MSVC} ${CMAKE_CXX_FLAGS}") + +list(APPEND ABSL_TEST_COMMON_LIBRARIES + gtest_main + gtest + gmock + ${CMAKE_THREAD_LIBS_INIT} +) + +add_subdirectory(absl) + + diff --git a/README.md b/README.md index c6db64ab..592dc66b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ standard library. - [Codemap](#codemap) - [License](#license) - [Links](#links) +- [Build with cmake](#cmake) ## About Abseil @@ -85,6 +86,11 @@ For more information about Abseil: [Abseil Compatibility Guarantees](http://abseil.io/about/compatibility) to understand both what we promise to you, and what we expect of you in return. + +## Build with CMake + +Please check the [CMake build instructions](CMake/README.md) + ## Disclaimer * This is not an official Google product. diff --git a/absl/CMakeLists.txt b/absl/CMakeLists.txt new file mode 100644 index 00000000..689f64e2 --- /dev/null +++ b/absl/CMakeLists.txt @@ -0,0 +1,30 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + + + +add_subdirectory(base) +add_subdirectory(algorithm) +add_subdirectory(container) +add_subdirectory(debugging) +add_subdirectory(memory) +add_subdirectory(meta) +add_subdirectory(numeric) +add_subdirectory(strings) +add_subdirectory(synchronization) +add_subdirectory(time) +add_subdirectory(types) +add_subdirectory(utility) diff --git a/absl/algorithm/CMakeLists.txt b/absl/algorithm/CMakeLists.txt new file mode 100644 index 00000000..fdf45c55 --- /dev/null +++ b/absl/algorithm/CMakeLists.txt @@ -0,0 +1,63 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND ALGORITHM_PUBLIC_HEADERS + "algorithm.h" + "container.h" +) + + +# +## TESTS +# + +# test algorithm_test +list(APPEND ALGORITHM_TEST_SRC + "algorithm_test.cc" + ${ALGORITHM_PUBLIC_HEADERS} + ${ALGORITHM_INTERNAL_HEADERS} +) + +absl_header_library( + TARGET + absl_algorithm + EXPORT_NAME + algorithm +) + +absl_test( + TARGET + algorithm_test + SOURCES + ${ALGORITHM_TEST_SRC} + PUBLIC_LIBRARIES + absl::algorithm +) + + + + +# test container_test +set(CONTAINER_TEST_SRC "container_test.cc") + +absl_test( + TARGET + container_test + SOURCES + ${CONTAINER_TEST_SRC} + PUBLIC_LIBRARIES + absl::algorithm +) diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt new file mode 100644 index 00000000..06f09d8f --- /dev/null +++ b/absl/base/CMakeLists.txt @@ -0,0 +1,296 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND BASE_PUBLIC_HEADERS + "attributes.h" + "call_once.h" + "casts.h" + "config.h" + "dynamic_annotations.h" + "macros.h" + "optimization.h" + "policy_checks.h" + "port.h" + "thread_annotations.h" +) + + +list(APPEND BASE_INTERNAL_HEADERS + "internal/atomic_hook.h" + "internal/cycleclock.h" + "internal/endian.h" + "internal/exception_testing.h" + "internal/identity.h" + "internal/invoke.h" + "internal/log_severity.h" + "internal/low_level_alloc.h" + "internal/low_level_scheduling.h" + "internal/malloc_extension_c.h" + "internal/malloc_extension.h" + "internal/malloc_hook_c.h" + "internal/malloc_hook.h" + "internal/malloc_hook_invoke.h" + "internal/per_thread_tls.h" + "internal/raw_logging.h" + "internal/scheduling_mode.h" + "internal/spinlock.h" + "internal/spinlock_wait.h" + "internal/sysinfo.h" + "internal/thread_identity.h" + "internal/throw_delegate.h" + "internal/tsan_mutex_interface.h" + "internal/unaligned_access.h" + "internal/unscaledcycleclock.h" +) + + +# absl_base main library +list(APPEND BASE_SRC + "internal/cycleclock.cc" + "internal/raw_logging.cc" + "internal/spinlock.cc" + "internal/sysinfo.cc" + "internal/thread_identity.cc" + "internal/unscaledcycleclock.cc" + "internal/spinlock_wait.cc" + "internal/low_level_alloc.cc" + "internal/malloc_hook.cc" + "dynamic_annotations.cc" + ${BASE_PUBLIC_HEADERS} + ${BASE_INTERNAL_HEADERS} +) + +absl_library( + TARGET + absl_base + SOURCES + ${BASE_SRC} + EXPORT_NAME + base +) + +# malloc extension library +set(MALLOC_EXTENSION_SRC "internal/malloc_extension.cc") +set(MALLOC_EXTENSION_PUBLIC_LIBRARIES absl::base) + +absl_library( + TARGET + absl_malloc_extension + SOURCES + ${MALLOC_EXTENSION_SRC} + PUBLIC_LIBRARIES + ${MALLOC_EXTENSION_PUBLIC_LIBRARIES} +) + +# throw delegate library +set(THROW_DELEGATE_SRC "internal/throw_delegate.cc") + +absl_library( + TARGET + absl_throw_delegate + SOURCES + ${THROW_DELEGATE_SRC} + PUBLIC_LIBRARIES + ${THROW_DELEGATE_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${ABSL_EXCEPTIONS_FLAG} +) + + +# +## TESTS +# + +# call once test +set(CALL_ONCE_TEST_SRC "call_once_test.cc") +set(CALL_ONCE_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization) + +absl_test( + TARGET + call_once_test + SOURCES + ${CALL_ONCE_TEST_SRC} + PUBLIC_LIBRARIES + ${CALL_ONCE_TEST_PUBLIC_LIBRARIES} +) + + +# test bit_cast_test +set(BIT_CAST_TEST_SRC "bit_cast_test.cc") + +absl_test( + TARGET + bit_cast_test + SOURCES + ${BIT_CAST_TEST_SRC} +) + + +# test absl_throw_delegate_test +set(THROW_DELEGATE_TEST_SRC "throw_delegate_test.cc") +set(THROW_DELEGATE_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate) + +absl_test( + TARGET + throw_delegate_test + SOURCES + ${THROW_DELEGATE_TEST_SRC} + PUBLIC_LIBRARIES + ${THROW_DELEGATE_TEST_PUBLIC_LIBRARIES} +) + + +# test invoke_test +set(INVOKE_TEST_SRC "invoke_test.cc") +set(INVOKE_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + invoke_test + SOURCES + ${INVOKE_TEST_SRC} + PUBLIC_LIBRARIES + ${INVOKE_TEST_PUBLIC_LIBRARIES} +) + + +# test spinlock_test_common +set(SPINLOCK_TEST_COMMON_SRC "spinlock_test_common.cc") +set(SPINLOCK_TEST_COMMON_PUBLIC_LIBRARIES absl::base absl::synchronization) + +absl_test( + TARGET + spinlock_test_common + SOURCES + ${SPINLOCK_TEST_COMMON_SRC} + PUBLIC_LIBRARIES + ${SPINLOCK_TEST_COMMON_PUBLIC_LIBRARIES} +) + + +# test spinlock_test +set(SPINLOCK_TEST_SRC "spinlock_test_common.cc") +set(SPINLOCK_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization) + +absl_test( + TARGET + spinlock_test + SOURCES + ${SPINLOCK_TEST_SRC} + PUBLIC_LIBRARIES + ${SPINLOCK_TEST_PUBLIC_LIBRARIES} +) + + +# test endian_test +set(ENDIAN_TEST_SRC "internal/endian_test.cc") + +absl_test( + TARGET + endian_test + SOURCES + ${ENDIAN_TEST_SRC} +) + + +# test config_test +set(CONFIG_TEST_SRC "config_test.cc") +set(CONFIG_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization) +absl_test( + TARGET + config_test + SOURCES + ${CONFIG_TEST_SRC} + PUBLIC_LIBRARIES + ${CONFIG_TEST_PUBLIC_LIBRARIES} +) + + +# test raw_logging_test +set(RAW_LOGGING_TEST_SRC "raw_logging_test.cc") +set(RAW_LOGGING_TEST_PUBLIC_LIBRARIES absl::base) + +absl_test( + TARGET + raw_logging_test + SOURCES + ${RAW_LOGGING_TEST_SRC} + PUBLIC_LIBRARIES + ${RAW_LOGGING_TEST_PUBLIC_LIBRARIES} +) + + +# test sysinfo_test +set(SYSINFO_TEST_SRC "internal/sysinfo_test.cc") +set(SYSINFO_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization) + +absl_test( + TARGET + sysinfo_test + SOURCES + ${SYSINFO_TEST_SRC} + PUBLIC_LIBRARIES + ${SYSINFO_TEST_PUBLIC_LIBRARIES} +) + + +# test low_level_alloc_test +set(LOW_LEVEL_ALLOC_TEST_SRC "internal/low_level_alloc_test.cc") +set(LOW_LEVEL_ALLOC_TEST_PUBLIC_LIBRARIES absl::base) + +absl_test( + TARGET + low_level_alloc_test + SOURCES + ${LOW_LEVEL_ALLOC_TEST_SRC} + PUBLIC_LIBRARIES + ${LOW_LEVEL_ALLOC_TEST_PUBLIC_LIBRARIES} +) + + +# test thread_identity_test +set(THREAD_IDENTITY_TEST_SRC "internal/thread_identity_test.cc") +set(THREAD_IDENTITY_TEST_PUBLIC_LIBRARIES absl::base absl::synchronization) + +absl_test( + TARGET + thread_identity_test + SOURCES + ${THREAD_IDENTITY_TEST_SRC} + PUBLIC_LIBRARIES + ${THREAD_IDENTITY_TEST_PUBLIC_LIBRARIES} +) + + +# test absl_malloc_extension_system_malloc_test +set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_SRC "internal/malloc_extension_test.cc") +set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PUBLIC_LIBRARIES absl::base absl_malloc_extension) +set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PRIVATE_COMPILE_FLAGS "-DABSL_MALLOC_EXTENSION_TEST_ALLOW_MISSING_EXTENSION=1") + +absl_test( + TARGET + absl_malloc_extension_system_malloc_test + SOURCES + ${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_SRC} + PUBLIC_LIBRARIES + ${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_PRIVATE_COMPILE_FLAGS} +) + + + + diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt new file mode 100644 index 00000000..f56ce92d --- /dev/null +++ b/absl/container/CMakeLists.txt @@ -0,0 +1,126 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + + +list(APPEND CONTAINER_PUBLIC_HEADERS + "fixed_array.h" + "inlined_vector.h" +) + + +list(APPEND CONTAINER_INTERNAL_HEADERS + "internal/test_instance_tracker.h" +) + + +absl_header_library( + TARGET + absl_container + EXPORT_NAME + container +) + + +# +## TESTS +# + +list(APPEND TEST_INSTANCE_TRACKER_LIB_SRC + "internal/test_instance_tracker.cc" + ${CONTAINER_PUBLIC_HEADERS} + ${CONTAINER_INTERNAL_HEADERS} +) + + +absl_library( + TARGET + test_instance_tracker_lib + SOURCES + ${TEST_INSTANCE_TRACKER_LIB_SRC} + PUBLIC_LIBRARIES + absl::container + DISABLE_INSTALL +) + + + +# test fixed_array_test +set(FIXED_ARRAY_TEST_SRC "fixed_array_test.cc") +set(FIXED_ARRAY_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib) + +absl_test( + TARGET + fixed_array_test + SOURCES + ${FIXED_ARRAY_TEST_SRC} + PUBLIC_LIBRARIES + ${FIXED_ARRAY_TEST_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${ABSL_EXCEPTIONS_FLAG} +) + + + +absl_test( + TARGET + fixed_array_test_noexceptions + SOURCES + ${FIXED_ARRAY_TEST_SRC} + PUBLIC_LIBRARIES + ${FIXED_ARRAY_TEST_PUBLIC_LIBRARIES} +) + + +# test inlined_vector_test +set(INLINED_VECTOR_TEST_SRC "inlined_vector_test.cc") +set(INLINED_VECTOR_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib) + +absl_test( + TARGET + inlined_vector_test + SOURCES + ${INLINED_VECTOR_TEST_SRC} + PUBLIC_LIBRARIES + ${INLINED_VECTOR_TEST_PUBLIC_LIBRARIES} +) + +absl_test( + TARGET + inlined_vector_test_noexceptions + SOURCES + ${INLINED_VECTOR_TEST_SRC} + PUBLIC_LIBRARIES + ${INLINED_VECTOR_TEST_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${ABSL_NOEXCEPTION_CXXFLAGS} +) + + +# test test_instance_tracker_test +set(TEST_INSTANCE_TRACKER_TEST_SRC "internal/test_instance_tracker_test.cc") +set(TEST_INSTANCE_TRACKER_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate test_instance_tracker_lib) + + +absl_test( + TARGET + test_instance_tracker_test + SOURCES + ${TEST_INSTANCE_TRACKER_TEST_SRC} + PUBLIC_LIBRARIES + ${TEST_INSTANCE_TRACKER_TEST_PUBLIC_LIBRARIES} +) + + diff --git a/absl/debugging/CMakeLists.txt b/absl/debugging/CMakeLists.txt new file mode 100644 index 00000000..48529a3e --- /dev/null +++ b/absl/debugging/CMakeLists.txt @@ -0,0 +1,58 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND DEBUGGING_PUBLIC_HEADERS + "leak_check.h" + "stacktrace.h" +) + + +list(APPEND DEBUGGING_INTERNAL_HEADERS + "internal/address_is_readable.h" + "internal/elf_mem_image.h" + "internal/stacktrace_config.h" + "internal/vdso_support.h" +) + + +list(APPEND STACKTRACE_SRC + "stacktrace.cc" + "internal/address_is_readable.cc" + "internal/elf_mem_image.cc" + "internal/vdso_support.cc" + ${DEBUGGING_PUBLIC_HEADERS} + ${DEBUGGING_INTERNAL_HEADERS} +) + +absl_library( + TARGET + absl_stacktrace + SOURCES + ${STACKTRACE_SRC} + PUBLIC_LIBRARIES + ${STACKTRACE_PUBLIC_LIBRARIES} + EXPORT_NAME + stacktrace +) + + +absl_header_library( + TARGET + absl_debugging + EXPORT_NAME + debugging +) + diff --git a/absl/memory/CMakeLists.txt b/absl/memory/CMakeLists.txt new file mode 100644 index 00000000..21bfc87e --- /dev/null +++ b/absl/memory/CMakeLists.txt @@ -0,0 +1,52 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND MEMORY_PUBLIC_HEADERS + "memory.h" +) + + +absl_header_library( + TARGET + absl_memory + EXPORT_NAME + memory +) + +# +## TESTS +# + +# test memory_test +list(APPEND MEMORY_TEST_SRC + "memory_test.cc" + ${MEMORY_PUBLIC_HEADERS} +) +set(MEMORY_TEST_PUBLIC_LIBRARIES absl::base absl::memory) + + + +absl_test( + TARGET + memory_test + SOURCES + ${MEMORY_TEST_SRC} + PUBLIC_LIBRARIES + ${MEMORY_TEST_PUBLIC_LIBRARIES} +) + + + diff --git a/absl/meta/CMakeLists.txt b/absl/meta/CMakeLists.txt new file mode 100644 index 00000000..d56fced8 --- /dev/null +++ b/absl/meta/CMakeLists.txt @@ -0,0 +1,49 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND META_PUBLIC_HEADERS + "type_traits.h" +) + + +# +## TESTS +# + +# test type_traits_test +list(APPEND TYPE_TRAITS_TEST_SRC + "type_traits_test.cc" + ${META_PUBLIC_HEADERS} +) + +absl_header_library( + TARGET + absl_meta + EXPORT_NAME + meta + ) + +absl_test( + TARGET + type_traits_test + SOURCES + ${TYPE_TRAITS_TEST_SRC} + PUBLIC_LIBRARIES + ${TYPE_TRAITS_TEST_PUBLIC_LIBRARIES} absl::meta +) + + + diff --git a/absl/numeric/CMakeLists.txt b/absl/numeric/CMakeLists.txt new file mode 100644 index 00000000..3360b2ee --- /dev/null +++ b/absl/numeric/CMakeLists.txt @@ -0,0 +1,62 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND NUMERIC_PUBLIC_HEADERS + "int128.h" +) + + +# library 128 +list(APPEND INT128_SRC + "int128.cc" + ${NUMERIC_PUBLIC_HEADERS} +) +absl_library( + TARGET + absl_int128 + SOURCES + ${INT128_SRC} + PUBLIC_LIBRARIES + ${INT128_PUBLIC_LIBRARIES} + EXPORT_NAME + int128 +) + + +absl_header_library( + TARGET + absl_numeric + PUBLIC_LIBRARIES + absl::int128 + EXPORT_NAME + numeric +) + +# test int128_test +set(INT128_TEST_SRC "int128_test.cc") +set(INT128_TEST_PUBLIC_LIBRARIES absl::numeric absl::base) + +absl_test( + TARGET + int128_test + SOURCES + ${INT128_TEST_SRC} + PUBLIC_LIBRARIES + ${INT128_TEST_PUBLIC_LIBRARIES} +) + + + diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt new file mode 100644 index 00000000..7923e344 --- /dev/null +++ b/absl/strings/CMakeLists.txt @@ -0,0 +1,300 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + + +list(APPEND STRINGS_PUBLIC_HEADERS + "ascii_ctype.h" + "ascii.h" + "escaping.h" + "match.h" + "numbers.h" + "str_cat.h" + "string_view.h" + "strip.h" + "str_join.h" + "str_replace.h" + "str_split.h" + "substitute.h" +) + + +list(APPEND STRINGS_INTERNAL_HEADERS + "internal/char_map.h" + "internal/memutil.h" + "internal/ostringstream.h" + "internal/resize_uninitialized.h" + "internal/str_join_internal.h" + "internal/str_split_internal.h" + "internal/utf8.h" +) + + + +# add string library +list(APPEND STRINGS_SRC + "ascii.cc" + "escaping.cc" + "internal/memutil.cc" + "internal/memutil.h" + "internal/utf8.cc" + "match.cc" + "numbers.cc" + "str_cat.cc" + "str_replace.cc" + "str_split.cc" + "string_view.cc" + "substitute.cc" + ${STRINGS_PUBLIC_HEADERS} + ${STRINGS_INTERNAL_HEADERS} +) +set(STRINGS_PUBLIC_LIBRARIES absl::base absl_throw_delegate) + +absl_library( + TARGET + absl_strings + SOURCES + ${STRINGS_SRC} + PUBLIC_LIBRARIES + ${STRINGS_PUBLIC_LIBRARIES} + EXPORT_NAME + strings +) + + +# +## TESTS +# + +# test match_test +set(MATCH_TEST_SRC "match_test.cc") +set(MATCH_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + match_test + SOURCES + ${MATCH_TEST_SRC} + PUBLIC_LIBRARIES + ${MATCH_TEST_PUBLIC_LIBRARIES} +) + + +# test escaping_test +set(ESCAPING_TEST_SRC "escaping_test.cc") +set(ESCAPING_TEST_PUBLIC_LIBRARIES absl::strings absl::base) + +absl_test( + TARGET + escaping_test + SOURCES + ${ESCAPING_TEST_SRC} + PUBLIC_LIBRARIES + ${ESCAPING_TEST_PUBLIC_LIBRARIES} +) + + +# test ascii_test +set(ASCII_TEST_SRC "ascii_test.cc") +set(ASCII_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + ascii_test + SOURCES + ${ASCII_TEST_SRC} + PUBLIC_LIBRARIES + ${ASCII_TEST_PUBLIC_LIBRARIES} +) + + +# test memutil_test +set(MEMUTIL_TEST_SRC "internal/memutil_test.cc") +set(MEMUTIL_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + memutil_test + SOURCES + ${MEMUTIL_TEST_SRC} + PUBLIC_LIBRARIES + ${MEMUTIL_TEST_PUBLIC_LIBRARIES} +) + + +# test utf8_test +set(UTF8_TEST_SRC "internal/utf8_test.cc") +set(UTF8_TEST_PUBLIC_LIBRARIES absl::strings absl::base) + +absl_test( + TARGET + utf8_test + SOURCES + ${UTF8_TEST_SRC} + PUBLIC_LIBRARIES + ${UTF8_TEST_PUBLIC_LIBRARIES} +) + + +# test string_view_test +set(STRING_VIEW_TEST_SRC "string_view_test.cc") +set(STRING_VIEW_TEST_PUBLIC_LIBRARIES absl::strings absl_throw_delegate absl::base) + +absl_test( + TARGET + string_view_test + SOURCES + ${STRING_VIEW_TEST_SRC} + PUBLIC_LIBRARIES + ${STRING_VIEW_TEST_PUBLIC_LIBRARIES} +) + + +# test substitute_test +set(SUBSTITUTE_TEST_SRC "substitute_test.cc") +set(SUBSTITUTE_TEST_PUBLIC_LIBRARIES absl::strings absl::base) + +absl_test( + TARGET + substitute_test + SOURCES + ${SUBSTITUTE_TEST_SRC} + PUBLIC_LIBRARIES + ${SUBSTITUTE_TEST_PUBLIC_LIBRARIES} +) + + +# test str_replace_test +set(STR_REPLACE_TEST_SRC "str_replace_test.cc") +set(STR_REPLACE_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate) + +absl_test( + TARGET + str_replace_test + SOURCES + ${STR_REPLACE_TEST_SRC} + PUBLIC_LIBRARIES + ${STR_REPLACE_TEST_PUBLIC_LIBRARIES} +) + + +# test str_split_test +set(STR_SPLIT_TEST_SRC "str_split_test.cc") +set(STR_SPLIT_TEST_PUBLIC_LIBRARIES absl::strings absl::base absl_throw_delegate) + +absl_test( + TARGET + str_split_test + SOURCES + ${STR_SPLIT_TEST_SRC} + PUBLIC_LIBRARIES + ${STR_SPLIT_TEST_PUBLIC_LIBRARIES} +) + + +# test ostringstream_test +set(OSTRINGSTREAM_TEST_SRC "internal/ostringstream_test.cc") + +absl_test( + TARGET + ostringstream_test + SOURCES + ${OSTRINGSTREAM_TEST_SRC} +) + + +# test resize_uninitialized_test +set(RESIZE_UNINITIALIZED_TEST_SRC "internal/resize_uninitialized_test.cc") + +absl_test( + TARGET + resize_uninitialized_test + SOURCES + ${RESIZE_UNINITIALIZED_TEST_SRC} +) + + +# test str_join_test +set(STR_JOIN_TEST_SRC "str_join_test.cc") +set(STR_JOIN_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + str_join_test + SOURCES + ${STR_JOIN_TEST_SRC} + PUBLIC_LIBRARIES + ${STR_JOIN_TEST_PUBLIC_LIBRARIES} +) + + +# test str_cat_test +set(STR_CAT_TEST_SRC "str_cat_test.cc") +set(STR_CAT_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + str_cat_test + SOURCES + ${STR_CAT_TEST_SRC} + PUBLIC_LIBRARIES + ${STR_CAT_TEST_PUBLIC_LIBRARIES} +) + + +# test numbers_test +set(NUMBERS_TEST_SRC "numbers_test.cc") +set(NUMBERS_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + numbers_test + SOURCES + ${NUMBERS_TEST_SRC} + PUBLIC_LIBRARIES + ${NUMBERS_TEST_PUBLIC_LIBRARIES} +) + + +# test strip_test +set(STRIP_TEST_SRC "strip_test.cc") +set(STRIP_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + strip_test + SOURCES + ${STRIP_TEST_SRC} + PUBLIC_LIBRARIES + ${STRIP_TEST_PUBLIC_LIBRARIES} +) + + +# test char_map_test +set(CHAR_MAP_TEST_SRC "internal/char_map_test.cc") +set(CHAR_MAP_TEST_PUBLIC_LIBRARIES absl::strings) + +absl_test( + TARGET + char_map_test + SOURCES + ${CHAR_MAP_TEST_SRC} + PUBLIC_LIBRARIES + ${CHAR_MAP_TEST_PUBLIC_LIBRARIES} +) + + + + diff --git a/absl/synchronization/CMakeLists.txt b/absl/synchronization/CMakeLists.txt new file mode 100644 index 00000000..c5c4c626 --- /dev/null +++ b/absl/synchronization/CMakeLists.txt @@ -0,0 +1,154 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND SYNCHRONIZATION_PUBLIC_HEADERS + "barrier.h" + "blocking_counter.h" + "mutex.h" + "notification.h" +) + + +list(APPEND SYNCHRONIZATION_INTERNAL_HEADERS + "internal/create_thread_identity.h" + "internal/graphcycles.h" + "internal/kernel_timeout.h" + "internal/per_thread_sem.h" + "internal/thread_pool.h" + "internal/waiter.h" +) + + + +# syncrhonisation library +list(APPEND SYNCHRONIZATION_SRC + "barrier.cc" + "blocking_counter.cc" + "internal/create_thread_identity.cc" + "internal/per_thread_sem.cc" + "internal/waiter.cc" + "internal/graphcycles.cc" + "notification.cc" + "mutex.cc" +) +set(SYNCHRONIZATION_PUBLIC_LIBRARIES absl::base absl_malloc_extension absl::time) + +absl_library( + TARGET + absl_synchronization + SOURCES + ${SYNCHRONIZATION_SRC} + PUBLIC_LIBRARIES + ${SYNCHRONIZATION_PUBLIC_LIBRARIES} + EXPORT_NAME + synchronization +) + + +# +## TESTS +# + + +# test barrier_test +set(BARRIER_TEST_SRC "barrier_test.cc") +set(BARRIER_TEST_PUBLIC_LIBRARIES absl::synchronization) + +absl_test( + TARGET + barrier_test + SOURCES + ${BARRIER_TEST_SRC} + PUBLIC_LIBRARIES + ${BARRIER_TEST_PUBLIC_LIBRARIES} +) + + +# test blocking_counter_test +set(BLOCKING_COUNTER_TEST_SRC "blocking_counter_test.cc") +set(BLOCKING_COUNTER_TEST_PUBLIC_LIBRARIES absl::synchronization) + +absl_test( + TARGET + blocking_counter_test + SOURCES + ${BLOCKING_COUNTER_TEST_SRC} + PUBLIC_LIBRARIES + ${BLOCKING_COUNTER_TEST_PUBLIC_LIBRARIES} +) + + +# test graphcycles_test +set(GRAPHCYCLES_TEST_SRC "internal/graphcycles_test.cc") +set(GRAPHCYCLES_TEST_PUBLIC_LIBRARIES absl::synchronization) + +absl_test( + TARGET + graphcycles_test + SOURCES + ${GRAPHCYCLES_TEST_SRC} + PUBLIC_LIBRARIES + ${GRAPHCYCLES_TEST_PUBLIC_LIBRARIES} +) + + +# test mutex_test +set(MUTEX_TEST_SRC "mutex_test.cc") +set(MUTEX_TEST_PUBLIC_LIBRARIES absl::synchronization) + +absl_test( + TARGET + mutex_test + SOURCES + ${MUTEX_TEST_SRC} + PUBLIC_LIBRARIES + ${MUTEX_TEST_PUBLIC_LIBRARIES} +) + + +# test notification_test +set(NOTIFICATION_TEST_SRC "notification_test.cc") +set(NOTIFICATION_TEST_PUBLIC_LIBRARIES absl::synchronization) + +absl_test( + TARGET + notification_test + SOURCES + ${NOTIFICATION_TEST_SRC} + PUBLIC_LIBRARIES + ${NOTIFICATION_TEST_PUBLIC_LIBRARIES} +) + + +# test per_thread_sem_test_common +set(PER_THREAD_SEM_TEST_COMMON_SRC "internal/per_thread_sem_test.cc") +set(PER_THREAD_SEM_TEST_COMMON_PUBLIC_LIBRARIES absl::synchronization absl::strings) + +absl_test( + TARGET + per_thread_sem_test_common + SOURCES + ${PER_THREAD_SEM_TEST_COMMON_SRC} + PUBLIC_LIBRARIES + ${PER_THREAD_SEM_TEST_COMMON_PUBLIC_LIBRARIES} +) + + + + + + + diff --git a/absl/time/CMakeLists.txt b/absl/time/CMakeLists.txt new file mode 100644 index 00000000..60f61483 --- /dev/null +++ b/absl/time/CMakeLists.txt @@ -0,0 +1,78 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND TIME_PUBLIC_HEADERS + "clock.h" + "time.h" +) + + +list(APPEND TIME_INTERNAL_HEADERS + "internal/test_util.h" +) + +list(APPEND TIME_SRC + "time.cc" + "clock.cc" + "duration.cc" + "format.cc" + ${TIME_PUBLIC_HEADERS} + ${TIME_INTERNAL_HEADERS} +) +set(TIME_PUBLIC_LIBRARIES absl::base absl::stacktrace absl::int128 cctz) + +absl_library( + TARGET + absl_time + SOURCES + ${TIME_SRC} + PUBLIC_LIBRARIES + ${TIME_PUBLIC_LIBRARIES} + PUBLIC_INCLUDE_DIRS + ${CCTZ_INCLUDE_DIRS} + EXPORT_NAME + time +) + + + +# +## TESTS +# + +# test time_test +list(APPEND TIME_TEST_SRC + "time_test.cc" + "clock_test.cc" + "duration_test.cc" + "format_test.cc" + "time_norm_test.cc" + "time_test.cc" + "time_zone_test.cc" + "internal/test_util.cc" +) +set(TIME_TEST_PUBLIC_LIBRARIES absl::time) + +absl_test( + TARGET + time_test + SOURCES + ${TIME_TEST_SRC} + PUBLIC_LIBRARIES + ${TIME_TEST_PUBLIC_LIBRARIES} +) + + diff --git a/absl/types/CMakeLists.txt b/absl/types/CMakeLists.txt new file mode 100644 index 00000000..95b19fec --- /dev/null +++ b/absl/types/CMakeLists.txt @@ -0,0 +1,153 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + +list(APPEND TYPES_PUBLIC_HEADERS + "any.h" + "bad_any_cast.h" + "bad_optional_access.h" + "optional.h" + "span.h" +) + + + +list(APPEND BAD_ANY_CAST_SRC + "bad_any_cast.cc" + ${TYPES_PUBLIC_HEADERS} +) +set(BAD_ANY_CAST_PUBLIC_LIBRARIES absl::base) + +absl_library( + TARGET + absl_bad_any_cast + SOURCES + ${BAD_ANY_CAST_SRC} + PUBLIC_LIBRARIES + ${BAD_ANY_CAST_PUBLIC_LIBRARIES} +) + + + +set(OPTIONAL_SRC "optional.cc") +set(OPTIONAL_PUBLIC_LIBRARIES absl::base) + +absl_library( + TARGET + absl_optional + SOURCES + ${OPTIONAL_SRC} + PUBLIC_LIBRARIES + ${OPTIONAL_PUBLIC_LIBRARIES} +) + + +set(BAD_OPTIONAL_ACCESS_SRC "bad_optional_access.cc") +set(BAD_OPTIONAL_ACCESS_LIBRARIES absl::base) + +absl_library( + TARGET + absl_bad_optional_access + SOURCES + ${BAD_OPTIONAL_ACCESS_SRC} + PUBLIC_LIBRARIES + ${BAD_OPTIONAL_ACCESS_PUBLIC_LIBRARIES} +) + + + +absl_header_library( + TARGET + absl_types + PUBLIC_LIBRARIES + absl_optional absl_bad_any_cast absl_bad_optional_access + EXPORT_NAME + types +) + +# +## TESTS +# + + +# test any_test +set(ANY_TEST_SRC "any_test.cc") +set(ANY_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate absl_bad_any_cast test_instance_tracker_lib) + +absl_test( + TARGET + any_test + SOURCES + ${ANY_TEST_SRC} + PUBLIC_LIBRARIES + ${ANY_TEST_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${ABSL_EXCEPTIONS_FLAG} +) + + +# test any_test_noexceptions +absl_test( + TARGET + any_test_noexceptions + SOURCES + ${ANY_TEST_SRC} + PUBLIC_LIBRARIES + ${ANY_TEST_PUBLIC_LIBRARIES} +) + + +# test span_test +set(SPAN_TEST_SRC "span_test.cc") +set(SPAN_TEST_PUBLIC_LIBRARIES absl::base absl::strings absl_throw_delegate absl_bad_any_cast test_instance_tracker_lib) + +absl_test( + TARGET + span_test + SOURCES + ${SPAN_TEST_SRC} + PUBLIC_LIBRARIES + ${SPAN_TEST_PUBLIC_LIBRARIES} + PRIVATE_COMPILE_FLAGS + ${ABSL_EXCEPTIONS_FLAG} +) + + +# test span_test_noexceptions +absl_test( + TARGET + span_test_noexceptions + SOURCES + ${SPAN_TEST_SRC} + PUBLIC_LIBRARIES + ${SPAN_TEST_PUBLIC_LIBRARIES} +) + + + +# test optional_test +set(OPTIONAL_TEST_SRC "optional_test.cc") +set(OPTIONAL_TEST_PUBLIC_LIBRARIES absl::base absl_throw_delegate absl_optional bad_optional_access) + +absl_test( + TARGET + optional_test + SOURCES + ${OPTIONAL_TEST_SRC} + PUBLIC_LIBRARIES + ${OPTIONAL_TEST_PUBLIC_LIBRARIES} +) + + diff --git a/absl/utility/CMakeLists.txt b/absl/utility/CMakeLists.txt new file mode 100644 index 00000000..daf34178 --- /dev/null +++ b/absl/utility/CMakeLists.txt @@ -0,0 +1,60 @@ +# +# Copyright 2017 The Abseil Authors. +# +# 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. +# + + +list(APPEND UTILITY_PUBLIC_HEADERS + "utility.h" +) + + + +list(APPEND UTILITY_SRC + "utility.cc" + ${UTILITY_PUBLIC_HEADERS} +) + +absl_library( + TARGET + absl_utility + SOURCES + ${UTILITY_SRC} + PUBLIC_LIBRARIES + ${UTILITY_PUBLIC_LIBRARIES} + EXPORT_NAME + utility +) + + + +# +## TESTS +# + +# test utility_test +set(UTILITY_TEST_SRC "utility_test.cc") +set(UTILITY_TEST_PUBLIC_LIBRARIES absl::utility) + +absl_test( + TARGET + utility_test + SOURCES + ${UTILITY_TEST_SRC} + PUBLIC_LIBRARIES + ${UTILITY_TEST_PUBLIC_LIBRARIES} +) + + + -- cgit v1.2.3