From 3bee004f63cc9683fef8dba009a5372f198f56b5 Mon Sep 17 00:00:00 2001 From: Mateusz Sokol Date: Mon, 22 Jul 2024 22:05:22 +0000 Subject: [PATCH] Apply review comments --- getarch_2nd.c | 7 ++++--- join_files.py | 21 +++++++++++++++++++++ lapack-netlib/meson.build | 1 + meson.build | 21 +++++++++++++++++---- 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 join_files.py diff --git a/getarch_2nd.c b/getarch_2nd.c index 0efb73615..038434d4a 100644 --- a/getarch_2nd.c +++ b/getarch_2nd.c @@ -1,15 +1,16 @@ #include #ifndef BUILD_KERNEL -#ifndef BUILD_WITH_MESON -#include "config.h" -#else +#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/join_files.py b/join_files.py new file mode 100644 index 000000000..8e9d21ddb --- /dev/null +++ b/join_files.py @@ -0,0 +1,21 @@ +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/lapack-netlib/meson.build b/lapack-netlib/meson.build index 2ab706ec3..28472cca8 100644 --- a/lapack-netlib/meson.build +++ b/lapack-netlib/meson.build @@ -1,5 +1,6 @@ add_languages('fortran', native: false) ff = meson.get_compiler('fortran') +# TODO(mtsokol): make it a local setting # if ff.has_argument('-Wno-conversion') # add_project_arguments('-Wno-conversion', language: 'fortran') # endif diff --git a/meson.build b/meson.build index 17d11762f..4efab7e43 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,7 @@ openblas_version = f'@openblas_major_version@.@openblas_minor_version@.@openblas # Skip the check for valid CC cc = meson.get_compiler('c') fc = meson.get_compiler('fortran') +cc_id = cc.get_id() fc_id = fc.get_id() # Common args @@ -415,8 +416,10 @@ symb_defs = { # config.h file generation -run_command('c_check', 'Makefile.conf', './build/_config_1.h', 'gcc') -run_command('f_check', 'Makefile.conf', './build/_config_1.h', 'gfortran') +_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) getarch = executable('getarch', ['getarch.c', 'cpuid.S']) @@ -429,7 +432,12 @@ _config_2h = custom_target('_config_2h', _config_for_getarch_2nd_h = custom_target('_config_for_getarch_2nd_h', output: '_config_for_getarch_2nd.h', - command: [find_program('cat'), './_config_1.h', _config_2h], + command: [ + find_program('python'), + _join_files_py, + _config_1_path, + _config_2h, + ], depends: [_config_2h], capture: true, ) @@ -448,7 +456,12 @@ _config_3h = custom_target('_config_3h', config_h = custom_target('config_h', output: 'config.h', - command: [find_program('cat'), _config_for_getarch_2nd_h, _config_3h], + command: [ + find_program('python'), + _join_files_py, + _config_for_getarch_2nd_h, + _config_3h, + ], depends: [_config_3h], capture: true, )