blob: 5a18afc0c13522341d57cfea9f0f02b2ba8fd075 [file] [log] [blame]
fbrosson533407a2018-04-04 21:44:29 +00001#!/usr/bin/env perl
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +02002
Dave Rodgman0f459d72023-01-10 15:09:19 +00003# Generate main file, individual apps and solution files for
Bence Szépkúti0719d7c2024-03-12 16:45:55 +01004# MS Visual Studio 2017
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +02005#
Dave Rodgman0f459d72023-01-10 15:09:19 +00006# Must be run from Mbed TLS root or scripts directory.
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +02007# Takes no argument.
Bence Szépkúti700ee442020-05-26 00:33:31 +02008#
Bence Szépkúti1e148272020-08-07 13:07:28 +02009# Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +000010# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Manuel Pégourié-Gonnard684e9dc2013-09-20 15:11:44 +020011
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +020012use warnings;
13use strict;
Ronald Cronddbf7292025-03-07 09:33:33 +010014use Getopt::Long;
Manuel Pégourié-Gonnard41e8b622014-05-09 12:27:49 +020015use Digest::MD5 'md5_hex';
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +020016
Ronald Cronddbf7292025-03-07 09:33:33 +010017# Declare variables for options
Bence Szépkútifac11222024-03-12 16:38:23 +010018my $vsx_dir = "visualc/VS2017";
Ronald Cronddbf7292025-03-07 09:33:33 +010019my $list = 0; # Default off
20
21GetOptions(
22 "directory=s" => \$vsx_dir, # Target directory
23 "list" => \$list # Only list generated files
24) or die "Invalid options\n";
25
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +020026my $vsx_ext = "vcxproj";
Bence Szépkútifac11222024-03-12 16:38:23 +010027my $vsx_app_tpl_file = "scripts/data_files/vs2017-app-template.$vsx_ext";
28my $vsx_main_tpl_file = "scripts/data_files/vs2017-main-template.$vsx_ext";
Manuel Pégourié-Gonnard813e5852015-01-26 15:42:27 +000029my $vsx_main_file = "$vsx_dir/mbedTLS.$vsx_ext";
Bence Szépkútifac11222024-03-12 16:38:23 +010030my $vsx_sln_tpl_file = "scripts/data_files/vs2017-sln-template.sln";
Manuel Pégourié-Gonnard813e5852015-01-26 15:42:27 +000031my $vsx_sln_file = "$vsx_dir/mbedTLS.sln";
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +020032
Harry Ramseyc94cb702024-10-31 14:28:53 +000033my $mbedtls_programs_dir = "programs";
Harry Ramseyec4af6c2025-02-12 20:56:34 +000034my $framework_programs_dir = "framework/tests/programs";
Harry Ramseyc94cb702024-10-31 14:28:53 +000035my $tfpsacrypto_programs_dir = "tf-psa-crypto/programs";
36
Darryl Green588e8cb2018-07-20 13:27:58 +010037my $mbedtls_header_dir = 'include/mbedtls';
Ronald Cron3d817ad2024-06-14 08:43:28 +020038my $drivers_builtin_header_dir = 'tf-psa-crypto/drivers/builtin/include/mbedtls';
Ronald Cronc7e9e362024-06-10 09:41:49 +020039my $psa_header_dir = 'tf-psa-crypto/include/psa';
Ronald Cronc29afb62024-07-01 14:50:54 +020040my $tls_source_dir = 'library';
41my $crypto_core_source_dir = 'tf-psa-crypto/core';
42my $crypto_source_dir = 'tf-psa-crypto/drivers/builtin/src';
David Horstmann08953f72024-11-06 16:24:49 +000043my $tls_test_source_dir = 'tests/src';
44my $tls_test_header_dir = 'tests/include/test';
Ronald Cron99226e92025-02-14 15:43:22 +010045my $crypto_test_source_dir = 'tf-psa-crypto/tests/src';
46my $crypto_test_header_dir = 'tf-psa-crypto/tests/include/test';
David Horstmann5b93d972024-10-31 15:36:05 +000047my $test_source_dir = 'framework/tests/src';
48my $test_header_dir = 'framework/tests/include/test';
49my $test_drivers_header_dir = 'framework/tests/include/test/drivers';
50my $test_drivers_source_dir = 'framework/tests/src/drivers';
Gilles Peskine13fac982020-02-12 20:34:22 +010051
Valerio Setti3de417f2025-06-16 15:03:42 +020052# This is a dirty patch to allow mbedtls#10091 to be merged without updating
53# tf-psa-crypto to psa#235. Once psa#235 will be merged, this dirty fix can
54# be removed.
55# The same holds also for @include_directories below.
56my @thirdparty_header_dirs;
57if (-d "tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest") {
58 @thirdparty_header_dirs = qw(
59 tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest
60 );
61} else {
62 @thirdparty_header_dirs = qw(
63 tf-psa-crypto/drivers/everest/include/everest
64 );
65}
Gilles Peskine13fac982020-02-12 20:34:22 +010066my @thirdparty_source_dirs = qw(
Ronald Cronaef8cf32024-07-01 18:33:24 +020067 tf-psa-crypto/drivers/everest/library
68 tf-psa-crypto/drivers/everest/library/kremlib
69 tf-psa-crypto/drivers/everest/library/legacy
Gilles Peskine13fac982020-02-12 20:34:22 +010070);
Gilles Peskineb41f88f2020-02-12 20:45:18 +010071
Gilles Peskine7156d8c2020-02-19 20:08:44 +010072# Directories to add to the include path.
73# Order matters in case there are files with the same name in more than
74# one directory: the compiler will use the first match.
Valerio Setti3de417f2025-06-16 15:03:42 +020075my @include_directories;
76if (-d "tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest") {
77 @include_directories = qw(
78 include
79 tf-psa-crypto/include
80 tf-psa-crypto/drivers/builtin/include
Valerio Setti2d7ded62025-06-18 00:08:46 +020081 tf-psa-crypto/drivers/everest/include/
Valerio Setti3de417f2025-06-16 15:03:42 +020082 tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest
83 tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/vs2013
84 tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib
85 tests/include
86 tf-psa-crypto/tests/include
87 framework/tests/include
88 framework/tests/programs
89 );
90} else {
91 @include_directories = qw(
92 include
93 tf-psa-crypto/include
94 tf-psa-crypto/drivers/builtin/include
95 tf-psa-crypto/drivers/everest/include/
96 tf-psa-crypto/drivers/everest/include/everest
97 tf-psa-crypto/drivers/everest/include/everest/vs2013
98 tf-psa-crypto/drivers/everest/include/everest/kremlib
99 tests/include
100 tf-psa-crypto/tests/include
101 framework/tests/include
102 framework/tests/programs
103 );
104}
Gilles Peskine7156d8c2020-02-19 20:08:44 +0100105my $include_directories = join(';', map {"../../$_"} @include_directories);
106
Ronald Cronc29afb62024-07-01 14:50:54 +0200107# Directories to add to the include path when building the libraries, but not
Gilles Peskine66c3dc42020-06-03 02:25:17 +0200108# when building tests or applications.
109my @library_include_directories = qw(
110 library
Ronald Cronc29afb62024-07-01 14:50:54 +0200111 tf-psa-crypto/core
112 tf-psa-crypto/drivers/builtin/src
Gilles Peskine66c3dc42020-06-03 02:25:17 +0200113);
114my $library_include_directories =
115 join(';', map {"../../$_"} (@library_include_directories,
116 @include_directories));
117
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100118my @excluded_files = qw(
Ronald Cronaef8cf32024-07-01 18:33:24 +0200119 tf-psa-crypto/drivers/everest/library/Hacl_Curve25519.c
Gilles Peskine13fac982020-02-12 20:34:22 +0100120);
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100121my %excluded_files = ();
122foreach (@excluded_files) { $excluded_files{$_} = 1 }
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200123
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200124my $vsx_hdr_tpl = <<EOT;
Gilles Peskine6e245c62021-04-22 20:09:25 +0200125 <ClInclude Include="..\\..\\{NAME}" />
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200126EOT
127my $vsx_src_tpl = <<EOT;
Gilles Peskine6e245c62021-04-22 20:09:25 +0200128 <ClCompile Include="..\\..\\{NAME}" />
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200129EOT
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200130
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200131my $vsx_sln_app_entry_tpl = <<EOT;
Gilles Peskine6e245c62021-04-22 20:09:25 +0200132Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "{APPNAME}", "{APPNAME}.vcxproj", "{GUID}"
133 ProjectSection(ProjectDependencies) = postProject
134 {46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}
135 EndProjectSection
136EndProject
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200137EOT
138
139my $vsx_sln_conf_entry_tpl = <<EOT;
Gilles Peskine6e245c62021-04-22 20:09:25 +0200140 {GUID}.Debug|Win32.ActiveCfg = Debug|Win32
141 {GUID}.Debug|Win32.Build.0 = Debug|Win32
142 {GUID}.Debug|x64.ActiveCfg = Debug|x64
143 {GUID}.Debug|x64.Build.0 = Debug|x64
144 {GUID}.Release|Win32.ActiveCfg = Release|Win32
145 {GUID}.Release|Win32.Build.0 = Release|Win32
146 {GUID}.Release|x64.ActiveCfg = Release|x64
147 {GUID}.Release|x64.Build.0 = Release|x64
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200148EOT
149
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200150exit( main() );
151
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200152sub check_dirs {
Gilles Peskine13fac982020-02-12 20:34:22 +0100153 foreach my $d (@thirdparty_header_dirs, @thirdparty_source_dirs) {
154 if (not (-d $d)) { return 0; }
155 }
Manuel Pégourié-Gonnard51f14be2015-05-14 13:04:03 +0200156 return -d $vsx_dir
Darryl Green588e8cb2018-07-20 13:27:58 +0100157 && -d $mbedtls_header_dir
Ronald Cron3d817ad2024-06-14 08:43:28 +0200158 && -d $drivers_builtin_header_dir
Darryl Green588e8cb2018-07-20 13:27:58 +0100159 && -d $psa_header_dir
Ronald Cronc29afb62024-07-01 14:50:54 +0200160 && -d $tls_source_dir
161 && -d $crypto_core_source_dir
162 && -d $crypto_source_dir
Ronald Cron8dc0af22020-06-05 16:00:22 +0200163 && -d $test_source_dir
David Horstmann08953f72024-11-06 16:24:49 +0000164 && -d $tls_test_source_dir
Ronald Cron99226e92025-02-14 15:43:22 +0100165 && -d $crypto_test_source_dir
Steven Cooreman16141ed2021-04-08 10:58:33 +0200166 && -d $test_drivers_source_dir
Ronald Cron8dc0af22020-06-05 16:00:22 +0200167 && -d $test_header_dir
David Horstmann08953f72024-11-06 16:24:49 +0000168 && -d $tls_test_header_dir
Ronald Cron99226e92025-02-14 15:43:22 +0100169 && -d $crypto_test_header_dir
Steven Cooremana70d5882020-07-16 20:26:18 +0200170 && -d $test_drivers_header_dir
Harry Ramseyc94cb702024-10-31 14:28:53 +0000171 && -d $mbedtls_programs_dir
Harry Ramseyec4af6c2025-02-12 20:56:34 +0000172 && -d $framework_programs_dir
Harry Ramseyc94cb702024-10-31 14:28:53 +0000173 && -d $tfpsacrypto_programs_dir;
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200174}
175
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200176sub slurp_file {
177 my ($filename) = @_;
178
179 local $/ = undef;
Gilles Peskine6e245c62021-04-22 20:09:25 +0200180 open my $fh, '<:crlf', $filename or die "Could not read $filename\n";
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200181 my $content = <$fh>;
182 close $fh;
183
184 return $content;
185}
186
Manuel Pégourié-Gonnard411f73e2014-05-09 13:00:18 +0200187sub content_to_file {
188 my ($content, $filename) = @_;
189
Gilles Peskine6e245c62021-04-22 20:09:25 +0200190 open my $fh, '>:crlf', $filename or die "Could not write to $filename\n";
Manuel Pégourié-Gonnard411f73e2014-05-09 13:00:18 +0200191 print $fh $content;
192 close $fh;
193}
194
Manuel Pégourié-Gonnard41e8b622014-05-09 12:27:49 +0200195sub gen_app_guid {
196 my ($path) = @_;
197
Manuel Pégourié-Gonnard813e5852015-01-26 15:42:27 +0000198 my $guid = md5_hex( "mbedTLS:$path" );
Manuel Pégourié-Gonnard41e8b622014-05-09 12:27:49 +0200199 $guid =~ s/(.{8})(.{4})(.{4})(.{4})(.{12})/\U{$1-$2-$3-$4-$5}/;
200
201 return $guid;
202}
203
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200204sub gen_app {
205 my ($path, $template, $dir, $ext) = @_;
206
Manuel Pégourié-Gonnard41e8b622014-05-09 12:27:49 +0200207 my $guid = gen_app_guid( $path );
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200208 $path =~ s!/!\\!g;
209 (my $appname = $path) =~ s/.*\\//;
Gilles Peskinea1023e22023-11-03 19:16:56 +0100210 my $is_test_app = ($path =~ m/^test\\/);
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200211
Harry Ramseyec4af6c2025-02-12 20:56:34 +0000212 my $srcs;
213 if( $appname eq "metatest" or $appname eq "query_compile_time_config" or
214 $appname eq "query_included_headers" or $appname eq "zeroize" ) {
215 $srcs = "<ClCompile Include=\"..\\..\\framework\\tests\\programs\\$appname.c\" \/>";
216 } else {
217 $srcs = "<ClCompile Include=\"..\\..\\programs\\$path.c\" \/>";
218 }
219
Andres Amaya Garciac84a65d2018-10-30 21:46:21 +0000220 if( $appname eq "ssl_client2" or $appname eq "ssl_server2" or
221 $appname eq "query_compile_time_config" ) {
Gilles Peskine6e245c62021-04-22 20:09:25 +0200222 $srcs .= "\n <ClCompile Include=\"..\\..\\programs\\test\\query_config.c\" \/>";
Andres Amaya Garciac84a65d2018-10-30 21:46:21 +0000223 }
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100224 if( $appname eq "ssl_client2" or $appname eq "ssl_server2" ) {
Gilles Peskine6e245c62021-04-22 20:09:25 +0200225 $srcs .= "\n <ClCompile Include=\"..\\..\\programs\\ssl\\ssl_test_lib.c\" \/>";
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100226 }
Andres Amaya Garciac84a65d2018-10-30 21:46:21 +0000227
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200228 my $content = $template;
Andres Amaya Garciac84a65d2018-10-30 21:46:21 +0000229 $content =~ s/<SOURCES>/$srcs/g;
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200230 $content =~ s/<APPNAME>/$appname/g;
Manuel Pégourié-Gonnard41e8b622014-05-09 12:27:49 +0200231 $content =~ s/<GUID>/$guid/g;
Gilles Peskinea1023e22023-11-03 19:16:56 +0100232 $content =~ s/INCLUDE_DIRECTORIES\n/($is_test_app ?
233 $library_include_directories :
234 $include_directories)/ge;
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200235
Manuel Pégourié-Gonnard411f73e2014-05-09 13:00:18 +0200236 content_to_file( $content, "$dir/$appname.$ext" );
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200237}
238
239sub get_app_list {
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200240 my $makefile_contents = slurp_file('programs/Makefile');
241 $makefile_contents =~ /\n\s*APPS\s*=[\\\s]*(.*?)(?<!\\)[\#\n]/s
242 or die "Cannot find APPS = ... in programs/Makefile\n";
243 return split /(?:\s|\\)+/, $1;
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200244}
245
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200246sub gen_app_files {
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200247 my @app_list = @_;
248
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200249 my $vsx_tpl = slurp_file( $vsx_app_tpl_file );
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200250
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200251 for my $app ( @app_list ) {
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200252 gen_app( $app, $vsx_tpl, $vsx_dir, $vsx_ext );
253 }
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200254}
255
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200256sub gen_entry_list {
Manuel Pégourié-Gonnardcd8f8442014-05-08 12:53:58 +0200257 my ($tpl, @names) = @_;
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200258
259 my $entries;
Manuel Pégourié-Gonnardcd8f8442014-05-08 12:53:58 +0200260 for my $name (@names) {
261 (my $entry = $tpl) =~ s/{NAME}/$name/g;
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200262 $entries .= $entry;
263 }
264
265 return $entries;
266}
267
268sub gen_main_file {
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100269 my ($headers, $sources,
270 $hdr_tpl, $src_tpl,
271 $main_tpl, $main_out) = @_;
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200272
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100273 my $header_entries = gen_entry_list( $hdr_tpl, @$headers );
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200274 my $source_entries = gen_entry_list( $src_tpl, @$sources );
275
276 my $out = slurp_file( $main_tpl );
Gilles Peskine6e245c62021-04-22 20:09:25 +0200277 $out =~ s/SOURCE_ENTRIES\n/$source_entries/m;
278 $out =~ s/HEADER_ENTRIES\n/$header_entries/m;
279 $out =~ s/INCLUDE_DIRECTORIES\n/$library_include_directories/g;
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200280
Manuel Pégourié-Gonnard411f73e2014-05-09 13:00:18 +0200281 content_to_file( $out, $main_out );
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200282}
283
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200284sub gen_vsx_solution {
285 my (@app_names) = @_;
286
287 my ($app_entries, $conf_entries);
288 for my $path (@app_names) {
289 my $guid = gen_app_guid( $path );
290 (my $appname = $path) =~ s!.*/!!;
291
292 my $app_entry = $vsx_sln_app_entry_tpl;
293 $app_entry =~ s/{APPNAME}/$appname/g;
294 $app_entry =~ s/{GUID}/$guid/g;
295
296 $app_entries .= $app_entry;
297
298 my $conf_entry = $vsx_sln_conf_entry_tpl;
299 $conf_entry =~ s/{GUID}/$guid/g;
300
301 $conf_entries .= $conf_entry;
302 }
303
304 my $out = slurp_file( $vsx_sln_tpl_file );
Gilles Peskine6e245c62021-04-22 20:09:25 +0200305 $out =~ s/APP_ENTRIES\n/$app_entries/m;
306 $out =~ s/CONF_ENTRIES\n/$conf_entries/m;
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200307
Manuel Pégourié-Gonnard411f73e2014-05-09 13:00:18 +0200308 content_to_file( $out, $vsx_sln_file );
Manuel Pégourié-Gonnard0598faf2014-05-09 12:56:03 +0200309}
310
Andres Amaya Garcia3c5f9492018-01-11 19:51:27 +0000311sub del_vsx_files {
312 unlink glob "'$vsx_dir/*.$vsx_ext'";
313 unlink $vsx_main_file;
314 unlink $vsx_sln_file;
315}
316
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200317sub main {
318 if( ! check_dirs() ) {
319 chdir '..' or die;
Dave Rodgman0f459d72023-01-10 15:09:19 +0000320 check_dirs or die "Must be run from Mbed TLS root or scripts dir\n";
Manuel Pégourié-Gonnard2d34fe32014-05-07 17:51:20 +0200321 }
322
Andres Amaya Garcia3c5f9492018-01-11 19:51:27 +0000323 # Remove old files to ensure that, for example, project files from deleted
324 # apps are not kept
Ronald Cronddbf7292025-03-07 09:33:33 +0100325 if (not $list) {
326 del_vsx_files();
327 }
Andres Amaya Garcia3c5f9492018-01-11 19:51:27 +0000328
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200329 my @app_list = get_app_list();
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100330 my @header_dirs = (
331 $mbedtls_header_dir,
Ronald Cron3d817ad2024-06-14 08:43:28 +0200332 $drivers_builtin_header_dir,
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100333 $psa_header_dir,
Ronald Cron8dc0af22020-06-05 16:00:22 +0200334 $test_header_dir,
David Horstmann08953f72024-11-06 16:24:49 +0000335 $tls_test_header_dir,
Ronald Cron99226e92025-02-14 15:43:22 +0100336 $crypto_test_header_dir,
Steven Cooremana70d5882020-07-16 20:26:18 +0200337 $test_drivers_header_dir,
Ronald Cronc29afb62024-07-01 14:50:54 +0200338 $tls_source_dir,
339 $crypto_core_source_dir,
340 $crypto_source_dir,
Harry Ramseyec4af6c2025-02-12 20:56:34 +0000341 $framework_programs_dir,
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100342 @thirdparty_header_dirs,
343 );
344 my @headers = (map { <$_/*.h> } @header_dirs);
345 my @source_dirs = (
Ronald Cronc29afb62024-07-01 14:50:54 +0200346 $tls_source_dir,
347 $crypto_core_source_dir,
348 $crypto_source_dir,
Ronald Cron8dc0af22020-06-05 16:00:22 +0200349 $test_source_dir,
David Horstmann08953f72024-11-06 16:24:49 +0000350 $tls_test_source_dir,
Ronald Cron99226e92025-02-14 15:43:22 +0100351 $crypto_test_source_dir,
Steven Cooreman16141ed2021-04-08 10:58:33 +0200352 $test_drivers_source_dir,
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100353 @thirdparty_source_dirs,
354 );
355 my @sources = (map { <$_/*.c> } @source_dirs);
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200356
Gilles Peskineb41f88f2020-02-12 20:45:18 +0100357 @headers = grep { ! $excluded_files{$_} } @headers;
358 @sources = grep { ! $excluded_files{$_} } @sources;
359 map { s!/!\\!g } @headers;
360 map { s!/!\\!g } @sources;
Christoph M. Wintersteiger48d26c22018-12-06 18:59:19 +0000361
Ronald Cronddbf7292025-03-07 09:33:33 +0100362 if ($list) {
363 foreach my $app (@app_list) {
364 $app =~ s/.*\///;
365 print "$vsx_dir/$app.$vsx_ext\n";
366 }
367 print "$vsx_main_file\n";
368 print "$vsx_sln_file\n";
369 } else {
370 gen_app_files( @app_list );
Manuel Pégourié-Gonnard0aafa5c2014-05-08 11:33:30 +0200371
Ronald Cronddbf7292025-03-07 09:33:33 +0100372 gen_main_file( \@headers, \@sources,
373 $vsx_hdr_tpl, $vsx_src_tpl,
374 $vsx_main_tpl_file, $vsx_main_file );
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200375
Ronald Cronddbf7292025-03-07 09:33:33 +0100376 gen_vsx_solution( @app_list );
377 }
Manuel Pégourié-Gonnardcd8f8442014-05-08 12:53:58 +0200378
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200379 return 0;
380}