aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/protobuf-c
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/protobuf-c
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/protobuf-c')
-rw-r--r--vcpkg/ports/protobuf-c/fix-crt-linkage.patch25
-rw-r--r--vcpkg/ports/protobuf-c/fix-dependency-protobuf.patch13
-rw-r--r--vcpkg/ports/protobuf-c/portfile.cmake48
-rw-r--r--vcpkg/ports/protobuf-c/vcpkg.json34
4 files changed, 120 insertions, 0 deletions
diff --git a/vcpkg/ports/protobuf-c/fix-crt-linkage.patch b/vcpkg/ports/protobuf-c/fix-crt-linkage.patch
new file mode 100644
index 0000000..2d67442
--- /dev/null
+++ b/vcpkg/ports/protobuf-c/fix-crt-linkage.patch
@@ -0,0 +1,25 @@
+diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt
+index 98b51eb..0243b80 100644
+--- a/build-cmake/CMakeLists.txt
++++ b/build-cmake/CMakeLists.txt
+@@ -74,11 +74,6 @@ if(MSVC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267 /wd4244")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244")
+
+- # Allow matching protobuf runtime dependency
+- if(NOT BUILD_SHARED_LIBS)
+- set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+- endif(NOT BUILD_SHARED_LIBS)
+-
+ endif()
+
+ get_filename_component(MAIN_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH)
+@@ -103,7 +98,7 @@ if(BUILD_PROTOC)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # for generated files
+ endif()
+
+-if(MSVC AND NOT BUILD_SHARED_LIBS)
++if (0)
+ # In case we are building static libraries, link also the runtime library
+ # statically so that MSVCR*.DLL is not required at runtime.
+ # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx This is achieved by
diff --git a/vcpkg/ports/protobuf-c/fix-dependency-protobuf.patch b/vcpkg/ports/protobuf-c/fix-dependency-protobuf.patch
new file mode 100644
index 0000000..9090429
--- /dev/null
+++ b/vcpkg/ports/protobuf-c/fix-dependency-protobuf.patch
@@ -0,0 +1,13 @@
+diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt
+index ba0b730..a5161cf 100644
+--- a/build-cmake/CMakeLists.txt
++++ b/build-cmake/CMakeLists.txt
+@@ -15,7 +15,7 @@ if(MSVC AND NOT BUILD_SHARED_LIBS)
+ set(Protobuf_USE_STATIC_LIBS ON)
+ endif()
+
+-find_package(Protobuf CONFIG)
++find_package(Protobuf CONFIG REQUIRED)
+ if(Protobuf_FOUND)
+ # Keep compatibility with FindProtobuf CMake module
+ set(PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>)
diff --git a/vcpkg/ports/protobuf-c/portfile.cmake b/vcpkg/ports/protobuf-c/portfile.cmake
new file mode 100644
index 0000000..a94702b
--- /dev/null
+++ b/vcpkg/ports/protobuf-c/portfile.cmake
@@ -0,0 +1,48 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO protobuf-c/protobuf-c
+ REF v${VERSION}
+ SHA512 c95ec5fa4d3531fb83c9db95968e62a60c5e16cb10fb390067eca35ccb9e0c65c1e667bbdc9b7aa3b8f6cf012b09a189d6833534d2a28e390f01ae0d12052a47
+ HEAD_REF master
+ PATCHES
+ fix-crt-linkage.patch
+ fix-dependency-protobuf.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ tools BUILD_PROTOC
+ test BUILD_TESTS
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}/build-cmake"
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install(ADD_BIN_TO_PATH)
+vcpkg_fixup_pkgconfig()
+vcpkg_copy_pdbs()
+
+if("tools" IN_LIST FEATURES)
+ vcpkg_copy_tools(
+ TOOL_NAMES protoc-gen-c
+ AUTO_CLEAN
+ )
+endif()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/protobuf-c")
+
+# Include files should not be duplicated into the /debug/include directory.
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Remove duplicate PDB files (vcpkg_copy_pdbs already copied them to "bin")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/protobuf-c.pdb")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/protobuf-c.pdb")
+if(NOT VCPKG_TARGET_IS_WINDOWS)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
+endif()
+
+# Handle copyright
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/protobuf-c/vcpkg.json b/vcpkg/ports/protobuf-c/vcpkg.json
new file mode 100644
index 0000000..8225a16
--- /dev/null
+++ b/vcpkg/ports/protobuf-c/vcpkg.json
@@ -0,0 +1,34 @@
+{
+ "name": "protobuf-c",
+ "version-semver": "1.5.2",
+ "description": "This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format.",
+ "homepage": "https://github.com/protobuf-c/protobuf-c",
+ "dependencies": [
+ "protobuf",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "test": {
+ "description": "Build test project.",
+ "dependencies": [
+ {
+ "name": "protobuf-c",
+ "features": [
+ "tools"
+ ]
+ }
+ ]
+ },
+ "tools": {
+ "description": "Build tools (protoc-gen-c).",
+ "supports": "!uwp"
+ }
+ }
+}