Skip to content

Commit

Permalink
Update after rebasing on main.
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Jan 13, 2023
1 parent 1c011f5 commit ec0d86e
Showing 1 changed file with 58 additions and 7 deletions.
65 changes: 58 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

project(pybind11_protobuf)

if(MSVC)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#============================================================================
# Options
set(ABSL_PROPAGATE_CXX_STD ON)
Expand Down Expand Up @@ -49,21 +57,20 @@ add_subdirectory(external)
# message("Protobuf_LIBRARIES: ${Protobuf_LIBRARIES}")

#============================================================================
# pybind11_proto pybind11 extension module
pybind11_add_module(pybind11_proto MODULE
pybind11_protobuf/proto.cc
# pybind11_proto_utils pybind11 extension module
pybind11_add_module(pybind11_proto_utils MODULE
pybind11_protobuf/proto_utils.cc
pybind11_protobuf/proto_utils.h
)

target_link_libraries(pybind11_proto
target_link_libraries(pybind11_proto_utils
PRIVATE
absl::strings
protobuf::libprotobuf
${Python_LIBRARIES}
)

target_include_directories(pybind11_proto
target_include_directories(pybind11_proto_utils
PRIVATE
${PROJECT_SOURCE_DIR}
${Protobuf_INCLUDE_DIRS}
Expand All @@ -73,12 +80,20 @@ target_include_directories(pybind11_proto
#============================================================================
# pybind11_native_proto_caster shared library
add_library(pybind11_native_proto_caster SHARED
pybind11_protobuf/enum_type_caster.h
pybind11_protobuf/native_proto_caster.cc
# bazel: pybind_library: native_proto_caster
pybind11_protobuf/native_proto_caster.h

# bazel: pybind_library: enum_type_caster
pybind11_protobuf/enum_type_caster.h

# bazel: pybind_library: proto_cast_util
pybind11_protobuf/proto_cast_util.cc
pybind11_protobuf/proto_cast_util.h
pybind11_protobuf/proto_caster_impl.h

# bazel: cc_library::check_unknown_fields
pybind11_protobuf/check_unknown_fields.cc
pybind11_protobuf/check_unknown_fields.h
)

target_link_libraries(pybind11_native_proto_caster
Expand All @@ -103,10 +118,17 @@ target_include_directories(pybind11_native_proto_caster
#============================================================================
# pybind11_wrapped_proto_caster shared library
add_library(pybind11_wrapped_proto_caster SHARED
# bazel: pybind_library: wrapped_proto_caster
pybind11_protobuf/wrapped_proto_caster.h

# bazel: pybind_library: proto_cast_util
pybind11_protobuf/proto_cast_util.cc
pybind11_protobuf/proto_cast_util.h
pybind11_protobuf/proto_caster_impl.h

# bazel: cc_library: check_unknown_fields
pybind11_protobuf/check_unknown_fields.cc
pybind11_protobuf/check_unknown_fields.h
)

target_link_libraries(pybind11_wrapped_proto_caster
Expand All @@ -127,3 +149,32 @@ target_include_directories(pybind11_wrapped_proto_caster
${Protobuf_INCLUDE_DIRS}
${pybind11_INCLUDE_DIRS}
)

# TODO set defines
# PYBIND11_PROTOBUF_ENABLE_PYPROTO_API
# see: bazel: pybind_library: proto_cast_util

# bazel equivs. checklist
#
# bazel: pybind_library: enum_type_caster
# - enum_type_caster.h
#
# bazel: pybind_library: native_proto_caster
# - native_proto_caster.h
#
# check_unknown_fields
# enum_type_caster
# proto_cast_util
#
# bazel: pybind_library: proto_cast_util
# - proto_cast_util.cc
# - proto_cast_util.h
# - proto_caster_impl.h
#
# check_unknown_fields
#
# bazel: pybind_library: wrapped_proto_caster
# - wrapped_proto_caster.h
#
# proto_cast_util
#

0 comments on commit ec0d86e

Please sign in to comment.