From fd0b332f4609bb3a2e3918f24ca470b1a3c2a301 Mon Sep 17 00:00:00 2001 From: Rich Gowman Date: Mon, 5 Feb 2018 13:55:20 -0500 Subject: Downgrade nanopb from 0.4.0-dev to 0.3.8. Also regenerate the protos --- cmake/FindNanopb.cmake | 2 +- cmake/external/nanopb.cmake | 40 ++++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 23 deletions(-) (limited to 'cmake') diff --git a/cmake/FindNanopb.cmake b/cmake/FindNanopb.cmake index fab6f4a..fb22aef 100644 --- a/cmake/FindNanopb.cmake +++ b/cmake/FindNanopb.cmake @@ -21,7 +21,7 @@ find_package_handle_standard_args( ) if(NANOPB_FOUND) - set(NANOPB_INCLUDE_DIRS ${NANOPB_INCLUDE_DIR} ) + set(NANOPB_INCLUDE_DIRS ${NANOPB_INCLUDE_DIR}) if (NOT TARGET nanopb) add_library(nanopb UNKNOWN IMPORTED) diff --git a/cmake/external/nanopb.cmake b/cmake/external/nanopb.cmake index d602d9a..c78613f 100644 --- a/cmake/external/nanopb.cmake +++ b/cmake/external/nanopb.cmake @@ -1,6 +1,4 @@ -# Copyright 2018 Google -# -# Licensed under the Apache License, Version 2.0 (the "License"); +# Copyright 2018 Google # # 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 # @@ -18,7 +16,7 @@ include(ExternalProjectFlags) ExternalProject_GitSource( NANOPB_GIT GIT_REPOSITORY "https://github.com/nanopb/nanopb.git" - GIT_TAG "master" # Needs the most recent. 0.3.9 doesn't fully support cmake. + GIT_TAG "0.3.8" ) ExternalProject_Add( @@ -28,34 +26,32 @@ ExternalProject_Add( ${NANOPB_GIT} + BUILD_IN_SOURCE ON + PREFIX ${PROJECT_BINARY_DIR}/external/nanopb + # Note for (not yet released) nanopb 0.4.0: nanopb will (likely) switch to + # cmake for the protoc plugin. Set these additional cmake variables to use + # it. + # -Dnanopb_BUILD_GENERATOR:BOOL=ON + # -Dnanopb_PROTOC_PATH:STRING=${FIREBASE_INSTALL_DIR}/external/protobuf/src/protobuf-build/src/protoc CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=OFF - -Dnanopb_BUILD_GENERATOR:BOOL=ON - -Dnanopb_PROTOC_PATH:STRING=${FIREBASE_INSTALL_DIR}/external/protobuf/src/protobuf-build/src/protoc BUILD_COMMAND - ${CMAKE_COMMAND} --build . - # NB: The following additional build commands are only necessary to - # regenerate the nanopb proto files. - COMMAND - ${CMAKE_COMMAND} -E make_directory /generator/proto COMMAND - ${CMAKE_COMMAND} -E copy /generator/proto/__init__.py /generator/proto/ - COMMAND - ${CMAKE_COMMAND} -E copy /generator/protoc-gen-nanopb /generator/ - COMMAND - ${CMAKE_COMMAND} -E copy /generator/nanopb_generator.py /generator/ - COMMAND - ${CMAKE_COMMAND} -E copy /nanopb_pb2.py /generator/proto/ + ${CMAKE_COMMAND} --build . + # NB: The following additional command is only necessary to regenerate the + # nanopb proto files. COMMAND - ${CMAKE_COMMAND} -E copy /plugin_pb2.py /generator/proto/ + make -C /generator/proto - # TODO: once we clone via a tag (rather than the master branch) we should - # disable updates; i.e.: - # UPDATE_COMMAND "" + # nanopb relies on $PATH for the location of protoc. cmake makes it difficult + # to adjust the path, so we'll just patch the build files with the exact + # location of protoc. + PATCH_COMMAND perl -i -pe s,protoc,${FIREBASE_INSTALL_DIR}/external/protobuf/src/protobuf-build/src/protoc,g ./CMakeLists.txt ./generator/proto/Makefile + UPDATE_COMMAND "" INSTALL_COMMAND "" ) -- cgit v1.2.3