Skip to content

Commit

Permalink
protobuf: change build system to cmake
Browse files Browse the repository at this point in the history
Autotools support has been removed and replaced completely by CMake.

See related issues for details:
protocolbuffers/protobuf#7911
protocolbuffers/protobuf#10132

Drop autotools patches too.

Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
  • Loading branch information
UVV-gh authored and kraj committed Aug 27, 2022
1 parent 0cdd5a6 commit efe8103
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 68 deletions.

This file was deleted.

This file was deleted.

23 changes: 16 additions & 7 deletions meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ SRCREV = "ab840345966d0fa8e7100d771c92a73bfbadd25c"

SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=21.x;protocol=https \
file://run-ptest \
file://0001-protobuf-fix-configure-error.patch \
file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \
file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
file://0001-Fix-linking-error-with-ld-gold.patch \
"
Expand All @@ -24,12 +22,17 @@ SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.pa

S = "${WORKDIR}/git"

inherit autotools-brokensep pkgconfig ptest
inherit cmake pkgconfig ptest

PACKAGECONFIG ??= ""
PACKAGECONFIG[python] = ",,"

EXTRA_OECONF += "--with-protoc=echo"
EXTRA_OECMAKE += "\
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_BUILD_LIBPROTOC=ON \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
"

TEST_SRC_DIR = "examples"
LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
Expand All @@ -40,9 +43,15 @@ do_compile_ptest() {
# Add the location of the cross-compiled header and library files
# which haven't been installed yet.
cp "${B}/protobuf.pc" "${B}/${TEST_SRC_DIR}/protobuf.pc"
cp ${S}/${TEST_SRC_DIR}/*.cc "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/*.proto "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/*.py "${B}/${TEST_SRC_DIR}/"
cp ${S}/${TEST_SRC_DIR}/Makefile "${B}/${TEST_SRC_DIR}/"
sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Libs:|Libs: -L${B}/src/.libs|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
sed -e 's|Libs:|Libs: -L${B}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
# Until out-of-tree build of examples is supported, we have to use this approach
sed -e 's|../src/google/protobuf/.libs/timestamp.pb.o|${B}/CMakeFiles/libprotobuf.dir/src/google/protobuf/timestamp.pb.cc.o|' -i "${B}/${TEST_SRC_DIR}/Makefile"
export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"

# Save the pkgcfg sysroot variable, and update it to nothing so
Expand All @@ -54,7 +63,7 @@ do_compile_ptest() {

# Compile the tests
for lang in ${LANG_SUPPORT}; do
oe_runmake -C "${S}/${TEST_SRC_DIR}" ${lang}
oe_runmake -C "${B}/${TEST_SRC_DIR}" ${lang}
done

# Restore the pkgconfig sysroot variable
Expand All @@ -71,7 +80,7 @@ do_install_ptest() {
install "$i" "${D}/${PTEST_PATH}"
fi
done
cp "${S}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
cp "${B}/${TEST_SRC_DIR}/addressbook_pb2.py" "${D}/${PTEST_PATH}"
cd "$olddir"
}

Expand Down

0 comments on commit efe8103

Please sign in to comment.