-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow creation of shared library for libTink #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ if (NOT TARGET crypto) | |
"$<BUILD_INTERFACE:${boringssl_SOURCE_DIR}/src/include>") | ||
else() | ||
# Support for ED25519 was added from 1.1.1. | ||
find_package(OpenSSL 1.1.1 REQUIRED) | ||
find_package(OpenSSL REQUIRED) | ||
_create_interface_target(crypto OpenSSL::Crypto) | ||
endif() | ||
else() | ||
|
@@ -123,11 +123,13 @@ set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "Tink dependency override" FORCE) | |
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "Tink dependency override" FORCE) | ||
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Tink dependency override" FORCE) | ||
|
||
http_archive( | ||
NAME rapidjson | ||
URL https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz | ||
SHA256 bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e | ||
) | ||
if(NOT TINK_USE_INSTALLED_RAPIDJSON) | ||
http_archive( | ||
NAME rapidjson | ||
URL https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz | ||
SHA256 bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e | ||
) | ||
endif() | ||
# Rapidjson is a header-only library with no explicit target. Here we create one. | ||
add_library(rapidjson INTERFACE) | ||
target_include_directories(rapidjson INTERFACE "${rapidjson_SOURCE_DIR}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this variable populated when |
||
|
@@ -136,8 +138,12 @@ set(protobuf_BUILD_TESTS OFF CACHE BOOL "Tink dependency override" FORCE) | |
set(protobuf_BUILD_EXAMPLES OFF CACHE BOOL "Tink dependency override" FORCE) | ||
set(protobuf_INSTALL OFF CACHE BOOL "Tink dependency override" FORCE) | ||
|
||
http_archive( | ||
NAME com_google_protobuf | ||
URL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protobuf-25.1.zip | ||
SHA256 5c86c077b0794c3e9bb30cac872cf883043febfb0f992137f0a8b1c3d534617c | ||
) | ||
if(NOT TINK_USE_INSTALLED_PROTOBUF) | ||
http_archive( | ||
NAME com_google_protobuf | ||
URL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protobuf-25.1.zip | ||
SHA256 5c86c077b0794c3e9bb30cac872cf883043febfb0f992137f0a8b1c3d534617c | ||
) | ||
else() | ||
find_package(Protobuf REQUIRED) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,7 @@ endif() | |
|
||
set(TINK_VERSION_H "${TINK_GENFILE_DIR}/tink/version.h") | ||
|
||
tink_cc_library( | ||
NAME cc | ||
SRCS | ||
set(TINK_PUBLIC_APIS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
aead.h | ||
aead_config.h | ||
aead_factory.h | ||
|
@@ -74,7 +72,9 @@ tink_cc_library( | |
streaming_mac.h | ||
tink_config.h | ||
"${TINK_VERSION_H}" | ||
DEPS | ||
) | ||
|
||
set(TINK_PUBLIC_API_DEPS | ||
tink::core::aead | ||
tink::core::binary_keyset_reader | ||
tink::core::binary_keyset_writer | ||
|
@@ -139,7 +139,15 @@ tink_cc_library( | |
tink::util::validation | ||
tink::proto::config_cc_proto | ||
tink::proto::tink_cc_proto | ||
PUBLIC | ||
) | ||
|
||
tink_cc_library( | ||
NAME cc | ||
SRCS | ||
${TINK_PUBLIC_APIS} | ||
DEPS | ||
${TINK_PUBLIC_API_DEPS} | ||
PUBLIC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
) | ||
|
||
add_library(tink::static ALIAS tink_core_cc) | ||
|
@@ -1123,6 +1131,33 @@ tink_cc_test( | |
tink::util::test_matchers | ||
) | ||
|
||
|
||
if (TINK_BUILD_SHARED_LIB) | ||
add_library(tink SHARED | ||
${TINK_PUBLIC_APIS} | ||
version_script.lds | ||
exported_symbols.lds | ||
) | ||
target_link_libraries(tink | ||
PRIVATE | ||
-fuse-ld=gold # GNU ld does not support ICF. | ||
-Wl,--version-script="${CMAKE_CURRENT_SOURCE_DIR}/version_script.lds" | ||
-Wl,--gc-sections | ||
-Wl,--icf=all | ||
-Wl,--strip-all | ||
) | ||
target_include_directories(tink PUBLIC ${TINK_INCLUDE_DIRS}) | ||
target_link_libraries(tink | ||
PRIVATE | ||
-Wl,--whole-archive | ||
${TINK_PUBLIC_API_DEPS} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do this, would the |
||
-Wl,--no-whole-archive | ||
) | ||
set_target_properties(tink PROPERTIES SOVERSION ${TINK_CC_VERSION_LABEL}) | ||
|
||
install(TARGETS tink EXPORT Tink LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
|
||
tink_cc_test( | ||
NAME big_integer_test | ||
SRCS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving 1.1.1 here provides a lower bound for OpenSSL which is what we want. I my understanding correct?