libprotozero

This commit is contained in:
Skyler Hawthorne 2021-03-04 23:42:32 -05:00 committed by Henrik Grimler
parent 2b3e931134
commit c1f5b9f39c
3 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,9 @@
TERMUX_PKG_HOMEPAGE=https://github.com/mapbox/protozero
TERMUX_PKG_DESCRIPTION="Minimalistic protocol buffer decoder and encoder in C++"
TERMUX_PKG_LICENSE="BSD 2-Clause"
TERMUX_PKG_LICENSE_FILE="LICENSE.md"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.7.0
TERMUX_PKG_SRCURL=https://github.com/mapbox/protozero/archive/v${TERMUX_PKG_VERSION}.zip
TERMUX_PKG_SHA256=b1dc381cdf75bc6531f1fee13c76a72bae432660984b3316f104c74c355766fd
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DPYBIND11_FINDPYTHON=OFF"

View File

@ -0,0 +1,34 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9702d6..2b870c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#-----------------------------------------------------------------------------
+option(BUILD_TESTING "Build the tests" ON)
option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON)
if(MSVC)
@@ -71,7 +72,9 @@ if(CLANG_TIDY)
${CMAKE_SOURCE_DIR}/test/unit/*.cpp
${CMAKE_SOURCE_DIR}/tools/*.cpp
)
- add_dependencies(clang-tidy writer_tests)
+ if(BUILD_TESTING)
+ add_dependencies(clang-tidy writer_tests)
+ endif()
else()
message(STATUS "Looking for clang-tidy - not found")
message(STATUS " Build target 'clang-tidy' will not be available.")
@@ -140,7 +143,8 @@ add_subdirectory(doc)
add_subdirectory(tools)
-add_subdirectory(test)
-
+if(BUILD_TESTING)
+ add_subdirectory(test)
+endif()
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,33 @@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c769123..79d4c87 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -56,6 +56,7 @@ set(TEST_DIRS alignment
string(REGEX REPLACE "([^;]+)" "t/\\1/reader_test_cases.cpp" _test_sources "${TEST_DIRS}")
add_executable(reader_tests reader_tests.cpp ${_test_sources})
+target_link_libraries(reader_tests log)
add_test(NAME reader_tests COMMAND reader_tests)
@@ -98,7 +99,7 @@ if(PROTOBUF_FOUND)
add_executable(writer_tests writer_tests.cpp ${SOURCES} ${PROTO_SRCS} ${PROTO_HDRS})
- target_link_libraries(writer_tests ${PROTOBUF_LITE_LIBRARY})
+ target_link_libraries(writer_tests ${PROTOBUF_LITE_LIBRARY} log)
if(NOT MSVC)
set_target_properties(writer_tests PROPERTIES COMPILE_FLAGS "-pthread")
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 0d1d75a..e91dfbf 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -18,6 +18,7 @@ set(UNIT_TESTS data_view
string(REGEX REPLACE "([^;]+)" "test_\\1.cpp" _test_sources "${UNIT_TESTS}")
add_executable(unit_tests main.cpp ${_test_sources})
+target_link_libraries(unit_tests log)
add_test(NAME unit_tests COMMAND unit_tests)