Skip to content

Commit

Permalink
Release fix (#219)
Browse files Browse the repository at this point in the history
* bump version

* cleanup centos script

* update windows workflows

* drop gtest for windows
  • Loading branch information
bcebere authored Jan 20, 2021
1 parent abd3b3c commit dc78061
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 124 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/scripts/build_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ set PATH=%PATH%;%programfiles%/protobuf/bin/;%programfiles(x86)%/protobuf/bin/
:: The general recommendation is to use MD, but for that we need to build and use protobufs as DLL.
set _CL_=/MT

protoc --proto_path=tenseal\proto --cpp_out=tenseal\proto tenseal\proto\tensealcontext.proto
protoc --proto_path=tenseal\proto --cpp_out=tenseal\proto tenseal\proto\tensors.proto

pip install .
19 changes: 0 additions & 19 deletions .github/workflows/scripts/install_req_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,3 @@ echo on
python -m pip install --upgrade pip
pip install -r ./requirements_dev.txt || goto :error
pip install setuptools wheel twine auditwheel

set _CL_=/MT

git clone https://github.com/google/protobuf.git
cd protobuf
git checkout -b 3.12.x
git submodule init && git submodule update

mkdir tmp && cd tmp

cmake -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF ..\cmake || goto :error
cmake -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF --build . || goto :error
cmake --build . --target install --config Release || goto :error

goto :EOF

:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%
8 changes: 0 additions & 8 deletions .github/workflows/scripts/run_gtest_windows.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
echo on

set _CL_=/MT

cmake -D BUILD_TEST=TRUE .
cmake -D BUILD_TEST=TRUE --build .
cmake --build . --target install

.\Debug\tenseal_tests.exe
131 changes: 74 additions & 57 deletions cmake/protobuf.cmake
Original file line number Diff line number Diff line change
@@ -1,61 +1,78 @@
set(Protobuf_USE_STATIC_LIBS ON)
set(Protobuf_MSVC_STATIC_RUNTIME OFF)

set(Protobuf_ROOT ${CMAKE_SOURCE_DIR}/third_party/protobuf/cmake)
set(Protobuf_DIR ${Protobuf_ROOT}/${CMAKE_INSTALL_LIBDIR}/cmake/protobuf)

message(STATUS "Setting up protobuf ...")
execute_process(
COMMAND
${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -D protobuf_BUILD_TESTS=OFF -D protobuf_BUILD_PROTOC_BINARIES=ON -D CMAKE_POSITION_INDEPENDENT_CODE=ON -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${Protobuf_ROOT})
if(result)
message(FATAL_ERROR "Failed to download protobuf (${result})!")
endif()

message(STATUS "Building protobuf ...")
execute_process(
COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${Protobuf_ROOT})
if(result)
message(FATAL_ERROR "Failed to build protobuf (${result})!")
endif()

message(STATUS "Installing protobuf ...")
if(WIN32)
include_directories(protobuf/src)
link_libraries("$ENV{PROGRAMFILES\(x86\)}/protobuf/lib/libprotobuf-lite.lib")
link_libraries("$ENV{PROGRAMFILES\(x86\)}/protobuf/lib/libprotobuf.lib")
link_libraries("$ENV{PROGRAMFILES\(x86\)}/protobuf/lib/libprotoc.lib")
else()
set(Protobuf_USE_STATIC_LIBS ON)
set(Protobuf_DEBUG ON)
set(Protobuf_MSVC_STATIC_RUNTIME OFF)

set(Protobuf_ROOT ${CMAKE_SOURCE_DIR}/third_party/protobuf/cmake)
set(Protobuf_DIR
${CMAKE_SOURCE_DIR}/third_party/protobuf/cmake/lib/cmake/protobuf/)

message(STATUS "Setting up protobuf ...")
execute_process(
COMMAND
${CMAKE_COMMAND} -D protobuf_BUILD_TESTS=OFF -D
protobuf_MSVC_STATIC_RUNTIME=OFF -D protobuf_BUILD_LIBPROTOC=ON -D
protobuf_BUILD_PROTOC_BINARIES=ON -D CMAKE_POSITION_INDEPENDENT_CODE=ON -G
"${CMAKE_GENERATOR}" .
OUTPUT_QUIET
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
RESULT_VARIABLE result
WORKING_DIRECTORY ${Protobuf_ROOT})
if(result)
message(FATAL_ERROR "Failed to download protobuf (${result})!")
endif()

message(STATUS "Building protobuf ...")
execute_process(
COMMAND ${CMAKE_COMMAND} --build .
OUTPUT_QUIET
RESULT_VARIABLE result
WORKING_DIRECTORY ${Protobuf_ROOT})
if(result)
message(FATAL_ERROR "Failed to build protobuf (${result})!")
endif()

find_package(Protobuf REQUIRED HINTS ${Protobuf_ROOT}/lib/cmake/protobuf)

include(${Protobuf_ROOT}/lib/cmake/protobuf/protobuf-config.cmake)
include(${Protobuf_ROOT}/lib/cmake/protobuf/protobuf-module.cmake)
include(${Protobuf_ROOT}/lib/cmake/protobuf/protobuf-options.cmake)
include(${Protobuf_ROOT}/lib/cmake/protobuf/protobuf-targets.cmake)

if(Protobuf_FOUND)
message(STATUS "Protobuf version : ${Protobuf_VERSION}")
message(STATUS "Protobuf include path : ${Protobuf_INCLUDE_DIRS}")
message(STATUS "Protobuf libraries : ${Protobuf_LIBRARIES}")
message(STATUS "Protobuf compiler libraries : ${Protobuf_PROTOC_LIBRARIES}")
message(STATUS "Protobuf lite libraries : ${Protobuf_LITE_LIBRARIES}")
else()
message(
WARNING
"Protobuf package not found -> specify search path via Protobuf_ROOT variable"
)
endif()

include_directories(${Protobuf_INCLUDE_DIRS})
add_subdirectory(tenseal/proto)
if(result)
message(FATAL_ERROR "Failed to build protobuf (${result})!")
endif()
endif()

find_package(Protobuf REQUIRED HINTS ${Protobuf_DIR})

include(${Protobuf_DIR}/protobuf-config.cmake)
include(${Protobuf_DIR}/protobuf-module.cmake)
include(${Protobuf_DIR}/protobuf-options.cmake)
include(${Protobuf_DIR}/protobuf-targets.cmake)

if(Protobuf_FOUND)
message(STATUS "Protobuf version : ${Protobuf_VERSION}")
message(STATUS "Protobuf include path : ${Protobuf_INCLUDE_DIRS}")
message(STATUS "Protobuf libraries : ${Protobuf_LIBRARIES}")
message(STATUS "Protobuf compiler libraries : ${Protobuf_PROTOC_LIBRARIES}")
message(STATUS "Protobuf lite libraries : ${Protobuf_LITE_LIBRARIES}")
message(STATUS "Protobuf protoc : ${Protobuf_PROTOC_EXECUTABLE}")
else()
message(
WARNING
"Protobuf package not found -> specify search path via Protobuf_ROOT variable"
)
endif()

include_directories(${Protobuf_INCLUDE_DIRS})

set(PROTO_ROOT ${CMAKE_SOURCE_DIR}/tenseal/proto)

execute_process(
COMMAND ${Protobuf_PROTOC_EXECUTABLE} --proto_path=${PROTO_ROOT}/
--cpp_out=${PROTO_ROOT}/ ${PROTO_ROOT}/tensealcontext.proto
COMMAND ${Protobuf_PROTOC_EXECUTABLE} --proto_path=${PROTO_ROOT}/
--cpp_out=${PROTO_ROOT}/ ${PROTO_ROOT}/tensors.proto
RESULT_VARIABLE result
WORKING_DIRECTORY ${Protobuf_ROOT})
if(result)
message(FATAL_ERROR "Failed to install protobuf (${result})!")
endif()

include_directories(${PROTO_ROOT})
set(PROTO_SOURCES ${PROTO_ROOT}/tensealcontext.pb.cc
${PROTO_ROOT}/tensors.pb.cc)

add_library(tenseal_proto ${PROTO_SOURCES})
target_link_libraries(tenseal_proto INTERFACE ${Protobuf_LIBRARIES})
10 changes: 2 additions & 8 deletions cmake/tenseal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ set(SOURCES
${TENSEAL_BASEDIR}/cpp/tensors/ckkstensor.cpp
${TENSEAL_BASEDIR}/cpp/tensors/ckksvector.cpp
${TENSEAL_BASEDIR}/cpp/tensors/utils/utils.cpp)
if(WIN32)
set(SOURCES ${SOURCES} ${TENSEAL_BASEDIR}/proto/tensealcontext.pb.cc
${TENSEAL_BASEDIR}/proto/tensors.pb.cc)
endif()

add_library(tenseal SHARED ${SOURCES})
pybind11_add_module(_tenseal_cpp ${SOURCES} ${TENSEAL_BASEDIR}/binding.cpp)
Expand All @@ -33,7 +29,5 @@ target_include_directories(_tenseal_cpp PUBLIC ${xtensor_INCLUDE_DIRS})
target_link_libraries(_sealapi_cpp PRIVATE seal)
target_link_libraries(_tenseal_cpp PRIVATE seal xtensor)
target_link_libraries(tenseal PRIVATE seal xtensor)
if(NOT WIN32)
target_link_libraries(tenseal PRIVATE tenseal_proto)
target_link_libraries(_tenseal_cpp PRIVATE tenseal_proto)
endif()
target_link_libraries(tenseal PRIVATE tenseal_proto)
target_link_libraries(_tenseal_cpp PRIVATE tenseal_proto)
4 changes: 1 addition & 3 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ if(${BUILD_TEST})
${TENSEAL_TESTS_BASEDIR}/tensors/bfvvector_test.cpp)
add_executable(tenseal_tests ${TESTING_SOURCES} ${SOURCES})
target_link_libraries(tenseal_tests PRIVATE gtest gtest_main seal)
if(NOT WIN32)
target_link_libraries(tenseal_tests PRIVATE tenseal tenseal_proto)
endif()
target_link_libraries(tenseal_tests PRIVATE tenseal tenseal_proto)
add_test(tenseal_tests tenseal_tests)
endif()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.0a1
current_version = 0.3.0a2
commit = True
tag = True
files = tenseal/version.py
Expand Down
24 changes: 0 additions & 24 deletions tenseal/proto/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tenseal/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0a1"
__version__ = "0.3.0a2"

0 comments on commit dc78061

Please sign in to comment.