mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-22 19:45:34 +00:00
build: Add top-level mbedtls_test target
In preparation of linking common test objects in programs, add the top-level mbedtls_test target. This target consists of the common test objects. It is necessary to declare it at the top-level as both tests and programs will depend on it and it is necessary to synchronize the compilation of those objects for tests and programs for the case of parallel building. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
bfd45f1f11
commit
ddaf99c9d4
|
@ -238,6 +238,15 @@ list(APPEND libs ${thirdparty_lib})
|
|||
|
||||
add_subdirectory(library)
|
||||
|
||||
if(ENABLE_TESTING OR ENABLE_PROGRAMS)
|
||||
file(GLOB MBEDTLS_TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/*.c)
|
||||
add_library(mbedtls_test OBJECT ${MBEDTLS_TEST_FILES})
|
||||
target_include_directories(mbedtls_test
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/library)
|
||||
endif()
|
||||
|
||||
if(ENABLE_PROGRAMS)
|
||||
add_subdirectory(programs)
|
||||
endif()
|
||||
|
|
7
Makefile
7
Makefile
|
@ -10,15 +10,18 @@ all: programs tests
|
|||
|
||||
no_test: programs
|
||||
|
||||
programs: lib
|
||||
programs: lib mbedtls_test
|
||||
$(MAKE) -C programs
|
||||
|
||||
lib:
|
||||
$(MAKE) -C library
|
||||
|
||||
tests: lib
|
||||
tests: lib mbedtls_test
|
||||
$(MAKE) -C tests
|
||||
|
||||
mbedtls_test:
|
||||
$(MAKE) -C tests mbedtls_test
|
||||
|
||||
ifndef WINDOWS
|
||||
install: no_test
|
||||
mkdir -p $(DESTDIR)/include/mbedtls
|
||||
|
|
|
@ -69,13 +69,6 @@ if(MSVC)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
|
||||
endif(MSVC)
|
||||
|
||||
file(GLOB MBEDTLS_TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)
|
||||
add_library(mbedtls_test OBJECT ${MBEDTLS_TEST_FILES})
|
||||
target_include_directories(mbedtls_test
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library)
|
||||
|
||||
add_test_suite(aes aes.cbc)
|
||||
add_test_suite(aes aes.cfb)
|
||||
add_test_suite(aes aes.ecb)
|
||||
|
|
|
@ -79,6 +79,8 @@ $(MBEDLIBS):
|
|||
|
||||
MBEDTLS_TEST_OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c))
|
||||
|
||||
mbedtls_test: $(MBEDTLS_TEST_OBJS)
|
||||
|
||||
# Rule to compile common test C files in src folder
|
||||
src/%.o : src/%.c
|
||||
echo " CC $<"
|
||||
|
|
Loading…
Reference in a new issue