Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Twon committed Nov 7, 2023
2 parents e824469 + a328042 commit 2760e88
Show file tree
Hide file tree
Showing 17 changed files with 1,161 additions and 159 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,25 @@ jobs:
os: ubuntu-22.04,
compiler:
{ type: GCC, version: 12, cc: "gcc-12", cxx: "g++-12", std: 20},
lib: "libstdc++11",
lib: "libstdc++12",
}
- {
name: "Ubuntu GCC-13",
os: ubuntu-22.04,
compiler:
{ type: GCC, version: 13, cc: "gcc-13", cxx: "g++-13", std: 20},
lib: "libstdc++13",
}
- {
name: "Visual Studio 2019",
os: windows-latest,
compiler: { type: VISUAL, version: 16, cc: "cl", cxx: "cl" },
}
- {
name: "Visual Studio 2022",
os: windows-latest,
compiler: { type: VISUAL, version: 17, cc: "cl", cxx: "cl" },
}
- {
name: "MacOS Apple Clang 14",
os: macos-13,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ _deps
bazel-*
build*/
out/
.cache
53 changes: 52 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ cc_library(

cc_library(
name = "polymorphic_inline_vtable",
defines = ["XYZ_POLYMORPHIC_USES_EXPERIMENTAL_INLINE_VTABLE"],
hdrs = [
"experimental/polymorphic_inline_vtable.h",
"polymorphic.h",
],
copts = ["-Iexternal/value_types/"],
defines = ["XYZ_POLYMORPHIC_USES_EXPERIMENTAL_INLINE_VTABLE"],
)

cc_library(
name = "polymorphic_sbo",
hdrs = [
"experimental/polymorphic_sbo.h",
"polymorphic.h",
],
copts = ["-Iexternal/value_types/"],
defines = ["XYZ_POLYMORPHIC_USES_EXPERIMENTAL_SMALL_BUFFER_OPTIMIZATION"],
)

cc_test(
Expand Down Expand Up @@ -96,6 +106,16 @@ cc_binary(
],
)

cc_test(
name = "polymorphic_sbo_test",
size = "small",
srcs = ["polymorphic_test.cc"],
deps = [
"polymorphic_sbo",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "polymorphic_inline_vtable_test",
size = "small",
Expand All @@ -105,6 +125,7 @@ cc_test(
"@com_google_googletest//:gtest_main",
],
)

cc_library(
name = "polymorphic_consteval_inline_vtable",
srcs = ["polymorphic_consteval.cc"],
Expand All @@ -130,3 +151,33 @@ cc_binary(
"@com_google_benchmark//:benchmark_main",
],
)

cc_library(
name = "indirect_pimpl",
srcs = [
"indirect_pimpl.cc",
"indirect_pimpl_use.cc",
],
hdrs = ["indirect_pimpl.h"],
deps = ["indirect"],
)

build_test(
name = "indirect_pimpl_build_test",
targets = ["indirect_pimpl"],
)

cc_library(
name = "polymorphic_pimpl",
srcs = [
"polymorphic_pimpl.cc",
"polymorphic_pimpl_use.cc",
],
hdrs = ["polymorphic_pimpl.h"],
deps = ["polymorphic"],
)

build_test(
name = "polymorphic_pimpl_build_test",
targets = ["polymorphic_pimpl"],
)
39 changes: 38 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,26 @@ target_compile_features(polymorphic_inline_vtable
)
target_compile_definitions(polymorphic_inline_vtable
INTERFACE
-DXYZ_POLYMORPHIC_USES_EXPERIMENTAL_INLINE_VTABLE
XYZ_POLYMORPHIC_USES_EXPERIMENTAL_INLINE_VTABLE
)

add_library(polymorphic_sbo INTERFACE)
target_include_directories(polymorphic_inline_vtable
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_sources(polymorphic_sbo
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/experimental/polymorphic_sbo.h>
)
target_compile_features(polymorphic_sbo
INTERFACE
cxx_std_23
)
target_compile_definitions(polymorphic_sbo
INTERFACE
XYZ_POLYMORPHIC_USES_EXPERIMENTAL_SMALL_BUFFER_OPTIMIZATION
)


Expand Down Expand Up @@ -161,6 +180,22 @@ if (${CPP_VALUE_TYPES_IS_NOT_SUBPROJECT})
common_compiler_settings
)

add_executable(polymorphic_sbo_test "")
target_sources(polymorphic_sbo_test
PRIVATE
polymorphic_test.cc
)
target_compile_options(polymorphic_sbo_test
PRIVATE
$<$<CXX_COMPILER_ID:Clang>:-ftemplate-backtrace-limit=0>
)
target_link_libraries(polymorphic_sbo_test
PRIVATE
polymorphic_sbo
GTest::gtest_main
common_compiler_settings
)

add_executable(value_types_benchmark "")
target_sources(value_types_benchmark
PRIVATE
Expand Down Expand Up @@ -254,6 +289,7 @@ if (${CPP_VALUE_TYPES_IS_NOT_SUBPROJECT})
include(GoogleTest)
gtest_discover_tests(indirect_test)
gtest_discover_tests(polymorphic_test)
gtest_discover_tests(polymorphic_sbo_test)
gtest_discover_tests(polymorphic_inline_vtable_test)

if (ENABLE_CODE_COVERAGE)
Expand All @@ -272,6 +308,7 @@ if (${CPP_VALUE_TYPES_IS_NOT_SUBPROJECT})
find_package(codecov)
add_coverage(indirect_test)
add_coverage(polymorphic_test)
add_coverage(polymorphic_sbo_test)
add_coverage(polymorphic_inline_vtable_test)
list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'")
coverage_evaluate()
Expand Down
3 changes: 2 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Global owner
# Global owners
@jbcoe
@twon

# CMake
CMakeLists.txt @twon
Expand Down
Loading

0 comments on commit 2760e88

Please sign in to comment.