Skip to content

Commit

Permalink
Use protobuf_generate instead of protobuf_generate_cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Dec 27, 2023
1 parent 4cf59d1 commit 5366051
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions wpimath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@ include(DownloadAndCheck)
# workaround for makefiles - for some reason parent directories aren't created.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/protobuf")
file(GLOB wpimath_proto_src src/main/proto/*.proto)
protobuf_generate_cpp(
WPIMATH_PROTO_SRCS
WPIMATH_PROTO_HDRS
# PROTOC_OUT_DIR
# "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
# PROTOS
${wpimath_proto_src}

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
add_library(wpimathproto ${wpimath_proto_src})

protobuf_generate(
TARGET
wpimathproto
LANGUAGE # This is the default, but have to make sure
cpp
OUR_VAR
test_proto_output
# EXPORT_MACRO?
PROTOC_OUT_DIR
"${CMAKE_CURRENT_BINARY_DIR}/protobuf"
IMPORT_DIRS
"src/main/proto"
)

message("WPIMATH_PROTO_SRCS: ${WPIMATH_PROTO_SRCS}")
message("WPIMATH_PROTO_HDRS: ${WPIMATH_PROTO_HDRS}")
# file(GLOB_RECURSE protoc_output RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/protobuf" "${CMAKE_CURRENT_BINARY_DIR}/protobuf/*")
# message("Output dir contents: ${protoc_output}")
message("test_proto_output: ${test_proto_output}")
file(GLOB_RECURSE protoc_output RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/protobuf" "${CMAKE_CURRENT_BINARY_DIR}/protobuf/*")
message("Output dir contents: ${protoc_output}")

function(quickbuf_generate SRCS JAVA_PACKAGE)
if(NOT ARGN)
Expand Down Expand Up @@ -207,8 +215,6 @@ endif()
file(GLOB_RECURSE wpimath_native_src src/main/native/cpp/*.cpp)
list(REMOVE_ITEM wpimath_native_src ${wpimath_jni_src})

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
add_library(wpimathproto ${WPIMATH_PROTO_SRCS} ${WPIMATH_PROTO_HDRS})
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
add_library(wpimath ${wpimath_native_src})
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
Expand Down Expand Up @@ -241,13 +247,13 @@ else()
target_link_libraries(wpimath Eigen3::Eigen)
endif()

install(DIRECTORY WPIMATH_PROTO_HDRS DESTINATION "${include_dest}/wpimath")
target_include_directories(
wpimathproto
PUBLIC
# $<BUILD_INTERFACE:${WPIMATH_PROTO_HDRS}>
$<INSTALL_INTERFACE:${include_dest}/wpimath>
)
# install(DIRECTORY WPIMATH_PROTO_HDRS DESTINATION "${include_dest}/wpimath")
# target_include_directories(
# wpimathproto
# PUBLIC
# # $<BUILD_INTERFACE:${WPIMATH_PROTO_HDRS}>
# $<INSTALL_INTERFACE:${include_dest}/wpimath>
# )

install(DIRECTORY src/main/native/thirdparty/gcem/include/ DESTINATION "${include_dest}/wpimath")
target_include_directories(
Expand Down

0 comments on commit 5366051

Please sign in to comment.