Skip to content

Commit

Permalink
fix release build
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Dec 13, 2024
1 parent 4b92594 commit dadbaef
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
export CXX=g++-11
export TARGET=all
mkdir -p build && cd build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build
run: |
Expand Down
32 changes: 20 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ else()
set( BOOST_LIBS_4_BLS boost_program_options )
endif()

set (WITH_PROCPS OFF)
set(WITH_PROCPS OFF)

set(BLS_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/bls
${DEPS_SOURCES_ROOT}
${DEPS_INSTALL_ROOT}
${CMAKE_CURRENT_SOURCE_DIR}/deps/include
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/bls
${DEPS_SOURCES_ROOT}
${DEPS_INSTALL_ROOT}
${CMAKE_CURRENT_SOURCE_DIR}/deps/include
PARENT_SCOPE
)

target_include_directories(bls PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(bls PRIVATE ff ${CRYPTOPP_LIBRARY} ${GMPXX_LIBRARY} ${GMP_LIBRARY})
Expand Down Expand Up @@ -245,7 +245,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(bls_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(bls_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(bls_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(bls_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME bls_tests COMMAND bls_unit_test)
Expand All @@ -255,7 +257,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(dkg_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(dkg_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(dkg_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(dkg_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME dkg_tests COMMAND dkg_unit_test)
Expand All @@ -265,7 +269,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(bls_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(bls_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(bls_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(bls_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME bls_test COMMAND bls_test)
Expand All @@ -281,7 +287,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(utils_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(utils_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(utils_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(utils_unit_test PRIVATE bls te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME utils_tests COMMAND utils_unit_test)
Expand Down
2 changes: 2 additions & 0 deletions third_party/cryptlite/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

#ifndef _CRYPTLITE_SHA256_H_
#define _CRYPTLITE_SHA256_H_
#include <third_party/cryptlite/base64.h>
Expand Down
77 changes: 40 additions & 37 deletions threshold_encryption/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ project(libTE)
option(BUILD_TESTS "Build tests" ON)

if(BUILD_TESTS)
enable_testing()
enable_testing()
endif()

set(sources
threshold_encryption.cpp
TEDecryptSet.cpp
TEPrivateKeyShare.cpp
TEPrivateKey.cpp
TEPublicKey.cpp
TEPublicKeyShare.cpp
${DKG_DIR}/dkg.cpp
${DKG_DIR}/DKGTEWrapper.cpp
${DKG_DIR}/DKGTESecret.cpp
${TOOLS_DIR}/utils.cpp
threshold_encryption.cpp
TEDecryptSet.cpp
TEPrivateKeyShare.cpp
TEPrivateKey.cpp
TEPublicKey.cpp
TEPublicKeyShare.cpp
${DKG_DIR}/dkg.cpp
${DKG_DIR}/DKGTEWrapper.cpp
${DKG_DIR}/DKGTESecret.cpp
${TOOLS_DIR}/utils.cpp
)

set(headers
threshold_encryption.h
TEDecryptSet.h
TEPrivateKeyShare.h
TEPrivateKey.h
TEPublicKey.h
TEPublicKeyShare.h
${DKG_DIR}/dkg.h
${DKG_DIR}/DKGTEWrapper.h
${DKG_DIR}/DKGTESecret.h
${TOOLS_DIR}/utils.h
threshold_encryption.h
TEDecryptSet.h
TEPrivateKeyShare.h
TEPrivateKey.h
TEPublicKey.h
TEPublicKeyShare.h
${DKG_DIR}/dkg.h
${DKG_DIR}/DKGTEWrapper.h
${DKG_DIR}/DKGTESecret.h
${TOOLS_DIR}/utils.h
)

set(PROJECT_VERSION 0.2.0)

set (THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set (TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)
set(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)

add_library(te ${sources} ${headers})

Expand All @@ -58,37 +58,40 @@ if (EMSCRIPTEN)
endif()

if (BUILD_TESTS)
add_executable(te_unit_test ../test/unit_tests_te.cpp)
target_include_directories(te_unit_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
add_executable(te_unit_test ../test/unit_tests_te.cpp)
target_include_directories(te_unit_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
if (EMSCRIPTEN)
target_compile_options(te_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(te_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
target_compile_options(te_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(te_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
else()
target_compile_options(te_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(te_unit_test PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY})

add_test(NAME te_tests COMMAND te_unit_test)
add_test(NAME te_tests COMMAND te_unit_test)

add_executable(te_test ../test/test_TE_wrappers.cpp)
target_include_directories(te_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
if (EMSCRIPTEN)
target_compile_options(te_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(te_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
target_compile_options(te_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(te_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
else()
target_compile_options(te_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(te_test PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY})

if (EMSCRIPTEN)
add_executable(encrypt_message ../test/encryptMessageJS.cpp)
target_include_directories(encrypt_message PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
target_compile_options(encrypt_message PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(encrypt_message PROPERTIES LINK_FLAGS "-s EXIT_RUNTIME=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS=['_main'] -s MAIN_MODULE=1 --bind")
target_compile_options(encrypt_message PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(encrypt_message PROPERTIES LINK_FLAGS "-s EXIT_RUNTIME=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS=['_main'] -s MAIN_MODULE=1 --bind")
target_link_libraries(encrypt_message PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY})
endif()

if(NOT EMSCRIPTEN AND NOT APPLE)
add_executable(te_sample_sgx ../test/te_sample_sgx.cpp)
target_include_directories(te_sample_sgx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
target_link_libraries(te_sample_sgx PRIVATE te bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY}
jsonrpccpp-client jsonrpccpp-server jsonrpccpp-common jsoncpp curl pthread ssl crypto z idn2)
target_include_directories(te_sample_sgx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR})
target_link_libraries(te_sample_sgx PRIVATE te bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} jsonrpccpp-client jsonrpccpp-server jsonrpccpp-common jsoncpp curl pthread ssl crypto z idn2)
endif()

add_test(NAME te_wrap_tests COMMAND te_unit_test)
Expand Down

0 comments on commit dadbaef

Please sign in to comment.