Skip to content

Commit

Permalink
Merge pull request microsoft#1800 from KindDragon/protobuf-fix
Browse files Browse the repository at this point in the history
[protobuf] Fix define PROTOBUF_USE_DLLS with static linking
  • Loading branch information
alexkaratarakis authored Sep 9, 2017
2 parents 5a46f8e + 5ad0d81 commit f52106a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ports/protobuf/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: protobuf
Version: 3.4.0
Version: 3.4.0-1
Build-Depends: zlib
Description: Protocol Buffers - Google's data interchange format
14 changes: 5 additions & 9 deletions ports/protobuf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ else()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
endif()

foreach(FILE ${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h)
file(READ ${FILE} _contents)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
string(REPLACE "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" "\#define PROTOBUF_USE_DLLS 1\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" _contents "${_contents}")
else()
string(REPLACE "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" "\#define PROTOBUF_USE_DLLS 0\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" _contents "${_contents}")
endif()
file(WRITE ${FILE} "${_contents}")
endforeach()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(READ ${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h _contents)
string(REPLACE "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" "\#define PROTOBUF_USE_DLLS\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" _contents "${_contents}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h "${_contents}")
endif()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright)
file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
Expand Down

0 comments on commit f52106a

Please sign in to comment.