From 53660513d1b5d9eedd2619b292a99f70e151cd8b Mon Sep 17 00:00:00 2001 From: Joseph Eng Date: Wed, 27 Dec 2023 11:17:26 -0800 Subject: [PATCH] Use protobuf_generate instead of protobuf_generate_cpp --- wpimath/CMakeLists.txt | 46 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/wpimath/CMakeLists.txt b/wpimath/CMakeLists.txt index 8dc7aef7aa8..66ea2fb8446 100644 --- a/wpimath/CMakeLists.txt +++ b/wpimath/CMakeLists.txt @@ -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) @@ -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) @@ -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 - # $ - $ -) +# install(DIRECTORY WPIMATH_PROTO_HDRS DESTINATION "${include_dest}/wpimath") +# target_include_directories( +# wpimathproto +# PUBLIC +# # $ +# $ +# ) install(DIRECTORY src/main/native/thirdparty/gcem/include/ DESTINATION "${include_dest}/wpimath") target_include_directories(