From 13fac98aca71fa3a51aca7631197246c9e8eedb0 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 12 Feb 2020 20:34:22 +0100 Subject: [PATCH] Generalize everest support to generic 3rdparty support Other third-party components can now be added by just adding lines to the definitions of @thirdparty_header_dirs and @thirdparty_source_dirs. No semantic change. The output does not change at all. --- scripts/generate_visualc_files.pl | 43 +++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl index 2134f53a6..adef3bda6 100755 --- a/scripts/generate_visualc_files.pl +++ b/scripts/generate_visualc_files.pl @@ -22,8 +22,18 @@ my $programs_dir = 'programs'; my $mbedtls_header_dir = 'include/mbedtls'; my $psa_header_dir = 'include/psa'; my $source_dir = 'library'; -my $everest_header_dir = '3rdparty/everest/include/everest'; -my @everest_source_dirs = ('3rdparty/everest/library', '3rdparty/everest/library/kremlib', '3rdparty/everest/library/legacy'); + +my @thirdparty_header_dirs = qw( + 3rdparty/everest/include/everest +); +my @thirdparty_source_dirs = qw( + 3rdparty/everest/library + 3rdparty/everest/library/kremlib + 3rdparty/everest/library/legacy +); +my @thirdparty_excluded = qw( + 3rdparty/everest/library/Hacl_Curve25519.c +); # Need windows line endings! my $vsx_hdr_tpl = <; - my @everest_sources = (); - foreach my $d (@everest_source_dirs) { push @everest_sources, <$d/*.c>; } - @everest_sources = grep !/3rdparty\/everest\/library\/Hacl_Curve25519.c/, @everest_sources; - map { s!/!\\!g } @everest_headers; - map { s!/!\\!g } @everest_sources; + my @thirdparty_headers = map { <$_/*.h> } @thirdparty_header_dirs; + my @thirdparty_sources = map { <$_/*.c> } @thirdparty_source_dirs; + @thirdparty_sources = grep { ! is_thirdparty_excluded($_) } @thirdparty_sources; + map { s!/!\\!g } @thirdparty_headers; + map { s!/!\\!g } @thirdparty_sources; gen_app_files( @app_list ); gen_main_file( \@mbedtls_headers, \@psa_headers, \@source_headers, - \@everest_headers, \@sources, \@everest_sources, $vsx_hdr_tpl, + \@thirdparty_headers, \@sources, \@thirdparty_sources, $vsx_hdr_tpl, $vsx_src_tpl, $vsx_main_tpl_file, $vsx_main_file ); gen_vsx_solution( @app_list );