| 1 |
set(CURRENT_LIB_NAME hpke) |
| 2 |
|
| 3 |
### |
| 4 |
### Library Config |
| 5 |
### |
| 6 |
|
| 7 |
file(GLOB_RECURSE LIB_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") |
| 8 |
file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") |
| 9 |
|
| 10 |
# -Werror=dangling-reference |
| 11 |
|
| 12 |
add_library(${CURRENT_LIB_NAME} STATIC ${LIB_HEADERS} ${LIB_SOURCES}) |
| 13 |
add_dependencies(${CURRENT_LIB_NAME} bytes tls_syntax) |
| 14 |
target_include_directories(${CURRENT_LIB_NAME} |
| 15 |
PRIVATE |
| 16 |
"${JSON_INCLUDE_INTERFACE}") |
| 17 |
|
| 18 |
target_link_libraries(${CURRENT_LIB_NAME} |
| 19 |
PUBLIC |
| 20 |
bytes tls_syntax |
| 21 |
) |
| 22 |
|
| 23 |
target_include_directories(${CURRENT_LIB_NAME} |
| 24 |
PUBLIC |
| 25 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 26 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> |
| 27 |
$<INSTALL_INTERFACE:include/${PROJECT_NAME}> |
| 28 |
PRIVATE |
| 29 |
${OPENSSL_INCLUDE_DIR} |
| 30 |
) |
| 31 |
|
| 32 |
# Private statically linked dependencies |
| 33 |
target_link_libraries(${CURRENT_LIB_NAME} PRIVATE |
| 34 |
mlspp |
| 35 |
mls_vectors |
| 36 |
bytes |
| 37 |
tls_syntax |
| 38 |
) |
| 39 |
|
| 40 |
target_compile_options( |
| 41 |
"${CURRENT_LIB_NAME}" |
| 42 |
PUBLIC |
| 43 |
"$<$<PLATFORM_ID:Windows>:/bigobj;/Zc:preprocessor>" |
| 44 |
PRIVATE |
| 45 |
"$<$<PLATFORM_ID:Windows>:$<$<CONFIG:Debug>:/sdl;/Od;/DEBUG;/MP;/DFD_SETSIZE=1024>>" |
| 46 |
"$<$<PLATFORM_ID:Windows>:$<$<CONFIG:Release>:/O2;/Oi;/Oy;/GL;/Gy;/sdl;/MP;/DFD_SETSIZE=1024>>" |
| 47 |
"$<$<PLATFORM_ID:Linux>:$<$<CONFIG:Debug>:-Wall;-Wempty-body;-Wno-psabi;-Wunknown-pragmas;-Wignored-qualifiers;-Wimplicit-fallthrough;-Wmissing-field-initializers;-Wsign-compare;-Wtype-limits;-Wuninitialized;-Wshift-negative-value;-pthread;-g;-Og;-fPIC>>" |
| 48 |
"$<$<PLATFORM_ID:Linux>:$<$<CONFIG:Release>:-Wall;-Wempty-body;-Wno-psabi;-Wunknown-pragmas;-Wignored-qualifiers;-Wimplicit-fallthrough;-Wmissing-field-initializers;-Wsign-compare;-Wtype-limits;-Wuninitialized;-Wshift-negative-value;-pthread;-O3;-fPIC>>" |
| 49 |
"${AVX_FLAG}" |
| 50 |
) |
| 51 |
|
| 52 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../lib/bytes/include") |
| 53 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../lib/hpke/include") |
| 54 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../lib/mls_vectors/include") |
| 55 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../lib/tls_syntax/include") |
| 56 |
# For nlohmann/json.hpp |
| 57 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../../include") |
| 58 |
if (DPP_USE_EXTERNAL_JSON) |
| 59 |
add_compile_definitions(DPP_USE_EXTERNAL_JSON) |
| 60 |
message("-- HPKE using external nlohmann::json") |
| 61 |
else() |
| 62 |
message("-- HPKE using DPP nlohmann::json") |
| 63 |
endif() |