diff --git a/ctest/meson.build b/ctest/meson.build index 32fcc4e1d..e7defe8c3 100644 --- a/ctest/meson.build +++ b/ctest/meson.build @@ -49,7 +49,7 @@ foreach lvl : ['l1', 'l2', 'l3', 'l3_3m'] executable( op_name, - sources: mapped_sources + [config_h], + sources: mapped_sources, link_with: [_openblas], dependencies: [dependency('threads')], include_directories: ctest_inc, diff --git a/driver/level2/meson.build b/driver/level2/meson.build index 78e25b3fd..6f013749d 100644 --- a/driver/level2/meson.build +++ b/driver/level2/meson.build @@ -540,7 +540,7 @@ foreach conf : kernel_confs # message(conf) _kern_libs += [static_library( conf['name'], - [conf['src'], config_h], + conf['src'], include_directories: _inc, c_args: conf['c_args'], )] diff --git a/driver/level3/meson.build b/driver/level3/meson.build index fca6407cf..298a8e085 100644 --- a/driver/level3/meson.build +++ b/driver/level3/meson.build @@ -465,7 +465,7 @@ foreach conf : kernel_confs # message(conf) _kern_libs += [static_library( conf['name'], - [conf['src'], config_h], + conf['src'], include_directories: _inc, c_args: conf['c_args'], )] diff --git a/driver/others/meson.build b/driver/others/meson.build index c1a2e681f..070e85e35 100644 --- a/driver/others/meson.build +++ b/driver/others/meson.build @@ -74,7 +74,7 @@ others_libs = [] foreach conf : others_confs others_libs += [static_library( conf['name'], - [conf['src'], config_h], + conf['src'], include_directories: _inc, c_args: conf['c_args'] )] diff --git a/getarch_2nd.c b/getarch_2nd.c index 038434d4a..dd1f83089 100644 --- a/getarch_2nd.c +++ b/getarch_2nd.c @@ -1,16 +1,9 @@ #include #ifndef BUILD_KERNEL - -#ifdef BUILD_WITH_MESON -#include "_config_for_getarch_2nd.h" -#else #include "config.h" -#endif - #else #include "config_kernel.h" #endif - #if (defined(__WIN32__) || defined(__WIN64__) || defined(__CYGWIN32__) || defined(__CYGWIN64__) || defined(_WIN32) || defined(_WIN64)) && defined(__64BIT__) typedef long long BLASLONG; typedef unsigned long long BLASULONG; diff --git a/interface/meson.build b/interface/meson.build index ff19535da..4c2fdfbbc 100644 --- a/interface/meson.build +++ b/interface/meson.build @@ -623,7 +623,7 @@ foreach conf : _blas_roots # Create the static library for each symbol lib = static_library( sym_name, - sources: [conf['fname'], config_h], + sources: conf['fname'], include_directories: _inc, c_args: compiler_args + [ f'-DASMNAME=@asm_name_prefix@@sym_name@', @@ -645,7 +645,7 @@ foreach conf : _blas_roots endif cblas_lib = static_library( cblas_sym_name, - sources: [conf['fname'], config_h], + sources: conf['fname'], include_directories: _inc, c_args: compiler_args + [ '-DCBLAS', diff --git a/join_files.py b/join_files.py deleted file mode 100644 index 8e9d21ddb..000000000 --- a/join_files.py +++ /dev/null @@ -1,21 +0,0 @@ -import argparse - - -def merge_files(file1_path: str, file2_path: str) -> str: - # Open files in read mode - with open(file1_path, 'r') as file1, open(file2_path, 'r') as file2: - content1 = file1.read() - content2 = file2.read() - merged_content = content1 + "\n" + content2 - return merged_content - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Merge and print content from two text files.") - parser.add_argument("file1", help="Path to the first text file.") - parser.add_argument("file2", help="Path to the second text file.") - - args = parser.parse_args() - - output = merge_files(args.file1, args.file2) - print(output) diff --git a/kernel/meson.build b/kernel/meson.build index b04cae6d1..1b8abe8dd 100644 --- a/kernel/meson.build +++ b/kernel/meson.build @@ -1509,7 +1509,7 @@ _is_asm = false foreach conf: kernel_confs _kern_libs += static_library( conf['name'], - [conf['src'], config_h], + conf['src'], include_directories: _inc, c_args: conf['c_args'], # See gh discussion 13374 for why, basically .S are coded as fortran.. diff --git a/meson.build b/meson.build index 775fa5b85..ef6770e1a 100644 --- a/meson.build +++ b/meson.build @@ -462,55 +462,31 @@ symb_defs = { # config.h file generation -_config_1_path = meson.current_build_dir() / '_config_1.h' -_join_files_py = '../join_files.py' -run_command('./c_check', 'Makefile.conf', _config_1_path, cc_id, check: true) -run_command('./f_check', 'Makefile.conf', _config_1_path, fc_id, check: true) +_config_h = meson.current_build_dir() / 'config.h' +run_command('./c_check', 'Makefile.conf', _config_h, cc_id, check: true) +run_command('./f_check', 'Makefile.conf', _config_h, fc_id, check: true) -getarch = executable('getarch', ['getarch.c', 'cpuid.S']) +run_command(cc_id, '-o', 'getarch', 'getarch.c', 'cpuid.S', check: true) +_getarch_result = run_command('./getarch', '1', check: true, capture: true) +run_command(py3, + './write_to_file.py', + _getarch_result.stdout(), + _config_h, + check: true) -_config_2h = custom_target('_config_2h', - output: '_config_2.h', - command: [getarch, '1'], - depends: [getarch], - capture: true, - ) - -_config_for_getarch_2nd_h = custom_target('_config_for_getarch_2nd_h', - output: '_config_for_getarch_2nd.h', - command: [ - py3, - _join_files_py, - _config_1_path, - _config_2h, - ], - depends: [_config_2h], - capture: true, - ) - -getarch_2nd = executable('getarch_2nd', - ['getarch_2nd.c', _config_for_getarch_2nd_h], - c_args: ['-DGEMM_MULTITHREAD_THRESHOLD=4', '-DBUILD_WITH_MESON'] - ) - -_config_3h = custom_target('_config_3h', - output: '_config_3.h', - command: [getarch_2nd, '1'], - depends: [getarch_2nd], - capture: true, - ) - -config_h = custom_target('config_h', - output: 'config.h', - command: [ - py3, - _join_files_py, - _config_for_getarch_2nd_h, - _config_3h, - ], - depends: [_config_3h], - capture: true, - ) +run_command(cc_id, + '-DGEMM_MULTITHREAD_THRESHOLD=4', + '-I.', + f'-I@prj_bld_dir@', + '-o', 'getarch_2nd', + 'getarch_2nd.c', + capture: true, check: true) +_getarch_2nd_result = run_command('./getarch_2nd', '1', check: true, capture: true) +run_command(py3, + './write_to_file.py', + _getarch_2nd_result.stdout(), + _config_h, + check: true) # Ignoring other hostarch checks and conflicts for arch in BSD for now _inc = [include_directories('.')] @@ -563,7 +539,6 @@ pcl = custom_target('prepare_config_last', exprecision ? '--exprecision' : [], ], build_by_default : true, - depends: config_h, ) # Generate the headers diff --git a/utest/meson.build b/utest/meson.build index 82ee633d0..99188d179 100644 --- a/utest/meson.build +++ b/utest/meson.build @@ -1,5 +1,4 @@ sources_utest = [ - config_h, 'utest_main.c', 'test_min.c', 'test_amax.c', @@ -18,7 +17,6 @@ sources_utest = [ dir_ext = 'test_extensions' sources_utest_ext = [ - config_h, 'utest_main.c', dir_ext / 'xerbla.c', dir_ext / 'common.c', diff --git a/write_to_file.py b/write_to_file.py new file mode 100644 index 000000000..eafb0ba2e --- /dev/null +++ b/write_to_file.py @@ -0,0 +1,13 @@ +import argparse + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Write contents to file.") + parser.add_argument("contents", help="Contents.") + parser.add_argument("file_path", help="File path.") + + args = parser.parse_args() + + f = open(args.file_path, "a") + f.write(args.contents) + f.close()