diff --git a/CMakeLists.txt b/CMakeLists.txt index fc72593fe..177c6a5c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,8 +119,6 @@ set(CMAKE_CXX_FLAGS "/MP /EHsc") #set(CMAKE_CXX_FLAGS_RELEASE "-O3") else() -find_package(Protobuf REQUIRED) -include_directories(${Protobuf_INCLUDE_DIRS}) find_library(IROHA_ED25519 ed25519 PATHS "dependencies/iroha-ed25519/build" REQUIRED) # set vars for mariadb cmake files @@ -143,7 +141,7 @@ if(WIN32) TARGET_LINK_LIBRARIES(Gradido_LoginServer optimized ${MYSQL_LIBRARIES} Shlwapi) TARGET_LINK_LIBRARIES(Gradido_LoginServer debug ${COMPILED_MARIADB_CLIENT_DEBUG} Shlwapi) else() -target_link_libraries(Gradido_LoginServer libmariadb ${Protobuf_LIBRARIES} -pthread) +target_link_libraries(Gradido_LoginServer libmariadb -pthread) endif() # install @@ -173,7 +171,7 @@ if(WIN32) TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test optimized ${MYSQL_LIBRARIES} Shlwapi) TARGET_LINK_LIBRARIES(Gradido_LoginServer_Test debug ${COMPILED_MARIADB_CLIENT_DEBUG} Shlwapi) else() - target_link_libraries(Gradido_LoginServer_Test libmariadb ${Protobuf_LIBRARIES} -pthread) + target_link_libraries(Gradido_LoginServer_Test libmariadb -pthread) endif() add_test(NAME main COMMAND Gradido_LoginServer_Test) diff --git a/Dockerfile b/Dockerfile index 1220b5279..d38008247 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,16 @@ +# Build protoc +FROM gcc:7.5 as protoc_build +RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git +WORKDIR /protobuf + +RUN git checkout v3.9.1 +RUN ./autogen.sh +RUN ./configure --enable-static=yes +RUN make -j$(grep processor /proc/cpuinfo | wc -l) +RUN make check + +CMD ["./protobuf"] + # Build From conanio/gcc7 as build @@ -5,26 +18,21 @@ From conanio/gcc7 as build ENV DOCKER_WORKDIR="/code" USER root -RUN apt-get update && \ - apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev && \ - apt-get autoclean && \ - apt-get autoremove && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +#RUN apt-get update && \ +# apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev && \ +# apt-get autoclean && \ +# apt-get autoremove && \ +# apt-get clean && \ +# rm -rf /var/lib/apt/lists/* #RUN grep processor /proc/cpuinfo | wc -l -#RUN mkdir -p "/helper" -#WORKDIR "/helper" -#RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git -#RUN cd protobuf && \ - #git checkout v3.14.0 && \ - #./autogen.sh && \ - #./configure && \ - #make -j$(grep processor /proc/cpuinfo | wc -l) && \ - #make check && \ - #make install && \ - #ldconfig +COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/ +COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20 +COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20 +COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/ +COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/ + RUN mkdir -p ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR} diff --git a/conanfile.txt b/conanfile.txt index a6c09d9fa..96bd6f5c8 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,6 +1,7 @@ [requires] Poco/1.9.4@pocoproject/stable libsodium/1.0.18@bincrafters/stable +protobuf/3.9.1@bincrafters/stable boost/1.71.0@conan/stable gtest/1.8.1@bincrafters/stable