Skip to content

Commit

Permalink
Merge 5a2491d into 39cd58f
Browse files Browse the repository at this point in the history
  • Loading branch information
lipnitsk committed May 13, 2020
2 parents 39cd58f + 5a2491d commit df882a3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
1 change: 0 additions & 1 deletion .commit_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ if ! git checkout "${DOC_BRANCH}"; then
fi

touch "$HTMLDIR/.nojekyll"
echo lib.protobuf-c.io > "$HTMLDIR/CNAME"

GIT_INDEX_FILE="$INDEX_FILE" GIT_WORK_TREE="$HTMLDIR" \
git add --no-ignore-removal .
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
global:
- PROTOBUF_VERSION=3.7.1
- PKG_CONFIG_PATH=$HOME/protobuf-$PROTOBUF_VERSION-bin/lib/pkgconfig
- CMAKE_PREFIX_PATH=$HOME/protobuf-$PROTOBUF_VERSION-bin

install:
- pip install --user cpp-coveralls
Expand All @@ -27,6 +28,7 @@ script:
- ./configure && make -j2 distcheck VERBOSE=1 && make clean
- ./configure --enable-valgrind-tests CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined" && make -j2 distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-valgrind-tests CFLAGS=\"-fsanitize=undefined -fno-sanitize-recover=undefined\"" VERBOSE=1 && make clean
- ./configure --enable-code-coverage && make -j2 && make check
- ( mkdir build-cmake/bin && cd build-cmake/bin && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=protobuf-c-bin ../ && make -j2 && make test && make install)

after_success:
- cpp-coveralls --build-root . --exclude t/ --exclude /usr/include --exclude protobuf-$PROTOBUF_VERSION --exclude protoc-c
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If building from a git checkout, the `autotools` (`autoconf`, `automake`, `libto

## Documentation

See the [online Doxygen documentation here](http://lib.protobuf-c.io) or [the Wiki](https://github.com/protobuf-c/protobuf-c/wiki) for a detailed reference. The Doxygen documentation can be built from the source tree by running:
See the [online Doxygen documentation here](https://protobuf-c.github.io/protobuf-c) or [the Wiki](https://github.com/protobuf-c/protobuf-c/wiki) for a detailed reference. The Doxygen documentation can be built from the source tree by running:

make html

Expand Down
44 changes: 41 additions & 3 deletions build-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
SET(PACKAGE protobuf-c)
SET(PACKAGE_NAME protobuf-c)
SET(PACKAGE_VERSION 1.3.3)

SET(PACKAGE_URL https://github.com/protobuf-c/protobuf-c)
SET(PACKAGE_DESCRIPTION "Protocol Buffers implementation in C")

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)

Expand All @@ -10,6 +11,12 @@ PROJECT(protobuf-c)
#options
option(MSVC_STATIC_BUILD "MSVC_STATIC_BUILD" OFF)
option(BUILD_PROTO3 "BUILD_PROTO3" ON)
option(BUILD_PROTOC "Build protoc-gen-c" ON)
if(CMAKE_BUILD_TYPE MATCHES Debug)
option(BUILD_TESTS "Build tests" ON)
else()
option(BUILD_TESTS "Build tests" OFF)
endif()

INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
Expand Down Expand Up @@ -40,6 +47,8 @@ ADD_LIBRARY(protobuf-c ${PC_SOURCES})

INCLUDE_DIRECTORIES(${MAIN_DIR})
INCLUDE_DIRECTORIES(${MAIN_DIR}/protobuf-c)

IF(BUILD_PROTOC)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) # for generated files

FIND_PACKAGE(Protobuf REQUIRED)
Expand All @@ -48,6 +57,7 @@ INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
if (BUILD_PROTO3)
ADD_DEFINITIONS(-DHAVE_PROTO3)
endif()
ENDIF()

if (MSVC AND MSVC_STATIC_BUILD)
# In case we are building static libraries, link also the runtime library statically
Expand All @@ -65,6 +75,11 @@ if (MSVC AND MSVC_STATIC_BUILD)
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif (MSVC AND MSVC_STATIC_BUILD)

IF(BUILD_PROTOC)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc )
ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC})

Expand All @@ -84,7 +99,7 @@ FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR)
ENDFUNCTION()


IF(CMAKE_BUILD_TYPE MATCHES Debug)
IF(BUILD_TESTS)
ENABLE_TESTING()

GENERATE_TEST_SOURCES(${TEST_DIR}/test.proto t/test.pb-c.c t/test.pb-c.h)
Expand Down Expand Up @@ -131,16 +146,38 @@ ADD_EXECUTABLE(test-generated-code3 ${TEST_DIR}/generated-code/test-generated-co
TARGET_COMPILE_DEFINITIONS(test-generated-code3 PUBLIC -DPROTO3)
TARGET_LINK_LIBRARIES(test-generated-code3 protobuf-c)

ENDIF() # BUILD_TESTS

# https://github.com/protocolbuffers/protobuf/issues/5107
IF(CMAKE_HOST_UNIX)
FIND_PACKAGE(Threads REQUIRED)
TARGET_LINK_LIBRARIES(protoc-gen-c ${CMAKE_THREAD_LIBS_INIT})
IF(CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(cxx-generate-packed-data ${CMAKE_THREAD_LIBS_INIT})
ENDIF()
ENDIF()

INSTALL(TARGETS protoc-gen-c protobuf-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
INSTALL(TARGETS protoc-gen-c RUNTIME DESTINATION bin)
ENDIF() # BUILD_PROTOC

INSTALL(TARGETS protobuf-c LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c)
INSTALL(FILES ${MAIN_DIR}/protobuf-c/protobuf-c.h DESTINATION include)

IF(CMAKE_HOST_UNIX)
INSTALL(CODE "EXECUTE_PROCESS (COMMAND ln -sf protoc-gen-c protoc-c WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)")
ENDIF()

INCLUDE(GNUInstallDirs)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix \${prefix})
SET(bindir \${exec_prefix}/${CMAKE_INSTALL_BINDIR})
SET(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
SET(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
CONFIGURE_FILE(${MAIN_DIR}/protobuf-c/libprotobuf-c.pc.in libprotobuf-c.pc @ONLY)
INSTALL(FILES ${CMAKE_BINARY_DIR}/libprotobuf-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

IF(BUILD_TESTS)
INCLUDE(Dart)

SET(DART_TESTING_TIMEOUT 5)
Expand All @@ -150,6 +187,7 @@ ADD_TEST(test-generated-code3 test-generated-code3)
ADD_TEST(test-issue220 test-issue220)
ADD_TEST(test-issue251 test-issue251)
ADD_TEST(test-version test-version)
ENDIF()


INCLUDE(CPack)
7 changes: 4 additions & 3 deletions protobuf-c/libprotobuf-c.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ libdir=@libdir@
includedir=@includedir@
bindir=@bindir@

Name: libprotobuf-c
Description: Protocol Buffers C library
Version: @VERSION@
Name: @PACKAGE_NAME@
Description: @PACKAGE_DESCRIPTION@
Version: @PACKAGE_VERSION@
URL: @PACKAGE_URL@
Libs: -L${libdir} -lprotobuf-c
Libs.private:
Cflags: -I${includedir}

0 comments on commit df882a3

Please sign in to comment.