BLD: Generate config.h file
This commit is contained in:
parent
6d98969c22
commit
4673fd0dcb
|
@ -540,7 +540,7 @@ foreach conf : kernel_confs
|
|||
# message(conf)
|
||||
_kern_libs += [static_library(
|
||||
conf['name'],
|
||||
conf['src'],
|
||||
[conf['src'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: conf['c_args'],
|
||||
)]
|
||||
|
|
|
@ -454,7 +454,7 @@ foreach conf : kernel_confs
|
|||
# message(conf)
|
||||
_kern_libs += [static_library(
|
||||
conf['name'],
|
||||
conf['src'],
|
||||
[conf['src'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: conf['c_args'],
|
||||
)]
|
||||
|
|
|
@ -75,7 +75,7 @@ others_libs = []
|
|||
foreach conf : others_confs
|
||||
others_libs += [static_library(
|
||||
conf['name'],
|
||||
conf['src'],
|
||||
[conf['src'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: conf['c_args']
|
||||
)]
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#ifndef BUILD_KERNEL
|
||||
|
||||
#ifndef BUILD_WITH_MESON
|
||||
#include "config.h"
|
||||
#else
|
||||
#include "_config_for_getarch_2nd.h"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "config_kernel.h"
|
||||
#endif
|
||||
|
|
|
@ -621,7 +621,7 @@ foreach conf : _blas_roots
|
|||
# Create the static library for each symbol
|
||||
lib = static_library(
|
||||
sym_name,
|
||||
sources: conf['fname'],
|
||||
sources: [conf['fname'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: compiler_args + [
|
||||
f'-DASMNAME=@sym_name@',
|
||||
|
@ -643,7 +643,7 @@ foreach conf : _blas_roots
|
|||
endif
|
||||
cblas_lib = static_library(
|
||||
cblas_sym_name,
|
||||
sources: conf['fname'],
|
||||
sources: [conf['fname'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: compiler_args + [
|
||||
'-DCBLAS',
|
||||
|
|
|
@ -1274,7 +1274,7 @@ _is_asm = false
|
|||
foreach conf: kernel_confs
|
||||
_kern_libs += static_library(
|
||||
conf['name'],
|
||||
conf['src'],
|
||||
[conf['src'], config_h],
|
||||
include_directories: _inc,
|
||||
c_args: conf['c_args'],
|
||||
# See gh discussion 13374 for why, basically .S are coded as fortran..
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
add_languages('fortran', native: false)
|
||||
ff = meson.get_compiler('fortran')
|
||||
if ff.has_argument('-Wno-conversion')
|
||||
add_project_arguments('-Wno-conversion', language: 'fortran')
|
||||
endif
|
||||
# if ff.has_argument('-Wno-conversion')
|
||||
# add_project_arguments('-Wno-conversion', language: 'fortran')
|
||||
# endif
|
||||
|
||||
lapack_major_version = 3 # soversion
|
||||
lapack_minor_version = 12
|
||||
|
|
94
meson.build
94
meson.build
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# NOTE: This is still a work in progress, the Makefiles are canonical
|
||||
project('OpenBLAS', ['c', 'fortran'],
|
||||
default_options: ['c_std=c99', 'pkg.relocatable=true'],
|
||||
default_options: ['c_std=c99', 'pkgconfig.relocatable=true'],
|
||||
version: '0.3.26.dev')
|
||||
|
||||
openblas_major_version = 0 # soversion
|
||||
|
@ -67,46 +67,6 @@ else
|
|||
no_affinity = false
|
||||
endif
|
||||
|
||||
# Makefile.prebuild stuff
|
||||
# TODO(rg): Generate within meson
|
||||
# getarch = executable('getarch',
|
||||
# ['getarch.c', 'cpuid.S'])
|
||||
# getarch_two = executable('getarch_2nd',
|
||||
# ['getarch_2nd.c'])
|
||||
cchk=custom_target(
|
||||
'c_checks',
|
||||
output: ['Makefile_c.conf', 'config_c.h'],
|
||||
input: ['ctest.c'],
|
||||
command: [find_program('c_check'), 'Makefile_c.conf', 'config_c.h', 'gcc'],
|
||||
)
|
||||
fchk=custom_target(
|
||||
'f_checks',
|
||||
output: ['Makefile_f.conf', 'config_f.h'],
|
||||
command: [find_program('f_check'), 'Makefile_f.conf', 'config_f.h', 'gfortran'],
|
||||
)
|
||||
fs = import('fs')
|
||||
basic_config = custom_target(
|
||||
'basic_config',
|
||||
output: ['config.h'],
|
||||
input: [cchk, fchk],
|
||||
command: [find_program('python'),
|
||||
'write_file.py', 'config.h',
|
||||
'config_c.h', 'config_f.h']
|
||||
)
|
||||
|
||||
getarch = executable('getarch',
|
||||
['getarch.c', 'cpuid.S', basic_config,])
|
||||
getarch_two = executable('getarch_2nd',
|
||||
['getarch_2nd.c', basic_config,])
|
||||
# gch = run_command('c_check', 'Makefile.conf', 'config.h', 'gcc')
|
||||
# run_command('f_check', 'Makefile.conf', 'config.h', 'gcc')
|
||||
# outp = gch.stdout().strip()
|
||||
# config_h = custom_target('gen_config_h',
|
||||
# # input: ['getarch.c'],
|
||||
# output: ['config.h'],
|
||||
# command: [getarch, '3']
|
||||
# )
|
||||
|
||||
_check_prefix = []
|
||||
conf_data = configuration_data()
|
||||
is_win = host_machine.system() == 'windows' or host_machine.system() == 'cygwin'
|
||||
|
@ -143,18 +103,6 @@ endforeach
|
|||
configure_file(output : 'getarch_conf.h',
|
||||
configuration : conf_data)
|
||||
|
||||
# run_target('generate_config_h',
|
||||
# command: [meson.current_build_dir() + '/getarch', '1'],
|
||||
# depends: getarch)
|
||||
|
||||
# gch = run_command(meson.current_build_dir() + '/getarch', '1')
|
||||
# outp = gch.stdout().strip()
|
||||
|
||||
# conf_data = configuration_data()
|
||||
# configure_file(input : meson.current_build_dir() + '/config.h',
|
||||
# output : 'config.h',
|
||||
# configuration : conf_data)
|
||||
|
||||
# Makefile.system
|
||||
cpu_fam = target_machine.cpu_family()
|
||||
|
||||
|
@ -465,6 +413,46 @@ symb_defs = {
|
|||
'cblas_?dotc_sub': {'def': ['CBLAS', 'FORCE_USE_STACK', 'CONJ']},
|
||||
}
|
||||
|
||||
# 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')
|
||||
|
||||
getarch = executable('getarch', ['getarch.c', 'cpuid.S'])
|
||||
|
||||
_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: [find_program('cat'), './_config_1.h', _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: [find_program('cat'), _config_for_getarch_2nd_h, _config_3h],
|
||||
depends: [_config_3h],
|
||||
capture: true,
|
||||
)
|
||||
|
||||
# Ignoring other hostarch checks and conflicts for arch in BSD for now
|
||||
_inc = [include_directories('.')]
|
||||
subdir('lapack-netlib')
|
||||
|
|
Loading…
Reference in New Issue