@@ -40,12 +40,12 @@ cmake_policy(SET CMP0012 NEW)
4040if (TEST_CPP)
4141 project ("Mbed TLS"
4242 LANGUAGES C CXX
43- VERSION 3.6.2
43+ VERSION 3.6.3
4444 )
4545else ()
4646 project ("Mbed TLS"
4747 LANGUAGES C
48- VERSION 3.6.2
48+ VERSION 3.6.3
4949 )
5050endif ()
5151
@@ -61,6 +61,7 @@ endif()
6161
6262# Set the project root directory.
6363set (MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
64+ set (MBEDTLS_FRAMEWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} /framework )
6465
6566option (ENABLE_PROGRAMS "Build Mbed TLS programs." ON )
6667
@@ -229,7 +230,21 @@ if(CMAKE_COMPILER_IS_GNU)
229230 set (CMAKE_C_FLAGS_RELEASE "-O2" )
230231 set (CMAKE_C_FLAGS_DEBUG "-O0 -g3" )
231232 set (CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage" )
232- set (CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3" )
233+ # Old GCC versions hit a performance problem with test_suite_pkwrite
234+ # "Private keey write check EC" tests when building with Asan+UBSan
235+ # and -O3: those tests take more than 100x time than normal, with
236+ # test_suite_pkwrite taking >3h on the CI. Observed with GCC 5.4 on
237+ # Ubuntu 16.04 x86_64 and GCC 6.5 on Ubuntu 18.04 x86_64.
238+ # GCC 7.5 and above on Ubuntu 18.04 appear fine.
239+ # To avoid the performance problem, we use -O2 when GCC version is lower than 7.0.
240+ # It doesn't slow down much even with modern compiler versions.
241+ if (GCC_VERSION VERSION_LESS 7.0)
242+ message (STATUS "USING O2" )
243+ set (CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O2" )
244+ else ()
245+ message (STATUS "USING O3" )
246+ set (CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3" )
247+ endif ()
233248 set (CMAKE_C_FLAGS_ASANDBG "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls" )
234249 set (CMAKE_C_FLAGS_TSAN "-fsanitize=thread -O3" )
235250 set (CMAKE_C_FLAGS_TSANDBG "-fsanitize=thread -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls" )
@@ -309,7 +324,7 @@ add_subdirectory(library)
309324add_subdirectory (pkgconfig)
310325
311326#
312- # The C files in tests/src directory contain test code shared among test suites
327+ # The C files in framework/ tests/src directory contain test code shared among test suites
313328# and programs. This shared test code is compiled and linked to test suites and
314329# programs objects as a set of compiled objects. The compiled objects are NOT
315330# built into a library that the test suite and program objects would link
@@ -325,23 +340,24 @@ add_subdirectory(pkgconfig)
325340if (ENABLE_TESTING OR ENABLE_PROGRAMS)
326341 file (GLOB MBEDTLS_TEST_FILES
327342 ${CMAKE_CURRENT_SOURCE_DIR} /tests/src/*.c
328- ${CMAKE_CURRENT_SOURCE_DIR} /tests/src/drivers/*.c)
343+ ${CMAKE_CURRENT_SOURCE_DIR} /framework /tests/src/*.c
344+ ${CMAKE_CURRENT_SOURCE_DIR} /framework /tests/src/drivers/*.c)
329345 add_library (mbedtls_test OBJECT ${MBEDTLS_TEST_FILES} )
330346 if (GEN_FILES)
331347 add_custom_command (
332348 OUTPUT
333- ${CMAKE_CURRENT_SOURCE_DIR} /tests/src /test_keys.h
349+ ${CMAKE_CURRENT_SOURCE_DIR} /framework / tests/include / test /test_keys.h
334350 WORKING_DIRECTORY
335351 ${CMAKE_CURRENT_SOURCE_DIR} /tests
336352 COMMAND
337353 "${MBEDTLS_PYTHON_EXECUTABLE} "
338354 "${CMAKE_CURRENT_SOURCE_DIR} /framework/scripts/generate_test_keys.py"
339355 "--output"
340- "${CMAKE_CURRENT_SOURCE_DIR} /tests/src /test_keys.h"
356+ "${CMAKE_CURRENT_SOURCE_DIR} /framework/ tests/include/test /test_keys.h"
341357 DEPENDS
342358 ${CMAKE_CURRENT_SOURCE_DIR} /framework /scripts/generate_test_keys.py
343359 )
344- add_custom_target (test_keys_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /tests/src /test_keys.h)
360+ add_custom_target (test_keys_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /framework / tests/include / test /test_keys.h)
345361 add_custom_command (
346362 OUTPUT
347363 ${CMAKE_CURRENT_SOURCE_DIR} /tests/src/test_certs.h
@@ -359,6 +375,7 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
359375 add_dependencies (mbedtls_test test_keys_header test_certs_header)
360376 endif ()
361377 target_include_directories (mbedtls_test
378+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /framework /tests/include
362379 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /tests/include
363380 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /include
364381 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /library)
@@ -369,6 +386,7 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
369386 ${CMAKE_CURRENT_SOURCE_DIR} /tests/src/test_helpers/*.c)
370387 add_library (mbedtls_test_helpers OBJECT ${MBEDTLS_TEST_HELPER_FILES} )
371388 target_include_directories (mbedtls_test_helpers
389+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /framework /tests/include
372390 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /tests/include
373391 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /include
374392 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /library
@@ -390,6 +408,9 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
390408endif ()
391409
392410if (ENABLE_PROGRAMS)
411+ set (ssl_opt_target "${MBEDTLS_TARGET_PREFIX} ssl-opt" )
412+ add_custom_target (${ssl_opt_target} )
413+
393414 add_subdirectory (programs)
394415endif ()
395416
@@ -444,7 +465,7 @@ if(NOT DISABLE_PACKAGE_CONFIG_AND_INSTALL)
444465 write_basic_package_version_file(
445466 "cmake/MbedTLSConfigVersion.cmake"
446467 COMPATIBILITY SameMajorVersion
447- VERSION 3.6.2 )
468+ VERSION 3.6.3 )
448469
449470 install (
450471 FILES "${CMAKE_CURRENT_BINARY_DIR} /cmake/MbedTLSConfig.cmake"
0 commit comments