diff --git a/ports/nanopb/fix-cmakelist-and-pb-header.patch b/ports/nanopb/fix-cmakelist-and-pb-header.patch new file mode 100644 index 00000000000000..366fa23205773d --- /dev/null +++ b/ports/nanopb/fix-cmakelist-and-pb-header.patch @@ -0,0 +1,49 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d241c5..4a3d31e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,11 +14,6 @@ option(nanopb_BUILD_RUNTIME "Build the headers and libraries needed at runtime" + option(nanopb_BUILD_GENERATOR "Build the protoc plugin for code generation" ON) + option(nanopb_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON) + +-find_program(nanopb_PROTOC_PATH protoc HINTS generator-bin generator) +-if(NOT EXISTS ${nanopb_PROTOC_PATH}) +- message(FATAL_ERROR "protoc compiler not found") +-endif() +- + if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "d") + endif() +@@ -39,7 +34,6 @@ if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) + set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/nanopb") + endif() + +-find_package(Python REQUIRED COMPONENTS Interpreter) + execute_process( + COMMAND ${Python_EXECUTABLE} -c + "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" +@@ -49,7 +43,9 @@ execute_process( + + if(nanopb_BUILD_GENERATOR) + set(generator_protos nanopb) +- ++ if(NOT DEFINED nanopb_PROTOC_PATH) ++ message(FATAL_ERROR "nanopb_PROTOC_PATH not defined") ++ endif() + foreach(generator_proto IN LISTS generator_protos) + string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/generator/proto/\\1.proto" generator_proto_file "${generator_proto}") + string(REGEX REPLACE "([^;]+)" "\\1_pb2.py" generator_proto_py_file "${generator_proto}") +diff --git a/pb.h b/pb.h +index 5b3e1ef..693262b 100644 +--- a/pb.h ++++ b/pb.h +@@ -170,6 +170,9 @@ extern "C" { + # if defined(__ICCARM__) + /* IAR has static_assert keyword but no _Static_assert */ + # define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); ++# elif defined(_MSC_VER) ++ /* MSVC has static_assert keyword but no _Static_assert */ ++# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); + # elif defined(PB_C99_STATIC_ASSERT) + /* Classic negative-size-array static assert mechanism */ + # define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; diff --git a/ports/nanopb/fix-python.patch b/ports/nanopb/fix-python.patch deleted file mode 100644 index f82293099958b1..00000000000000 --- a/ports/nanopb/fix-python.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d9c5e5e..4e94bb7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -41,7 +41,6 @@ endif() - if(nanopb_BUILD_GENERATOR) - set(generator_protos nanopb) - -- find_package(Python REQUIRED) - execute_process( - COMMAND ${Python_EXECUTABLE} -c - "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))" -@@ -64,10 +63,10 @@ if(nanopb_BUILD_GENERATOR) - DESTINATION ${PYTHON_INSTDIR}/proto/ - ) - endforeach() -+ install( FILES generator/proto/_utils.py -+ DESTINATION ${PYTHON_INSTDIR}/proto/ ) - endif() - --install( FILES generator/proto/_utils.py -- DESTINATION ${PYTHON_INSTDIR}/proto/ ) - - if( WIN32 ) - install( diff --git a/ports/nanopb/portfile.cmake b/ports/nanopb/portfile.cmake index cd79b8775f5980..450cc60470747a 100644 --- a/ports/nanopb/portfile.cmake +++ b/ports/nanopb/portfile.cmake @@ -3,11 +3,11 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO nanopb/nanopb - REF 0.4.5 - SHA512 2f24308440bd961a94449e253627fbe38f6c5217cd70c57e9b3ab702da3c2df03b087ccdd62518940acf6b480a1dbb440ca5681f1766a17b199010d3df7b17a1 + REF 0.4.7 + SHA512 7fb46dad8a432898c8f9e7faa90a55276670dea3b13f15b68010fe126d7f6251ef5715d0dfe5bce66582e80cfdc5d4b1e7f5947e96a058fa7181f0a45da20860 HEAD_REF master PATCHES - fix-python.patch + fix-cmakelist-and-pb-header.patch ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" nanopb_BUILD_STATIC_LIBS) @@ -21,24 +21,23 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS vcpkg_find_acquire_program(PYTHON3) -vcpkg_configure_cmake( +vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA OPTIONS -DPython_EXECUTABLE=${PYTHON3} -Dnanopb_BUILD_RUNTIME=ON -DBUILD_STATIC_LIBS=${nanopb_BUILD_STATIC_LIBS} -Dnanopb_MSVC_STATIC_RUNTIME=${nanopb_STATIC_LINKING} - -Dnanopb_PROTOC_PATH=${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX} + -Dnanopb_PROTOC_PATH="${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}" ${FEATURE_OPTIONS} ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") if(nanopb_BUILD_GENERATOR) file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/nanopb_generator.py" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") @@ -54,4 +53,4 @@ if(nanopb_BUILD_STATIC_LIBS) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() # Handle copyright -configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt") diff --git a/ports/nanopb/vcpkg.json b/ports/nanopb/vcpkg.json index dad0eff55b36e4..63e5e3300de3b3 100644 --- a/ports/nanopb/vcpkg.json +++ b/ports/nanopb/vcpkg.json @@ -1,8 +1,19 @@ { "name": "nanopb", - "version-semver": "0.4.5", + "version-semver": "0.4.7", "description": "A small code-size Protocol Buffers implementation in ANSI C.", "homepage": "https://jpa.kapsi.fi/nanopb/", + "license": "Zlib", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], "features": { "generator": { "description": "build the generator", diff --git a/versions/baseline.json b/versions/baseline.json index 058c01298482a0..711d67f309f7c1 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5209,7 +5209,7 @@ "port-version": 4 }, "nanopb": { - "baseline": "0.4.5", + "baseline": "0.4.7", "port-version": 0 }, "nanoprintf": { diff --git a/versions/n-/nanopb.json b/versions/n-/nanopb.json index ecc09b1a387fe5..972b5ab6fb0aed 100644 --- a/versions/n-/nanopb.json +++ b/versions/n-/nanopb.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "230c55c9370ee3756674be33a6d5740ff04fccda", + "version-semver": "0.4.7", + "port-version": 0 + }, { "git-tree": "855b599338a79c3a7d61c1171110e4dd49c3f164", "version-semver": "0.4.5",