mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-28 00:35:21 +00:00
Adjust build systems
Adjust build systems such as we can built Mbed TLS in the default and full configuration. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
550a18d4d6
commit
3d817add46
1
3rdparty/everest/CMakeLists.txt
vendored
1
3rdparty/everest/CMakeLists.txt
vendored
@ -9,6 +9,7 @@ target_include_directories(${everest_target}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/include>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/include>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/drivers/builtin/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE include/everest
|
||||
include/everest/kremlib
|
||||
|
1
3rdparty/p256-m/CMakeLists.txt
vendored
1
3rdparty/p256-m/CMakeLists.txt
vendored
@ -9,6 +9,7 @@ target_include_directories(${p256m_target}
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/p256-m>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/include>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/include>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/drivers/builtin/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${MBEDTLS_DIR}/library/)
|
||||
|
||||
|
@ -356,6 +356,7 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/builtin/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/library)
|
||||
# Request C11, needed for memory poisoning tests
|
||||
set_target_properties(mbedtls_test PROPERTIES C_STANDARD 11)
|
||||
@ -367,6 +368,7 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tf-psa-crypto/drivers/builtin/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/library
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/everest/include)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 04847216ab964b9bdce41f1e61ccc6d8f5d2a139
|
||||
Subproject commit 86dede517741011ccd65c1946963add19580f6ca
|
@ -129,19 +129,22 @@ set(src_tls
|
||||
if(GEN_FILES)
|
||||
find_package(Perl REQUIRED)
|
||||
|
||||
file(GLOB error_headers ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/*.h)
|
||||
file(GLOB crypto_error_headers ${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/drivers/builtin/include/mbedtls/*.h)
|
||||
file(GLOB tls_error_headers ${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls/*.h)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_BINARY_DIR}/error.c
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/drivers/builtin/include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/error.c
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
|
||||
${error_headers}
|
||||
${crypto_error_headers}
|
||||
${tls_error_headers}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/error.fmt
|
||||
)
|
||||
|
||||
@ -170,7 +173,7 @@ if(GEN_FILES)
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_ssl_debug_helpers.py
|
||||
${error_headers}
|
||||
${tls_error_headers}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
@ -329,6 +332,7 @@ foreach(target IN LISTS target_libraries)
|
||||
target_include_directories(${target}
|
||||
PUBLIC $<BUILD_INTERFACE:${MBEDTLS_DIR}/include/>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/include/>
|
||||
$<BUILD_INTERFACE:${MBEDTLS_DIR}/tf-psa-crypto/drivers/builtin/include/>
|
||||
$<INSTALL_INTERFACE:include/>
|
||||
PRIVATE ${MBEDTLS_DIR}/library/
|
||||
# Needed to include psa_crypto_driver_wrappers.h
|
||||
|
@ -28,11 +28,13 @@ CFLAGS ?= -O2
|
||||
WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
|
||||
LDFLAGS ?=
|
||||
|
||||
# Include ../include, ../tf-psa-crypto/include for public headers and . for
|
||||
# Include ../include, ../tf-psa-crypto/include and
|
||||
# ../tf-psa-crypto/drivers/builtin/includefor public headers and . for
|
||||
# private headers. Note that . needs to be included explicitly for the sake of
|
||||
# library files that are not in the /library directory (which currently means
|
||||
# under /3rdparty).
|
||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I. -I../include -I../tf-psa-crypto/include -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I. -I../include -I../tf-psa-crypto/include \
|
||||
-I../tf-psa-crypto/drivers/builtin/include -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_LDFLAGS =
|
||||
|
||||
ifdef DEBUG
|
||||
|
@ -27,7 +27,8 @@ if(TEST_CPP)
|
||||
add_executable(cpp_dummy_build "${cpp_dummy_build_cpp}")
|
||||
target_include_directories(cpp_dummy_build
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/drivers/builtin/include)
|
||||
target_link_libraries(cpp_dummy_build ${mbedcrypto_target} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
@ -36,7 +37,8 @@ if(USE_SHARED_MBEDTLS_LIBRARY AND
|
||||
add_executable(dlopen "dlopen.c")
|
||||
target_include_directories(dlopen
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tf-psa-crypto/drivers/builtin/include)
|
||||
target_link_libraries(dlopen ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
|
@ -21,7 +21,10 @@ WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
|
||||
WARNING_CXXFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
|
||||
LDFLAGS ?=
|
||||
|
||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I$(MBEDTLS_TEST_PATH)/include -I$(MBEDTLS_PATH)/include -I$(MBEDTLS_PATH)/tf-psa-crypto/include -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I$(MBEDTLS_TEST_PATH)/include \
|
||||
-I$(MBEDTLS_PATH)/include -I$(MBEDTLS_PATH)/tf-psa-crypto/include \
|
||||
-I$(MBEDTLS_PATH)/tf-psa-crypto/drivers/builtin/include \
|
||||
-D_FILE_OFFSET_BITS=64
|
||||
LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I$(MBEDTLS_PATH)/include -I$(MBEDTLS_PATH)/tests/include -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
|
||||
-L$(MBEDTLS_PATH)/library \
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Generate error.c
|
||||
#
|
||||
# Usage: ./generate_errors.pl or scripts/generate_errors.pl without arguments,
|
||||
# or generate_errors.pl include_dir data_dir error_file
|
||||
# or generate_errors.pl crypto_include_dir tls_include_dir data_dir error_file
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
@ -11,22 +11,24 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my ($include_dir, $data_dir, $error_file);
|
||||
my ($crypto_include_dir, $tls_include_dir, $data_dir, $error_file);
|
||||
|
||||
if( @ARGV ) {
|
||||
die "Invalid number of arguments" if scalar @ARGV != 3;
|
||||
($include_dir, $data_dir, $error_file) = @ARGV;
|
||||
die "Invalid number of arguments" if scalar @ARGV != 4;
|
||||
($crypto_include_dir, $tls_include_dir, $data_dir, $error_file) = @ARGV;
|
||||
|
||||
-d $include_dir or die "No such directory: $include_dir\n";
|
||||
-d $crypto_include_dir or die "No such directory: $crypto_include_dir\n";
|
||||
-d $tls_include_dir or die "No such directory: $tls_include_dir\n";
|
||||
-d $data_dir or die "No such directory: $data_dir\n";
|
||||
} else {
|
||||
$include_dir = 'include/mbedtls';
|
||||
$crypto_include_dir = 'tf-psa-crypto/drivers/builtin/include/mbedtls';
|
||||
$tls_include_dir = 'include/mbedtls';
|
||||
$data_dir = 'scripts/data_files';
|
||||
$error_file = 'library/error.c';
|
||||
|
||||
unless( -d $include_dir && -d $data_dir ) {
|
||||
unless( -d $crypto_include_dir && -d $tls_include_dir && -d $data_dir ) {
|
||||
chdir '..' or die;
|
||||
-d $include_dir && -d $data_dir
|
||||
-d $crypto_include_dir && -d $tls_include_dir && -d $data_dir
|
||||
or die "Without arguments, must be run from root or scripts\n"
|
||||
}
|
||||
}
|
||||
@ -48,7 +50,8 @@ open(FORMAT_FILE, '<:crlf', "$error_format_file") or die "Opening error format f
|
||||
my $error_format = <FORMAT_FILE>;
|
||||
close(FORMAT_FILE);
|
||||
|
||||
my @files = glob qq("$include_dir/*.h");
|
||||
my @files = glob qq("$crypto_include_dir/*.h");
|
||||
push(@files, glob qq("$tls_include_dir/*.h"));
|
||||
my @necessary_include_files;
|
||||
my @matches;
|
||||
foreach my $file (@files) {
|
||||
|
@ -23,6 +23,7 @@ my $vsx_sln_file = "$vsx_dir/mbedTLS.sln";
|
||||
|
||||
my $programs_dir = 'programs';
|
||||
my $mbedtls_header_dir = 'include/mbedtls';
|
||||
my $drivers_builtin_header_dir = 'tf-psa-crypto/drivers/builtin/include/mbedtls';
|
||||
my $psa_header_dir = 'tf-psa-crypto/include/psa';
|
||||
my $source_dir = 'library';
|
||||
my $test_source_dir = 'tests/src';
|
||||
@ -45,6 +46,7 @@ my @thirdparty_source_dirs = qw(
|
||||
my @include_directories = qw(
|
||||
include
|
||||
tf-psa-crypto/include
|
||||
tf-psa-crypto/drivers/builtin/include
|
||||
3rdparty/everest/include/
|
||||
3rdparty/everest/include/everest
|
||||
3rdparty/everest/include/everest/vs2013
|
||||
@ -102,6 +104,7 @@ sub check_dirs {
|
||||
}
|
||||
return -d $vsx_dir
|
||||
&& -d $mbedtls_header_dir
|
||||
&& -d $drivers_builtin_header_dir
|
||||
&& -d $psa_header_dir
|
||||
&& -d $source_dir
|
||||
&& -d $test_source_dir
|
||||
@ -258,6 +261,7 @@ sub main {
|
||||
my @app_list = get_app_list();
|
||||
my @header_dirs = (
|
||||
$mbedtls_header_dir,
|
||||
$drivers_builtin_header_dir,
|
||||
$psa_header_dir,
|
||||
$test_header_dir,
|
||||
$test_drivers_header_dir,
|
||||
|
@ -209,6 +209,8 @@ include/alt-extra/%_alt.h: ../include/%.h
|
||||
perl -p -e 's/^(# *(define|ifndef) +\w+_)H\b/$${1}ALT_H/' $< >$@
|
||||
include/alt-extra/%_alt.h: ../tf-psa-crypto/include/%.h
|
||||
perl -p -e 's/^(# *(define|ifndef) +\w+_)H\b/$${1}ALT_H/' $< >$@
|
||||
include/alt-extra/%_alt.h: ../tf-psa-crypto/drivers/builtin/include/%.h
|
||||
perl -p -e 's/^(# *(define|ifndef) +\w+_)H\b/$${1}ALT_H/' $< >$@
|
||||
|
||||
# Generate test library
|
||||
|
||||
|
@ -8,7 +8,9 @@ LIBPSACLIENT := -Llibpsaclient/ -lmbedcrypto -lmbedx509 -lmbedtls
|
||||
LIBPSASERVER := -Llibpsaserver/ -lmbedcrypto
|
||||
|
||||
MBEDTLS_ROOT_PATH = ../../..
|
||||
COMMON_INCLUDE := -I./include -I$(MBEDTLS_ROOT_PATH)/include -I$(MBEDTLS_ROOT_PATH)/tf-psa-crypto/include
|
||||
COMMON_INCLUDE := -I./include -I$(MBEDTLS_ROOT_PATH)/include \
|
||||
-I$(MBEDTLS_ROOT_PATH)/tf-psa-crypto/include \
|
||||
-I$(MBEDTLS_ROOT_PATH)/tf-psa-crypto/drivers/builtin/include
|
||||
|
||||
GENERATED_H_FILES = include/psa_manifest/manifest.h \
|
||||
include/psa_manifest/pid.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user