只使用Qt和附带的工具构建protobufs
Build protobufs only using Qt and tools shipped with it
我在win7上开发Qt应用程序(使用包含MinGW的Windows Qt发行版),我需要使用谷歌的协议缓冲区。所以我遵循了这个如何在Windows中使用MinGW构建Google's protobuf ?我已经成功地建立了它。
但是我有必要分别安装MinGW和MSYS来实现这一点。
是否有清洁方式如何在我的应用程序中构建protobufs只是使用Qt和它的工具链?
我们创建了一个新项目,并从protobuf中添加了文件。我可以给你我的。profile文件。然后我们将这个项目包含到我们的公共项目(子项目)
QT -= gui
TARGET = protobuf
TEMPLATE = lib
CONFIG += staticlib
# DESTDIR
win32 {
CONFIG(debug, debug|release): DESTDIR = ../bin/debug
CONFIG(release, debug|release): DESTDIR = ../bin/release
}
unix {
CONFIG(debug, debug|release): DESTDIR = ../bin_unix/debug
CONFIG(release, debug|release): DESTDIR = ../bin_unix/release
}
INCLUDEPATH += ../protobuf
SOURCES +=
google/protobuf/wire_format_lite.cc
google/protobuf/wire_format.cc
google/protobuf/unknown_field_set.cc
google/protobuf/text_format.cc
google/protobuf/service.cc
google/protobuf/repeated_field.cc
google/protobuf/reflection_ops.cc
google/protobuf/message_lite.cc
google/protobuf/message.cc
google/protobuf/generated_message_util.cc
google/protobuf/generated_message_reflection.cc
google/protobuf/extension_set_heavy.cc
google/protobuf/extension_set.cc
google/protobuf/dynamic_message.cc
google/protobuf/descriptor_database.cc
google/protobuf/descriptor.pb.cc
google/protobuf/descriptor.cc
google/protobuf/compiler/parser.cc
google/protobuf/compiler/importer.cc
google/protobuf/io/zero_copy_stream_impl_lite.cc
google/protobuf/io/zero_copy_stream_impl.cc
google/protobuf/io/zero_copy_stream.cc
google/protobuf/io/tokenizer.cc
google/protobuf/io/printer.cc
google/protobuf/io/gzip_stream.cc
google/protobuf/io/coded_stream.cc
google/protobuf/stubs/substitute.cc
google/protobuf/stubs/strutil.cc
google/protobuf/stubs/structurally_valid.cc
google/protobuf/stubs/once.cc
google/protobuf/stubs/common.cc
HEADERS +=
google/protobuf/wire_format_lite_inl.h
google/protobuf/wire_format_lite.h
google/protobuf/wire_format.h
google/protobuf/unknown_field_set.h
google/protobuf/text_format.h
google/protobuf/service.h
google/protobuf/repeated_field.h
google/protobuf/reflection_ops.h
google/protobuf/message_lite.h
google/protobuf/message.h
google/protobuf/generated_message_util.h
google/protobuf/generated_message_reflection.h
google/protobuf/extension_set.h
google/protobuf/dynamic_message.h
google/protobuf/descriptor_database.h
google/protobuf/descriptor.pb.h
google/protobuf/descriptor.h
google/protobuf/compiler/parser.h
google/protobuf/compiler/importer.h
google/protobuf/io/zero_copy_stream_impl_lite.h
google/protobuf/io/zero_copy_stream_impl.h
google/protobuf/io/zero_copy_stream.h
google/protobuf/io/tokenizer.h
google/protobuf/io/printer.h
google/protobuf/io/gzip_stream.h
google/protobuf/io/coded_stream_inl.h
google/protobuf/io/coded_stream.h
google/protobuf/stubs/substitute.h
google/protobuf/stubs/strutil.h
google/protobuf/stubs/stl_util-inl.h
google/protobuf/stubs/once.h
google/protobuf/stubs/map-util.h
google/protobuf/stubs/hash.h
google/protobuf/stubs/common.h
config.h
# Turn off ALL warning for the project
win32:CONFIG += warn_off
另一种构建方法是使用这个项目:https://github.com/cjh1/protobuf,它不需要运行。/configure,但需要CMake构建系统,它可以与Qt自带的MinGW工具链集成。它目前只构建一个protobufs作为静态库(不是动态/共享),不安装头文件,但我希望最终这些功能将被内置。
相关文章:
- 在OSX上使用CMake将Adobe的XMP工具包构建为共享库的最简单方法是什么?
- 构建LLVM 10 C++工具链的问题
- 安装 v142 以使用 v142 构建工具进行构建
- cmake在构建过程中使用另一个工具检测标志
- 所有Visual Studio安装程序崩溃,可视化构建工具也无法正常工作
- 构建在VS 2013中找不到平台工具集= 'v141'
- cl.exe在哪里?(MS 构建工具 '13)
- 如何使用自动工具在单独的目录中构建
- 如果使用平台工具集构建应用,则 CCheckListBox 项在选择时会重叠'Visual Studio 2017 (v141)'
- VS 2017 构建工具失败,出现错误 MSB4019:找不到导入的项目"D:Microsoft.Cpp.Default.props"
- Rust 找不到Microsoft C++构建工具
- 将Java包移植到C++并使用Cmake作为构建工具
- 尝试将Winelib与标准macOS构建工具一起使用:得到奇怪的编译器错误
- Android NDK 中的预构建工具链和自定义工具链编译器之间的差异
- 使用集成工具构建系统
- 使用自动工具构建系统/在单独的'build'目录中构建
- 在使用自动工具构建静态/共享库时,如何避免双重编译
- 如何将 Google 测试与通过自动工具构建的项目一起使用
- Xcode 4中的命令行工具构建版本,在构建可执行文件中包含图像存在问题
- 只使用Qt和附带的工具构建protobufs