@@ -42,6 +42,8 @@ def pre_process_fypp(args):
4242 kwd .append ("-DWITH_QP=True" )
4343 if args .with_xdp :
4444 kwd .append ("-DWITH_XDP=True" )
45+ if args .with_ilp64 :
46+ kwd .append ("-DWITH_ILP64=True" )
4547
4648 optparser = fypp .get_option_parser ()
4749 options , leftover = optparser .parse_args (args = kwd )
@@ -78,32 +80,38 @@ def process_f(file):
7880 return
7981
8082
81- def deploy_stdlib_fpm ():
83+ def deploy_stdlib_fpm (with_ilp64 ):
8284 """create the stdlib-fpm folder for backwards compatibility (to be deprecated)
8385 """
8486 import shutil
8587 prune = (
8688 "test_hash_functions.f90" ,
8789 "f18estop.f90" ,
8890 )
89- if not os .path .exists ('stdlib-fpm' + os .sep + 'src' ):
90- os .makedirs ('stdlib-fpm' + os .sep + 'src' )
91- if not os .path .exists ('stdlib-fpm' + os .sep + 'test' ):
92- os .makedirs ('stdlib-fpm' + os .sep + 'test' )
93- if not os .path .exists ('stdlib-fpm' + os .sep + 'example' ):
94- os .makedirs ('stdlib-fpm' + os .sep + 'example' )
91+
92+ if with_ilp64 :
93+ base_folder = 'stdlib-fpm-ilp64'
94+ else :
95+ base_folder = 'stdlib-fpm'
96+
97+ if not os .path .exists (base_folder + os .sep + 'src' ):
98+ os .makedirs (base_folder + os .sep + 'src' )
99+ if not os .path .exists (base_folder + os .sep + 'test' ):
100+ os .makedirs (base_folder + os .sep + 'test' )
101+ if not os .path .exists (base_folder + os .sep + 'example' ):
102+ os .makedirs (base_folder + os .sep + 'example' )
95103
96104 def recursive_copy (folder ):
97105 for root , _ , files in os .walk (folder ):
98106 for file in files :
99107 if file not in prune :
100- if file .endswith (".f90" ) or file . endswith ( ".F90" ) or file . endswith ( ".dat" ) or file . endswith ( ".npy" ):
101- shutil .copy2 (os .path .join (root , file ), 'stdlib-fpm' + os .sep + folder + os .sep + file )
108+ if file .endswith (( ".f90" , ".F90" , ".dat" , ".npy" , ".c" ) ):
109+ shutil .copy2 (os .path .join (root , file ), base_folder + os .sep + folder + os .sep + file )
102110 recursive_copy ('src' )
103111 recursive_copy ('test' )
104112 recursive_copy ('example' )
105113 for file in ['.gitignore' ,'fpm.toml' ,'LICENSE' ,'VERSION' ]:
106- shutil .copy2 (file , 'stdlib-fpm' + os .sep + file )
114+ shutil .copy2 (file , base_folder + os .sep + file )
107115 return
108116
109117def fpm_build (args ,unknown ):
@@ -122,11 +130,11 @@ def fpm_build(args,unknown):
122130 flags = flags + unknown [idx + 1 ]
123131 #==========================================
124132 # build with fpm
125- subprocess .run ([ "fpm build" ] +
126- [ " --compiler " ] + [ FPM_FC ] +
127- [ " --c-compiler " ] + [ FPM_CC ] +
128- [ " --cxx-compiler " ] + [ FPM_CXX ] +
129- [ " --flag " ] + [ flags ] , shell = True , check = True )
133+ subprocess .run ("fpm build" +
134+ " --compiler " + FPM_FC +
135+ " --c-compiler " + FPM_CC +
136+ " --cxx-compiler " + FPM_CXX +
137+ " --flag \" {} \" " . format ( flags ) , shell = True , check = True )
130138 return
131139
132140if __name__ == "__main__" :
@@ -137,11 +145,12 @@ def fpm_build(args,unknown):
137145 parser .add_argument ("--vpatch" , type = int , default = 0 , help = "Project Version Patch" )
138146
139147 parser .add_argument ("--njob" , type = int , default = 4 , help = "Number of parallel jobs for preprocessing" )
140- parser .add_argument ("--maxrank" ,type = int , default = 7 , help = "Set the maximum allowed rank for arrays" )
148+ parser .add_argument ("--maxrank" ,type = int , default = 4 , help = "Set the maximum allowed rank for arrays" )
141149 parser .add_argument ("--with_qp" ,action = 'store_true' , help = "Include WITH_QP in the command" )
142150 parser .add_argument ("--with_xdp" ,action = 'store_true' , help = "Include WITH_XDP in the command" )
151+ parser .add_argument ("--with_ilp64" ,action = 'store_true' , help = "Include WITH_ILP64 to build 64-bit integer BLAS/LAPACK" )
143152 parser .add_argument ("--lnumbering" ,action = 'store_true' , help = "Add line numbering in preprocessed files" )
144- parser .add_argument ("--deploy_stdlib_fpm" ,action = 'store_true' , help = "create the stdlib-fpm folder" )
153+ parser .add_argument ("--deploy_stdlib_fpm" ,action = 'store_true' , help = "create the stdlib-fpm folder" )
145154 # external libraries arguments
146155 parser .add_argument ("--build" , action = 'store_true' , help = "Build the project" )
147156
@@ -158,8 +167,8 @@ def fpm_build(args,unknown):
158167 # pre process the meta programming fypp files
159168 pre_process_fypp (args )
160169 if args .deploy_stdlib_fpm :
161- deploy_stdlib_fpm ()
170+ deploy_stdlib_fpm (args . with_ilp64 )
162171 #==========================================
163172 # build using fpm
164173 if args .build :
165- fpm_build (args ,unknown )
174+ fpm_build (args ,unknown )
0 commit comments