From e7bac84a22a3b70df6cece3546eac1b3db4e515e Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Mon, 15 Sep 2025 09:13:19 +0200 Subject: [PATCH] Remove the generation of MS visual studio files Signed-off-by: Ronald Cron --- scripts/bump_version.sh | 3 - scripts/generate_visualc_files.pl | 352 ----------------------- scripts/legacy.make | 27 -- tests/scripts/components-basic-checks.sh | 6 - visualc/VS2017/.gitignore | 16 -- 5 files changed, 404 deletions(-) delete mode 100755 scripts/generate_visualc_files.pl delete mode 100644 visualc/VS2017/.gitignore diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index 86ed74eada..62939e3823 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -143,6 +143,3 @@ scripts/generate_query_config.pl [ $VERBOSE ] && echo "Re-generating library/version_features.c" scripts/generate_features.pl -[ $VERBOSE ] && echo "Re-generating visualc files" -scripts/generate_visualc_files.pl - diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl deleted file mode 100755 index ef684b79d8..0000000000 --- a/scripts/generate_visualc_files.pl +++ /dev/null @@ -1,352 +0,0 @@ -#!/usr/bin/env perl - -# Generate main file, individual apps and solution files for -# MS Visual Studio 2017 -# -# Must be run from Mbed TLS root or scripts directory. -# Takes no argument. -# -# Copyright The Mbed TLS Contributors -# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later - -use warnings; -use strict; -use Getopt::Long; -use Digest::MD5 'md5_hex'; - -# Declare variables for options -my $vsx_dir = "visualc/VS2017"; -my $list = 0; # Default off - -GetOptions( - "directory=s" => \$vsx_dir, # Target directory - "list" => \$list # Only list generated files -) or die "Invalid options\n"; - -my $vsx_ext = "vcxproj"; -my $vsx_app_tpl_file = "scripts/data_files/vs2017-app-template.$vsx_ext"; -my $vsx_main_tpl_file = "scripts/data_files/vs2017-main-template.$vsx_ext"; -my $vsx_main_file = "$vsx_dir/mbedTLS.$vsx_ext"; -my $vsx_sln_tpl_file = "scripts/data_files/vs2017-sln-template.sln"; -my $vsx_sln_file = "$vsx_dir/mbedTLS.sln"; - -my $mbedtls_programs_dir = "programs"; -my $framework_programs_dir = "framework/tests/programs"; -my $tfpsacrypto_programs_dir = "tf-psa-crypto/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 $tls_source_dir = 'library'; -my $crypto_core_source_dir = 'tf-psa-crypto/core'; -my $crypto_source_dir = 'tf-psa-crypto/drivers/builtin/src'; -my $tls_test_source_dir = 'tests/src'; -my $tls_test_header_dir = 'tests/include/test'; -my $crypto_test_source_dir = 'tf-psa-crypto/tests/src'; -my $crypto_test_header_dir = 'tf-psa-crypto/tests/include/test'; -my $test_source_dir = 'framework/tests/src'; -my $test_header_dir = 'framework/tests/include/test'; -my $test_drivers_header_dir = 'framework/tests/include/test/drivers'; -my $test_drivers_source_dir = 'framework/tests/src/drivers'; - -my @thirdparty_header_dirs = qw( - tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest -); -my @thirdparty_source_dirs = qw( - tf-psa-crypto/drivers/everest/library - tf-psa-crypto/drivers/everest/library/kremlib - tf-psa-crypto/drivers/everest/library/legacy -); - -# Directories to add to the include path. -# Order matters in case there are files with the same name in more than -# one directory: the compiler will use the first match. -my @include_directories = qw( - include - tf-psa-crypto/include - tf-psa-crypto/drivers/builtin/include - tf-psa-crypto/drivers/everest/include/ - tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest - tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/vs2013 - tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib - tests/include - tf-psa-crypto/tests/include - framework/tests/include - framework/tests/programs -); -my $include_directories = join(';', map {"../../$_"} @include_directories); - -# Directories to add to the include path when building the libraries, but not -# when building tests or applications. -my @library_include_directories = qw( - library - tf-psa-crypto/core - tf-psa-crypto/drivers/builtin/src -); -my $library_include_directories = - join(';', map {"../../$_"} (@library_include_directories, - @include_directories)); - -my @excluded_files = qw( - tf-psa-crypto/drivers/everest/library/Hacl_Curve25519.c -); -my %excluded_files = (); -foreach (@excluded_files) { $excluded_files{$_} = 1 } - -my $vsx_hdr_tpl = < -EOT -my $vsx_src_tpl = < -EOT - -my $vsx_sln_app_entry_tpl = <; - close $fh; - - return $content; -} - -sub content_to_file { - my ($content, $filename) = @_; - - open my $fh, '>:crlf', $filename or die "Could not write to $filename\n"; - print $fh $content; - close $fh; -} - -sub gen_app_guid { - my ($path) = @_; - - my $guid = md5_hex( "mbedTLS:$path" ); - $guid =~ s/(.{8})(.{4})(.{4})(.{4})(.{12})/\U{$1-$2-$3-$4-$5}/; - - return $guid; -} - -sub gen_app { - my ($path, $template, $dir, $ext) = @_; - - my $guid = gen_app_guid( $path ); - $path =~ s!/!\\!g; - (my $appname = $path) =~ s/.*\\//; - my $is_test_app = ($path =~ m/^test\\/); - - my $srcs; - if( $appname eq "metatest" or $appname eq "query_compile_time_config" or - $appname eq "query_included_headers" or $appname eq "zeroize" ) { - $srcs = ""; - } else { - $srcs = ""; - } - - if( $appname eq "ssl_client2" or $appname eq "ssl_server2" or - $appname eq "query_compile_time_config" ) { - $srcs .= "\n "; - } - if( $appname eq "ssl_client2" or $appname eq "ssl_server2" ) { - $srcs .= "\n "; - } - - my $content = $template; - $content =~ s//$srcs/g; - $content =~ s//$appname/g; - $content =~ s//$guid/g; - $content =~ s/INCLUDE_DIRECTORIES\n/($is_test_app ? - $library_include_directories : - $include_directories)/ge; - - content_to_file( $content, "$dir/$appname.$ext" ); -} - -sub get_app_list { - my $makefile_contents = slurp_file('programs/Makefile'); - $makefile_contents =~ /\n\s*APPS\s*=[\\\s]*(.*?)(? } @header_dirs); - my @source_dirs = ( - $tls_source_dir, - $crypto_core_source_dir, - $crypto_source_dir, - $test_source_dir, - $tls_test_source_dir, - $crypto_test_source_dir, - $test_drivers_source_dir, - @thirdparty_source_dirs, - ); - my @sources = (map { <$_/*.c> } @source_dirs); - - @headers = grep { ! $excluded_files{$_} } @headers; - @sources = grep { ! $excluded_files{$_} } @sources; - map { s!/!\\!g } @headers; - map { s!/!\\!g } @sources; - - if ($list) { - foreach my $app (@app_list) { - $app =~ s/.*\///; - print "$vsx_dir/$app.$vsx_ext\n"; - } - print "$vsx_main_file\n"; - print "$vsx_sln_file\n"; - } else { - gen_app_files( @app_list ); - - gen_main_file( \@headers, \@sources, - $vsx_hdr_tpl, $vsx_src_tpl, - $vsx_main_tpl_file, $vsx_main_file ); - - gen_vsx_solution( @app_list ); - } - - return 0; -} diff --git a/scripts/legacy.make b/scripts/legacy.make index 6706143a24..9c8585cd86 100644 --- a/scripts/legacy.make +++ b/scripts/legacy.make @@ -62,7 +62,6 @@ tests/%: FORCE generated_files: library/generated_files generated_files: programs/generated_files generated_files: tests/generated_files -generated_files: visualc_files # Set GEN_FILES to the empty string to disable dependencies on generated # source files. Then `make generated_files` will only build files that @@ -87,26 +86,6 @@ else gen_file_dep = | endif -.PHONY: visualc_files -VISUALC_FILES = visualc/VS2017/mbedTLS.sln visualc/VS2017/mbedTLS.vcxproj -# TODO: $(app).vcxproj for each $(app) in programs/ -visualc_files: $(VISUALC_FILES) - -# Ensure that the .c files that generate_visualc_files.pl enumerates are -# present before it runs. It doesn't matter if the files aren't up-to-date, -# they just need to be present. -$(VISUALC_FILES): | library/generated_files -$(VISUALC_FILES): | programs/generated_files -$(VISUALC_FILES): | tests/generated_files -$(VISUALC_FILES): $(gen_file_dep) scripts/generate_visualc_files.pl -$(VISUALC_FILES): $(gen_file_dep) scripts/data_files/vs2017-app-template.vcxproj -$(VISUALC_FILES): $(gen_file_dep) scripts/data_files/vs2017-main-template.vcxproj -$(VISUALC_FILES): $(gen_file_dep) scripts/data_files/vs2017-sln-template.sln -# TODO: also the list of .c and .h source files, but not their content -$(VISUALC_FILES): - echo " Gen $@ ..." - $(PERL) scripts/generate_visualc_files.pl - ifndef WINDOWS install: no_test mkdir -p $(DESTDIR)/include/mbedtls @@ -159,12 +138,6 @@ neat: clean_more_on_top $(MAKE) -C library neat $(MAKE) -C programs neat $(MAKE) -C tests neat -ifndef WINDOWS - rm -f visualc/VS2017/*.vcxproj visualc/VS2017/mbedTLS.sln -else - if exist visualc\VS2017\*.vcxproj del /Q /F visualc\VS2017\*.vcxproj - if exist visualc\VS2017\mbedTLS.sln del /Q /F visualc\VS2017\mbedTLS.sln -endif ifndef PSASIM check: lib diff --git a/tests/scripts/components-basic-checks.sh b/tests/scripts/components-basic-checks.sh index 74b3ab3055..e791ad065c 100644 --- a/tests/scripts/components-basic-checks.sh +++ b/tests/scripts/components-basic-checks.sh @@ -39,12 +39,6 @@ component_check_generated_files () { make cd "$MBEDTLS_ROOT_DIR" - # Files for MS Visual Studio are not generated with cmake thus copy the - # ones generated with make to pacify make_generated_files.py check. - # Files for MS Visual Studio are rather on their way out thus not adding - # support for them with cmake. - cp -Rf visualc "$OUT_OF_SOURCE_DIR" - $FRAMEWORK/scripts/make_generated_files.py --root "$OUT_OF_SOURCE_DIR" --check cd $TF_PSA_CRYPTO_ROOT_DIR diff --git a/visualc/VS2017/.gitignore b/visualc/VS2017/.gitignore deleted file mode 100644 index e45eaf68fb..0000000000 --- a/visualc/VS2017/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Files that may be left over from make_generated-files.py --check -/*.bak - -# Visual Studio artifacts -/.localhistory/ -/.vs/ -/Debug/ -/Release/ -/*.vcxproj.filters -/*.vcxproj.user - -###START_GENERATED_FILES### -# Files automatically generated by generate_visualc_files.pl -/mbedTLS.sln -/*.vcxproj -###END_GENERATED_FILES###